+++ /dev/null
-package CGI::Ajax;
-use strict;
-use Data::Dumper;
-use base qw(Class::Accessor);
-use overload '""' => 'show_javascript'; # for building web pages, so
- # you can just say: print $pjx
-BEGIN {
- use vars qw ($VERSION @ISA @METHODS);
- @METHODS = qw(url_list coderef_list DEBUG JSDEBUG html
- js_encode_function cgi_header_extra);
-
- CGI::Ajax->mk_accessors( @METHODS );
-
- $VERSION = .697;
-}
-
-########################################### main pod documentation begin ##
-
-=head1 NAME
-
-CGI::Ajax - a perl-specific system for writing Asynchronous web
-applications
-
-=head1 SYNOPSIS
-
- use strict;
- use CGI; # or any other CGI:: form handler/decoder
- use CGI::Ajax;
-
- my $cgi = new CGI;
- my $pjx = new CGI::Ajax( 'exported_func' => \&perl_func );
-
- print $pjx->build_html( $cgi, \&Show_HTML);
-
- sub perl_func {
- my $input = shift;
- # do something with $input
- my $output = $input . " was the input!";
- return( $output );
- }
-
- sub Show_HTML {
- my $html = <<EOHTML;
- <HTML>
- <BODY>
- Enter something:
- <input type="text" name="val1" id="val1"
- onkeyup="exported_func( ['val1'], ['resultdiv'] );">
- <br>
- <div id="resultdiv"></div>
- </BODY>
- </HTML>
- EOHTML
- return $html;
- }
-
-I<There are several fully-functional examples in the 'scripts/'
-directory of the distribution.>
-
-=head1 DESCRIPTION
-
-CGI::Ajax is an object-oriented module that provides a unique
-mechanism for using perl code asynchronously from javascript-
-enhanced HTML pages. CGI::Ajax unburdens the user from having to
-write extensive javascript, except for associating an exported
-method with a document-defined event (such as onClick, onKeyUp,
-etc). CGI::Ajax also mixes well with HTML containing more complex
-javascript.
-
-CGI::Ajax supports methods that return single results or multiple
-results to the web page, and supports returning values to multiple
-DIV elements on the HTML page.
-
-Using CGI::Ajax, the URL for the HTTP GET/POST request is
-automatically generated based on HTML layout and events, and the
-page is then dynamically updated with the output from the perl
-function. Additionally, CGI::Ajax supports mapping URL's to a
-CGI::Ajax function name, so you can separate your code processing
-over multiple scripts.
-
-Other than using the Class::Accessor module to generate CGI::Ajax'
-accessor methods, CGI::Ajax is completely self-contained - it
-does not require you to install a larger package or a full Content
-Management System, etc.
-
-We have added I<support> for other CGI handler/decoder modules,
-like L<CGI::Simple> or L<CGI::Minimal>, but we can't test these
-since we run mod_perl2 only here. CGI::Ajax checks to see if a
-header() method is available to the CGI object, and then uses it.
-If method() isn't available, it creates it's own minimal header.
-
-A primary goal of CGI::Ajax is to keep the module streamlined and
-maximally flexible. We are trying to keep the generated javascript
-code to a minimum, but still provide users with a variety of
-methods for deploying CGI::Ajax. And VERY little user javascript.
-
-=head1 EXAMPLES
-
-The CGI::Ajax module allows a Perl subroutine to be called
-asynchronously, when triggered from a javascript event on the
-HTML page. To do this, the subroutine must be I<registered>,
-usually done during:
-
- my $pjx = new CGI::Ajax( 'JSFUNC' => \&PERLFUNC );
-
-This maps a perl subroutine (PERLFUNC) to an automatically
-generated Javascript function (JSFUNC). Next you setup a trigger this
-function when an event occurs (e.g. "onClick"):
-
- onClick="JSFUNC(['source1','source2'], ['dest1','dest2']);"
-
-where 'source1', 'dest1', 'source2', 'dest2' are the DIV ids of
-HTML elements in your page...
-
- <input type=text id=source1>
- <input type=text id=source2>
- <div id=dest1></div>
- <div id=dest2></div>
-
-L<CGI::Ajax> sends the values from source1 and source2 to your
-Perl subroutine and returns the results to dest1 and dest2.
-
-=head2 4 Usage Methods
-
-=over 4
-
-=item 1 Standard CGI::Ajax example
-
-Start by defining a perl subroutine that you want available from
-javascript. In this case we'll define a subrouting that determines
-whether or not an input is odd, even, or not a number (NaN):
-
- use strict;
- use CGI::Ajax;
- use CGI;
-
-
- sub evenodd_func {
- my $input = shift;
-
- # see if input is defined
- if ( not defined $input ) {
- return("input not defined or NaN");
- }
-
- # see if value is a number (*thanks Randall!*)
- if ( $input !~ /\A\d+\z/ ) {
- return("input is NaN");
- }
-
- # got a number, so mod by 2
- $input % 2 == 0 ? return("EVEN") : return("ODD");
- }
-
-Alternatively, we could have used coderefs to associate an
-exported name...
-
- my $evenodd_func = sub {
- # exactly the same as in the above subroutine
- };
-
-Next we define a function to generate the web page - this can
-be done many different ways, and can also be defined as an
-anonymous sub. The only requirement is that the sub send back
-the html of the page. You can do this via a string containing the
-html, or from a coderef that returns the html, or from a function
-(as shown here)...
-
- sub Show_HTML {
- my $html = <<EOT;
- <HTML>
- <HEAD><title>CGI::Ajax Example</title>
- </HEAD>
- <BODY>
- Enter a number:
- <input type="text" name="somename" id="val1" size="6"
- OnKeyUp="evenodd( ['val1'], ['resultdiv'] );">
- <br>
- <hr>
- <div id="resultdiv">
- </div>
- </BODY>
- </HTML>
-EOT
- return $html;
- }
-
-The exported Perl subrouting is triggered using the C<OnKeyUp>
-event handler of the input HTML element. The subroutine takes one
-value from the form, the input element B<'val1'>, and returns the
-the result to an HTML div element with an id of B<'resultdiv'>.
-Sending in the input id in an array format is required to support
-multiple inputs, and similarly, to output multiple the results,
-you can use an array for the output divs, but this isn't mandatory -
-as will be explained in the B<Advanced> usage.
-
-Now create a CGI object and a CGI::Ajax object, associating a reference
-to our subroutine with the name we want available to javascript.
-
- my $cgi = new CGI();
- my $pjx = new CGI::Ajax( 'evenodd' => \&evenodd_func );
-
-And if we used a coderef, it would look like this...
-
- my $pjx = new CGI::Ajax( 'evenodd' => $evenodd_func );
-
-Now we're ready to print the output page; we send in the cgi
-object and the HTML-generating function.
-
- print $pjx->build_html($cgi,\&Show_HTML);
-
-CGI::Ajax has support for passing in extra HTML header information
-to the CGI object. This can be accomplished by adding a third
-argument to the build_html() call. The argument needs to be a
-hashref containing Key=>value pairs that CGI objects understand:
-
- print $pjx->build_html($cgi,\&Show_HTML,
- {-charset=>'UTF-8, -expires=>'-1d'});
-
-See L<CGI> for more header() method options.
-
-That's it for the CGI::Ajax standard method. Let's look at
-something more advanced.
-
-=item 2 Advanced CGI::Ajax example
-
-Let's say we wanted to have a perl subroutine process multiple
-values from the HTML page, and similarly return multiple values
-back to distinct divs on the page. This is easy to do, and
-requires no changes to the perl code - you just create it as you
-would any perl subroutine that works with multiple input values
-and returns multiple values. The significant change happens in
-the event handler javascript in the HTML...
-
- onClick="exported_func(['input1','input2'],['result1','result2']);"
-
-Here we associate our javascript function ("exported_func") with
-two HTML element ids ('input1','input2'), and also send in two
-HTML element ids to place the results in ('result1','result2').
-
-=item 3 Sending Perl Subroutine Output to a Javascript function
-
-Occassionally, you might want to have a custom javascript function
-process the returned information from your Perl subroutine.
-This is possible, and the only requierment is that you change
-your event handler code...
-
- onClick="exported_func(['input1'],[js_process_func]);"
-
-In this scenario, C<js_process_func> is a javascript function you
-write to take the returned value from your Perl subroutine and
-process the results. I<Note that a javascript function is not
-quoted -- if it were, then CGI::Ajax would look for a HTML element
-with that id.> Beware that with this usage, B<you are responsible
-for distributing the results to the appropriate place on the
-HTML page>. If the exported Perl subroutine returns, e.g. 2
-values, then C<js_process_func> would need to process the input
-by working through an array, or using the javascript Function
-C<arguments> object.
-
- function js_process_func() {
- var input1 = arguments[0]
- var input2 = arguments[1];
- // do something and return results, or set HTML divs using
- // innerHTML
- document.getElementById('outputdiv').innerHTML = input1;
- }
-
-=item 4 URL/Outside Script CGI::Ajax example
-
-There are times when you may want a different script to
-return content to your page. This could be because you have
-an existing script already written to perform a particular
-task, or you want to distribute a part of your application to another
-script. This can be accomplished in L<CGI::Ajax> by using a URL in
-place of a locally-defined Perl subroutine. In this usage,
-you alter you creation of the L<CGI::Ajax> object to link an
-exported javascript function name to a local URL instead of
-a coderef or a subroutine.
-
- my $url = 'scripts/other_script.pl';
- my $pjx = new CGI::Ajax( 'external' => $url );
-
-This will work as before in terms of how it is called from you
-event handler:
-
- onClick="external(['input1','input2'],['resultdiv']);"
-
-The other_script.pl will get the values via a CGI object and
-accessing the 'args' key. The values of the B<'args'> key will
-be an array of everything that was sent into the script.
-
- my @input = $cgi->params('args');
- $input[0]; # contains first argument
- $input[1]; # contains second argument, etc...
-
-This is good, but what if you need to send in arguments to the
-other script which are directly from the calling Perl script,
-i.e. you want a calling Perl script's variable to be sent, not
-the value from an HTML element on the page? This is possible
-using the following syntax:
-
- onClick="exported_func(['args__$input1','args__$input2'],
- ['resultdiv']);"
-
-Similary, if the external script required a constant as input
-(e.g. C<script.pl?args=42>, you would use this syntax:
-
- onClick="exported_func(['args__42'],['resultdiv']);"
-
-In both of the above examples, the result from the external
-script would get placed into the I<resultdiv> element on our
-(the calling script's) page.
-
-If you are sending more than one argument from an external perl
-script back to a javascript function, you will need to split the
-string (AJAX applications communicate in strings only) on something.
-Internally, we use '__pjx__', and this string is checked for. If
-found, L<CGI::Ajax> will automatically split it. However, if you
-don't want to use '__pjx__', you can do it yourself:
-
-For example, from your Perl script, you would...
-
- return("A|B"); # join with "|"
-
-and then in the javascript function you would have something like...
-
- process_func() {
- var arr = arguments[0].split("|");
- // arr[0] eq 'A'
- // arr[1] eq 'B'
- }
-
-In order to rename parameters, in case the outside script needs
-specifically-named parameters and not CGI::Ajax' I<'args'> default
-parameter name, change your event handler associated with an HTML
-event like this
-
- onClick="exported_func(['myname__$input1','myparam__$input2'],
- ['resultdiv']);"
-
-The URL generated would look like this...
-
-C<script.pl?myname=input1&myparam=input2>
-
-You would then retrieve the input in the outside script with this...
-
- my $p1 = $cgi->params('myname');
- my $p1 = $cgi->params('myparam');
-
-Finally, what if we need to get a value from our HTML page and we
-want to send that value to an outside script but the outside script
-requires a named parameter different from I<'args'>? You can
-accomplish this with L<CGI::Ajax> using the getVal() javascript
-method (which returns an array, thus the C<getVal()[0]> notation):
-
- onClick="exported_func(['myparam__' + getVal('div_id')[0]],
- ['resultdiv']);"
-
-This will get the value of our HTML element with and
-I<id> of I<div_id>, and submit it to the url attached to
-I<myparam__>. So if our exported handler referred to a URI
-called I<script/scr.pl>, and the element on our HTML page called
-I<div_id> contained the number '42', then the URL would look
-like this C<script/scr.pl?myparam=42>. The result from this
-outside URL would get placed back into our HTML page in the
-element I<resultdiv>. See the example script that comes with
-the distribution called I<pjx_url.pl> and its associated outside
-script I<convert_degrees.pl> for a working example.
-
-B<N.B.> These examples show the use of outside scripts which
-are other perl scripts - I<but you are not limited to Perl>!
-The outside script could just as easily have been PHP or any other
-CGI script, as long as the return from the other script is just
-the result, and not addition HTML code (like FORM elements, etc).
-
-=back
-
-=head2 GET versus POST
-
-Note that all the examples so far have used the following syntax:
-
- onClick="exported_func(['input1'],['result1']);"
-
-There is an optional third argument to a L<CGI::Ajax> exported
-function that allows change the submit method. The above event could
-also have been coded like this...
-
- onClick="exported_func(['input1'],['result1'], 'GET');"
-
-By default, L<CGI::Ajax> sends a I<'GET'> request. If you need it,
-for example your URL is getting way too long, you can easily switch
-to a I<'POST'> request with this syntax...
-
- onClick="exported_func(['input1'],['result1'], 'POST');"
-
-I<('POST' and 'post' are supported)>
-
-=head2 Page Caching
-
-We have implemented a method to prevent page cacheing from undermining
-the AJAX methods in a page. If you send in an input argument to a
-L<CGI::Ajax>-exported function called 'NO_CACHE', the a special
-parameter will get attached to the end or your url with a random
-number in it. This will prevent a browser from caching your request.
-
- onClick="exported_func(['input1','NO_CACHE'],['result1']);"
-
-The extra param is called pjxrand, and won't interfere with the order
-of processing for the rest of your parameters.
-
-=head1 METHODS
-
-=cut
-
-################################### main pod documentation end ##
-
-######################################################
-## METHODS - public ##
-######################################################
-
-=over 4
-
-=item build_html()
-
- Purpose: Associates a cgi obj ($cgi) with pjx object, inserts
- javascript into <HEAD></HEAD> element and constructs
- the page, or part of the page. AJAX applications
- are designed to update only the section of the
- page that needs it - the whole page doesn't have
- to be redrawn. L<CGI::Ajax> applications use the
- build_html() method to take care of this: if the CGI
- parameter C<fname> exists, then the return from the
- L<CGI::Ajax>-exported function is sent to the page.
- Otherwise, the entire page is sent, since without
- an C<fname> param, this has to be the first time
- the page is being built.
-
- Arguments: The CGI object, and either a coderef, or a string
- containing html. Optionally, you can send in a third
- parameter containing information that will get passed
- directly to the CGI object header() call.
- Returns: html or updated html (including the header)
- Called By: originating cgi script
-
-=cut
-sub build_html {
- my ( $self, $cgi, $html_source, $cgi_header_extra ) = @_;
-
- if ( ref( $cgi ) =~ /CGI.*/ ) {
- if ( $self->DEBUG() ) {
- print STDERR "CGI::Ajax->build_html: CGI* object was received\n";
- }
- $self->cgi( $cgi ); # associate the cgi obj with the CGI::Ajax object
- }
-
- if ( defined $cgi_header_extra ) {
- if ( $self->DEBUG() ) {
- print STDERR "CGI::Ajax->build_html: got extra cgi header info\n";
- if ( ref($cgi_header_extra) eq "HASH" ) {
- foreach my $k ( keys %$cgi_header_extra ) {
- print STDERR "\t$k => ", $cgi_header_extra->{$k}, "\n";
- }
- } else {
- print STDERR "\t$cgi_header_extra\n";
- }
- }
- $self->cgi_header_extra( $cgi_header_extra );
- }
-
- #check if "fname" was defined in the CGI object
- if ( defined $self->cgi()->param("fname") ) {
- # it was, so just return the html from the handled request
- return ( $self->handle_request() );
- }
- else {
- # start with the minimum, a http header line and any extra cgi
- # header params sent in
- my $html = "";
- if ( $self->cgi()->can('header') ) {
- #$html .= $self->cgi()->header();
- $html .= $self->cgi()->header( $self->cgi_header_extra() );
- }
- else {
- # don't have an object with a "header()" method, so just create
- # a mimimal one
- $html .= "Content-Type: text/html;";
- $html .= $self->cgi_header_extra();
- $html .= "\n\n";
- }
-
- # check if the user sent in a coderef for generating the html,
- # or the actual html
- if ( ref($html_source) eq "CODE" ) {
- if ( $self->DEBUG() ) {
- print STDERR "CGI::Ajax->build_html: html_source is a CODEREF\n";
- }
- eval { $html .= &$html_source };
- if ($@) {
- # there was a problem evaluating the html-generating function
- # that was sent in, so generate an error page
- if ( $self->cgi()->can('header') ) {
- $html = $self->cgi()->header( $self->cgi_header_extra() );
- }
- else {
- # don't have an object with a "header()" method, so just create
- # a mimimal one
- $html = "Content-Type: text/html;";
- $html .= $self->cgi_header_extra();
- $html .= "\n\n";
- }
- $html .= qq!<html><head><title></title></head><body><h2>Problems</h2> with
- the html-generating function sent to CGI::Ajax
- object</body></html>!;
- return $html;
- }
- $self->html($html); # no problems, so set html
- }
- else {
- # user must have sent in raw html, so add it
- if ( $self->DEBUG() ) {
- print STDERR "CGI::Ajax->build_html: html_source is HTML\n";
- }
- $self->html( $html . $html_source );
- }
-
- # now modify the html to insert the javascript
- $self->insert_js_in_head();
- }
- return $self->html();
-}
-
-=item show_javascript()
-
- Purpose: builds the text of all the javascript that needs to be
- inserted into the calling scripts html <head> section
- Arguments:
- Returns: javascript text
- Called By: originating web script
- Note: This method is also overridden so when you just print
- a CGI::Ajax object it will output all the javascript needed
- for the web page.
-
-=cut
-
-sub show_javascript {
- my ($self) = @_;
- my $rv = $self->show_common_js(); # show the common js
-
- # build the js for each perl function you want exported to js
- foreach my $func ( keys %{ $self->coderef_list() }, keys %{ $self->url_list() } ) {
- $rv .= $self->make_function($func);
- }
- # wrap up the return in a CDATA structure for XML compatibility
- # (thanks Thos Davis)
- $rv = "\n" . '//<![CDATA[' . "\n" . $rv . "\n" . '//]]>' . "\n";
- $rv = '<script type="text/javascript">' . $rv . '</script>';
- return $rv;
-}
-
-## new
-sub new {
- my ($class) = shift;
- my $self = bless ({}, ref ($class) || $class);
-# $self->SUPER::new();
- $self->JSDEBUG(0); # turn javascript debugging off (if on,
- # extra info will be added to the web page output
- # if set to 1, then the core js will get
- # compressed, but the user-defined functions will
- # not be compressed. If set to 2 (or anything
- # greater than 1 or 0), then none of the
- # javascript will get compressed.
- #
- $self->DEBUG(0); # turn debugging off (if on, check web logs)
-
- #accessorized attributes
- $self->coderef_list({});
- $self->url_list({});
- #$self->html("");
- #$self->cgi();
- #$self->cgi_header_extra(""); # set cgi_header_extra to an empty string
-
- # setup a default endcoding; if you need support for international
- # charsets, use 'escape' instead of encodeURIComponent. Due to the
- # number of browser problems users report about scripts with a default of
- # encodeURIComponent, we are setting the default to 'escape'
- $self->js_encode_function('escape');
-
- if ( @_ < 2 ) {
- die "incorrect usage: must have fn=>code pairs in new\n";
- }
-
- while ( @_ ) {
- my($function_name,$code) = splice( @_, 0, 2 );
- if ( ref( $code ) eq "CODE" ) {
- if ( $self->DEBUG() ) {
- print STDERR "name = $function_name, code = $code\n";
- }
- # add the name/code to hash
- $self->coderef_list()->{ $function_name } = $code;
- } elsif ( ref($code) ) {
- die "Unsuported code block/url\n";
- } else {
- if ( $self->DEBUG() ) {
- print STDERR "Setting function $function_name to url $code\n";
- }
- # if it's a url, it is added here
- $self->url_list()->{ $function_name } = $code;
- }
- }
- return ($self);
-}
-
-######################################################
-## METHODS - private ##
-######################################################
-
-# sub cgiobj(), cgi()
-#
-# Purpose: accessor method to associate a CGI object with our
-# CGI::Ajax object
-# Arguments: a CGI object
-# Returns: CGI::Ajax objects cgi object
-# Called By: originating cgi script, or build_html()
-#
-sub cgiobj {
- my $self = shift;
- # see if any values were sent in...
- if ( @_ ) {
- my $cgi = shift;
- # add support for other CGI::* modules This requires that your web server
- # be configured properly. I can't test anything but a mod_perl2
- # setup, so this prevents me from testing CGI::Lite,CGI::Simple, etc.
- if ( ref($cgi) =~ /CGI.*/ ) {
- if ( $self->DEBUG() ) {
- print STDERR "cgiobj() received a CGI-like object ($cgi)\n";
- }
- $self->{'cgi'} = $cgi;
- } else {
- die "CGI::Ajax -- Can't set internal CGI object to a non-CGI object ($cgi)\n";
- }
- }
- # return the object
- return( $self->{'cgi'} );
-}
-
-sub cgi {
- my $self = shift;
- if ( @_ ) {
- return( $self->cgiobj( @_ ) );
- } else {
- return( $self->cgiobj() );
- }
-}
-
-## # sub cgi_header_extra
-## #
-## # Purpose: accessor method to associate CGI header information
-## # with the CGI::Ajax object
-## # Arguments: a hashref with key=>value pairs that get handed off to
-## # the CGI object's header() method
-## # Returns: hashref of extra cgi header params
-## # Called By: originating cgi script, or build_html()
-##
-## sub cgi_header_extra {
-## my $self = shift;
-## if ( @_ ) {
-## $self->{'cgi_header_extra'} = shift;
-## }
-## return( $self->{'cgi_header_extra'} );
-## }
-
-# sub create_js_setRequestHeader
-#
-# Purpose: create text of the header for the javascript side,
-# xmlhttprequest call
-# Arguments: none
-# Returns: text of header to pass to xmlhttpreq call so it will
-# match whatever was setup for the main web-page
-# Called By: originating cgi script, or build_html()
-#
-
-sub create_js_setRequestHeader {
- my $self = shift;
- my $cgi_header_extra = $self->cgi_header_extra();
- my $js_header_string = q{r.setRequestHeader("};
- #$js_header_string .= $self->cgi()->header( $cgi_header_extra );
- $js_header_string .= $self->cgi()->header();
- $js_header_string .= q{");};
- #if ( ref $cgi_header_extra eq "HASH" ) {
- # foreach my $k ( keys(%$cgi_header_extra) ) {
- # $js_header_string .= $self->cgi()->header($cgi_headers)
- # }
- #} else {
- #print STDERR $self->cgi()->header($cgi_headers) ;
-
- if ( $self->DEBUG() ) {
- print STDERR "js_header_string is (", $js_header_string, ")\n";
- }
-
- return($js_header_string);
-}
-
-# sub show_common_js()
-#
-# Purpose: create text of the javascript needed to interface with
-# the perl functions
-# Arguments: none
-# Returns: text of common javascript subroutine, 'do_http_request'
-# Called By: originating cgi script, or build_html()
-#
-
-sub show_common_js {
- my $self = shift;
- my $encodefn = $self->js_encode_function();
- my $decodefn = $encodefn;
- $decodefn =~ s/^(en)/de/;
- $decodefn =~ s/^(esc)/unesc/;
- #my $request_header_str = $self->create_js_setRequestHeader();
- my $request_header_str = "";
- my $rv = <<EOT;
-var ajax = [];
-function pjx(args,fname,method) {
- this.target=args[1];
- this.args=args[0];
- method=(method)?method:'GET';
- if(method=='post'){method='POST';}
- this.method = method;
- this.r=ghr();
- this.url = this.getURL(fname);
-}
-
-function formDump(){
- var all = [];
- var fL = document.forms.length;
- for(var f = 0;f<fL;f++){
- var els = document.forms[f].elements;
- for(var e in els){
- var tmp = (els[e].id != undefined)? els[e].id : els[e].name;
- if(typeof tmp != 'string'){continue;}
- if(tmp){ all[all.length]=tmp}
- }
- }
- return all;
-}
-function getVal(id) {
- if (id.constructor == Function ) { return id(); }
- if (typeof(id)!= 'string') { return id; }
- var element = document.getElementById(id) || document.forms[0].elements[id];
- if(!element){
- alert('ERROR: Cant find HTML element with id or name: ' +
- id+'. Check that an element with name or id='+id+' exists');
- return 0;
- }
- if(element.type == 'select-one') {
- if(element.selectedIndex == -1) return;
- var item = element[element.selectedIndex];
- return item.value || item.text
- }
- if (element.type == 'select-multiple') {
- var ans = [];
- var k =0;
- for (var i=0;i<element.length;i++) {
- if (element[i].selected || element[i].checked ) {
- ans[k++]= element[i].value || element[i].text;
- }
- }
- return ans;
- }
-
- if(element.type == 'radio' || element.type == 'checkbox'){
- var ans =[];
- var elms = document.getElementsByTagName('input');
- var endk = elms.length;
- var i =0;
- for(var k=0;k<endk;k++){
- if(elms[k].type== element.type && elms[k].checked && elms[k].id==id){
- ans[i++]=elms[k].value;
- }
- }
- return ans;
- }
- if( element.value == undefined ){
- return element.innerHTML;
- }else{
- return element.value;
- }
-}
-function fnsplit(arg) {
- var url="";
- if(arg=='NO_CACHE'){return '&pjxrand='+Math.random()}
- if((typeof(arg)).toLowerCase() == 'object'){
- for(var k in arg){
- url += '&' + k + '=' + arg[k];
- }
- }else if (arg.indexOf('__') != -1) {
- arga = arg.split(/__/);
- url += '&' + arga[0] +'='+ $encodefn(arga[1]);
- } else {
- var res = getVal(arg) || '';
- if(res.constructor != Array){ res = [res] }
- for(var i=0;i<res.length;i++) {
- url += '&args=' + $encodefn(res[i]) + '&' + arg + '=' + $encodefn(res[i]);
- }
- }
- return url;
-}
-
-pjx.prototype = {
- send2perl : function(){
- var r = this.r;
- var dt = this.target;
- this.pjxInitialized(dt);
- var url=this.url;
- var postdata;
- if(this.method=="POST"){
- var idx=url.indexOf('?');
- postdata = url.substr(idx+1);
- url = url.substr(0,idx);
- }
- r.open(this.method,url,true);
- $request_header_str;
- if(this.method=="POST"){
- r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- r.send(postdata);
- }
- if(this.method=="GET"){
- r.send(null);
- }
- r.onreadystatechange = handleReturn;
- },
- pjxInitialized : function(){},
- pjxCompleted : function(){},
- readyState4 : function(){
- var rsp = $decodefn(this.r.responseText); /* the response from perl */
- var splitval = '__pjx__'; /* to split text */
- /* fix IE problems with undef values in an Array getting squashed*/
- rsp = rsp.replace(splitval+splitval+'g',splitval+" "+splitval);
- var data = rsp.split(splitval);
- dt = this.target;
- if (dt.constructor != Array) { dt=[dt]; }
- if (data.constructor != Array) { data=[data]; }
- if (typeof(dt[0])!='function') {
- for ( var i=0; i<dt.length; i++ ) {
- var div = document.getElementById(dt[i]);
- if (div.type =='text' || div.type=='textarea' || div.type=='hidden' ) {
- div.value=data[i];
- } else{
- div.innerHTML = data[i];
- }
- }
- } else if (typeof(dt[0])=='function') {
- dt[0].apply(this,data);
- }
- this.pjxCompleted(dt);
- },
-
- getURL : function(fname) {
- var args = this.args;
- var url= 'fname=' + fname;
- for (var i=0;i<args.length;i++) {
- url=url + args[i];
- }
- return url;
- }
-};
-
-handleReturn = function() {
- for( var k=0; k<ajax.length; k++ ) {
- if (ajax[k].r==null) { ajax.splice(k--,1); continue; }
- if ( ajax[k].r.readyState== 4) {
- ajax[k].readyState4();
- ajax.splice(k--,1);
- continue;
- }
- }
-};
-
-var ghr=getghr();
-function getghr(){
- if(typeof XMLHttpRequest != "undefined")
- {
- return function(){return new XMLHttpRequest();}
- }
- var msv= ["Msxml2.XMLHTTP.7.0", "Msxml2.XMLHTTP.6.0",
- "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0",
- "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];
- for(var j=0;j<=msv.length;j++){
- try
- {
- A = new ActiveXObject(msv[j]);
- if(A){
- return function(){return new ActiveXObject(msv[j]);}
- }
- }
- catch(e) { }
- }
- return false;
-}
-
-
-function jsdebug(){
- var tmp = document.getElementById('pjxdebugrequest').innerHTML = "<br><pre>";
- for( var i=0; i < ajax.length; i++ ) {
- tmp += '<a href= '+ ajax[i].url +' target=_blank>' +
- decodeURI(ajax[i].url) + ' </a><br>';
- }
- document.getElementById('pjxdebugrequest').innerHTML = tmp + "</pre>";
-}
-
-EOT
-
- if ( $self->JSDEBUG() <= 1 ) {
- $rv = $self->compress_js($rv);
- }
-
- return($rv);
-}
-
-# sub compress_js()
-#
-# Purpose: searches the javascript for newlines and spaces and
-# removes them (if a newline) or shrinks them to a single (if
-# space).
-# Arguments: javascript to compress
-# Returns: compressed js string
-# Called By: show_common_js(),
-#
-
-sub compress_js {
- my($self,$js) = @_;
- return if not defined $js;
- return if $js eq "";
- $js =~ s/\n//g; # drop newlines
- $js =~ s/\s+/ /g; # replace 1+ spaces with just one space
- return $js;
-}
-
-
-# sub insert_js_in_head()
-#
-# Purpose: searches the html value in the CGI::Ajax object and inserts
-# the ajax javascript code in the <script></script> section,
-# or if no such section exists, then it creates it. If
-# JSDEBUG is set, then an extra div will be added and the
-# url wil be desplayed as a link
-# Arguments: none
-# Returns: none
-# Called By: build_html()
-#
-
-sub insert_js_in_head{
- my $self = shift;
- my $mhtml = $self->html();
- my $newhtml;
- my @shtml;
- my $js = $self->show_javascript();
-
- if ( $self->JSDEBUG() ) {
- my $showurl=qq!<br/><div id='pjxdebugrequest'></div><br/>!;
- # find the terminal </body> so we can insert just before it
- my @splith = $mhtml =~ /(.*)(<\s*\/\s*body[^>]*>?)(.*)/is;
- $mhtml = $splith[0].$showurl.$splith[1].$splith[2];
- }
-
- # see if we can match on <head>
- @shtml= $mhtml =~ /(.*)(<\s*head[^>]*>?)(.*)/is;
- if ( @shtml ) {
- # yes, there's already a <head></head>, so let's insert inside it,
- # at the beginning
- $newhtml = $shtml[0].$shtml[1].$js.$shtml[2];
- } elsif( @shtml= $mhtml =~ /(.*)(<\s*html[^>]*>?)(.*)/is){
- # there's no <head>, so look for the <html> tag, and insert out
- # javascript inside that tag
- $newhtml = $shtml[0].$shtml[1].$js.$shtml[2];
- } else {
- $newhtml .= "<html><head>";
- $newhtml .= $js;
- $newhtml .= "</head><body>";
- $newhtml .= "No head/html tags, nowhere to insert. Returning javascript anyway<br>";
- $newhtml .= "</body></html>";
- }
- $self->html($newhtml);
- return;
-}
-
-# sub handle_request()
-#
-# Purpose: makes sure a fname function name was set in the CGI
-# object, and then tries to eval the function with
-# parameters sent in on args
-# Arguments: none
-# Returns: the result of the perl subroutine, as text; if multiple
-# arguments are sent back from the defined, exported perl
-# method, then join then with a connector (__pjx__).
-# Called By: build_html()
-#
-
-sub handle_request {
- my ($self) = shift;
-
- my $result; # $result takes the output of the function, if it's an
- # array split on __pjx__
- my @other = (); # array for catching extra parameters
-
- # we need to access "fname" in the form from the web page, so make
- # sure there is a CGI object defined
- return undef unless defined $self->cgi();
-
- my $rv = "";
- if ( $self->cgi()->can('header') ) {
- $rv = $self->cgi()->header( $self->cgi_header_extra() );
- } else {
- # don't have an object with a "header()" method, so just create
- # a mimimal one
- $rv = "Content-Type: text/html;";
- # TODO:
- $rv .= $self->cgi_header_extra();
- $rv .= "\n\n";
- }
-
- # get the name of the function
- my $func_name = $self->cgi()->param("fname");
-
- # check if the function name was created
- if ( defined $self->coderef_list()->{$func_name} ) {
- my $code = $self->coderef_list()->{$func_name};
-
- # eval the code from the coderef, and append the output to $rv
- if ( ref($code) eq "CODE" ) {
- eval { ($result, @other) = $code->( $self->cgi()->param("args") ) };
-
- if ($@) {
- # see if the eval caused and error and report it
- # Should we be more severe and die?
- if ( $self->DEBUG() ) {
- print STDERR "Problem with code: $@\n";
- }
- }
-
- if( @other ) {
- $rv .= join( "__pjx__", ($result, @other) );
- if ( $self->DEBUG() ) {
- print STDERR "rv = $rv\n";
- }
- } else {
- if ( defined $result ) {
- $rv .= $result;
- }
- }
-
- } # end if ref = CODE
- } else {
- # # problems with the URL, return a CGI rrror
- print STDERR "POSSIBLE SECURITY INCIDENT! Browser from ", $self->cgi()->remote_addr();
- print STDERR "\trequested URL: ", $self->cgi()->url();
- print STDERR "\tfname request: ", $self->cgi()->param('fname');
- print STDERR " -- returning Bad Request status 400\n";
- if ( $self->cgi()->can('header') ) {
- return($self->cgi()->header( -status=>'400' ));
- } else {
- # don't have an object with a "header()" method, so just create
- # a mimimal one with 400 error
- $rv = "Status: 400\nContent-Type: text/html;\n\n";
- }
- }
- return $rv;
-}
-
-
-# sub make_function()
-#
-# Purpose: creates the javascript wrapper for the underlying perl
-# subroutine
-# Arguments: CGI object from web form, and the name of the perl
-# function to export to javascript, or a url if the
-# function name refers to another cgi script
-# Returns: text of the javascript-wrapped perl subroutine
-# Called By: show_javascript; called once for each registered perl
-# subroutine
-#
-
-sub make_function {
- my ($self, $func_name ) = @_;
- return("") if not defined $func_name;
- return("") if $func_name eq "";
- my $rv = "";
- my $script = $0 || $ENV{SCRIPT_FILENAME};
- $script =~ s/.*[\/|\\](.+)$/$1/;
- my $outside_url = $self->url_list()->{ $func_name };
- my $url = defined $outside_url ? $outside_url : $script;
- if ($url =~ /\?/) { $url.='&'; } else {$url.='?'}
- $url = "'$url'";
- my $jsdebug = "";
- if ( $self->JSDEBUG()) {
- $jsdebug = "jsdebug()";
- }
-
- #create the javascript text
- $rv .= <<EOT;
-function $func_name() {
- var args = $func_name.arguments;
- for( var i=0; i<args[0].length;i++ ) {
- args[0][i] = fnsplit(args[0][i]);
- }
- var l = ajax.length;
- ajax[l]= new pjx(args,"$func_name",args[2]);
- ajax[l].url = $url + ajax[l].url;
- ajax[l].send2perl();
- $jsdebug;
-}
-EOT
-
- if ( not $self->JSDEBUG() ) {
- $rv = $self->compress_js($rv);
- }
- return $rv;
-}
-
-=item register()
-
- Purpose: adds a function name and a code ref to the global coderef
- hash, after the original object was created
- Arguments: function name, code reference
- Returns: none
- Called By: originating web script
-
-=cut
-
-sub register {
- my ( $self, $fn, $coderef ) = @_;
- # coderef_list() is a Class::Accessor function
- # url_list() is a Class::Accessor function
- if ( ref( $coderef ) eq "CODE" ) {
- $self->coderef_list()->{$fn} = $coderef;
- } elsif ( ref($coderef) ) {
- die "Unsupported code/url type - error\n";
- } else {
- $self->url_list()->{$fn} = $coderef;
- }
-}
-
-=item JSDEBUG()
-
- Purpose: Show the AJAX URL that is being generated, and stop
- compression of the generated javascript, both of which can aid
- during debugging. If set to 1, then the core js will get
- compressed, but the user-defined functions will not be
- compressed. If set to 2 (or anything greater than 1 or 0),
- then none of the javascript will get compressed.
-
- Arguments: JSDEBUG(0); # turn javascript debugging off
- JSDEBUG(1); # turn javascript debugging on, some javascript compression
- JSDEBUG(2); # turn javascript debugging on, no javascript compresstion
- Returns: prints a link to the url that is being generated automatically by
- the Ajax object. this is VERY useful for seeing what
- CGI::Ajax is doing. Following the link, will show a page
- with the output that the page is generating.
-
- Called By: $pjx->JSDEBUG(1) # where $pjx is a CGI::Ajax object;
-
-=item DEBUG()
-
- Purpose: Show debugging information in web server logs
- Arguments: DEBUG(0); # turn debugging off (default)
- DEBUG(1); # turn debugging on
- Returns: prints debugging information to the web server logs using
- STDERR
- Called By: $pjx->DEBUG(1) # where $pjx is a CGI::Ajax object;
-
-=back
-
-=head1 BUGS
-
-Follow any bugs at our homepage....
-
- http://www.perljax.us
-
-=head1 SUPPORT
-
-Check out the news/discussion/bugs lists at our homepage:
-
- http://www.perljax.us
-
-=head1 AUTHORS
-
- Brian C. Thomas Brent Pedersen
- CPAN ID: BCT
- bct.x42@gmail.com bpederse@gmail.com
-
-=head1 A NOTE ABOUT THE MODULE NAME
-
-This module was initiated using the name "Perljax", but then
-registered with CPAN under the WWW group "CGI::", and so became
-"CGI::Perljax". Upon further deliberation, we decided to change it's
-name to L<CGI::Ajax>.
-
-=head1 COPYRIGHT
-
-This program is free software; you can redistribute
-it and/or modify it under the same terms as Perl itself.
-
-The full text of the license can be found in the
-LICENSE file included with this module.
-
-=head1 SEE ALSO
-
-L<Data::Javascript>
-L<CGI>
-L<Class::Accessor>
-
-=cut
-
-1;
-__END__
+++ /dev/null
-Terms of Perl itself
-
-a) the GNU General Public License as published by the Free
- Software Foundation; either version 1, or (at your option) any
- later version, or
-b) the "Artistic License"
-
----------------------------------------------------------------------------
-
-The General Public License (GPL)
-Version 2, June 1991
-
-Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
-Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute
-verbatim copies of this license document, but changing it is not allowed.
-
-Preamble
-
-The licenses for most software are designed to take away your freedom to share
-and change it. By contrast, the GNU General Public License is intended to
-guarantee your freedom to share and change free software--to make sure the
-software is free for all its users. This General Public License applies to most of
-the Free Software Foundation's software and to any other program whose
-authors commit to using it. (Some other Free Software Foundation software is
-covered by the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
-When we speak of free software, we are referring to freedom, not price. Our
-General Public Licenses are designed to make sure that you have the freedom
-to distribute copies of free software (and charge for this service if you wish), that
-you receive source code or can get it if you want it, that you can change the
-software or use pieces of it in new free programs; and that you know you can do
-these things.
-
-To protect your rights, we need to make restrictions that forbid anyone to deny
-you these rights or to ask you to surrender the rights. These restrictions
-translate to certain responsibilities for you if you distribute copies of the
-software, or if you modify it.
-
-For example, if you distribute copies of such a program, whether gratis or for a
-fee, you must give the recipients all the rights that you have. You must make
-sure that they, too, receive or can get the source code. And you must show
-them these terms so they know their rights.
-
-We protect your rights with two steps: (1) copyright the software, and (2) offer
-you this license which gives you legal permission to copy, distribute and/or
-modify the software.
-
-Also, for each author's protection and ours, we want to make certain that
-everyone understands that there is no warranty for this free software. If the
-software is modified by someone else and passed on, we want its recipients to
-know that what they have is not the original, so that any problems introduced by
-others will not reflect on the original authors' reputations.
-
-Finally, any free program is threatened constantly by software patents. We wish
-to avoid the danger that redistributors of a free program will individually obtain
-patent licenses, in effect making the program proprietary. To prevent this, we
-have made it clear that any patent must be licensed for everyone's free use or
-not licensed at all.
-
-The precise terms and conditions for copying, distribution and modification
-follow.
-
-GNU GENERAL PUBLIC LICENSE
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
-MODIFICATION
-
-0. This License applies to any program or other work which contains a notice
-placed by the copyright holder saying it may be distributed under the terms of
-this General Public License. The "Program", below, refers to any such program
-or work, and a "work based on the Program" means either the Program or any
-derivative work under copyright law: that is to say, a work containing the
-Program or a portion of it, either verbatim or with modifications and/or translated
-into another language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not covered by
-this License; they are outside its scope. The act of running the Program is not
-restricted, and the output from the Program is covered only if its contents
-constitute a work based on the Program (independent of having been made by
-running the Program). Whether that is true depends on what the Program does.
-
-1. You may copy and distribute verbatim copies of the Program's source code as
-you receive it, in any medium, provided that you conspicuously and appropriately
-publish on each copy an appropriate copyright notice and disclaimer of warranty;
-keep intact all the notices that refer to this License and to the absence of any
-warranty; and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and you may at
-your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Program or any portion of it, thus
-forming a work based on the Program, and copy and distribute such
-modifications or work under the terms of Section 1 above, provided that you also
-meet all of these conditions:
-
-a) You must cause the modified files to carry prominent notices stating that you
-changed the files and the date of any change.
-
-b) You must cause any work that you distribute or publish, that in whole or in
-part contains or is derived from the Program or any part thereof, to be licensed
-as a whole at no charge to all third parties under the terms of this License.
-
-c) If the modified program normally reads commands interactively when run, you
-must cause it, when started running for such interactive use in the most ordinary
-way, to print or display an announcement including an appropriate copyright
-notice and a notice that there is no warranty (or else, saying that you provide a
-warranty) and that users may redistribute the program under these conditions,
-and telling the user how to view a copy of this License. (Exception: if the
-Program itself is interactive but does not normally print such an announcement,
-your work based on the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If identifiable
-sections of that work are not derived from the Program, and can be reasonably
-considered independent and separate works in themselves, then this License,
-and its terms, do not apply to those sections when you distribute them as
-separate works. But when you distribute the same sections as part of a whole
-which is a work based on the Program, the distribution of the whole must be on
-the terms of this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest your rights to
-work written entirely by you; rather, the intent is to exercise the right to control
-the distribution of derivative or collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program with the
-Program (or with a work based on the Program) on a volume of a storage or
-distribution medium does not bring the other work under the scope of this
-License.
-
-3. You may copy and distribute the Program (or a work based on it, under
-Section 2) in object code or executable form under the terms of Sections 1 and 2
-above provided that you also do one of the following:
-
-a) Accompany it with the complete corresponding machine-readable source
-code, which must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange; or,
-
-b) Accompany it with a written offer, valid for at least three years, to give any
-third party, for a charge no more than your cost of physically performing source
-distribution, a complete machine-readable copy of the corresponding source
-code, to be distributed under the terms of Sections 1 and 2 above on a medium
-customarily used for software interchange; or,
-
-c) Accompany it with the information you received as to the offer to distribute
-corresponding source code. (This alternative is allowed only for noncommercial
-distribution and only if you received the program in object code or executable
-form with such an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for making
-modifications to it. For an executable work, complete source code means all the
-source code for all modules it contains, plus any associated interface definition
-files, plus the scripts used to control compilation and installation of the
-executable. However, as a special exception, the source code distributed need
-not include anything that is normally distributed (in either source or binary form)
-with the major components (compiler, kernel, and so on) of the operating system
-on which the executable runs, unless that component itself accompanies the
-executable.
-
-If distribution of executable or object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the source
-code from the same place counts as distribution of the source code, even though
-third parties are not compelled to copy the source along with the object code.
-
-4. You may not copy, modify, sublicense, or distribute the Program except as
-expressly provided under this License. Any attempt otherwise to copy, modify,
-sublicense or distribute the Program is void, and will automatically terminate
-your rights under this License. However, parties who have received copies, or
-rights, from you under this License will not have their licenses terminated so long
-as such parties remain in full compliance.
-
-5. You are not required to accept this License, since you have not signed it.
-However, nothing else grants you permission to modify or distribute the Program
-or its derivative works. These actions are prohibited by law if you do not accept
-this License. Therefore, by modifying or distributing the Program (or any work
-based on the Program), you indicate your acceptance of this License to do so,
-and all its terms and conditions for copying, distributing or modifying the
-Program or works based on it.
-
-6. Each time you redistribute the Program (or any work based on the Program),
-the recipient automatically receives a license from the original licensor to copy,
-distribute or modify the Program subject to these terms and conditions. You
-may not impose any further restrictions on the recipients' exercise of the rights
-granted herein. You are not responsible for enforcing compliance by third parties
-to this License.
-
-7. If, as a consequence of a court judgment or allegation of patent infringement
-or for any other reason (not limited to patent issues), conditions are imposed on
-you (whether by court order, agreement or otherwise) that contradict the
-conditions of this License, they do not excuse you from the conditions of this
-License. If you cannot distribute so as to satisfy simultaneously your obligations
-under this License and any other pertinent obligations, then as a consequence
-you may not distribute the Program at all. For example, if a patent license would
-not permit royalty-free redistribution of the Program by all those who receive
-copies directly or indirectly through you, then the only way you could satisfy
-both it and this License would be to refrain entirely from distribution of the
-Program.
-
-If any portion of this section is held invalid or unenforceable under any particular
-circumstance, the balance of the section is intended to apply and the section as
-a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any patents or other
-property right claims or to contest validity of any such claims; this section has
-the sole purpose of protecting the integrity of the free software distribution
-system, which is implemented by public license practices. Many people have
-made generous contributions to the wide range of software distributed through
-that system in reliance on consistent application of that system; it is up to the
-author/donor to decide if he or she is willing to distribute software through any
-other system and a licensee cannot impose that choice.
-
-This section is intended to make thoroughly clear what is believed to be a
-consequence of the rest of this License.
-
-8. If the distribution and/or use of the Program is restricted in certain countries
-either by patents or by copyrighted interfaces, the original copyright holder who
-places the Program under this License may add an explicit geographical
-distribution limitation excluding those countries, so that distribution is permitted
-only in or among countries not thus excluded. In such case, this License
-incorporates the limitation as if written in the body of this License.
-
-9. The Free Software Foundation may publish revised and/or new versions of the
-General Public License from time to time. Such new versions will be similar in
-spirit to the present version, but may differ in detail to address new problems or
-concerns.
-
-Each version is given a distinguishing version number. If the Program specifies a
-version number of this License which applies to it and "any later version", you
-have the option of following the terms and conditions either of that version or of
-any later version published by the Free Software Foundation. If the Program does
-not specify a version number of this License, you may choose any version ever
-published by the Free Software Foundation.
-
-10. If you wish to incorporate parts of the Program into other free programs
-whose distribution conditions are different, write to the author to ask for
-permission. For software which is copyrighted by the Free Software Foundation,
-write to the Free Software Foundation; we sometimes make exceptions for this.
-Our decision will be guided by the two goals of preserving the free status of all
-derivatives of our free software and of promoting the sharing and reuse of
-software generally.
-
-NO WARRANTY
-
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS
-NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
-COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
-"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
-IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
-ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
-YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
-CORRECTION.
-
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED
-TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY
-WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS
-PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
-ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
-(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
-OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS
-BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-END OF TERMS AND CONDITIONS
-
-
----------------------------------------------------------------------------
-
-The Artistic License
-
-Preamble
-
-The intent of this document is to state the conditions under which a Package
-may be copied, such that the Copyright Holder maintains some semblance of
-artistic control over the development of the package, while giving the users of the
-package the right to use and distribute the Package in a more-or-less customary
-fashion, plus the right to make reasonable modifications.
-
-Definitions:
-
-- "Package" refers to the collection of files distributed by the Copyright
- Holder, and derivatives of that collection of files created through textual
- modification.
-- "Standard Version" refers to such a Package if it has not been modified,
- or has been modified in accordance with the wishes of the Copyright
- Holder.
-- "Copyright Holder" is whoever is named in the copyright or copyrights for
- the package.
-- "You" is you, if you're thinking about copying or distributing this Package.
-- "Reasonable copying fee" is whatever you can justify on the basis of
- media cost, duplication charges, time of people involved, and so on. (You
- will not be required to justify it to the Copyright Holder, but only to the
- computing community at large as a market that must bear the fee.)
-- "Freely Available" means that no fee is charged for the item itself, though
- there may be fees involved in handling the item. It also means that
- recipients of the item may redistribute it under the same conditions they
- received it.
-
-1. You may make and give away verbatim copies of the source form of the
-Standard Version of this Package without restriction, provided that you duplicate
-all of the original copyright notices and associated disclaimers.
-
-2. You may apply bug fixes, portability fixes and other modifications derived from
-the Public Domain or from the Copyright Holder. A Package modified in such a
-way shall still be considered the Standard Version.
-
-3. You may otherwise modify your copy of this Package in any way, provided
-that you insert a prominent notice in each changed file stating how and when
-you changed that file, and provided that you do at least ONE of the following:
-
- a) place your modifications in the Public Domain or otherwise
- make them Freely Available, such as by posting said modifications
- to Usenet or an equivalent medium, or placing the modifications on
- a major archive site such as ftp.uu.net, or by allowing the
- Copyright Holder to include your modifications in the Standard
- Version of the Package.
-
- b) use the modified Package only within your corporation or
- organization.
-
- c) rename any non-standard executables so the names do not
- conflict with standard executables, which must also be provided,
- and provide a separate manual page for each non-standard
- executable that clearly documents how it differs from the Standard
- Version.
-
- d) make other distribution arrangements with the Copyright Holder.
-
-4. You may distribute the programs of this Package in object code or executable
-form, provided that you do at least ONE of the following:
-
- a) distribute a Standard Version of the executables and library
- files, together with instructions (in the manual page or equivalent)
- on where to get the Standard Version.
-
- b) accompany the distribution with the machine-readable source of
- the Package with your modifications.
-
- c) accompany any non-standard executables with their
- corresponding Standard Version executables, giving the
- non-standard executables non-standard names, and clearly
- documenting the differences in manual pages (or equivalent),
- together with instructions on where to get the Standard Version.
-
- d) make other distribution arrangements with the Copyright Holder.
-
-5. You may charge a reasonable copying fee for any distribution of this Package.
-You may charge any fee you choose for support of this Package. You may not
-charge a fee for this Package itself. However, you may distribute this Package in
-aggregate with other (possibly commercial) programs as part of a larger
-(possibly commercial) software distribution provided that you do not advertise
-this Package as a product of your own.
-
-6. The scripts and library files supplied as input to or produced as output from
-the programs of this Package do not automatically fall under the copyright of this
-Package, but belong to whomever generated them, and may be sold
-commercially, and may be aggregated with this Package.
-
-7. C or perl subroutines supplied by you and linked into this Package shall not
-be considered part of this Package.
-
-8. Aggregation of this Package with a commercial distribution is always permitted
-provided that the use of this Package is embedded; that is, when no overt attempt
-is made to make this Package's interfaces visible to the end user of the
-commercial distribution. Such use shall not be construed as a distribution of
-this Package.
-
-9. The name of the Copyright Holder may not be used to endorse or promote
-products derived from this software without specific prior written permission.
-
-10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
-
-The End
-
-
+++ /dev/null
-pod2text CGI::Perljax.pm > README
-
-CGI::Perljax
-
-Perljax - a perl-specific system for writing AJAX- or
-DHTML-based web applications.
-
-
-Perljax provides a unique mechanism for using perl code
-asynchronously from javascript using AJAX to access user-written
-perl functions/methods. Perljax unburdens the user from having to
-write any javascript, except for having to associate an exported
-method with a document-defined event (such as onClick, onKeyUp,
-etc). Only in the more advanced implementations of a exported perl
-method would a user need to write custom javascript. Perljax supports
-methods that return single results, or multiple results to the web
-page. No other projects that we know of are like Perljax for the
-following reasons: 1. Perljax is targeted specifically for perl
-development. 2. Perljax shields the user from having to write any
-javascript at all (unless they want to). 3. The URL for the HTTP GET
-request is automatically generated based on HTML layout and events,
-and the page is then dynamically updated. 4. Perljax is not part
-of a Content Management System, or some other larger project.
-
-
-INSTALL
-
-perl Makefile.PL
-make
-make test
-make install
-
-*If you are on a windows box you should use 'nmake' rather than 'make'.
-
-Installation will place Perljax into the system perl @INC path, but it
-is important that you make sure mod_perl uses this path (which is
-mod_perl's default behavior, and also assuming you use mod_perl, and
-not just run perl as a CGI).
-
-Example scripts are provided in the source script directory, and can
-also be seen on the project's website, http://www.perljax.us.
--- /dev/null
+Order Allow,Deny
+Deny from all
package AM;
use Data::Dumper;
+use SL::DBUtils;
sub get_account {
$main::lxdebug->enter_sub();
my ($self, $myconfig, $form) = @_;
- $form->{id} = "NULL" unless ($form->{id});
-
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query = qq§SELECT c.accno, c.description, c.charttype, c.gifi_accno,
- c.category,c.link, tk.taxkey_id, tk.pos_ustva, tk.tax_id,tk.tax_id||'--'||tk.taxkey_id AS tax, tk.startdate, c.pos_bilanz, c.pos_eur, c.new_chart_id, c.valid_from, c.pos_bwa
- FROM chart c LEFT JOIN taxkeys tk
- ON (c.id=tk.chart_id AND tk.id = (SELECT id from taxkeys where taxkeys.chart_id =c.id AND startdate<=current_date ORDER BY startdate desc LIMIT 1))
- WHERE c.id = $form->{id}§;
-
-
+ my $query = qq{
+ SELECT c.accno, c.description, c.charttype, c.category,
+ c.link, c.pos_bilanz, c.pos_eur, c.new_chart_id, c.valid_from,
+ c.pos_bwa, datevautomatik,
+ tk.taxkey_id, tk.pos_ustva, tk.tax_id,
+ tk.tax_id || '--' || tk.taxkey_id AS tax, tk.startdate
+ FROM chart c
+ LEFT JOIN taxkeys tk
+ ON (c.id=tk.chart_id AND tk.id =
+ (SELECT id FROM taxkeys
+ WHERE taxkeys.chart_id = c.id AND startdate <= current_date
+ ORDER BY startdate DESC LIMIT 1))
+ WHERE c.id = ?
+ };
+
+
+ $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query");
my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
my $ref = $sth->fetchrow_hashref(NAME_lc);
# get default accounts
$query = qq|SELECT inventory_accno_id, income_accno_id, expense_accno_id
FROM defaults|;
+ $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query");
$sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
$sth->finish;
+
+
# get taxkeys and description
- $query = qq§SELECT id, taxkey,id||'--'||taxkey AS tax, taxdescription
- FROM tax ORDER BY taxkey§;
+ $query = qq{
+ SELECT
+ id,
+ (SELECT accno FROM chart WHERE id=tax.chart_id) AS chart_accno,
+ taxkey,
+ id||'--'||taxkey AS tax,
+ taxdescription,
+ rate
+ FROM tax ORDER BY taxkey
+ };
+ $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query");
$sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
-
+
$form->{TAXKEY} = [];
-
+
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
push @{ $form->{TAXKEY} }, $ref;
}
$sth->finish;
if ($form->{id}) {
-
- $where = " WHERE link='$form->{link}'";
-
-
# get new accounts
$query = qq|SELECT id, accno,description
- FROM chart $where|;
+ FROM chart
+ WHERE link = ?
+ ORDER BY accno|;
+ $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query");
$sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
+ $sth->execute($form->{link}) || $form->dberror($query . " ($form->{link})");
+
+ $form->{NEWACCOUNT} = [];
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
push @{ $form->{NEWACCOUNT} }, $ref;
}
-
+
+ $sth->finish;
+
+ # get the taxkeys of account
+
+ $query = qq{
+ SELECT
+ tk.id,
+ tk.chart_id,
+ c.accno,
+ tk.tax_id,
+ t.taxdescription,
+ t.rate,
+ tk.taxkey_id,
+ tk.pos_ustva,
+ tk.startdate
+ FROM taxkeys tk
+ LEFT JOIN tax t ON (t.id = tk.tax_id)
+ LEFT JOIN chart c ON (c.id = t.chart_id)
+
+ WHERE tk.chart_id = ?
+ ORDER BY startdate DESC
+ };
+ $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query");
+ $sth = $dbh->prepare($query);
+
+ $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
+
+ $form->{ACCOUNT_TAXKEYS} = [];
+
+ while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
+ push @{ $form->{ACCOUNT_TAXKEYS} }, $ref;
+ }
+
$sth->finish;
+
}
# check if we have any transactions
$query = qq|SELECT a.trans_id FROM acc_trans a
- WHERE a.chart_id = $form->{id}|;
+ WHERE a.chart_id = ?|;
+ $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query");
$sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
($form->{orphaned}) = $sth->fetchrow_array;
$form->{orphaned} = !$form->{orphaned};
$form->{new_chart_valid} = 0;
if ($form->{new_chart_id}) {
$query = qq|SELECT current_date-valid_from FROM chart
- WHERE id = $form->{id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my ($count) = $sth->fetchrow_array;
+ WHERE id = ?|;
+ $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query");
+ my ($count) = selectrow_query($form, $dbh, $query, $form->{id});
if ($count >=0) {
$form->{new_chart_valid} = 1;
}
}
chop $form->{link};
- # if we have an id then replace the old record
- $form->{description} =~ s/\'/\'\'/g;
-
# strip blanks from accno
map { $form->{$_} =~ s/ //g; } qw(accno);
$form->{id} = "";
}
- map({ $form->{$_} = "NULL" unless ($form->{$_}); }
- qw(pos_ustva pos_bwa pos_bilanz pos_eur new_chart_id));
- my($tax_id, $taxkey) = split /--/, $form->{tax};
- $form->{valid_from} = ($form->{valid_from}) ? "'$form->{valid_from}'" : "NULL";
- my $startdate = ($form->{startdate}) ? "'$form->{startdate}'" : "'1970-01-01'";
- if ($form->{id} && $form->{orphaned}) {
- $query = qq|UPDATE chart SET
- accno = '$form->{accno}',
- description = '$form->{description}',
- charttype = '$form->{charttype}',
- gifi_accno = '$form->{gifi_accno}',
- category = '$form->{category}',
- link = '$form->{link}',
- taxkey_id = $taxkey,
- pos_ustva = $form->{pos_ustva},
- pos_bwa = $form->{pos_bwa},
- pos_bilanz = $form->{pos_bilanz},
- pos_eur = $form->{pos_eur},
- new_chart_id = $form->{new_chart_id},
- valid_from = $form->{valid_from}
- WHERE id = $form->{id}|;
- } elsif ($form->{id} && !$form->{new_chart_valid}) {
- $query = qq|UPDATE chart SET
- new_chart_id = $form->{new_chart_id},
- valid_from = $form->{valid_from}
- WHERE id = $form->{id}|;
- } else {
-
- $query = qq|INSERT INTO chart
- (accno, description, charttype, gifi_accno, category, link, taxkey_id, pos_ustva, pos_bwa, pos_bilanz,pos_eur, new_chart_id, valid_from)
- VALUES ('$form->{accno}', '$form->{description}',
- '$form->{charttype}', '$form->{gifi_accno}',
- '$form->{category}', '$form->{link}', $taxkey, $form->{pos_ustva}, $form->{pos_bwa}, $form->{pos_bilanz}, $form->{pos_eur}, $form->{new_chart_id}, $form->{valid_from})|;
- }
- $dbh->do($query) || $form->dberror($query);
-
- #Save Taxes
- if (!$form->{id}) {
- $query = qq|INSERT INTO taxkeys (chart_id,tax_id,taxkey_id, pos_ustva, startdate) VALUES ((SELECT id FROM chart where accno='$form->{accno}'), $tax_id, $taxkey,$form->{pos_ustva}, $startdate)|;
- $dbh->do($query) || $form->dberror($query);
- } else {
- $query = qq|DELETE FROM taxkeys WHERE chart_id=$form->{id} AND tax_id=$tax_id|;
- $dbh->do($query) || $form->dberror($query);
- $query = qq|INSERT INTO taxkeys (chart_id,tax_id,taxkey_id, pos_ustva, startdate) VALUES ($form->{id}, $tax_id, $taxkey,$form->{pos_ustva}, $startdate)|;
- $dbh->do($query) || $form->dberror($query);
- }
-
-# if ($form->{IC_taxpart} || $form->{IC_taxservice} || $form->{CT_tax}) {
-#
-# my $chart_id = $form->{id};
-#
-# unless ($form->{id}) {
-#
-# # get id from chart
-# $query = qq|SELECT c.id
-# FROM chart c
-# WHERE c.accno = '$form->{accno}'|;
-# $sth = $dbh->prepare($query);
-# $sth->execute || $form->dberror($query);
-#
-# ($chart_id) = $sth->fetchrow_array;
-# $sth->finish;
-# }
-#
-# # add account if it doesn't exist in tax
-# $query = qq|SELECT t.chart_id
-# FROM tax t
-# WHERE t.chart_id = $chart_id|;
-# $sth = $dbh->prepare($query);
-# $sth->execute || $form->dberror($query);
-#
-# my ($tax_id) = $sth->fetchrow_array;
-# $sth->finish;
-#
-# # add tax if it doesn't exist
-# unless ($tax_id) {
-# $query = qq|INSERT INTO tax (chart_id, rate)
-# VALUES ($chart_id, 0)|;
-# $dbh->do($query) || $form->dberror($query);
-# }
-# } else {
-#
-# # remove tax
-# if ($form->{id}) {
-# $query = qq|DELETE FROM tax
-# WHERE chart_id = $form->{id}|;
-# $dbh->do($query) || $form->dberror($query);
-# }
-# }
-
- # commit
- my $rc = $dbh->commit;
- $dbh->disconnect;
-
- $main::lxdebug->leave_sub();
-
- return $rc;
-}
-
-sub delete_account {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- # connect to database, turn off AutoCommit
- my $dbh = $form->dbconnect_noauto($myconfig);
+ my @values;
- my $query = qq|SELECT count(*) FROM acc_trans a
- WHERE a.chart_id = $form->{id}|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ if ($form->{id}) {
+ $query = qq|UPDATE chart SET
+ accno = ?,
+ description = ?,
+ charttype = ?,
+ category = ?,
+ link = ?,
+ pos_bwa = ?,
+ pos_bilanz = ?,
+ pos_eur = ?,
+ new_chart_id = ?,
+ valid_from = ?,
+ datevautomatik = ?
+ WHERE id = ?|;
+
+ @values = (
+ $form->{accno},
+ $form->{description},
+ $form->{charttype},
+ $form->{category},
+ $form->{link},
+ conv_i($form->{pos_bwa}),
+ conv_i($form->{pos_bilanz}),
+ conv_i($form->{pos_eur}),
+ conv_i($form->{new_chart_id}),
+ conv_date($form->{valid_from}),
+ ($form->{datevautomatik} eq 'T') ? 'true':'false',
+ $form->{id},
+ );
- if ($sth->fetchrow_array) {
- $sth->finish;
- $dbh->disconnect;
- $main::lxdebug->leave_sub();
- return;
}
- $sth->finish;
-
- # delete chart of account record
- $query = qq|DELETE FROM chart
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
-
- # set inventory_accno_id, income_accno_id, expense_accno_id to defaults
- $query = qq|UPDATE parts
- SET inventory_accno_id =
- (SELECT inventory_accno_id FROM defaults)
- WHERE inventory_accno_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
-
- $query = qq|UPDATE parts
- SET income_accno_id =
- (SELECT income_accno_id FROM defaults)
- WHERE income_accno_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ elsif ($form->{id} && !$form->{new_chart_valid}) {
- $query = qq|UPDATE parts
- SET expense_accno_id =
- (SELECT expense_accno_id FROM defaults)
- WHERE expense_accno_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|
+ UPDATE chart
+ SET new_chart_id = ?,
+ valid_from = ?
+ WHERE id = ?
+ |;
- foreach my $table (qw(partstax customertax vendortax tax)) {
- $query = qq|DELETE FROM $table
- WHERE chart_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ @values = (
+ conv_i($form->{new_chart_id}),
+ conv_date($form->{valid_from}),
+ $form->{id}
+ );
}
+ else {
- # commit and redirect
- my $rc = $dbh->commit;
- $dbh->disconnect;
-
- $main::lxdebug->leave_sub();
-
- return $rc;
-}
-
-sub gifi_accounts {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
-
- my $query = qq|SELECT accno, description
- FROM gifi
- ORDER BY accno|;
+ $query = qq|
+ INSERT INTO chart (
+ accno,
+ description,
+ charttype,
+ category,
+ link,
+ pos_bwa,
+ pos_bilanz,
+ pos_eur,
+ new_chart_id,
+ valid_from,
+ datevautomatik )
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+ |;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ @values = (
+ $form->{accno},
+ $form->{description},
+ $form->{charttype},
+ $form->{category}, $form->{link},
+ conv_i($form->{pos_bwa}),
+ conv_i($form->{pos_bilanz}), conv_i($form->{pos_eur}),
+ conv_i($form->{new_chart_id}),
+ conv_date($form->{valid_from}),
+ ($form->{datevautomatik} eq 'T') ? 'true':'false',
+ );
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{ALL} }, $ref;
}
- $sth->finish;
- $dbh->disconnect;
-
- $main::lxdebug->leave_sub();
-}
-
-sub get_gifi {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
-
- my $query = qq|SELECT g.accno, g.description
- FROM gifi g
- WHERE g.accno = '$form->{accno}'|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my $ref = $sth->fetchrow_hashref(NAME_lc);
-
- map { $form->{$_} = $ref->{$_} } keys %$ref;
+ do_query($form, $dbh, $query, @values);
- $sth->finish;
+ #Save Taxkeys
- # check for transactions
- $query = qq|SELECT count(*) FROM acc_trans a, chart c, gifi g
- WHERE c.gifi_accno = g.accno
- AND a.chart_id = c.id
- AND g.accno = '$form->{accno}'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my @taxkeys = ();
- ($form->{orphaned}) = $sth->fetchrow_array;
- $sth->finish;
- $form->{orphaned} = !$form->{orphaned};
+ my $MAX_TRIES = 10; # Maximum count of taxkeys in form
+ my $tk_count;
- $dbh->disconnect;
+ READTAXKEYS:
+ for $tk_count (0 .. $MAX_TRIES) {
- $main::lxdebug->leave_sub();
-}
+ # Loop control
-sub save_gifi {
- $main::lxdebug->enter_sub();
+ # Check if the account already exists, else cancel
+ last READTAXKEYS if ( $form->{'id'} == 0);
- my ($self, $myconfig, $form) = @_;
+ # check if there is a startdate
+ if ( $form->{"taxkey_startdate_$tk_count"} eq '' ) {
+ $tk_count++;
+ next READTAXKEYS;
+ }
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
+ # check if there is at least one relation to pos_ustva or tax_id
+ if ( $form->{"taxkey_pos_ustva_$tk_count"} eq '' && $form->{"taxkey_tax_$tk_count"} == 0 ) {
+ $tk_count++;
+ next READTAXKEYS;
+ }
- $form->{description} =~ s/\'/\'\'/g;
+ # Add valid taxkeys into the array
+ push @taxkeys ,
+ {
+ id => ($form->{"taxkey_id_$tk_count"} eq 'NEW') ? conv_i('') : conv_i($form->{"taxkey_id_$tk_count"}),
+ tax_id => conv_i($form->{"taxkey_tax_$tk_count"}),
+ startdate => conv_date($form->{"taxkey_startdate_$tk_count"}),
+ chart_id => conv_i($form->{"id"}),
+ pos_ustva => conv_i($form->{"taxkey_pos_ustva_$tk_count"}),
+ delete => ( $form->{"taxkey_del_$tk_count"} eq 'delete' ) ? '1' : '',
+ };
- # id is the old account number!
- if ($form->{id}) {
- $query = qq|UPDATE gifi SET
- accno = '$form->{accno}',
- description = '$form->{description}'
- WHERE accno = '$form->{id}'|;
- } else {
- $query = qq|INSERT INTO gifi
- (accno, description)
- VALUES ('$form->{accno}', '$form->{description}')|;
+ $tk_count++;
}
- $dbh->do($query) || $form->dberror($query);
-
- $dbh->disconnect;
-
- $main::lxdebug->leave_sub();
-}
-
-sub delete_gifi {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
-
- # id is the old account number!
- $query = qq|DELETE FROM gifi
- WHERE accno = '$form->{id}'|;
- $dbh->do($query) || $form->dberror($query);
-
- $dbh->disconnect;
- $main::lxdebug->leave_sub();
-}
+ TAXKEY:
+ for my $j (0 .. $#taxkeys){
+ if ( defined $taxkeys[$j]{'id'} ){
+ # delete Taxkey?
-sub warehouses {
- $main::lxdebug->enter_sub();
+ if ($taxkeys[$j]{'delete'}){
+ $query = qq{
+ DELETE FROM taxkeys WHERE id = ?
+ };
- my ($self, $myconfig, $form) = @_;
+ @values = ($taxkeys[$j]{'id'});
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
+ do_query($form, $dbh, $query, @values);
- my $query = qq|SELECT id, description
- FROM warehouse
- ORDER BY 2|;
+ next TAXKEY;
+ }
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ # UPDATE Taxkey
+
+ $query = qq{
+ UPDATE taxkeys
+ SET taxkey_id = (SELECT taxkey FROM tax WHERE tax.id = ?),
+ chart_id = ?,
+ tax_id = ?,
+ pos_ustva = ?,
+ startdate = ?
+ WHERE id = ?
+ };
+ @values = (
+ $taxkeys[$j]{'tax_id'},
+ $taxkeys[$j]{'chart_id'},
+ $taxkeys[$j]{'tax_id'},
+ $taxkeys[$j]{'pos_ustva'},
+ $taxkeys[$j]{'startdate'},
+ $taxkeys[$j]{'id'},
+ );
+ do_query($form, $dbh, $query, @values);
+ }
+ else {
+ # INSERT Taxkey
+
+ $query = qq{
+ INSERT INTO taxkeys (
+ taxkey_id,
+ chart_id,
+ tax_id,
+ pos_ustva,
+ startdate
+ )
+ VALUES ((SELECT taxkey FROM tax WHERE tax.id = ?), ?, ?, ?, ?)
+ };
+ @values = (
+ $taxkeys[$j]{'tax_id'},
+ $taxkeys[$j]{'chart_id'},
+ $taxkeys[$j]{'tax_id'},
+ $taxkeys[$j]{'pos_ustva'},
+ $taxkeys[$j]{'startdate'},
+ );
+
+ do_query($form, $dbh, $query, @values);
+ }
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{ALL} }, $ref;
}
- $sth->finish;
+ # commit
+ my $rc = $dbh->commit;
$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();
+ return $rc;
}
-sub save_warehouse {
+sub delete_account {
$main::lxdebug->enter_sub();
my ($self, $myconfig, $form) = @_;
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
+ # connect to database, turn off AutoCommit
+ my $dbh = $form->dbconnect_noauto($myconfig);
- $form->{description} =~ s/\'/\'\'/g;
+ my $query = qq|SELECT count(*) FROM acc_trans a
+ WHERE a.chart_id = ?|;
+ my ($count) = selectrow_query($form, $dbh, $query, $form->{id});
- 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}')|;
+ if ($count) {
+ $dbh->disconnect;
+ $main::lxdebug->leave_sub();
+ return;
}
- $dbh->do($query) || $form->dberror($query);
-
- $dbh->disconnect;
-
- $main::lxdebug->leave_sub();
-}
-sub delete_warehouse {
- $main::lxdebug->enter_sub();
+ # set inventory_accno_id, income_accno_id, expense_accno_id to defaults
+ foreach my $type (qw(inventory income expense)) {
+ $query =
+ qq|UPDATE parts | .
+ qq|SET ${type}_accno_id = (SELECT ${type}_accno_id FROM defaults) | .
+ qq|WHERE ${type}_accno_id = ?|;
+ do_query($form, $dbh, $query, $form->{id});
+ }
- my ($self, $myconfig, $form) = @_;
+ foreach my $table (qw(partstax customertax vendortax tax)) {
+ $query = qq|DELETE FROM $table
+ WHERE chart_id = ?|;
+ do_query($form, $dbh, $query, $form->{id});
+ }
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
+ # delete chart of account record
+ $query = qq|DELETE FROM chart
+ WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{id});
- $query = qq|DELETE FROM warehouse
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ # delete account taxkeys
+ $query = qq|DELETE FROM taxkeys
+ WHERE chart_id = ?|;
+ do_query($form, $dbh, $query, $form->{id});
+ # commit and redirect
+ my $rc = $dbh->commit;
$dbh->disconnect;
$main::lxdebug->leave_sub();
+
+ return $rc;
}
sub departments {
my $query = qq|SELECT d.id, d.description, d.role
FROM department d
- ORDER BY 2|;
+ ORDER BY 2|;
$sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
+ $form->{ALL} = [];
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
push @{ $form->{ALL} }, $ref;
}
my $query = qq|SELECT d.description, d.role
FROM department d
- WHERE d.id = $form->{id}|;
+ WHERE d.id = ?|;
my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
my $ref = $sth->fetchrow_hashref(NAME_lc);
# see if it is in use
$query = qq|SELECT count(*) FROM dpt_trans d
- WHERE d.department_id = $form->{id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ WHERE d.department_id = ?|;
+ ($form->{orphaned}) = selectrow_query($form, $dbh, $query, $form->{id});
- ($form->{orphaned}) = $sth->fetchrow_array;
$form->{orphaned} = !$form->{orphaned};
$sth->finish;
# connect to database
my $dbh = $form->dbconnect($myconfig);
- $form->{description} =~ s/\'/\'\'/g;
-
+ my @values = ($form->{description}, $form->{role});
if ($form->{id}) {
$query = qq|UPDATE department SET
- description = '$form->{description}',
- role = '$form->{role}'
- WHERE id = $form->{id}|;
+ description = ?, role = ?
+ WHERE id = ?|;
+ push(@values, $form->{id});
} else {
$query = qq|INSERT INTO department
(description, role)
- VALUES ('$form->{description}', '$form->{role}')|;
+ VALUES (?, ?)|;
}
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, $query, @values);
$dbh->disconnect;
my $dbh = $form->dbconnect($myconfig);
$query = qq|DELETE FROM department
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{id});
$dbh->disconnect;
my $query = qq|SELECT id, lead
FROM leads
- ORDER BY 2|;
+ ORDER BY 2|;
$sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
+ $form->{ALL};
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
push @{ $form->{ALL} }, $ref;
}
my $dbh = $form->dbconnect($myconfig);
my $query =
- qq|SELECT l.id, l.lead
- FROM leads l
- WHERE l.id = $form->{id}|;
+ qq|SELECT l.id, l.lead | .
+ qq|FROM leads l | .
+ qq|WHERE l.id = ?|;
my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
my $ref = $sth->fetchrow_hashref(NAME_lc);
# connect to database
my $dbh = $form->dbconnect($myconfig);
- $form->{lead} =~ s/\'/\'\'/g;
-
+ my @values = ($form->{description});
# id is the old record
if ($form->{id}) {
$query = qq|UPDATE leads SET
- lead = '$form->{description}'
- WHERE id = $form->{id}|;
+ lead = ?
+ WHERE id = ?|;
+ puhs(@values, $form->{id});
} else {
$query = qq|INSERT INTO leads
(lead)
- VALUES ('$form->{description}')|;
+ VALUES (?)|;
}
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, $query, @values);
$dbh->disconnect;
my $dbh = $form->dbconnect($myconfig);
$query = qq|DELETE FROM leads
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{id});
$dbh->disconnect;
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT id, description, discount, customernumberinit, salesman
+ my $query = qq|SELECT id, description, discount, customernumberinit
FROM business
- ORDER BY 2|;
+ ORDER BY 2|;
$sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
+ $form->{ALL};
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
push @{ $form->{ALL} }, $ref;
}
my $dbh = $form->dbconnect($myconfig);
my $query =
- qq|SELECT b.description, b.discount, b.customernumberinit, b.salesman
- FROM business b
- WHERE b.id = $form->{id}|;
+ qq|SELECT b.description, b.discount, b.customernumberinit
+ FROM business b
+ WHERE b.id = ?|;
my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
my $ref = $sth->fetchrow_hashref(NAME_lc);
# connect to database
my $dbh = $form->dbconnect($myconfig);
- $form->{description} =~ s/\'/\'\'/g;
- $form->{discount} /= 100;
- $form->{salesman} *= 1;
-
+ my @values = ($form->{description}, $form->{discount},
+ $form->{customernumberinit});
# id is the old record
if ($form->{id}) {
$query = qq|UPDATE business SET
- description = '$form->{description}',
- discount = $form->{discount},
- customernumberinit = '$form->{customernumberinit}',
- salesman = '$form->{salesman}'
- WHERE id = $form->{id}|;
+ description = ?,
+ discount = ?,
+ customernumberinit = ?
+ WHERE id = ?|;
+ push(@values, $form->{id});
} else {
$query = qq|INSERT INTO business
- (description, discount, customernumberinit, salesman)
- VALUES ('$form->{description}', $form->{discount}, '$form->{customernumberinit}', '$form->{salesman}')|;
+ (description, discount, customernumberinit)
+ VALUES (?, ?, ?)|;
}
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, $query, @values);
$dbh->disconnect;
my $dbh = $form->dbconnect($myconfig);
$query = qq|DELETE FROM business
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{id});
$dbh->disconnect;
"SELECT template_code, " .
" output_numberformat, output_dateformat, output_longdates " .
"FROM language WHERE id = ?";
- my @res = $dbh->selectrow_array($query, undef, $id);
+ my @res = selectrow_query($form, $dbh, $query, $id);
$dbh->disconnect;
$main::lxdebug->leave_sub();
" output_numberformat, output_dateformat, output_longdates" .
") VALUES (?, ?, ?, ?, ?, ?)";
}
- $dbh->do($query, undef, @values) ||
- $form->dberror($query . " (" . join(", ", @values) . ")");
+ do_query($form, $dbh, $query, @values);
$dbh->disconnect;
# connect to database
my $dbh = $form->dbconnect_noauto($myconfig);
- my $query = "DELETE FROM units_language WHERE language_id = ?";
- $dbh->do($query, undef, $form->{"id"}) ||
- $form->dberror($query . " ($form->{id})");
+ foreach my $table (qw(translation_payment_terms units_language)) {
+ my $query = qq|DELETE FROM $table WHERE language_id = ?|;
+ do_query($form, $dbh, $query, $form->{"id"});
+ }
$query = "DELETE FROM language WHERE id = ?";
- $dbh->do($query, undef, $form->{"id"}) ||
- $form->dberror($query . " ($form->{id})");
+ do_query($form, $dbh, $query, $form->{"id"});
$dbh->commit();
$dbh->disconnect;
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT id, description, inventory_accno_id, (select accno from chart where id=inventory_accno_id) as inventory_accno, income_accno_id_0, (select accno from chart where id=income_accno_id_0) as income_accno_0, expense_accno_id_0, (select accno from chart where id=expense_accno_id_0) as expense_accno_0, income_accno_id_1, (select accno from chart where id=income_accno_id_1) as income_accno_1, expense_accno_id_1, (select accno from chart where id=expense_accno_id_1) as expense_accno_1, income_accno_id_2, (select accno from chart where id=income_accno_id_2) as income_accno_2, expense_accno_id_2, (select accno from chart where id=expense_accno_id_2) as expense_accno_2, income_accno_id_3, (select accno from chart where id=income_accno_id_3) as income_accno_3, expense_accno_id_3, (select accno from chart where id=expense_accno_id_3) as expense_accno_3
- FROM buchungsgruppen
- ORDER BY id|;
+ my $query = qq|SELECT id, description,
+ inventory_accno_id,
+ (SELECT accno FROM chart WHERE id = inventory_accno_id) AS inventory_accno,
+ income_accno_id_0,
+ (SELECT accno FROM chart WHERE id = income_accno_id_0) AS income_accno_0,
+ expense_accno_id_0,
+ (SELECT accno FROM chart WHERE id = expense_accno_id_0) AS expense_accno_0,
+ income_accno_id_1,
+ (SELECT accno FROM chart WHERE id = income_accno_id_1) AS income_accno_1,
+ expense_accno_id_1,
+ (SELECT accno FROM chart WHERE id = expense_accno_id_1) AS expense_accno_1,
+ income_accno_id_2,
+ (SELECT accno FROM chart WHERE id = income_accno_id_2) AS income_accno_2,
+ expense_accno_id_2,
+ (select accno FROM chart WHERE id = expense_accno_id_2) AS expense_accno_2,
+ income_accno_id_3,
+ (SELECT accno FROM chart WHERE id = income_accno_id_3) AS income_accno_3,
+ expense_accno_id_3,
+ (SELECT accno FROM chart WHERE id = expense_accno_id_3) AS expense_accno_3
+ FROM buchungsgruppen
+ ORDER BY sortkey|;
$sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
+ $form->{ALL} = [];
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
push @{ $form->{ALL} }, $ref;
}
if ($form->{id}) {
my $query =
- qq|SELECT description, inventory_accno_id, (select accno from chart where id=inventory_accno_id) as inventory_accno, income_accno_id_0, (select accno from chart where id=income_accno_id_0) as income_accno_0, expense_accno_id_0, (select accno from chart where id=expense_accno_id_0) as expense_accno_0, income_accno_id_1, (select accno from chart where id=income_accno_id_1) as income_accno_1, expense_accno_id_1, (select accno from chart where id=expense_accno_id_1) as expense_accno_1, income_accno_id_2, (select accno from chart where id=income_accno_id_2) as income_accno_2, expense_accno_id_2, (select accno from chart where id=expense_accno_id_2) as expense_accno_2, income_accno_id_3, (select accno from chart where id=income_accno_id_3) as income_accno_3, expense_accno_id_3, (select accno from chart where id=expense_accno_id_3) as expense_accno_3
- FROM buchungsgruppen
- WHERE id = $form->{id}|;
+ qq|SELECT description, inventory_accno_id,
+ (SELECT accno FROM chart WHERE id = inventory_accno_id) AS inventory_accno,
+ income_accno_id_0,
+ (SELECT accno FROM chart WHERE id = income_accno_id_0) AS income_accno_0,
+ expense_accno_id_0,
+ (SELECT accno FROM chart WHERE id = expense_accno_id_0) AS expense_accno_0,
+ income_accno_id_1,
+ (SELECT accno FROM chart WHERE id = income_accno_id_1) AS income_accno_1,
+ expense_accno_id_1,
+ (SELECT accno FROM chart WHERE id = expense_accno_id_1) AS expense_accno_1,
+ income_accno_id_2,
+ (SELECT accno FROM chart WHERE id = income_accno_id_2) AS income_accno_2,
+ expense_accno_id_2,
+ (select accno FROM chart WHERE id = expense_accno_id_2) AS expense_accno_2,
+ income_accno_id_3,
+ (SELECT accno FROM chart WHERE id = income_accno_id_3) AS income_accno_3,
+ expense_accno_id_3,
+ (SELECT accno FROM chart WHERE id = expense_accno_id_3) AS expense_accno_3
+ FROM buchungsgruppen
+ WHERE id = ?|;
my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
+ $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
+
my $ref = $sth->fetchrow_hashref(NAME_lc);
-
+
map { $form->{$_} = $ref->{$_} } keys %$ref;
-
- $sth->finish;
-
- my $query =
- qq|SELECT count(id) as anzahl
- FROM parts
- WHERE buchungsgruppen_id = $form->{id}|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my $ref = $sth->fetchrow_hashref(NAME_lc);
- if (!$ref->{anzahl}) {
- $form->{orphaned} = 1;
- }
+
$sth->finish;
+ my $query =
+ qq|SELECT count(id) = 0 AS orphaned
+ FROM parts
+ WHERE buchungsgruppen_id = ?|;
+ ($form->{orphaned}) = selectrow_query($form, $dbh, $query, $form->{id});
}
$query = "SELECT inventory_accno_id, income_accno_id, expense_accno_id ".
"FROM defaults";
($form->{"std_inventory_accno_id"}, $form->{"std_income_accno_id"},
- $form->{"std_expense_accno_id"}) = $dbh->selectrow_array($query);
+ $form->{"std_expense_accno_id"}) = selectrow_query($form, $dbh, $query);
my $module = "IC";
$query = qq|SELECT c.accno, c.description, c.link, c.id,
# connect to database
my $dbh = $form->dbconnect($myconfig);
- $form->{description} =~ s/\'/\'\'/g;
+ my @values = ($form->{description}, $form->{inventory_accno_id},
+ $form->{income_accno_id_0}, $form->{expense_accno_id_0},
+ $form->{income_accno_id_1}, $form->{expense_accno_id_1},
+ $form->{income_accno_id_2}, $form->{expense_accno_id_2},
+ $form->{income_accno_id_3}, $form->{expense_accno_id_3});
+ my $query;
# id is the old record
if ($form->{id}) {
$query = qq|UPDATE buchungsgruppen SET
- description = '$form->{description}',
- inventory_accno_id = '$form->{inventory_accno_id}',
- income_accno_id_0 = '$form->{income_accno_id_0}',
- expense_accno_id_0 = '$form->{expense_accno_id_0}',
- income_accno_id_1 = '$form->{income_accno_id_1}',
- expense_accno_id_1 = '$form->{expense_accno_id_1}',
- income_accno_id_2 = '$form->{income_accno_id_2}',
- expense_accno_id_2 = '$form->{expense_accno_id_2}',
- income_accno_id_3 = '$form->{income_accno_id_3}',
- expense_accno_id_3 = '$form->{expense_accno_id_3}'
- WHERE id = $form->{id}|;
+ description = ?, inventory_accno_id = ?,
+ income_accno_id_0 = ?, expense_accno_id_0 = ?,
+ income_accno_id_1 = ?, expense_accno_id_1 = ?,
+ income_accno_id_2 = ?, expense_accno_id_2 = ?,
+ income_accno_id_3 = ?, expense_accno_id_3 = ?
+ WHERE id = ?|;
+ push(@values, $form->{id});
} else {
+ $query = qq|SELECT COALESCE(MAX(sortkey) + 1, 1) FROM buchungsgruppen|;
+ my ($sortkey) = $dbh->selectrow_array($query);
+ $form->dberror($query) if ($dbh->err);
+ push(@values, $sortkey);
$query = qq|INSERT INTO buchungsgruppen
- (description, inventory_accno_id, income_accno_id_0, expense_accno_id_0, income_accno_id_1, expense_accno_id_1, income_accno_id_2, expense_accno_id_2, income_accno_id_3, expense_accno_id_3)
- VALUES ('$form->{description}', '$form->{inventory_accno_id}', '$form->{income_accno_id_0}', '$form->{expense_accno_id_0}', '$form->{income_accno_id_1}', '$form->{expense_accno_id_1}', '$form->{income_accno_id_2}', '$form->{expense_accno_id_2}', '$form->{income_accno_id_3}', '$form->{expense_accno_id_3}')|;
+ (description, inventory_accno_id,
+ income_accno_id_0, expense_accno_id_0,
+ income_accno_id_1, expense_accno_id_1,
+ income_accno_id_2, expense_accno_id_2,
+ income_accno_id_3, expense_accno_id_3,
+ sortkey)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
}
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, $query, @values);
$dbh->disconnect;
# connect to database
my $dbh = $form->dbconnect($myconfig);
- $query = qq|DELETE FROM buchungsgruppen
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|DELETE FROM buchungsgruppen WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{id});
$dbh->disconnect;
$main::lxdebug->leave_sub();
}
+sub swap_sortkeys {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form, $table) = @_;
+
+ # connect to database
+ my $dbh = $form->dbconnect_noauto($myconfig);
+
+ my $query =
+ qq|SELECT
+ (SELECT sortkey FROM $table WHERE id = ?) AS sortkey1,
+ (SELECT sortkey FROM $table WHERE id = ?) AS sortkey2|;
+ my @values = ($form->{"id1"}, $form->{"id2"});
+ my @sortkeys = selectrow_query($form, $dbh, $query, @values);
+ $main::lxdebug->dump(0, "v", \@values);
+ $main::lxdebug->dump(0, "s", \@sortkeys);
+
+ $query = qq|UPDATE $table SET sortkey = ? WHERE id = ?|;
+ my $sth = $dbh->prepare($query);
+ $sth->execute($sortkeys[1], $form->{"id1"}) ||
+ $form->dberror($query . " ($sortkeys[1], $form->{id1})");
+ $sth->execute($sortkeys[0], $form->{"id2"}) ||
+ $form->dberror($query . " ($sortkeys[0], $form->{id2})");
+ $sth->finish();
+
+ $dbh->commit();
+ $dbh->disconnect;
+
+ $main::lxdebug->leave_sub();
+}
+
sub printer {
$main::lxdebug->enter_sub();
my $query = qq|SELECT id, printer_description, template_code, printer_command
FROM printers
- ORDER BY 2|;
+ ORDER BY 2|;
$sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
+ $form->{"ALL"} = [];
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
push @{ $form->{ALL} }, $ref;
}
my $query =
qq|SELECT p.printer_description, p.template_code, p.printer_command
- FROM printers p
- WHERE p.id = $form->{id}|;
+ FROM printers p
+ WHERE p.id = ?|;
my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
my $ref = $sth->fetchrow_hashref(NAME_lc);
# connect to database
my $dbh = $form->dbconnect($myconfig);
- $form->{printer_description} =~ s/\'/\'\'/g;
- $form->{printer_command} =~ s/\'/\'\'/g;
- $form->{template_code} =~ s/\'/\'\'/g;
-
+ my @values = ($form->{printer_description},
+ $form->{template_code},
+ $form->{printer_command});
# id is the old record
if ($form->{id}) {
$query = qq|UPDATE printers SET
- printer_description = '$form->{printer_description}',
- template_code = '$form->{template_code}',
- printer_command = '$form->{printer_command}'
- WHERE id = $form->{id}|;
+ printer_description = ?, template_code = ?, printer_command = ?
+ WHERE id = ?|;
+ push(@values, $form->{id});
} else {
$query = qq|INSERT INTO printers
(printer_description, template_code, printer_command)
- VALUES ('$form->{printer_description}', '$form->{template_code}', '$form->{printer_command}')|;
+ VALUES (?, ?, ?)|;
}
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, $query, @values);
$dbh->disconnect;
my $dbh = $form->dbconnect($myconfig);
$query = qq|DELETE FROM printers
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{id});
$dbh->disconnect;
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT *
- FROM payment_terms
- ORDER BY id|;
+ my $query = qq|SELECT * FROM payment_terms ORDER BY sortkey|;
$sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- $ref->{percent_skonto} = $form->format_amount($myconfig,($ref->{percent_skonto} * 100));
+ $form->{ALL} = [];
+ while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
push @{ $form->{ALL} }, $ref;
}
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query =
- qq|SELECT *
- FROM payment_terms
- WHERE id = $form->{id}|;
+ my $query = qq|SELECT * FROM payment_terms WHERE id = ?|;
my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute($form->{"id"}) || $form->dberror($query . " ($form->{id})");
my $ref = $sth->fetchrow_hashref(NAME_lc);
- $ref->{percent_skonto} = $form->format_amount($myconfig,($ref->{percent_skonto} * 100));
-
map { $form->{$_} = $ref->{$_} } keys %$ref;
+ $sth->finish();
+ $query =
+ qq|SELECT t.language_id, t.description_long, l.description AS language | .
+ qq|FROM translation_payment_terms t | .
+ qq|LEFT JOIN language l ON t.language_id = l.id | .
+ qq|WHERE t.payment_terms_id = ? | .
+ qq|UNION | .
+ qq|SELECT l.id AS language_id, NULL AS description_long, | .
+ qq| l.description AS language | .
+ qq|FROM language l|;
+ $sth = $dbh->prepare($query);
+ $sth->execute($form->{"id"}) || $form->dberror($query . " ($form->{id})");
+
+ my %mapping;
+ while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
+ $mapping{ $ref->{"language_id"} } = $ref
+ unless (defined($mapping{ $ref->{"language_id"} }));
+ }
$sth->finish;
+ $form->{"TRANSLATION"} = [sort({ $a->{"language"} cmp $b->{"language"} }
+ values(%mapping))];
+
$dbh->disconnect;
$main::lxdebug->leave_sub();
my ($self, $myconfig, $form) = @_;
# connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->dbconnect_noauto($myconfig);
- $form->{description} =~ s/\'/\'\'/g;
- $form->{description_long} =~ s/\'/\'\'/g;
- $percentskonto = $form->parse_amount($myconfig, $form->{percent_skonto}) /100;
- $form->{ranking} *= 1;
- $form->{terms_netto} *= 1;
- $form->{terms_skonto} *= 1;
- $form->{percent_skonto} *= 1;
+ my $query;
+ if (!$form->{id}) {
+ $query = qq|SELECT nextval('id'), COALESCE(MAX(sortkey) + 1, 1) | .
+ qq|FROM payment_terms|;
+ my $sortkey;
+ ($form->{id}, $sortkey) = selectrow_query($form, $dbh, $query);
+ $query = qq|INSERT INTO payment_terms (id, sortkey) VALUES (?, ?)|;
+ do_query($form, $dbh, $query, $form->{id}, $sortkey);
- # id is the old record
- if ($form->{id}) {
- $query = qq|UPDATE payment_terms SET
- description = '$form->{description}',
- ranking = $form->{ranking},
- description_long = '$form->{description_long}',
- terms_netto = $form->{terms_netto},
- terms_skonto = $form->{terms_skonto},
- percent_skonto = $percentskonto
- WHERE id = $form->{id}|;
} else {
- $query = qq|INSERT INTO payment_terms
- (description, ranking, description_long, terms_netto, terms_skonto, percent_skonto)
- VALUES ('$form->{description}', $form->{ranking}, '$form->{description_long}', $form->{terms_netto}, $form->{terms_skonto}, $percentskonto)|;
- }
- $dbh->do($query) || $form->dberror($query);
-
- $dbh->disconnect;
-
- $main::lxdebug->leave_sub();
-}
-
-sub delete_payment {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
-
- $query = qq|DELETE FROM payment_terms
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
-
- $dbh->disconnect;
-
- $main::lxdebug->leave_sub();
-}
-
-sub sic {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
+ $query =
+ qq|DELETE FROM translation_payment_terms | .
+ qq|WHERE payment_terms_id = ?|;
+ do_query($form, $dbh, $query, $form->{"id"});
+ }
+
+ $query = qq|UPDATE payment_terms SET
+ description = ?, description_long = ?,
+ ranking = ?,
+ terms_netto = ?, terms_skonto = ?,
+ percent_skonto = ?
+ WHERE id = ?|;
+ my @values = ($form->{description}, $form->{description_long},
+ $form->{ranking} * 1,
+ $form->{terms_netto} * 1, $form->{terms_skonto} * 1,
+ $form->{percent_skonto} * 1,
+ $form->{id});
+ do_query($form, $dbh, $query, @values);
+
+ $query = qq|SELECT id FROM language|;
+ my @language_ids;
+ my $sth = $dbh->prepare($query);
+ $sth->execute() || $form->dberror($query);
- my $query = qq|SELECT code, sictype, description
- FROM sic
- ORDER BY code|;
+ while (my ($id) = $sth->fetchrow_array()) {
+ push(@language_ids, $id);
+ }
+ $sth->finish();
+ $query =
+ qq|INSERT INTO translation_payment_terms | .
+ qq|(language_id, payment_terms_id, description_long) | .
+ qq|VALUES (?, ?, ?)|;
$sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{ALL} }, $ref;
+ foreach my $language_id (@language_ids) {
+ do_statement($form, $sth, $query, $language_id, $form->{"id"},
+ $form->{"description_long_${language_id}"});
}
+ $sth->finish();
- $sth->finish;
+ $dbh->commit();
$dbh->disconnect;
$main::lxdebug->leave_sub();
}
-sub get_sic {
+sub delete_payment {
$main::lxdebug->enter_sub();
my ($self, $myconfig, $form) = @_;
# connect to database
- my $dbh = $form->dbconnect($myconfig);
-
- my $query = qq|SELECT s.code, s.sictype, s.description
- FROM sic s
- WHERE s.code = '$form->{code}'|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my $ref = $sth->fetchrow_hashref(NAME_lc);
+ my $dbh = $form->dbconnect_noauto($myconfig);
- map { $form->{$_} = $ref->{$_} } keys %$ref;
+ my $query =
+ qq|DELETE FROM translation_payment_terms WHERE payment_terms_id = ?|;
+ do_query($form, $dbh, $query, $form->{"id"});
- $sth->finish;
+ $query = qq|DELETE FROM payment_terms WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{"id"});
+ $dbh->commit();
$dbh->disconnect;
$main::lxdebug->leave_sub();
}
-sub save_sic {
+
+sub prepare_template_filename {
$main::lxdebug->enter_sub();
my ($self, $myconfig, $form) = @_;
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my ($filename, $display_filename);
- $form->{code} =~ s/\'/\'\'/g;
- $form->{description} =~ s/\'/\'\'/g;
+ if ($form->{type} eq "stylesheet") {
+ $filename = "css/$myconfig->{stylesheet}";
+ $display_filename = $myconfig->{stylesheet};
- # if there is an id
- if ($form->{id}) {
- $query = qq|UPDATE sic SET
- code = '$form->{code}',
- sictype = '$form->{sictype}',
- description = '$form->{description}'
- WHERE code = '$form->{id}'|;
} else {
- $query = qq|INSERT INTO sic
- (code, sictype, description)
- VALUES ('$form->{code}', '$form->{sictype}', '$form->{description}')|;
- }
- $dbh->do($query) || $form->dberror($query);
-
- $dbh->disconnect;
-
- $main::lxdebug->leave_sub();
-}
-
-sub delete_sic {
- $main::lxdebug->enter_sub();
+ $filename = $form->{formname};
- my ($self, $myconfig, $form) = @_;
-
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
+ if ($form->{language}) {
+ my ($id, $template_code) = split(/--/, $form->{language});
+ $filename .= "_${template_code}";
+ }
- $query = qq|DELETE FROM sic
- WHERE code = '$form->{code}'|;
- $dbh->do($query) || $form->dberror($query);
+ if ($form->{printer}) {
+ my ($id, $template_code) = split(/--/, $form->{printer});
+ $filename .= "_${template_code}";
+ }
- $dbh->disconnect;
+ $filename .= "." . ($form->{format} eq "html" ? "html" : "tex");
+ $filename =~ s|.*/||;
+ $display_filename = $filename;
+ $filename = "$myconfig->{templates}/$filename";
+ }
$main::lxdebug->leave_sub();
+
+ return ($filename, $display_filename);
}
+
sub load_template {
$main::lxdebug->enter_sub();
- my ($self, $form) = @_;
+ my ($self, $filename) = @_;
- open(TEMPLATE, "$form->{file}") or $form->error("$form->{file} : $!");
+ my ($content, $lines) = ("", 0);
- while (<TEMPLATE>) {
- $form->{body} .= $_;
- }
+ local *TEMPLATE;
- close(TEMPLATE);
+ if (open(TEMPLATE, $filename)) {
+ while (<TEMPLATE>) {
+ $content .= $_;
+ $lines++;
+ }
+ close(TEMPLATE);
+ }
$main::lxdebug->leave_sub();
+
+ return ($content, $lines);
}
sub save_template {
$main::lxdebug->enter_sub();
- my ($self, $form) = @_;
+ my ($self, $filename, $content) = @_;
- open(TEMPLATE, ">$form->{file}") or $form->error("$form->{file} : $!");
+ local *TEMPLATE;
- # strip
- $form->{body} =~ s/\r\n/\n/g;
- print TEMPLATE $form->{body};
+ my $error = "";
- close(TEMPLATE);
+ if (open(TEMPLATE, ">$filename")) {
+ $content =~ s/\r\n/\n/g;
+ print(TEMPLATE $content);
+ close(TEMPLATE);
+ } else {
+ $error = $!;
+ }
$main::lxdebug->leave_sub();
+
+ return $error;
}
sub save_preferences {
# these defaults are database wide
# user specific variables are in myconfig
# save defaults
- my $query = qq|UPDATE defaults SET
- inventory_accno_id =
- (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{inventory_accno}'),
- income_accno_id =
- (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{income_accno}'),
- expense_accno_id =
- (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{expense_accno}'),
- fxgain_accno_id =
- (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{fxgain_accno}'),
- fxloss_accno_id =
- (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{fxloss_accno}'),
- invnumber = '$form->{invnumber}',
- cnnumber = '$form->{cnnumber}',
- sonumber = '$form->{sonumber}',
- ponumber = '$form->{ponumber}',
- sqnumber = '$form->{sqnumber}',
- rfqnumber = '$form->{rfqnumber}',
- customernumber = '$form->{customernumber}',
- vendornumber = '$form->{vendornumber}',
- articlenumber = '$form->{articlenumber}',
- servicenumber = '$form->{servicenumber}',
- yearend = '$form->{yearend}',
- curr = '$form->{curr}',
- businessnumber = '$form->{businessnumber}'
- |;
- $dbh->do($query) || $form->dberror($query);
+ my $query =
+ qq|UPDATE defaults SET | .
+ qq|inventory_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?), | .
+ qq|income_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?), | .
+ qq|expense_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?), | .
+ qq|fxgain_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?), | .
+ qq|fxloss_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?), | .
+ qq|invnumber = ?, | .
+ qq|cnnumber = ?, | .
+ qq|sonumber = ?, | .
+ qq|ponumber = ?, | .
+ qq|sqnumber = ?, | .
+ qq|rfqnumber = ?, | .
+ qq|customernumber = ?, | .
+ qq|vendornumber = ?, | .
+ qq|articlenumber = ?, | .
+ qq|servicenumber = ?, | .
+ qq|yearend = ?, | .
+ qq|curr = ?, | .
+ qq|businessnumber = ?|;
+ my @values = ($form->{inventory_accno}, $form->{income_accno},
+ $form->{expense_accno},
+ $form->{fxgain_accno}, $form->{fxloss_accno},
+ $form->{invnumber}, $form->{cnnumber},
+ $form->{sonumber}, $form->{ponumber},
+ $form->{sqnumber}, $form->{rfqnumber},
+ $form->{customernumber}, $form->{vendornumber},
+ $form->{articlenumber}, $form->{servicenumber},
+ $form->{yearend}, $form->{curr},
+ $form->{businessnumber});
+ do_query($form, $dbh, $query, @values);
# update name
- my $name = $form->{name};
- $name =~ s/\'/\'\'/g;
$query = qq|UPDATE employee
- SET name = '$name'
- WHERE login = '$form->{login}'|;
- $dbh->do($query) || $form->dberror($query);
-
-# foreach my $item (split(/ /, $form->{taxaccounts})) {
-# $query = qq|UPDATE tax
-# SET rate = | . ($form->{$item} / 100) . qq|,
-# taxnumber = '$form->{"taxnumber_$item"}'
-# WHERE chart_id = $item|;
-# $dbh->do($query) || $form->dberror($query);
-# }
+ SET name = ?
+ WHERE login = ?|;
+ do_query($form, $dbh, $query, $form->{name}, $form->{login});
my $rc = $dbh->commit;
$dbh->disconnect;
$query = qq|SELECT c.id, c.accno, c.description
FROM chart c
- WHERE c.category = 'I'
- AND c.charttype = 'A'
+ WHERE c.category = 'I'
+ AND c.charttype = 'A'
ORDER BY c.accno|;
$sth = $dbh->prepare($query);
$sth->execute || $self->dberror($query);
$query = qq|SELECT c.id, c.accno, c.description
FROM chart c
- WHERE c.category = 'E'
- AND c.charttype = 'A'
+ WHERE c.category = 'E'
+ AND c.charttype = 'A'
ORDER BY c.accno|;
$sth = $dbh->prepare($query);
$sth->execute || $self->dberror($query);
$query = qq|SELECT c.id, c.accno, c.description,
t.rate * 100 AS rate, t.taxnumber
FROM chart c, tax t
- WHERE c.id = t.chart_id|;
+ WHERE c.id = t.chart_id|;
$sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
$main::lxdebug->leave_sub();
}
-sub backup {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form, $userspath) = @_;
-
- my $mail;
- my $err;
- my $boundary = time;
- my $tmpfile =
- "$userspath/$boundary.$myconfig->{dbname}-$form->{dbversion}.sql";
- my $out = $form->{OUT};
- $form->{OUT} = ">$tmpfile";
-
- if ($form->{media} eq 'email') {
-
- use SL::Mailer;
- $mail = new Mailer;
-
- $mail->{to} = qq|"$myconfig->{name}" <$myconfig->{email}>|;
- $mail->{from} = qq|"$myconfig->{name}" <$myconfig->{email}>|;
- $mail->{subject} =
- "Lx-Office Backup / $myconfig->{dbname}-$form->{dbversion}.sql";
- @{ $mail->{attachments} } = ($tmpfile);
- $mail->{version} = $form->{version};
- $mail->{fileid} = "$boundary.";
-
- $myconfig->{signature} =~ s/\\n/\r\n/g;
- $mail->{message} = "--\n$myconfig->{signature}";
-
- }
-
- open(OUT, "$form->{OUT}") or $form->error("$form->{OUT} : $!");
-
- # get sequences, functions and triggers
- open(FH, "sql/lx-office.sql") or $form->error("sql/lx-office.sql : $!");
-
- my @sequences = ();
- my @functions = ();
- my @triggers = ();
- my @indices = ();
- my %tablespecs;
-
- my $query = "";
- my @quote_chars;
-
- while (<FH>) {
-
- # Remove DOS and Unix style line endings.
- s/[\r\n]//g;
-
- # ignore comments or empty lines
- next if /^(--.*|\s+)$/;
-
- for (my $i = 0; $i < length($_); $i++) {
- my $char = substr($_, $i, 1);
-
- # Are we inside a string?
- if (@quote_chars) {
- if ($char eq $quote_chars[-1]) {
- pop(@quote_chars);
- }
- $query .= $char;
-
- } else {
- if (($char eq "'") || ($char eq "\"")) {
- push(@quote_chars, $char);
-
- } elsif ($char eq ";") {
-
- # Query is complete. Check for triggers and functions.
- if ($query =~ /^create\s+function\s+\"?(\w+)\"?/i) {
- push(@functions, $query);
-
- } elsif ($query =~ /^create\s+trigger\s+\"?(\w+)\"?/i) {
- push(@triggers, $query);
-
- } elsif ($query =~ /^create\s+sequence\s+\"?(\w+)\"?/i) {
- push(@sequences, $1);
-
- } elsif ($query =~ /^create\s+table\s+\"?(\w+)\"?/i) {
- $tablespecs{$1} = $query;
-
- } elsif ($query =~ /^create\s+index\s+\"?(\w+)\"?/i) {
- push(@indices, $query);
-
- }
-
- $query = "";
- $char = "";
- }
-
- $query .= $char;
- }
- }
- }
- close(FH);
-
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
-
- # get all the tables
- my @tables = $dbh->tables('', '', 'customer', '', { noprefix => 0 });
-
- my $today = scalar localtime;
-
- $myconfig->{dbhost} = 'localhost' unless $myconfig->{dbhost};
-
- print OUT qq|-- Lx-Office Backup
--- Dataset: $myconfig->{dbname}
--- Version: $form->{dbversion}
--- Host: $myconfig->{dbhost}
--- Login: $form->{login}
--- User: $myconfig->{name}
--- Date: $today
---
--- set options
-$myconfig->{dboptions};
---
-|;
-
- print OUT "-- DROP Sequences\n";
- my $item;
- foreach $item (@sequences) {
- print OUT qq|DROP SEQUENCE $item;\n|;
- }
-
- print OUT "-- DROP Triggers\n";
-
- foreach $item (@triggers) {
- if ($item =~ /^create\s+trigger\s+\"?(\w+)\"?\s+.*on\s+\"?(\w+)\"?\s+/i) {
- print OUT qq|DROP TRIGGER "$1" ON "$2";\n|;
- }
- }
-
- print OUT "-- DROP Functions\n";
-
- foreach $item (@functions) {
- if ($item =~ /^create\s+function\s+\"?(\w+)\"?/i) {
- print OUT qq|DROP FUNCTION "$1" ();\n|;
- }
- }
-
- foreach $table (@tables) {
- if (!($table =~ /^sql_.*/)) {
- my $query = qq|SELECT * FROM $table|;
-
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- $query = "INSERT INTO $table (";
- map { $query .= qq|$sth->{NAME}->[$_],| }
- (0 .. $sth->{NUM_OF_FIELDS} - 1);
- chop $query;
-
- $query .= ") VALUES";
-
- if ($tablespecs{$table}) {
- print(OUT "--\n");
- print(OUT "DROP TABLE $table;\n");
- print(OUT $tablespecs{$table}, ";\n");
- } else {
- print(OUT "--\n");
- print(OUT "DELETE FROM $table;\n");
- }
- while (my @arr = $sth->fetchrow_array) {
-
- $fields = "(";
- foreach my $item (@arr) {
- if (defined $item) {
- $item =~ s/\'/\'\'/g;
- $fields .= qq|'$item',|;
- } else {
- $fields .= 'NULL,';
- }
- }
-
- chop $fields;
- $fields .= ")";
-
- print OUT qq|$query $fields;\n|;
- }
-
- $sth->finish;
- }
- }
-
- # create indices, sequences, functions and triggers
-
- print(OUT "-- CREATE Indices\n");
- map({ print(OUT "$_;\n"); } @indices);
-
- print OUT "-- CREATE Sequences\n";
- foreach $item (@sequences) {
- $query = qq|SELECT last_value FROM $item|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- my ($id) = $sth->fetchrow_array;
- $sth->finish;
-
- print OUT qq|--
-CREATE SEQUENCE $item START $id;
-|;
- }
-
- print OUT "-- CREATE Functions\n";
-
- # functions
- map { print(OUT $_, ";\n"); } @functions;
-
- print OUT "-- CREATE Triggers\n";
-
- # triggers
- map { print(OUT $_, ";\n"); } @triggers;
-
- close(OUT);
-
- $dbh->disconnect;
-
- # compress backup
- my @args = ("gzip", "$tmpfile");
- system(@args) == 0 or $form->error("$args[0] : $?");
-
- $tmpfile .= ".gz";
-
- if ($form->{media} eq 'email') {
- @{ $mail->{attachments} } = ($tmpfile);
- $err = $mail->send($out);
- }
-
- if ($form->{media} eq 'file') {
-
- open(IN, "$tmpfile") or $form->error("$tmpfile : $!");
- open(OUT, ">-") or $form->error("STDOUT : $!");
-
- print OUT qq|Content-Type: application/x-tar-gzip;
-Content-Disposition: attachment; filename="$myconfig->{dbname}-$form->{dbversion}.sql.gz"
-
-|;
-
- while (<IN>) {
- print OUT $_;
- }
-
- close(IN);
- close(OUT);
-
- }
-
- unlink "$tmpfile";
-
- $main::lxdebug->leave_sub();
-}
-
sub closedto {
$main::lxdebug->enter_sub();
my $dbh = $form->dbconnect($myconfig);
+ my ($query, @values);
+
if ($form->{revtrans}) {
+ $query = qq|UPDATE defaults SET closedto = NULL, revtrans = '1'|;
- $query = qq|UPDATE defaults SET closedto = NULL,
- revtrans = '1'|;
} elsif ($form->{closedto}) {
+ $query = qq|UPDATE defaults SET closedto = ?, revtrans = '0'|;
+ @values = (conv_date($form->{closedto}));
- $query = qq|UPDATE defaults SET closedto = '$form->{closedto}',
- revtrans = '0'|;
} else {
-
- $query = qq|UPDATE defaults SET closedto = NULL,
- revtrans = '0'|;
+ $query = qq|UPDATE defaults SET closedto = NULL, revtrans = '0'|;
}
# set close in defaults
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, $query, @values);
$dbh->disconnect;
my $dbh = $form->dbconnect($myconfig);
+ map({ $_->{"in_use"} = 0; } values(%{$units}));
+
foreach my $unit (values(%{$units})) {
my $base_unit = $unit->{"original_base_unit"};
while ($base_unit) {
+ $units->{$base_unit}->{"in_use"} = 1;
$units->{$base_unit}->{"DEPENDING_UNITS"} = [] unless ($units->{$base_unit}->{"DEPENDING_UNITS"});
push(@{$units->{$base_unit}->{"DEPENDING_UNITS"}}, $unit->{"name"});
$base_unit = $units->{$base_unit}->{"original_base_unit"};
}
foreach my $unit (values(%{$units})) {
- $unit->{"in_use"} = 0;
map({ $_ = $dbh->quote($_); } @{$unit->{"DEPENDING_UNITS"}});
foreach my $table (qw(parts invoice orderitems)) {
if (0 == scalar(@{$unit->{"DEPENDING_UNITS"}})) {
$query .= "= " . $dbh->quote($unit->{"name"});
} else {
- $query .= "IN (" . $dbh->quote($unit->{"name"}) . "," . join(",", @{$unit->{"DEPENDING_UNITS"}}) . ")";
+ $query .= "IN (" . $dbh->quote($unit->{"name"}) . "," .
+ join(",", map({ $dbh->quote($_) } @{$unit->{"DEPENDING_UNITS"}})) . ")";
}
my ($count) = $dbh->selectrow_array($query);
push(@{$select}, { "name" => "", "base_unit" => "", "factor" => "", "selected" => "" });
}
- foreach my $unit (sort({ lc($a) cmp lc($b) } keys(%{$units}))) {
+ foreach my $unit (sort({ $units->{$a}->{"sortkey"} <=> $units->{$b}->{"sortkey"} } keys(%{$units}))) {
push(@{$select}, { "name" => $unit,
"base_unit" => $units->{$unit}->{"base_unit"},
"factor" => $units->{$unit}->{"factor"},
my $select = "<select name=${name}>";
- foreach my $unit (sort({ lc($a) cmp lc($b) } keys(%{$units}))) {
+ foreach my $unit (sort({ $units->{$a}->{"sortkey"} <=> $units->{$b}->{"sortkey"} } keys(%{$units}))) {
if (!$convertible_into ||
($units->{$convertible_into} &&
($units->{$convertible_into}->{"base_unit"} eq $units->{$unit}->{"base_unit"}))) {
my $dbh = $form->dbconnect_noauto($myconfig);
- my $query = "INSERT INTO units (name, base_unit, factor, type) VALUES (?, ?, ?, ?)";
- $dbh->do($query, undef, $name, $base_unit, $factor, $type) || $form->dberror($query . " ($name, $base_unit, $factor, $type)");
+ my $query = qq|SELECT COALESCE(MAX(sortkey), 0) + 1 FROM units|;
+ my ($sortkey) = selectrow_query($form, $dbh, $query);
+
+ $query = "INSERT INTO units (name, base_unit, factor, type, sortkey) " .
+ "VALUES (?, ?, ?, ?, ?)";
+ do_query($form, $dbh, $query, $name, $base_unit, $factor, $type, $sortkey);
if ($languages) {
$query = "INSERT INTO units_language (unit, language_id, localized, localized_plural) VALUES (?, ?, ?, ?)";
$main::lxdebug->leave_sub();
}
+sub swap_units {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form, $dir, $name_1, $unit_type) = @_;
+
+ my $dbh = $form->dbconnect_noauto($myconfig);
+
+ my $query;
+
+ $query = qq|SELECT sortkey FROM units WHERE name = ?|;
+ my ($sortkey_1) = selectrow_query($form, $dbh, $query, $name_1);
+
+ $query =
+ qq|SELECT sortkey FROM units | .
+ qq|WHERE sortkey | . ($dir eq "down" ? ">" : "<") . qq| ? AND type = ? | .
+ qq|ORDER BY sortkey | . ($dir eq "down" ? "ASC" : "DESC") . qq| LIMIT 1|;
+ my ($sortkey_2) = selectrow_query($form, $dbh, $query, $sortkey_1, $unit_type);
+
+ if (defined($sortkey_1)) {
+ $query = qq|SELECT name FROM units WHERE sortkey = ${sortkey_2}|;
+ my ($name_2) = selectrow_query($form, $dbh, $query);
+
+ if (defined($name_2)) {
+ $query = qq|UPDATE units SET sortkey = ? WHERE name = ?|;
+ my $sth = $dbh->prepare($query);
+
+ do_statement($form, $sth, $query, $sortkey_1, $name_2);
+ do_statement($form, $sth, $query, $sortkey_2, $name_1);
+ }
+ }
+
+ $dbh->commit();
+ $dbh->disconnect();
+
+ $main::lxdebug->leave_sub();
+}
+
+sub taxes {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form) = @_;
+
+ # connect to database
+ my $dbh = $form->dbconnect($myconfig);
+
+ my $query = qq|SELECT
+ t.id,
+ t.taxkey,
+ t.taxdescription,
+ round(t.rate * 100, 2) AS rate,
+ (SELECT accno FROM chart WHERE id = chart_id) AS taxnumber,
+ (SELECT description FROM chart WHERE id = chart_id) AS account_description
+ FROM tax t
+ ORDER BY taxkey|;
+
+ $sth = $dbh->prepare($query);
+ $sth->execute || $form->dberror($query);
+
+ $form->{TAX} = [];
+ while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
+ push @{ $form->{TAX} }, $ref;
+ }
+
+ $sth->finish;
+ $dbh->disconnect;
+
+ $main::lxdebug->leave_sub();
+}
+
+sub get_tax_accounts {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form) = @_;
+
+ my $dbh = $form->dbconnect($myconfig);
+
+ # get Accounts from chart
+ my $query = qq{ SELECT
+ id,
+ accno || ' - ' || description AS taxaccount
+ FROM chart
+ WHERE link LIKE '%_tax%'
+ ORDER BY accno
+ };
+
+ $sth = $dbh->prepare($query);
+ $sth->execute || $form->dberror($query);
+
+ $form->{ACCOUNTS} = [];
+ while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
+ push @{ $form->{ACCOUNTS} }, $ref;
+ }
+
+ $sth->finish;
+
+ $dbh->disconnect;
+
+ $main::lxdebug->leave_sub();
+}
+
+sub get_tax {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form) = @_;
+
+ # connect to database
+ my $dbh = $form->dbconnect($myconfig);
+
+ my $query = qq|SELECT
+ taxkey,
+ taxdescription,
+ round(rate * 100, 2) AS rate,
+ chart_id
+ FROM tax
+ WHERE id = ? |;
+
+ my $sth = $dbh->prepare($query);
+ $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
+
+ my $ref = $sth->fetchrow_hashref(NAME_lc);
+
+ map { $form->{$_} = $ref->{$_} } keys %$ref;
+
+ $sth->finish;
+
+ # see if it is used by a taxkey
+ $query = qq|SELECT count(*) FROM taxkeys
+ WHERE tax_id = ? AND chart_id >0|;
+
+ ($form->{orphaned}) = selectrow_query($form, $dbh, $query, $form->{id});
+
+ $form->{orphaned} = !$form->{orphaned};
+ $sth->finish;
+
+ if (!$form->{orphaned} ) {
+ $query = qq|SELECT DISTINCT c.id, c.accno
+ FROM taxkeys tk
+ JOIN tax t ON (t.id = tk.tax_id)
+ JOIN chart c ON (c.id = tk.chart_id)
+ WHERE tk.tax_id = ?|;
+
+ $sth = $dbh->prepare($query);
+ $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
+
+ $form->{TAXINUSE} = [];
+ while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
+ push @{ $form->{TAXINUSE} }, $ref;
+ }
+
+ $sth->finish;
+ }
+
+ $dbh->disconnect;
+
+ $main::lxdebug->leave_sub();
+}
+
+sub save_tax {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form) = @_;
+
+ # connect to database
+ my $dbh = $form->get_standard_dbh($myconfig);
+
+ $form->{rate} = $form->{rate} / 100;
+
+ my @values = ($form->{taxkey}, $form->{taxdescription}, $form->{rate}, $form->{chart_id}, $form->{chart_id} );
+ if ($form->{id} ne "") {
+ $query = qq|UPDATE tax SET
+ taxkey = ?,
+ taxdescription = ?,
+ rate = ?,
+ chart_id = ?,
+ taxnumber = (SELECT accno FROM chart WHERE id= ? )
+ WHERE id = ?|;
+ push(@values, $form->{id});
+
+ } else {
+ #ok
+ $query = qq|INSERT INTO tax (
+ taxkey,
+ taxdescription,
+ rate,
+ chart_id,
+ taxnumber
+ )
+ VALUES (?, ?, ?, ?, (SELECT accno FROM chart WHERE id = ?) )|;
+ }
+ do_query($form, $dbh, $query, @values);
+
+ $dbh->commit();
+
+ $main::lxdebug->leave_sub();
+}
+
+sub delete_tax {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form) = @_;
+
+ # connect to database
+ my $dbh = $form->get_standard_dbh($myconfig);
+
+ $query = qq|DELETE FROM tax
+ WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{id});
+
+ $dbh->commit();
+
+ $main::lxdebug->leave_sub();
+}
+
+
+
1;
package AP;
+use SL::DBUtils;
+use SL::MoreCommon;
+
sub post_transaction {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form) = @_;
+ my ($self, $myconfig, $form, $provided_dbh, $payments_only) = @_;
# connect to database
- my $dbh = $form->dbconnect_noauto($myconfig);
+ my $dbh = $provided_dbh ? $provided_dbh : $form->dbconnect_noauto($myconfig);
my ($null, $taxrate, $amount);
my $exchangerate = 0;
+ $form->{defaultcurrency} = $form->get_default_currency($myconfig);
+
($null, $form->{department_id}) = split(/--/, $form->{department});
$form->{department_id} *= 1;
$form->{taxincluded} = 0 if ($form->{amount} == 0);
for $i (1 .. $form->{rowcount}) {
- ($form->{"tax_id_$i"}, $NULL) = split /--/, $form->{"taxchart_$i"};
+ ($form->{"tax_id_$i"}, $NULL) = split /--/, $form->{"taxchart_$i"};
- $query = qq|SELECT c.accno, t.taxkey, t.rate
- FROM tax t LEFT JOIN chart c on (c.id=t.chart_id)
- WHERE t.id=$form->{"tax_id_$i"}
- ORDER BY c.accno|;
+ $query =
+ qq|SELECT c.accno, t.taxkey, t.rate | .
+ qq|FROM tax t LEFT JOIN chart c on (c.id=t.chart_id) | .
+ qq|WHERE t.id = ? | .
+ qq|ORDER BY c.accno|;
$sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute($form->{"tax_id_$i"}) || $form->dberror($query . " (" . $form->{"tax_id_$i"} . ")");
($form->{AP_amounts}{"tax_$i"}, $form->{"taxkey_$i"}, $form->{"taxrate_$i"}) =
$sth->fetchrow_array;
$form->{AP_amounts}{"tax_$i"}{taxkey} = $form->{"taxkey_$i"};
# amount for total AP
$form->{payables} = $form->{invtotal};
- my ($query, $sth);
-
- # if we have an id delete old records
- if ($form->{id}) {
-
- # delete detail records
- $query = qq|DELETE FROM acc_trans WHERE trans_id = $form->{id}|;
-
- $dbh->do($query) || $form->dberror($query);
-
- } else {
- my $uid = rand() . time;
+ $form->{datepaid} = $form->{transdate} unless ($form->{datepaid});
+ my $datepaid = ($form->{invpaid} != 0) ? $form->{datepaid} : undef;
- $uid .= $form->{login};
+ # update exchangerate
+ if (($form->{currency} ne $form->{defaultcurrency}) && !$exchangerate) {
+ $form->update_exchangerate($dbh, $form->{currency}, $form->{transdate}, 0,
+ $form->{exchangerate});
+ }
- $uid = substr($uid, 2, 75);
+ my ($query, $sth);
- $query = qq|INSERT INTO ap (invnumber, employee_id)
- VALUES ('$uid', (SELECT e.id FROM employee e
- WHERE e.login = '$form->{login}') )|;
- $dbh->do($query) || $form->dberror($query);
+ if (!$payments_only) {
+ # if we have an id delete old records
+ if ($form->{id}) {
- $query = qq|SELECT a.id FROM ap a
- WHERE a.invnumber = '$uid'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ # delete detail records
+ $query = qq|DELETE FROM acc_trans WHERE trans_id = ?|;
+ do_query($form, $dbh, $query, $form->{id});
- ($form->{id}) = $sth->fetchrow_array;
- $sth->finish;
+ } else {
+ my $uid = rand() . time;
- }
+ $uid .= $form->{login};
- $form->{invnumber} = $form->{id} unless $form->{invnumber};
+ $uid = substr($uid, 2, 75);
- # escape '
- map { $form->{$_} =~ s/\'/\'\'/g } qw(invnumber ordnumber notes);
+ $query =
+ qq|INSERT INTO ap (invnumber, employee_id) | .
+ qq|VALUES (?, (SELECT e.id FROM employee e WHERE e.login = ?))|;
+ do_query($form, $dbh, $query, $uid, $form->{login});
- $form->{datepaid} = $form->{transdate} unless ($form->{datepaid});
- my $datepaid = ($form->{invpaid} != 0) ? qq|'$form->{datepaid}'| : 'NULL';
-
- $query = qq|UPDATE ap SET
- invnumber = '$form->{invnumber}',
- transdate = '$form->{transdate}',
- ordnumber = '$form->{ordnumber}',
- vendor_id = $form->{vendor_id},
- taxincluded = '$form->{taxincluded}',
- amount = $form->{invtotal},
- duedate = '$form->{duedate}',
- paid = $form->{invpaid},
- datepaid = $datepaid,
- netamount = $form->{netamount},
- curr = '$form->{currency}',
- notes = '$form->{notes}',
- department_id = $form->{department_id}
- WHERE id = $form->{id}
- |;
- $dbh->do($query) || $form->dberror($query);
-
- # update exchangerate
- if (($form->{currency} ne $form->{defaultcurrency}) && !$exchangerate) {
- $form->update_exchangerate($dbh, $form->{currency}, $form->{transdate}, 0,
- $form->{exchangerate});
- }
+ $query = qq|SELECT a.id FROM ap a
+ WHERE a.invnumber = ?|;
+ ($form->{id}) = selectrow_query($form, $dbh, $query, $uid);
+ }
- # add individual transactions
- for $i (1 .. $form->{rowcount}) {
- if ($form->{"amount_$i"} != 0) {
- $project_id = 'NULL';
- if ("amount_$i" =~ /amount_/) {
- if ($form->{"project_id_$i"} && $form->{"projectnumber_$i"}) {
- $project_id = $form->{"project_id_$i"};
- }
- }
- if ("amount_$i" =~ /amount/) {
+ $form->{invnumber} = $form->{id} unless $form->{invnumber};
+
+ $query = qq|UPDATE ap SET
+ invnumber = ?, transdate = ?, ordnumber = ?, vendor_id = ?, taxincluded = ?,
+ amount = ?, duedate = ?, paid = ?, datepaid = ?, netamount = ?,
+ curr = ?, notes = ?, department_id = ?, storno = ?, storno_id = ?
+ WHERE id = ?|;
+ my @values = ($form->{invnumber}, conv_date($form->{transdate}),
+ $form->{ordnumber}, conv_i($form->{vendor_id}),
+ $form->{taxincluded} ? 't' : 'f', $form->{invtotal},
+ conv_date($form->{duedate}), $form->{invpaid},
+ conv_date($datepaid), $form->{netamount},
+ $form->{currency}, $form->{notes},
+ conv_i($form->{department_id}), $form->{storno},
+ $form->{storno_id}, $form->{id});
+ do_query($form, $dbh, $query, @values);
+
+ # add individual transactions
+ for $i (1 .. $form->{rowcount}) {
+ if ($form->{"amount_$i"} != 0) {
+ my $project_id;
+ $project_id = conv_i($form->{"project_id_$i"});
$taxkey = $form->{AP_amounts}{"amount_$i"}{taxkey};
- }
-
- # insert detail records in acc_trans
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
- project_id, taxkey)
- VALUES ($form->{id}, (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{AP_amounts}{"amount_$i"}'),
- $form->{"amount_$i"}, '$form->{transdate}', $project_id, '$taxkey')|;
- $dbh->do($query) || $form->dberror($query);
-
- if ($form->{"tax_$i"} != 0) {
# insert detail records in acc_trans
$query =
- qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
- project_id, taxkey)
- VALUES ($form->{id}, (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{AP_amounts}{"tax_$i"}'),
- $form->{"tax_$i"}, '$form->{transdate}', $project_id, '$taxkey')|;
- $dbh->do($query) || $form->dberror($query);
- }
+ qq|INSERT INTO acc_trans | .
+ qq| (trans_id, chart_id, amount, transdate, project_id, taxkey)| .
+ qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), | .
+ qq| ?, ?, ?, ?)|;
+ @values = ($form->{id}, $form->{AP_amounts}{"amount_$i"},
+ $form->{"amount_$i"}, conv_date($form->{transdate}),
+ $project_id, $taxkey);
+ do_query($form, $dbh, $query, @values);
+
+ if ($form->{"tax_$i"} != 0) {
+ # insert detail records in acc_trans
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, | .
+ qq| project_id, taxkey) | .
+ qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), | .
+ qq| ?, ?, ?, ?)|;
+ @values = ($form->{id}, $form->{AP_amounts}{"tax_$i"},
+ $form->{"tax_$i"}, conv_date($form->{transdate}),
+ $project_id, $taxkey);
+ do_query($form, $dbh, $query, @values);
+ }
+ }
}
- }
- # add payables
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
- project_id)
- VALUES ($form->{id}, (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{AP_amounts}{payables}'),
- $form->{payables}, '$form->{transdate}', $project_id)|;
- $dbh->do($query) || $form->dberror($query);
+ # add payables
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey) | .
+ qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, | .
+ qq| (SELECT taxkey_id FROM chart WHERE accno = ?))|;
+ @values = ($form->{id}, $form->{AP_amounts}{payables}, $form->{payables},
+ conv_date($form->{transdate}), $form->{AP_amounts}{payables});
+ do_query($form, $dbh, $query, @values);
+ }
# if there is no amount but a payment record a payable
if ($form->{amount} == 0 && $form->{invtotal} == 0) {
# add paid transactions
for my $i (1 .. $form->{paidaccounts}) {
if ($form->{"paid_$i"} != 0) {
+ my $project_id = conv_i($form->{"paid_project_id_$i"});
$exchangerate = 0;
if ($form->{currency} eq $form->{defaultcurrency}) {
$form->round_amount($form->{"paid_$i"} * $form->{exchangerate} * -1,
2);
if ($form->{payables}) {
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate)
- VALUES ($form->{id},
- (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{AP}{payables}'),
- $amount, '$form->{"datepaid_$i"}')|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey) | .
+ qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, | .
+ qq| (SELECT taxkey_id FROM chart WHERE accno = ?))|;
+ @values = ($form->{id}, $form->{AP}{payables}, $amount,
+ conv_date($form->{"datepaid_$i"}), $project_id,
+ $form->{AP}{payables});
+ do_query($form, $dbh, $query, @values);
}
$form->{payables} = $amount;
- $form->{"memo_$i"} =~ s/\'/\'\'/g;
-
# add payment
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate, source, memo)
- VALUES ($form->{id},
- (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{AP}{"paid_$i"}'),
- $form->{"paid_$i"}, '$form->{"datepaid_$i"}',
- '$form->{"source_$i"}', '$form->{"memo_$i"}')|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, source, memo, project_id, taxkey) | .
+ qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, ?, | .
+ qq| (SELECT taxkey_id FROM chart WHERE accno = ?))|;
+ @values = ($form->{id}, $form->{AP}{"paid_$i"}, $form->{"paid_$i"},
+ conv_date($form->{"datepaid_$i"}), $form->{"source_$i"},
+ $form->{"memo_$i"}, $project_id, $form->{AP}{"paid_$i"});
+ do_query($form, $dbh, $query, @values);
# add exchange rate difference
$amount =
- $form->round_amount(
- $form->{"paid_$i"} * ($form->{"exchangerate_$i"} - 1),
- 2);
+ $form->round_amount($form->{"paid_$i"} *
+ ($form->{"exchangerate_$i"} - 1), 2);
if ($amount != 0) {
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate, fx_transaction, cleared)
- VALUES ($form->{id},
- (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{AP}{"paid_$i"}'),
- $amount, '$form->{"datepaid_$i"}', '1', '0')|;
-
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey) | .
+ qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 't', 'f', ?, | .
+ qq| (SELECT taxkey_id FROM chart WHERE accno = ?))|;
+ @values = ($form->{id}, $form->{AP}{"paid_$i"}, $amount,
+ conv_date($form->{"datepaid_$i"}), $project_id,
+ $form->{AP}{"paid_$i"});
+ do_query($form, $dbh, $query, @values);
}
# exchangerate gain/loss
$amount =
- $form->round_amount(
- $form->{"paid_$i"} *
- ($form->{exchangerate} - $form->{"exchangerate_$i"}),
- 2);
+ $form->round_amount($form->{"paid_$i"} *
+ ($form->{exchangerate} -
+ $form->{"exchangerate_$i"}), 2);
if ($amount != 0) {
- $accno = ($amount > 0) ? $form->{fxgain_accno} : $form->{fxloss_accno};
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate, fx_transaction, cleared)
- VALUES ($form->{id}, (SELECT c.id FROM chart c
- WHERE c.accno = '$accno'),
- $amount, '$form->{"datepaid_$i"}', '1', '0')|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey) | .
+ qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 't', 'f', ?, | .
+ qq| (SELECT taxkey_id FROM chart WHERE accno = ?))|;
+ @values = ($form->{id}, ($amount > 0) ?
+ $form->{fxgain_accno} : $form->{fxloss_accno},
+ $amount, conv_date($form->{"datepaid_$i"}), $project_id,
+ ($amount > 0) ?
+ $form->{fxgain_accno} : $form->{fxloss_accno});
+ do_query($form, $dbh, $query, @values);
}
# update exchange rate record
}
}
- my $rc = $dbh->commit;
- $dbh->disconnect;
+ if ($payments_only) {
+ $query = qq|UPDATE ap SET paid = ? WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{invpaid}, conv_i($form->{id}));
+ }
+
+ my $rc = 1;
+ if (!$provided_dbh) {
+ $dbh->commit();
+ $dbh->disconnect();
+ }
$main::lxdebug->leave_sub();
# connect to database
my $dbh = $form->dbconnect_noauto($myconfig);
- my $query = qq|DELETE FROM ap WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ my $query = qq|DELETE FROM ap WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{id});
- $query = qq|DELETE FROM acc_trans WHERE trans_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|DELETE FROM acc_trans WHERE trans_id = ?|;
+ do_query($form, $dbh, $query, $form->{id});
# commit and redirect
my $rc = $dbh->commit;
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT a.id, a.invnumber, a.transdate, a.duedate,
- a.amount, a.paid, a.ordnumber, v.name, a.invoice,
- a.netamount, a.datepaid, a.notes, e.name AS employee
- FROM ap a
- JOIN vendor v ON (a.vendor_id = v.id)
- LEFT JOIN employee e ON (a.employee_id = e.id)|;
-
- my $where = "1 = 1";
+ my $query =
+ qq|SELECT a.id, a.invnumber, a.transdate, a.duedate, a.amount, a.paid, | .
+ qq| a.ordnumber, v.name, a.invoice, a.netamount, a.datepaid, a.notes, | .
+ qq| a.globalproject_id, | .
+ qq| pr.projectnumber AS globalprojectnumber, | .
+ qq| e.name AS employee | .
+ qq|FROM ap a | .
+ qq|JOIN vendor v ON (a.vendor_id = v.id) | .
+ qq|LEFT JOIN employee e ON (a.employee_id = e.id) | .
+ qq|LEFT JOIN project pr ON (a.globalproject_id = pr.id) |;
+
+ my $where = qq| WHERE COALESCE(storno, false) != true |;
+ my @values;
if ($form->{vendor_id}) {
- $where .= " AND a.vendor_id = $form->{vendor_id}";
- } else {
- if ($form->{vendor}) {
- my $vendor = $form->like(lc $form->{vendor});
- $where .= " AND lower(v.name) LIKE '$vendor'";
- }
+ $where .= " AND a.vendor_id = ?";
+ push(@values, $form->{vendor_id});
+ } elsif ($form->{vendor}) {
+ $where .= " AND v.name ILIKE ?";
+ push(@values, $form->like($form->{vendor}));
}
if ($form->{department}) {
my ($null, $department_id) = split /--/, $form->{department};
- $where .= " AND a.department_id = $department_id";
+ $where .= " AND a.department_id = ?";
+ push(@values, $department_id);
}
if ($form->{invnumber}) {
- my $invnumber = $form->like(lc $form->{invnumber});
- $where .= " AND lower(a.invnumber) LIKE '$invnumber'";
+ $where .= " AND a.invnumber ILIKE ?";
+ push(@values, $form->like($form->{invnumber}));
}
if ($form->{ordnumber}) {
- my $ordnumber = $form->like(lc $form->{ordnumber});
- $where .= " AND lower(a.ordnumber) LIKE '$ordnumber'";
+ $where .= " AND a.ordnumber ILIKE ?";
+ push(@values, $form->like($form->{ordnumber}));
}
if ($form->{notes}) {
- my $notes = $form->like(lc $form->{notes});
- $where .= " AND lower(a.notes) LIKE '$notes'";
+ $where .= " AND lower(a.notes) LIKE ?";
+ push(@values, $form->like($form->{notes}));
+ }
+ if ($form->{project_id}) {
+ $where .=
+ qq|AND ((a.globalproject_id = ?) OR EXISTS | .
+ qq| (SELECT * FROM invoice i | .
+ qq| WHERE i.project_id = ? AND i.trans_id = a.id))|;
+ push(@values, $form->{project_id}, $form->{project_id});
}
- $where .= " AND a.transdate >= '$form->{transdatefrom}'"
- if $form->{transdatefrom};
- $where .= " AND a.transdate <= '$form->{transdateto}'"
- if $form->{transdateto};
+ if ($form->{transdatefrom}) {
+ $where .= " AND a.transdate >= ?";
+ push(@values, $form->{transdatefrom});
+ }
+ if ($form->{transdateto}) {
+ $where .= " AND a.transdate <= ?";
+ push(@values, $form->{transdateto});
+ }
if ($form->{open} || $form->{closed}) {
unless ($form->{open} && $form->{closed}) {
$where .= " AND a.amount <> a.paid" if ($form->{open});
}
}
+ if ($where) {
+# substr($where, 0, 4) = "WHERE";
+ $query .= $where;
+ }
+
my @a = (transdate, invnumber, name);
push @a, "employee" if $self->{l_employee};
- my $sortorder = join ', ', $form->sort_columns(@a);
- $sortorder = $form->{sort} if $form->{sort};
+ my $sortorder = join(', ', @a);
- $query .= "WHERE $where
- ORDER by $sortorder";
+ if (grep({ $_ eq $form->{sort} }
+ qw(transdate id invnumber ordnumber name netamount tax amount
+ paid datepaid due duedate notes employee))) {
+ $sortorder = $form->{sort};
+ }
+
+ $query .= " ORDER by $sortorder";
my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute(@values) ||
+ $form->dberror($query . " (" . join(", ", @values) . ")");
+ $form->{AP} = [];
while (my $ap = $sth->fetchrow_hashref(NAME_lc)) {
push @{ $form->{AP} }, $ap;
}
my $query =
"SELECT COALESCE(" .
- " (SELECT transdate FROM gl WHERE id = " .
- " (SELECT MAX(id) FROM gl) LIMIT 1), " .
+ " (SELECT transdate FROM ap WHERE id = " .
+ " (SELECT MAX(id) FROM ap) LIMIT 1), " .
" current_date)";
($form->{transdate}) = $dbh->selectrow_array($query);
$main::lxdebug->leave_sub();
}
+sub _delete_payments {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $form, $dbh) = @_;
+
+ my @delete_oids;
+
+ # Delete old payment entries from acc_trans.
+ my $query =
+ qq|SELECT oid
+ FROM acc_trans
+ WHERE (trans_id = ?) AND fx_transaction
+
+ UNION
+
+ SELECT at.oid
+ FROM acc_trans at
+ LEFT JOIN chart c ON (at.chart_id = c.id)
+ WHERE (trans_id = ?) AND (c.link LIKE '%AP_paid%')|;
+ push @delete_oids, selectall_array_query($form, $dbh, $query, conv_i($form->{id}), conv_i($form->{id}));
+
+ $query =
+ qq|SELECT at.oid
+ FROM acc_trans at
+ LEFT JOIN chart c ON (at.chart_id = c.id)
+ WHERE (trans_id = ?)
+ AND ((c.link = 'AP') OR (c.link LIKE '%:AP') OR (c.link LIKE 'AP:%'))
+ ORDER BY at.oid
+ OFFSET 1|;
+ push @delete_oids, selectall_array_query($form, $dbh, $query, conv_i($form->{id}));
+
+ if (@delete_oids) {
+ $query = qq|DELETE FROM acc_trans WHERE oid IN (| . join(", ", @delete_oids) . qq|)|;
+ do_query($form, $dbh, $query);
+ }
+
+ $main::lxdebug->leave_sub();
+}
+
+sub post_payment {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form, $locale) = @_;
+
+ # connect to database, turn off autocommit
+ my $dbh = $form->dbconnect_noauto($myconfig);
+
+ my (%payments, $old_form, $row, $item, $query, %keep_vars);
+
+ $old_form = save_form();
+
+ # Delete all entries in acc_trans from prior payments.
+ $self->_delete_payments($form, $dbh);
+
+ # Save the new payments the user made before cleaning up $form.
+ my $payments_re = '^datepaid_\d+$|^memo_\d+$|^source_\d+$|^exchangerate_\d+$|^paid_\d+$|^paid_project_id_\d+$|^AP_paid_\d+$|^paidaccounts$';
+ map { $payments{$_} = $form->{$_} } grep m/$payments_re/, keys %{ $form };
+
+ # Clean up $form so that old content won't tamper the results.
+ %keep_vars = map { $_, 1 } qw(login password id);
+ map { delete $form->{$_} unless $keep_vars{$_} } keys %{ $form };
+
+ # Retrieve the invoice from the database.
+ $form->create_links('AP', $myconfig, 'vendor', $dbh);
+
+ # Restore the payment options from the user input.
+ map { $form->{$_} = $payments{$_} } keys %payments;
+
+ # Set up the content of $form in the way that AR::post_transaction() expects.
+
+ $self->setup_form($form);
+
+ ($form->{defaultcurrency}) = selectrow_query($form, $dbh, qq|SELECT curr FROM defaults|);
+ $form->{defaultcurrency} = (split m/:/, $form->{defaultcurrency})[0];
+
+ $form->{exchangerate} = $form->format_amount($myconfig, $form->{exchangerate});
+
+ # Get the AP accno.
+ $query =
+ qq|SELECT c.accno
+ FROM acc_trans at
+ LEFT JOIN chart c ON (at.chart_id = c.id)
+ WHERE (trans_id = ?)
+ AND ((c.link = 'AP') OR (c.link LIKE '%:AP') OR (c.link LIKE 'AP:%'))
+ ORDER BY at.oid
+ LIMIT 1|;
+
+ ($form->{APselected}) = selectfirst_array_query($form, $dbh, $query, conv_i($form->{id}));
+
+ # Post the new payments.
+ $self->post_transaction($myconfig, $form, $dbh, 1);
+
+ restore_form($old_form);
+
+ my $rc = $dbh->commit();
+ $dbh->disconnect();
+
+ $main::lxdebug->leave_sub();
+
+ return $rc;
+}
+
+sub setup_form {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $form) = @_;
+
+ my ($exchangerate, $i, $j, $k, $key, $akey, $ref, $index, $taxamount, $totalamount);
+
+ # forex
+ $form->{forex} = $form->{exchangerate};
+ $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
+
+ foreach $key (keys %{ $form->{AP_links} }) {
+ foreach $ref (@{ $form->{AP_links}{$key} }) {
+ if ($key eq "AP_paid") {
+ $form->{"select$key"} .= "<option value=\"$ref->{accno}\">$ref->{accno}--$ref->{description}</option>\n";
+ } else {
+ $form->{"select$key"} .= "<option value=\"$ref->{accno}--$ref->{tax_id}\">$ref->{accno}--$ref->{description}</option>\n";
+ }
+ }
+
+ $form->{$key} = $form->{"select$key"};
+
+ # if there is a value we have an old entry
+ $j = 0;
+ $k = 0;
+
+ for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
+
+ if ($key eq "AP_paid") {
+ $j++;
+ $form->{"AP_paid_$j"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
+ $form->{"paid_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{amount};
+ $form->{"datepaid_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{transdate};
+ $form->{"source_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{source};
+ $form->{"memo_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{memo};
+
+ $form->{"exchangerate_$i"} = $form->{acc_trans}{$key}->[$i - 1]->{exchangerate};
+ $form->{"forex_$j"} = $form->{"exchangerate_$i"};
+ $form->{"AP_paid_$j"} = $form->{acc_trans}{$key}->[$i-1]->{accno};
+ $form->{"paid_project_id_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{project_id};
+ $form->{paidaccounts}++;
+
+ } else {
+ $akey = $key;
+ $akey =~ s/AP_//;
+
+ if (($key eq "AP_tax") || ($key eq "AR_tax")) {
+ $form->{"${key}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
+ $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} = $form->round_amount($form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate, 2);
+
+ if ($form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"} > 0) {
+ $totaltax += $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
+ } else {
+ $totalwithholding += $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
+ $withholdingrate += $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
+ }
+
+ $index = $form->{acc_trans}{$key}->[$i - 1]->{index};
+ $form->{"tax_$index"} = $form->{acc_trans}{$key}->[$i - 1]->{amount} * -1;
+ $totaltax += $form->{"tax_$index"};
+
+ } else {
+ $k++;
+ $form->{"${akey}_$k"} = $form->round_amount($form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate, 2);
+
+ if ($akey eq 'amount') {
+ $form->{rowcount}++;
+ $form->{"${akey}_$i"} *= -1;
+ $totalamount += $form->{"${akey}_$i"};
+ $form->{taxrate} = $form->{acc_trans}{$key}->[$i - 1]->{rate};
+
+ $form->{"projectnumber_$k"} = "$form->{acc_trans}{$key}->[$i-1]->{projectnumber}";
+ $form->{"oldprojectnumber_$k"} = $form->{"projectnumber_$k"};
+ $form->{"project_id_$k"} = "$form->{acc_trans}{$key}->[$i-1]->{project_id}";
+ }
+
+ $form->{"${key}_$k"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
+
+ my $q_description = quotemeta($form->{acc_trans}{$key}->[$i-1]->{description});
+ $form->{"select${key}"} =~
+ m/<option value=\"
+ ($form->{acc_trans}{$key}->[$i-1]->{accno}--[^\"]*)
+ \">
+ $form->{acc_trans}{$key}->[$i-1]->{accno}
+ --
+ ${q_description}
+ <\/option>\n/x;
+ $form->{"${key}_$k"} = $1;
+
+ if ($akey eq "AP") {
+ $form->{APselected} = $form->{acc_trans}{$key}->[$i-1]->{accno};
+
+ } elsif ($akey eq 'amount') {
+ $form->{"${key}_$k"} = $form->{acc_trans}{$key}->[$i-1]->{accno} . "--" . $form->{acc_trans}{$key}->[$i-1]->{id};
+ $form->{"taxchart_$k"} = $form->{acc_trans}{$key}->[$i-1]->{id} . "--" . $form->{acc_trans}{$key}->[$i-1]->{rate};
+ }
+ }
+ }
+ }
+ }
+
+ $form->{taxincluded} = $taxincluded if ($form->{id});
+ $form->{paidaccounts} = 1 if not defined $form->{paidaccounts};
+
+ if ($form->{taxincluded} && $form->{taxrate} && $totalamount) {
+ # add tax to amounts and invtotal
+ for $i (1 .. $form->{rowcount}) {
+ $taxamount = ($totaltax + $totalwithholding) * $form->{"amount_$i"} / $totalamount;
+ $tax = $form->round_amount($taxamount, 2);
+ $diff += ($taxamount - $tax);
+ $form->{"amount_$i"} += $form->{"tax_$i"};
+ }
+
+ $form->{amount_1} += $form->round_amount($diff, 2);
+ }
+
+ $taxamount = $form->round_amount($taxamount, 2);
+ $form->{invtotal} = $totalamount + $totaltax;
+
+ $main::lxdebug->leave_sub();
+}
+
+sub storno {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $form, $myconfig, $id) = @_;
+
+ my ($query, $new_id, $storno_row, $acc_trans_rows);
+ my $dbh = $form->get_standard_dbh($myconfig);
+
+ $query = qq|SELECT nextval('glid')|;
+ ($new_id) = selectrow_query($form, $dbh, $query);
+
+ $query = qq|SELECT * FROM ap WHERE id = ?|;
+ $storno_row = selectfirst_hashref_query($form, $dbh, $query, $id);
+
+ $storno_row->{id} = $new_id;
+ $storno_row->{storno_id} = $id;
+ $storno_row->{storno} = 't';
+ $storno_row->{invnumber} = 'Storno-' . $storno_row->{invnumber};
+ $storno_row->{amount} *= -1;
+ $storno_row->{netamount} *= -1;
+ $storno_row->{paid} = $storno_amount->{amount};
+
+ delete @$storno_row{qw(itime mtime)};
+
+ $query = sprintf 'INSERT INTO ap (%s) VALUES (%s)', join(', ', keys %$storno_row), join(', ', map '?', values %$storno_row);
+ do_query($form, $dbh, $query, (values %$storno_row));
+
+ $query = qq|UPDATE ap SET paid = amount + paid, storno = 't' WHERE id = ?|;
+ do_query($form, $dbh, $query, $id);
+
+ # now copy acc_trans entries
+ $query = qq|SELECT a.*, c.link FROM acc_trans a LEFT JOIN chart c ON a.chart_id = c.id WHERE a.trans_id = ? ORDER BY a.oid|;
+ my $rowref = selectall_hashref_query($form, $dbh, $query, $id);
+
+ # kill all entries containing payments, which are the last 2n rows, of which the last has link =~ /paid/
+ while ($rowref->[-1]{link} =~ /paid/) {
+ splice(@$rowref, -2);
+ }
+
+ for my $row (@$rowref) {
+ delete @$row{qw(itime mtime link)};
+ $query = sprintf 'INSERT INTO acc_trans (%s) VALUES (%s)', join(', ', keys %$row), join(', ', map '?', values %$row);
+ $row->{trans_id} = $new_id;
+ $row->{amount} *= -1;
+ do_query($form, $dbh, $query, (values %$row));
+ }
+
+ $dbh->commit;
+
+ $main::lxdebug->leave_sub();
+}
+
1;
package AR;
use Data::Dumper;
+use SL::DBUtils;
+use SL::MoreCommon;
+
+our (%myconfig, $form);
sub post_transaction {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form) = @_;
+ my ($self, $myconfig, $form, $provided_dbh, $payments_only) = @_;
- my ($null, $taxrate, $amount, $tax, $diff);
+ my ($query, $sth, $null, $taxrate, $amount, $tax);
my $exchangerate = 0;
my $i;
- my $dbh = $form->dbconnect_noauto($myconfig);
-
- if ($form->{currency} eq $form->{defaultcurrency}) {
- $form->{exchangerate} = 1;
- } else {
- $exchangerate =
- $form->check_exchangerate($myconfig, $form->{currency},
- $form->{transdate}, 'buy');
- }
- for $i (1 .. $form->{rowcount}) {
- $form->{AR_amounts}{"amount_$i"} =
- (split(/--/, $form->{"AR_amount_$i"}))[0];
- }
- ($form->{AR_amounts}{receivables}) = split(/--/, $form->{ARselected});
- ($form->{AR}{receivables}) = split(/--/, $form->{ARselected});
+ my @values;
- $form->{exchangerate} =
- ($exchangerate)
- ? $exchangerate
- : $form->parse_amount($myconfig, $form->{exchangerate});
+ my $dbh = $provided_dbh ? $provided_dbh : $form->dbconnect_noauto($myconfig);
+ $form->{defaultcurrency} = $form->get_default_currency($myconfig);
- for $i (1 .. $form->{rowcount}) {
+ # set exchangerate
+ $form->{exchangerate} = ($form->{currency} eq $form->{defaultcurrency}) ? 1 :
+ ( $form->check_exchangerate($myconfig, $form->{currency}, $form->{transdate}, 'buy') ||
+ $form->parse_amount($myconfig, $form->{exchangerate}) );
- $form->{"amount_$i"} =
- $form->round_amount($form->parse_amount($myconfig, $form->{"amount_$i"})
- * $form->{exchangerate},
- 2);
+ # get the charts selected
+ map { ($form->{AR_amounts}{"amount_$_"}) = split /--/, $form->{"AR_amount_$_"} } 1 .. $form->{rowcount};
- $form->{netamount} += $form->{"amount_$i"};
+ $form->{AR_amounts}{receivables} = $form->{ARselected};
+ $form->{AR}{receivables} = $form->{ARselected};
- # parse tax_$i for later
- $form->{"tax_$i"} = $form->parse_amount($myconfig, $form->{"tax_$i"});
+ # parsing
+ for $i (1 .. $form->{rowcount}) {
+ $form->{"amount_$i"} = $form->round_amount($form->parse_amount($myconfig, $form->{"amount_$i"}) * $form->{exchangerate}, 2);
+ $form->{amount} += $form->{"amount_$i"};
+ $form->{"tax_$i"} = $form->parse_amount($myconfig, $form->{"tax_$i"});
}
# this is for ar
-
- $form->{amount} = $form->{netamount};
-
$form->{tax} = 0;
$form->{netamount} = 0;
$form->{total_tax} = 0;
# taxincluded doesn't make sense if there is no amount
+ $form->{taxincluded} = 0 unless $form->{amount};
- $form->{taxincluded} = 0 if ($form->{amount} == 0);
for $i (1 .. $form->{rowcount}) {
- ($form->{"tax_id_$i"}, $NULL) = split /--/, $form->{"taxchart_$i"};
+ ($form->{"tax_id_$i"}) = split /--/, $form->{"taxchart_$i"};
- $query = qq|SELECT c.accno, t.taxkey, t.rate
- FROM tax t LEFT JOIN chart c on (c.id=t.chart_id)
- WHERE t.id=$form->{"tax_id_$i"}
- ORDER BY c.accno|;
+ $query = qq|SELECT c.accno, t.taxkey, t.rate FROM tax t LEFT JOIN chart c ON (c.id = t.chart_id) WHERE t.id = ? ORDER BY c.accno|;
+ ($form->{AR_amounts}{"tax_$i"}, $form->{"taxkey_$i"}, $form->{"taxrate_$i"}) = selectrow_query($form, $dbh, $query, $form->{"tax_id_$i"});
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- ($form->{AR_amounts}{"tax_$i"}, $form->{"taxkey_$i"}, $form->{"taxrate_$i"}) =
- $sth->fetchrow_array;
- $form->{AR_amounts}{"tax_$i"}{taxkey} = $form->{"taxkey_$i"};
- $form->{AR_amounts}{"amount_$i"}{taxkey} = $form->{"taxkey_$i"};
+ $form->{AR_amounts}{"tax_$i"}{taxkey} = $form->{"taxkey_$i"};
+ $form->{AR_amounts}{"amounts_$i"}{taxkey} = $form->{"taxkey_$i"};
- $sth->finish;
if ($form->{taxincluded} *= 1) {
- if (!$form->{"korrektur_$i"}) {
- $tax =
- $form->{"amount_$i"} -
- ($form->{"amount_$i"} / ($form->{"taxrate_$i"} + 1));
- } else {
- $tax = $form->{"tax_$i"};
- }
- $amount = $form->{"amount_$i"} - $tax;
- $form->{"amount_$i"} = $form->round_amount($amount, 2);
- $diff += $amount - $form->{"amount_$i"};
- $form->{"tax_$i"} = $form->round_amount($tax, 2);
- $form->{netamount} += $form->{"amount_$i"};
+ $tax = $form->{"korrektur_$i"}
+ ? $form->{"tax_$i"}
+ : $form->{"amount_$i"} - ($form->{"amount_$i"} / ($form->{"taxrate_$i"} + 1)); # should be same as taxrate * amount / (taxrate + 1)
+ $form->{"amount_$i"} = $form->round_amount($form->{"amount_$i"} - $tax, 2);
+ $form->{"tax_$i"} = $form->round_amount($tax, 2);
} else {
- if (!$form->{"korrektur_$i"}) {
- $form->{"tax_$i"} = $form->{"amount_$i"} * $form->{"taxrate_$i"};
- }
- $form->{"tax_$i"} =
- $form->round_amount($form->{"tax_$i"} * $form->{exchangerate}, 2);
- $form->{netamount} += $form->{"amount_$i"};
+ $form->{"tax_$i"} = $form->{"amount_$i"} * $form->{"taxrate_$i"} unless $form->{"korrektur_$i"};
+ $form->{"tax_$i"} = $form->round_amount($form->{"tax_$i"} * $form->{exchangerate}, 2);
}
-
- $form->{total_tax} += $form->{"tax_$i"};
+ $form->{netamount} += $form->{"amount_$i"};
+ $form->{total_tax} += $form->{"tax_$i"};
}
# adjust paidaccounts if there is no date in the last row
- $form->{paidaccounts}-- unless ($form->{"datepaid_$form->{paidaccounts}"});
- $form->{paid} = 0;
-
- # add payments
- for $i (1 .. $form->{paidaccounts}) {
- $form->{"paid_$i"} =
- $form->round_amount($form->parse_amount($myconfig, $form->{"paid_$i"}),
- 2);
-
- $form->{paid} += $form->{"paid_$i"};
- $form->{datepaid} = $form->{"datepaid_$i"};
+ # this does not apply to stornos, where the paid field is set manually
+ unless ($form->{storno}) {
+ $form->{paidaccounts}-- unless $form->{"datepaid_$form->{paidaccounts}"};
+ $form->{paid} = 0;
+
+ # add payments
+ for $i (1 .. $form->{paidaccounts}) {
+ $form->{"paid_$i"} = $form->round_amount($form->parse_amount($myconfig, $form->{"paid_$i"}), 2);
+ $form->{paid} += $form->{"paid_$i"};
+ $form->{datepaid} = $form->{"datepaid_$i"};
+ }
+ $form->{amount} = $form->{netamount} + $form->{total_tax};
}
-
- $form->{amount} = $form->{netamount} + $form->{total_tax};
- $form->{paid} =
- $form->round_amount($form->{paid} * $form->{exchangerate}, 2);
-
- my ($query, $sth, $null);
+ $form->{paid} = $form->round_amount($form->{paid} * ($form->{exchangerate} || 1), 2);
($null, $form->{employee_id}) = split /--/, $form->{employee};
- unless ($form->{employee_id}) {
- $form->get_employee($dbh);
- }
-
- # if we have an id delete old records
- if ($form->{id}) {
-
- # delete detail records
- $query = qq|DELETE FROM acc_trans WHERE trans_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
-
- } else {
- my $uid = rand() . time;
-
- $uid .= $form->{login};
- $uid = substr($uid, 2, 75);
+ $form->get_employee($dbh) unless $form->{employee_id};
- $query = qq|INSERT INTO ar (invnumber, employee_id)
- VALUES ('$uid', $form->{employee_id})|;
- $dbh->do($query) || $form->dberror($query);
-
- $query = qq|SELECT a.id FROM ar a
- WHERE a.invnumber = '$uid'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($form->{id}) = $sth->fetchrow_array;
- $sth->finish;
+ # if we have an id delete old records else make one
+ if (!$payments_only) {
+ if ($form->{id}) {
+ # delete detail records
+ $query = qq|DELETE FROM acc_trans WHERE trans_id = ?|;
+ do_query($form, $dbh, $query, $form->{id});
+ } else {
+ $query = qq|SELECT nextval('glid')|;
+ ($form->{id}) = selectrow_query($form, $dbh, $query);
+ $query = qq|INSERT INTO ar (id, invnumber, employee_id) VALUES (?, 'dummy', ?)|;
+ do_query($form, $dbh, $query, $form->{id}, $form->{employee_id});
+ $form->{invnumber} = $form->update_defaults($myconfig, "invnumber", $dbh) unless $form->{invnumber};
+ }
}
# update department
($null, $form->{department_id}) = split(/--/, $form->{department});
$form->{department_id} *= 1;
- # escape '
- map { $form->{$_} =~ s/\'/\'\'/g } qw(invnumber ordnumber notes);
-
# record last payment date in ar table
- $form->{datepaid} = $form->{transdate} unless $form->{datepaid};
- my $datepaid = ($form->{paid} != 0) ? qq|'$form->{datepaid}'| : 'NULL';
-
- $query = qq|UPDATE ar set
- invnumber = '$form->{invnumber}',
- ordnumber = '$form->{ordnumber}',
- transdate = '$form->{transdate}',
- customer_id = $form->{customer_id},
- taxincluded = '$form->{taxincluded}',
- amount = $form->{amount},
- duedate = '$form->{duedate}',
- paid = $form->{paid},
- datepaid = $datepaid,
- netamount = $form->{netamount},
- curr = '$form->{currency}',
- notes = '$form->{notes}',
- department_id = $form->{department_id},
- employee_id = $form->{employee_id}
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ $form->{datepaid} ||= $form->{transdate} ;
+ my $datepaid = ($form->{paid} != 0) ? $form->{datepaid} : undef;
# amount for AR account
$form->{receivables} = $form->round_amount($form->{amount}, 2) * -1;
# update exchangerate
- if (($form->{currency} ne $form->{defaultcurrency}) && !$exchangerate) {
- $form->update_exchangerate($dbh, $form->{currency}, $form->{transdate},
- $form->{exchangerate}, 0);
- }
-
- # add individual transactions for AR, amount and taxes
- for $i (1 .. $form->{rowcount}) {
- if ($form->{"amount_$i"} != 0) {
- $project_id = 'NULL';
- if ("amount_$i" =~ /amount_/) {
- if ($form->{"project_id_$i"} && $form->{"projectnumber_$i"}) {
- $project_id = $form->{"project_id_$i"};
- }
- }
- if ("amount_$i" =~ /amount/) {
- $taxkey = $form->{AR_amounts}{"amount_$i"}{taxkey};
- }
-
- # insert detail records in acc_trans
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
- project_id, taxkey)
- VALUES ($form->{id}, (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{AR_amounts}{"amount_$i"}'),
- $form->{"amount_$i"}, '$form->{transdate}', $project_id, '$taxkey')|;
- $dbh->do($query) || $form->dberror($query);
- if ($form->{"tax_$i"} != 0) {
+ $form->update_exchangerate($dbh, $form->{currency}, $form->{transdate}, $form->{exchangerate}, 0)
+ if ($form->{currency} ne $form->{defaultcurrency}) && !$form->check_exchangerate($myconfig, $form->{currency}, $form->{transdate}, 'buy');
+
+ if (!$payments_only) {
+ $query =
+ qq|UPDATE ar set
+ invnumber = ?, ordnumber = ?, transdate = ?, customer_id = ?,
+ taxincluded = ?, amount = ?, duedate = ?, paid = ?, datepaid = ?,
+ netamount = ?, curr = ?, notes = ?, department_id = ?,
+ employee_id = ?, storno = ?, storno_id = ?
+ WHERE id = ?|;
+ my @values = ($form->{invnumber}, $form->{ordnumber}, conv_date($form->{transdate}), conv_i($form->{customer_id}), $form->{taxincluded} ? 't' : 'f', $form->{amount},
+ conv_date($form->{duedate}), $form->{paid}, conv_date($datepaid), $form->{netamount}, $form->{currency}, $form->{notes}, conv_i($form->{department_id}),
+ conv_i($form->{employee_id}), $form->{storno} ? 't' : 'f', $form->{storno_id}, conv_i($form->{id}));
+ do_query($form, $dbh, $query, @values);
+
+ # add individual transactions for AR, amount and taxes
+ for $i (1 .. $form->{rowcount}) {
+ if ($form->{"amount_$i"} != 0) {
+ my $project_id = conv_i($form->{"project_id_$i"});
+ $taxkey = $form->{AR_amounts}{"amounts_$i"}{taxkey};
# insert detail records in acc_trans
- $query =
- qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
- project_id, taxkey)
- VALUES ($form->{id}, (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{AR_amounts}{"tax_$i"}'),
- $form->{"tax_$i"}, '$form->{transdate}', $project_id, '$taxkey')|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey)
+ VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, ?, ?)|;
+ @values = (conv_i($form->{id}), conv_i($form->{AR_amounts}{"amount_$i"}), conv_i($form->{"amount_$i"}), conv_date($form->{transdate}), $project_id, conv_i($taxkey));
+ do_query($form, $dbh, $query, @values);
+
+ if ($form->{"tax_$i"} != 0) {
+ # insert detail records in acc_trans
+ $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey)
+ VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, ?, ?)|;
+ @values = (conv_i($form->{id}), conv_i($form->{AR_amounts}{"tax_$i"}), conv_i($form->{"tax_$i"}), conv_date($form->{transdate}), $project_id, conv_i($taxkey));
+ do_query($form, $dbh, $query, @values);
+ }
}
}
- }
- # add recievables
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
- project_id)
- VALUES ($form->{id}, (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{AR_amounts}{receivables}'),
- $form->{receivables}, '$form->{transdate}', $project_id)|;
- $dbh->do($query) || $form->dberror($query);
+ # add recievables
+ $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey)
+ VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, (SELECT taxkey_id FROM chart WHERE accno = ?))|;
+ @values = (conv_i($form->{id}), $form->{AR_amounts}{receivables}, conv_i($form->{receivables}), conv_date($form->{transdate}), $form->{AR_amounts}{receivables});
+ do_query($form, $dbh, $query, @values);
+ }
# add paid transactions
for my $i (1 .. $form->{paidaccounts}) {
if ($form->{"paid_$i"} != 0) {
+ my $project_id = conv_i($form->{"paid_project_id_$i"});
$form->{"AR_paid_$i"} =~ s/\"//g;
($form->{AR}{"paid_$i"}) = split(/--/, $form->{"AR_paid_$i"});
$form->{"datepaid_$i"} = $form->{transdate}
unless ($form->{"datepaid_$i"});
- $exchangerate = 0;
- if ($form->{currency} eq $form->{defaultcurrency}) {
- $form->{"exchangerate_$i"} = 1;
- } else {
- $exchangerate =
- $form->check_exchangerate($myconfig, $form->{currency},
- $form->{"datepaid_$i"}, 'buy');
-
- $form->{"exchangerate_$i"} =
- ($exchangerate)
- ? $exchangerate
- : $form->parse_amount($myconfig, $form->{"exchangerate_$i"});
- }
+ $form->{"exchangerate_$i"} = ($form->{currency} eq $form->{defaultcurrency}) ? 1 :
+ ( $form->check_exchangerate($myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'buy') ||
+ $form->parse_amount($myconfig, $form->{"exchangerate_$i"}) );
# if there is no amount and invtotal is zero there is no exchangerate
- if ($form->{amount} == 0 && $form->{netamount} == 0) {
- $form->{exchangerate} = $form->{"exchangerate_$i"};
- }
+ $form->{exchangerate} = $form->{"exchangerate_$i"}
+ if ($form->{amount} == 0 && $form->{netamount} == 0);
# receivables amount
- $amount =
- $form->round_amount($form->{"paid_$i"} * $form->{exchangerate}, 2);
-
- if ($form->{receivables} != 0) {
+ $amount = $form->round_amount($form->{"paid_$i"} * $form->{exchangerate}, 2);
+ if ($amount != 0) {
# add receivable
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate)
- VALUES ($form->{id},
- (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{AR}{receivables}'),
- $amount, '$form->{"datepaid_$i"}')|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey)
+ VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, (SELECT taxkey_id FROM chart WHERE accno = ?))|;
+ @values = (conv_i($form->{id}), $form->{AR}{receivables}, $amount, conv_date($form->{"datepaid_$i"}), $project_id, $form->{AR}{receivables});
+ do_query($form, $dbh, $query, @values);
}
- $form->{receivables} = $amount;
-
- $form->{"memo_$i"} =~ s/\'/\'\'/g;
if ($form->{"paid_$i"} != 0) {
-
+ my $project_id = conv_i($form->{"paid_project_id_$i"});
# add payment
$amount = $form->{"paid_$i"} * -1;
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate, source, memo)
- VALUES ($form->{id},
- (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{AR}{"paid_$i"}'),
- $amount, '$form->{"datepaid_$i"}',
- '$form->{"source_$i"}', '$form->{"memo_$i"}')|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, source, memo, project_id, taxkey)
+ VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, ?, (SELECT taxkey_id FROM chart WHERE accno = ?))|;
+ @values = (conv_i($form->{id}), $form->{AR}{"paid_$i"}, $amount, conv_date($form->{"datepaid_$i"}), $form->{"source_$i"}, $form->{"memo_$i"}, $project_id, $form->{AR}{"paid_$i"});
+ do_query($form, $dbh, $query, @values);
# exchangerate difference for payment
- $amount =
- $form->round_amount(
- $form->{"paid_$i"} * ($form->{"exchangerate_$i"} - 1) * -1,
- 2);
+ $amount = $form->round_amount( $form->{"paid_$i"} * ($form->{"exchangerate_$i"} - 1) * -1, 2);
if ($amount != 0) {
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate, fx_transaction, cleared)
- VALUES ($form->{id},
- (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{AR}{"paid_$i"}'),
- $amount, '$form->{"datepaid_$i"}', '1', '0')|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey)
+ VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 't', 'f', ?, (SELECT taxkey_id FROM chart WHERE accno = ?))|;
+ @values = (conv_i($form->{id}), $form->{AR}{"paid_$i"}, $amount, conv_date($form->{"datepaid_$i"}), $project_id, $form->{AR}{"paid_$i"});
+ do_query($form, $dbh, $query, @values);
}
# exchangerate gain/loss
- $amount =
- $form->round_amount(
- $form->{"paid_$i"} *
- ($form->{exchangerate} - $form->{"exchangerate_$i"}) * -1,
- 2);
+ $amount = $form->round_amount( $form->{"paid_$i"} * ($form->{exchangerate} - $form->{"exchangerate_$i"}) * -1, 2);
if ($amount != 0) {
- $accno =
- ($amount > 0) ? $form->{fxgain_accno} : $form->{fxloss_accno};
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate, fx_transaction, cleared)
- VALUES ($form->{id}, (SELECT c.id FROM chart c
- WHERE c.accno = '$accno'),
- $amount, '$form->{"datepaid_$i"}', '1', '0')|;
- $dbh->do($query) || $form->dberror($query);
+ $accno = ($amount > 0) ? $form->{fxgain_accno} : $form->{fxloss_accno};
+ $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey)
+ VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 't', 'f', ?, (SELECT taxkey_id FROM chart WHERE accno = ?))|;
+ @values = (conv_i($form->{id}), $accno, $amount, conv_date($form->{"datepaid_$i"}), $project_id, $accno);
+ do_query($form, $dbh, $query, @values);
}
}
# update exchangerate record
- if (($form->{currency} ne $form->{defaultcurrency}) && !$exchangerate) {
- $form->update_exchangerate($dbh, $form->{currency},
- $form->{"datepaid_$i"},
- $form->{"exchangerate_$i"}, 0);
- }
+ $form->update_exchangerate($dbh, $form->{currency}, $form->{"datepaid_$i"}, $form->{"exchangerate_$i"}, 0)
+ if ($form->{currency} ne $form->{defaultcurrency}) && !$form->check_exchangerate($myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'buy');
}
}
- my $rc = $dbh->commit;
- $dbh->disconnect;
+ my $rc = 1;
+ if (!$provided_dbh) {
+ $rc = $dbh->commit();
+ $dbh->disconnect();
+ }
+
+ $main::lxdebug->leave_sub() and return $rc;
+}
+
+sub _delete_payments {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $form, $dbh) = @_;
+
+ my @delete_oids;
+
+ # Delete old payment entries from acc_trans.
+ my $query =
+ qq|SELECT oid
+ FROM acc_trans
+ WHERE (trans_id = ?) AND fx_transaction
+
+ UNION
+
+ SELECT at.oid
+ FROM acc_trans at
+ LEFT JOIN chart c ON (at.chart_id = c.id)
+ WHERE (trans_id = ?) AND (c.link LIKE '%AR_paid%')|;
+ push @delete_oids, selectall_array_query($form, $dbh, $query, conv_i($form->{id}), conv_i($form->{id}));
+
+ $query =
+ qq|SELECT at.oid
+ FROM acc_trans at
+ LEFT JOIN chart c ON (at.chart_id = c.id)
+ WHERE (trans_id = ?)
+ AND ((c.link = 'AR') OR (c.link LIKE '%:AR') OR (c.link LIKE 'AR:%'))
+ ORDER BY at.oid
+ OFFSET 1|;
+ push @delete_oids, selectall_array_query($form, $dbh, $query, conv_i($form->{id}));
+
+ if (@delete_oids) {
+ $query = qq|DELETE FROM acc_trans WHERE oid IN (| . join(", ", @delete_oids) . qq|)|;
+ do_query($form, $dbh, $query);
+ }
+
+ $main::lxdebug->leave_sub();
+}
+
+sub post_payment {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form, $locale) = @_;
+
+ # connect to database, turn off autocommit
+ my $dbh = $form->dbconnect_noauto($myconfig);
+
+ my (%payments, $old_form, $row, $item, $query, %keep_vars);
+
+ $old_form = save_form();
+
+ # Delete all entries in acc_trans from prior payments.
+ $self->_delete_payments($form, $dbh);
+
+ # Save the new payments the user made before cleaning up $form.
+ my $payments_re = '^datepaid_\d+$|^memo_\d+$|^source_\d+$|^exchangerate_\d+$|^paid_\d+$|^paid_project_id_\d+$|^AR_paid_\d+$|^paidaccounts$';
+ map { $payments{$_} = $form->{$_} } grep m/$payments_re/, keys %{ $form };
+
+ # Clean up $form so that old content won't tamper the results.
+ %keep_vars = map { $_, 1 } qw(login password id);
+ map { delete $form->{$_} unless $keep_vars{$_} } keys %{ $form };
+
+ # Retrieve the invoice from the database.
+ $form->create_links('AR', $myconfig, 'customer', $dbh);
+
+ # Restore the payment options from the user input.
+ map { $form->{$_} = $payments{$_} } keys %payments;
+
+ # Set up the content of $form in the way that AR::post_transaction() expects.
+
+ $self->setup_form($form);
+
+ ($form->{defaultcurrency}) = selectrow_query($form, $dbh, qq|SELECT curr FROM defaults|);
+ $form->{defaultcurrency} = (split m/:/, $form->{defaultcurrency})[0];
+
+ $form->{exchangerate} = $form->format_amount($myconfig, $form->{exchangerate});
+
+ # Get the AR accno (which is normally done by Form::create_links()).
+ $query =
+ qq|SELECT c.accno
+ FROM acc_trans at
+ LEFT JOIN chart c ON (at.chart_id = c.id)
+ WHERE (trans_id = ?)
+ AND ((c.link = 'AR') OR (c.link LIKE '%:AR') OR (c.link LIKE 'AR:%'))
+ ORDER BY at.oid
+ LIMIT 1|;
+
+ ($form->{ARselected}) = selectfirst_array_query($form, $dbh, $query, conv_i($form->{id}));
+
+ # Post the new payments.
+ $self->post_transaction($myconfig, $form, $dbh, 1);
+
+ restore_form($old_form);
+
+ my $rc = $dbh->commit();
+ $dbh->disconnect();
$main::lxdebug->leave_sub();
# connect to database, turn AutoCommit off
my $dbh = $form->dbconnect_noauto($myconfig);
- my $query = qq|DELETE FROM ar WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ my $query = qq|DELETE FROM ar WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{id});
- $query = qq|DELETE FROM acc_trans WHERE trans_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|DELETE FROM acc_trans WHERE trans_id = ?|;
+ do_query($form, $dbh, $query, $form->{id});
# commit
my $rc = $dbh->commit;
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT a.id, a.invnumber, a.ordnumber, a.transdate,
- a.duedate, a.netamount, a.amount, a.paid, c.name,
- a.invoice, a.datepaid, a.terms, a.notes, a.shipvia,
- a.shippingpoint, a.storno,
- e.name AS employee
- FROM ar a
- JOIN customer c ON (a.customer_id = c.id)
- LEFT JOIN employee e ON (a.employee_id = e.id)|;
+ my @values;
+
+ my $query =
+ qq|SELECT a.id, a.invnumber, a.ordnumber, a.transdate, | .
+ qq| a.duedate, a.netamount, a.amount, a.paid, | .
+ qq| a.invoice, a.datepaid, a.terms, a.notes, a.shipvia, | .
+ qq| a.shippingpoint, a.storno, a.storno_id, a.globalproject_id, | .
+ qq| a.marge_total, a.marge_percent, | .
+ qq| a.transaction_description, | .
+ qq| pr.projectnumber AS globalprojectnumber, | .
+ qq| c.name, | .
+ qq| e.name AS employee | .
+ qq|FROM ar a | .
+ qq|JOIN customer c ON (a.customer_id = c.id) | .
+ qq|LEFT JOIN employee e ON (a.employee_id = e.id) | .
+ qq|LEFT JOIN project pr ON (a.globalproject_id = pr.id)|;
my $where = "1 = 1";
if ($form->{customer_id}) {
- $where .= " AND a.customer_id = $form->{customer_id}";
- } else {
- if ($form->{customer}) {
- my $customer = $form->like(lc $form->{customer});
- $where .= " AND lower(c.name) LIKE '$customer'";
- }
+ $where .= " AND a.customer_id = ?";
+ push(@values, $form->{customer_id});
+ } elsif ($form->{customer}) {
+ $where .= " AND c.name ILIKE ?";
+ push(@values, $form->like($form->{customer}));
}
if ($form->{department}) {
my ($null, $department_id) = split /--/, $form->{department};
- $where .= " AND a.department_id = $department_id";
- }
- if ($form->{invnumber}) {
- my $invnumber = $form->like(lc $form->{invnumber});
- $where .= " AND lower(a.invnumber) LIKE '$invnumber'";
+ $where .= " AND a.department_id = ?";
+ push(@values, $department_id);
}
- if ($form->{ordnumber}) {
- my $ordnumber = $form->like(lc $form->{ordnumber});
- $where .= " AND lower(a.ordnumber) LIKE '$ordnumber'";
+ foreach my $column (qw(invnumber ordnumber notes transaction_description)) {
+ if ($form->{$column}) {
+ $where .= " AND a.$column ILIKE ?";
+ push(@values, $form->like($form->{$column}));
+ }
}
- if ($form->{notes}) {
- my $notes = $form->like(lc $form->{notes});
- $where .= " AND lower(a.notes) LIKE '$notes'";
+ if ($form->{"project_id"}) {
+ $where .=
+ qq|AND ((a.globalproject_id = ?) OR EXISTS | .
+ qq| (SELECT * FROM invoice i | .
+ qq| WHERE i.project_id = ? AND i.trans_id = a.id))|;
+ push(@values, $form->{"project_id"}, $form->{"project_id"});
}
- $where .= " AND a.transdate >= '$form->{transdatefrom}'"
- if $form->{transdatefrom};
- $where .= " AND a.transdate <= '$form->{transdateto}'"
- if $form->{transdateto};
+ if ($form->{transdatefrom}) {
+ $where .= " AND a.transdate >= ?";
+ push(@values, $form->{transdatefrom});
+ }
+ if ($form->{transdateto}) {
+ $where .= " AND a.transdate <= ?";
+ push(@values, $form->{transdateto});
+ }
if ($form->{open} || $form->{closed}) {
unless ($form->{open} && $form->{closed}) {
$where .= " AND a.amount <> a.paid" if ($form->{open});
my @a = (transdate, invnumber, name);
push @a, "employee" if $form->{l_employee};
- my $sortorder = join ', ', $form->sort_columns(@a);
- $sortorder = $form->{sort} if $form->{sort};
+ my $sortorder = join(', ', @a);
+
+ if (grep({ $_ eq $form->{sort} }
+ qw(id transdate duedate invnumber ordnumber name
+ datepaid employee shippingpoint shipvia))) {
+ $sortorder = $form->{sort};
+ }
- $query .= "WHERE $where
- ORDER by $sortorder";
+ $query .= " WHERE $where ORDER by $sortorder";
my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute(@values) ||
+ $form->dberror($query . " (" . join(", ", @values) . ")");
+ $form->{AR} = [];
while (my $ar = $sth->fetchrow_hashref(NAME_lc)) {
push @{ $form->{AR} }, $ar;
}
my $query =
"SELECT COALESCE(" .
- " (SELECT transdate FROM gl WHERE id = " .
- " (SELECT MAX(id) FROM gl) LIMIT 1), " .
+ " (SELECT transdate FROM ar WHERE id = " .
+ " (SELECT MAX(id) FROM ar) LIMIT 1), " .
" current_date)";
($form->{transdate}) = $dbh->selectrow_array($query);
$main::lxdebug->leave_sub();
}
+sub setup_form {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $form) = @_;
+
+ my ($exchangerate, $key, $akey, $i, $j, $k, $index, $taxamount, $totaltax, $taxrate, $diff);
+
+ # forex
+ $form->{forex} = $form->{exchangerate};
+ $exchangerate = $form->{exchangerate} ? $form->{exchangerate} : 1;
+
+ foreach $key (keys %{ $form->{AR_links} }) {
+ # if there is a value we have an old entry
+ $j = 0;
+ $k = 0;
+
+ for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
+ if ($key eq "AR_paid") {
+ $j++;
+ $form->{"AR_paid_$j"} = $form->{acc_trans}{$key}->[$i-1]->{accno};
+
+ # reverse paid
+ $form->{"paid_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{amount} * -1;
+ $form->{"datepaid_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{transdate};
+ $form->{"source_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{source};
+ $form->{"memo_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{memo};
+ $form->{"forex_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{exchangerate};
+ $form->{"exchangerate_$i"} = $form->{"forex_$j"};
+ $form->{"paid_project_id_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{project_id};
+ $form->{paidaccounts}++;
+
+ } else {
+
+ $akey = $key;
+ $akey =~ s/AR_//;
+
+ if ($key eq "AR_tax" || $key eq "AP_tax") {
+ $form->{"${key}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
+ $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} = $form->round_amount($form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate, 2);
+
+ if ($form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"} > 0) {
+ $totaltax += $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
+ $taxrate += $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
+
+ } else {
+ $totalwithholding += $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
+ $withholdingrate += $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
+ }
+
+ $index = $form->{acc_trans}{$key}->[$i - 1]->{index};
+ $form->{"tax_$index"} = $form->{acc_trans}{$key}->[$i - 1]->{amount};
+ $totaltax += $form->{"tax_$index"};
+
+ } else {
+ $k++;
+ $form->{"${akey}_$k"} = $form->round_amount($form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate, 2);
+
+ if ($akey eq 'amount') {
+ $form->{rowcount}++;
+ $totalamount += $form->{"${akey}_$i"};
+
+ $form->{"oldprojectnumber_$k"} = $form->{acc_trans}{$key}->[$i-1]->{projectnumber};
+ $form->{"projectnumber_$k"} = $form->{acc_trans}{$key}->[$i-1]->{projectnumber};
+ $form->{taxrate} = $form->{acc_trans}{$key}->[$i - 1]->{rate};
+ $form->{"project_id_$k"} = $form->{acc_trans}{$key}->[$i-1]->{project_id};
+ }
+
+ $form->{"${key}_$i"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
+
+ if ($akey eq "AR") {
+ $form->{ARselected} = $form->{acc_trans}{$key}->[$i-1]->{accno};
+
+ } elsif ($akey eq "amount") {
+ $form->{"${key}_$k"} = $form->{acc_trans}{$key}->[$i-1]->{accno} . "--" . $form->{acc_trans}{$key}->[$i-1]->{id};
+ $form->{"taxchart_$k"} = $form->{acc_trans}{$key}->[$i-1]->{id} . "--" . $form->{acc_trans}{$key}->[$i-1]->{rate};
+ }
+ }
+ }
+ }
+ }
+
+ $form->{taxincluded} = $taxincluded if ($form->{id});
+ $form->{paidaccounts} = 1 if not defined $form->{paidaccounts};
+
+ if ($form->{taxincluded} && $form->{taxrate} && $totalamount) {
+
+ # add tax to amounts and invtotal
+ for $i (1 .. $form->{rowcount}) {
+ $taxamount = ($totaltax + $totalwithholding) * $form->{"amount_$i"} / $totalamount;
+ $tax = $form->round_amount($taxamount, 2);
+ $diff += ($taxamount - $tax);
+ $form->{"amount_$i"} += $form->{"tax_$i"};
+ }
+ $form->{amount_1} += $form->round_amount($diff, 2);
+ }
+
+ $taxamount = $form->round_amount($taxamount, 2);
+ $form->{tax} = $taxamount;
+
+ $form->{invtotal} = $totalamount + $totaltax;
+
+ $main::lxdebug->leave_sub();
+}
+
+sub storno {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $form, $myconfig, $id) = @_;
+
+ my ($query, $new_id, $storno_row, $acc_trans_rows);
+ my $dbh = $form->get_standard_dbh($myconfig);
+
+ $query = qq|SELECT nextval('glid')|;
+ ($new_id) = selectrow_query($form, $dbh, $query);
+
+ $query = qq|SELECT * FROM ar WHERE id = ?|;
+ $storno_row = selectfirst_hashref_query($form, $dbh, $query, $id);
+
+ $storno_row->{id} = $new_id;
+ $storno_row->{storno_id} = $id;
+ $storno_row->{storno} = 't';
+ $storno_row->{invnumber} = 'Storno-' . $storno_row->{invnumber};
+ $storno_row->{amount} *= -1;
+ $storno_row->{netamount} *= -1;
+ $storno_row->{paid} = $storno_amount->{amount};
+
+ delete @$storno_row{qw(itime mtime)};
+
+ $query = sprintf 'INSERT INTO ar (%s) VALUES (%s)', join(', ', keys %$storno_row), join(', ', map '?', values %$storno_row);
+ do_query($form, $dbh, $query, (values %$storno_row));
+
+ $query = qq|UPDATE ar SET paid = amount + paid, storno = 't' WHERE id = ?|;
+ do_query($form, $dbh, $query, $id);
+
+ # now copy acc_trans entries
+ $query = qq|SELECT a.*, c.link FROM acc_trans a LEFT JOIN chart c ON a.chart_id = c.id WHERE a.trans_id = ? ORDER BY a.oid|;
+ my $rowref = selectall_hashref_query($form, $dbh, $query, $id);
+
+ # kill all entries containing payments, which are the last 2n rows, of which the last has link =~ /paid/
+ while ($rowref->[-1]{link} =~ /paid/) {
+ splice(@$rowref, -2);
+ }
+
+ for my $row (@$rowref) {
+ delete @$row{qw(itime mtime link)};
+ $query = sprintf 'INSERT INTO acc_trans (%s) VALUES (%s)', join(', ', keys %$row), join(', ', map '?', values %$row);
+ $row->{trans_id} = $new_id;
+ $row->{amount} *= -1;
+ do_query($form, $dbh, $query, (values %$row));
+ }
+
+ $dbh->commit;
+
+ $main::lxdebug->leave_sub();
+}
+
+
1;
package BP;
+use SL::DBUtils;
+
sub get_vc {
$main::lxdebug->enter_sub();
check => 'ap',
receipt => 'ar');
- $query = qq|SELECT count(*)
- FROM (SELECT DISTINCT ON (vc.id) vc.id
- FROM $form->{vc} vc, $arap{$form->{type}} a, status s
- WHERE a.$form->{vc}_id = vc.id
- AND s.trans_id = a.id
- AND s.formname = '$form->{type}'
- AND s.spoolfile IS NOT NULL) AS total|;
+ my $vc = $form->{vc} eq "customer" ? "customer" : "vendor";
+ my $arap_type = defined($arap{$form->{type}}) ? $arap{$form->{type}} : 'ar';
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- my ($count) = $sth->fetchrow_array;
- $sth->finish;
+ $query =
+ qq|SELECT count(*) | .
+ qq|FROM (SELECT DISTINCT ON (vc.id) vc.id FROM $vc vc, $arap_type a, status s | .
+ qq| WHERE a.${vc}_id = vc.id AND s.trans_id = a.id AND s.formname = ? | .
+ qq| AND s.spoolfile IS NOT NULL) AS total|;
+
+ my ($count) = selectrow_query($form, $dbh, $query, $form->{type});
# build selection list
if ($count < $myconfig->{vclimit}) {
- $query = qq|SELECT DISTINCT ON (vc.id) vc.id, vc.name
- FROM $form->{vc} vc, $arap{$form->{type}} a, status s
- WHERE a.$form->{vc}_id = vc.id
- AND s.trans_id = a.id
- AND s.formname = '$form->{type}'
- AND s.spoolfile IS NOT NULL|;
- }
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{"all_$form->{vc}"} }, $ref;
+ $query =
+ qq|SELECT DISTINCT ON (vc.id) vc.id, vc.name | .
+ qq|FROM $vc vc, $arap_type a, status s | .
+ qq|WHERE a.${vc}_id = vc.id AND s.trans_id = a.id AND s.formname = ? | .
+ qq| AND s.spoolfile IS NOT NULL|;
+
+ $sth = $dbh->prepare($query);
+ $sth->execute($form->{type}) || $form->dberror($query . " ($form->{type})");
+
+ $form->{"all_${vc}"} = [];
+ while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
+ push @{ $form->{"all_${vc}"} }, $ref;
+ }
+ $sth->finish;
}
- $sth->finish;
$dbh->disconnect;
$main::lxdebug->leave_sub();
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT DISTINCT ON (s.chart_id) c.accno, c.description
- FROM status s, chart c
- WHERE s.chart_id = c.id
- AND s.formname = '$form->{type}'|;
+ my $query =
+ qq|SELECT DISTINCT ON (s.chart_id) c.accno, c.description | .
+ qq|FROM status s, chart c | .
+ qq|WHERE s.chart_id = c.id AND s.formname = ?|;
my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute($form->{type}) || $form->dberror($query . " ($form->{type})");
+ $form->{accounts} = [];
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
push @{ $form->{accounts} }, $ref;
}
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my ($query, $arap);
+ my ($query, $arap, @values);
my $invnumber = "invnumber";
+ my $vc = $form->{vc} eq "customer" ? "customer" : "vendor";
+
if ($form->{type} eq 'check' || $form->{type} eq 'receipt') {
$arap = ($form->{type} eq 'check') ? "ap" : "ar";
my ($accno) = split /--/, $form->{account};
- $query = qq|SELECT a.id, s.spoolfile, vc.name, ac.transdate, a.invnumber,
- a.invoice, '$arap' AS module
- FROM status s, chart c, $form->{vc} vc, $arap a, acc_trans ac
- WHERE s.formname = '$form->{type}'
- AND s.chart_id = c.id
- AND c.accno = '$accno'
- AND s.trans_id = a.id
- AND a.$form->{vc}_id = vc.id
- AND ac.trans_id = s.trans_id
- AND ac.chart_id = c.id
- AND NOT ac.fx_transaction|;
- } else {
+ $query =
+ qq|SELECT a.id, s.spoolfile, vc.name, ac.transdate, a.invnumber, | .
+ qq| a.invoice, '$arap' AS module | .
+ qq|FROM status s, chart c, $vc vc, $arap a, acc_trans ac | .
+ qq|WHERE s.formname = ? | .
+ qq| AND s.chart_id = c.id | .
+ qq| AND c.accno = ? | .
+ qq| AND s.trans_id = a.id | .
+ qq| AND a.${vc}_id = vc.id | .
+ qq| AND ac.trans_id = s.trans_id | .
+ qq| AND ac.chart_id = c.id | .
+ qq| AND NOT ac.fx_transaction|;
+ @values = ($form->{type}, $accno);
+ } else {
$arap = "ar";
my $invoice = "a.invoice";
$invoice = '0';
}
- $query = qq|SELECT a.id, a.$invnumber AS invnumber, a.ordnumber,
- a.quonumber, a.transdate, $invoice AS invoice,
- '$arap' AS module, vc.name, s.spoolfile
- FROM $arap a, $form->{vc} vc, status s
- WHERE s.trans_id = a.id
- AND s.spoolfile IS NOT NULL
- AND s.formname = '$form->{type}'
- AND a.$form->{vc}_id = vc.id|;
+ $query =
+ qq|SELECT a.id, a.$invnumber AS invnumber, a.ordnumber, a.quonumber, | .
+ qq| a.transdate, $invoice AS invoice, '$arap' AS module, vc.name, | .
+ qq| s.spoolfile | .
+ qq|FROM $arap a, ${vc} vc, status s | .
+ qq|WHERE s.trans_id = a.id | .
+ qq| AND s.spoolfile IS NOT NULL | .
+ qq| AND s.formname = ? | .
+ qq| AND a.${vc}_id = vc.id|;
+ @values = ($form->{type});
}
- if ($form->{"$form->{vc}_id"}) {
- $query .= qq| AND a.$form->{vc}_id = $form->{"$form->{vc}_id"}|;
- } else {
- if ($form->{ $form->{vc} }) {
- my $name = $form->like(lc $form->{ $form->{vc} });
- $query .= " AND lower(vc.name) LIKE '$name'";
- }
- }
- if ($form->{invnumber}) {
- my $number = $form->like(lc $form->{invnumber});
- $query .= " AND lower(a.invnumber) LIKE '$number'";
+ if ($form->{"${vc}_id"}) {
+ $query .= qq| AND a.${vc}_id = ?|;
+ push(@values, conv_i($form->{"${vc}_id"}));
+ } elsif ($form->{ $vc }) {
+ $query .= " AND vc.name ILIKE ?";
+ push(@values, $form->like($form->{ $vc }));
}
- if ($form->{ordnumber}) {
- my $ordnumber = $form->like(lc $form->{ordnumber});
- $query .= " AND lower(a.ordnumber) LIKE '$ordnumber'";
- }
- if ($form->{quonumber}) {
- my $quonumber = $form->like(lc $form->{quonumber});
- $query .= " AND lower(a.quonumber) LIKE '$quonumber'";
+ foreach my $column (qw(invnumber ordnumber quonumber)) {
+ if ($form->{$column}) {
+ $query .= " AND a.$column ILIKE ?";
+ push(@values, $form->like($form->{$column}));
+ }
}
if ($form->{type} =~ /(invoice|sales_order|sales_quotation|packing_list|puchase_order|request_quotation)$/) {
- $query .= " AND a.transdate >= '$form->{transdatefrom}'" if $form->{transdatefrom};
- $query .= " AND a.transdate <= '$form->{transdateto}'" if $form->{transdateto};
+ if ($form->{transdatefrom}) {
+ $query .= " AND a.transdate >= ?";
+ push(@values, $form->{transdatefrom});
+ }
+ if ($form->{transdateto}) {
+ $query .= " AND a.transdate <= ?";
+ push(@values, $form->{transdateto});
+ }
}
my @a = (transdate, $invnumber, name);
my $sortorder = join ', ', $form->sort_columns(@a);
- $sortorder = $form->{sort} if $form->{sort};
- $query .= " ORDER by $sortorder";
+ if (grep({ $_ eq $form->{sort} }
+ qw(transdate invnumber ordnumber quonumber name))) {
+ $sortorder = $form->{sort};
+ }
+
+ $query .= " ORDER BY $sortorder";
my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute(@values) ||
+ $form->dberror($query . " (" . join(", ", @values) . ")");
+ $form->{SPOOL} = [];
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
push @{ $form->{SPOOL} }, $ref;
}
my $query;
if ($form->{type} =~ /(check|receipt)/) {
- $query = qq|DELETE FROM status
- WHERE spoolfile = ?|;
+ $query = qq|DELETE FROM status WHERE spoolfile = ?|;
} else {
- $query = qq|UPDATE status SET
- spoolfile = NULL,
- printed = '1'
- WHERE spoolfile = ?|;
+ $query =
+ qq|UPDATE status SET spoolfile = NULL, printed = '1' | .
+ qq|WHERE spoolfile = ?|;
}
my $sth = $dbh->prepare($query) || $form->dberror($query);
if ($rc) {
foreach my $i (1 .. $form->{rowcount}) {
- $_ = qq|$spool/$form->{"spoolfile_$i"}|;
if ($form->{"checked_$i"}) {
- unlink;
+ unlink(qq|$spool/$form->{"spoolfile_$i"}|);
}
}
}
sub print_spool {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form, $spool) = @_;
+ my ($self, $myconfig, $form, $spool, $output) = @_;
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|UPDATE status SET
- printed = '1'
- WHERE formname = '$form->{type}'
- AND spoolfile = ?|;
+ my $query =
+ qq|UPDATE status SET printed = '1' | .
+ qq|WHERE formname = ? AND spoolfile = ?|;
my $sth = $dbh->prepare($query) || $form->dberror($query);
foreach my $i (1 .. $form->{rowcount}) {
if ($form->{"checked_$i"}) {
- open(OUT, $form->{OUT}) or $form->error("$form->{OUT} : $!");
+ # $output is safe ( = does not come directly from the browser).
+ open(OUT, $output) or $form->error("$output : $!");
+ $form->{"spoolfile_$i"} =~ s|.*/||;
$spoolfile = qq|$spool/$form->{"spoolfile_$i"}|;
# send file to printer
close(IN);
close(OUT);
- $sth->execute($form->{"spoolfile_$i"}) || $form->dberror($query);
+ $sth->execute($form->{type}, $form->{"spoolfile_$i"}) ||
+ $form->dberror($query . " ($form->{type}, " . $form->{"spoolfile_$i"} . ")");
$sth->finish;
}
package CA;
use Data::Dumper;
+use SL::DBUtils;
sub all_accounts {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form) = @_;
+ my ($self, $myconfig, $form, $chart_id) = @_;
- my $amount = ();
+ my %amount;
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT c.accno,
- SUM(a.amount) AS amount
- FROM chart c, acc_trans a
- WHERE c.id = a.chart_id
- GROUP BY c.accno|;
+ my $query =
+ qq|SELECT c.accno, SUM(a.amount) AS amount | .
+ qq|FROM chart c, acc_trans a | .
+ qq|WHERE c.id = a.chart_id | .
+ qq|GROUP BY c.accno|;
my $sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
}
$sth->finish;
- $query = qq|SELECT accno, description
- FROM gifi|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my $gifi = ();
- while (my ($accno, $description) = $sth->fetchrow_array) {
- $gifi{$accno} = $description;
- }
- $sth->finish;
-
- $query = qq|SELECT c.id, c.accno, c.description, c.charttype, c.gifi_accno,
- c.category, c.link
- FROM chart c
- ORDER BY accno|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $where = "AND c.id = $chart_id" if ($chart_id ne '');
+
+ $query = qq{
+ SELECT
+ c.accno,
+ c.id,
+ c.description,
+ c.charttype,
+ c.category,
+ c.link,
+ c.pos_bwa,
+ c.pos_bilanz,
+ c.pos_eur,
+ c.valid_from,
+ c.datevautomatik,
+ comma(tk.startdate) AS startdate,
+ comma(tk.taxkey_id) AS taxkey,
+ comma(tx.taxdescription || to_char (tx.rate, '99V99' ) || '%') AS taxdescription,
+ comma(tx.taxnumber) AS taxaccount,
+ comma(tk.pos_ustva) AS tk_ustva,
+ ( SELECT accno
+ FROM chart c2
+ WHERE c2.id = c.id
+ ) AS new_account
+ FROM chart c
+ LEFT JOIN taxkeys tk ON (c.id = tk.chart_id)
+ LEFT JOIN tax tx ON (tk.tax_id = tx.id)
+ WHERE 1=1
+ $where
+ GROUP BY c.accno, c.id, c.description, c.charttype, c.gifi_accno,
+ c.category, c.link, c.pos_bwa, c.pos_bilanz, c.pos_eur, c.valid_from,
+ c.datevautomatik
+ ORDER BY c.accno
+ };
+
+ my $sth = prepare_execute_query($form, $dbh, $query);
+
+ $form->{CA} = [];
while (my $ca = $sth->fetchrow_hashref(NAME_lc)) {
- $ca->{amount} = $amount{ $ca->{accno} };
- $ca->{gifi_description} = $gifi{ $ca->{gifi_accno} };
+ $ca->{amount} = $amount{ $ca->{accno} };
if ($ca->{amount} < 0) {
$ca->{debit} = $ca->{amount} * -1;
} else {
$ca->{credit} = $ca->{amount};
}
- push @{ $form->{CA} }, $ca;
+ push(@{ $form->{CA} }, $ca);
}
$sth->finish;
my $dbh = $form->dbconnect($myconfig);
# get chart_id
- my $query = qq|SELECT c.id FROM chart c
- WHERE c.accno = '$form->{accno}'|;
- if ($form->{accounttype} eq 'gifi') {
- $query = qq|SELECT c.id FROM chart c
- WHERE c.gifi_accno = '$form->{gifi_accno}'|;
- }
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my @id = ();
- while (my ($id) = $sth->fetchrow_array) {
- push @id, $id;
- }
- $sth->finish;
+ my $query = qq|SELECT id FROM chart WHERE accno = ?|;
+ my @id = selectall_array_query($form, $dbh, $query, $form->{accno});
my $fromdate_where;
my $todate_where;
- my $where = '1 = 1';
+ my $where = qq|1 = 1|;
# build WHERE clause from dates if any
# if ($form->{fromdate}) {
# $where .= " AND ac.transdate <= '$form->{todate}'";
# }
+ my (@values, @where_values, @subwhere_values);
if ($form->{fromdate}) {
- $fromto = " AND ac.transdate >= '$form->{fromdate}'";
- $subwhere .= " AND transdate >= '$form->{fromdate}'";
- $glwhere = " AND ac.transdate >= '$form->{fromdate}'";
+ $where .= qq| AND ac.transdate >= ?|;
+ $subwhere .= qq| AND transdate >= ?|;
+ push(@where_values, conv_date($form->{fromdate}));
+ push(@subwhere_values, conv_date($form->{fromdate}));
}
if ($form->{todate}) {
- $fromto .= " AND ac.transdate <= '$form->{todate}'";
- $subwhere .= " AND transdate <= '$form->{todate}'";
- $glwhere .= " AND ac.transdate <= '$form->{todate}'";
+ $where .= qq| AND ac.transdate <= ?|;
+ $subwhere .= qq| AND transdate <= ?|;
+ push(@where_values, conv_date($form->{todate}));
+ push(@subwhere_values, conv_date($form->{todate}));
}
- if ($form->{eur}) {
- $AR_PAID = qq|AND ac.trans_id IN
- (
- SELECT trans_id
- FROM acc_trans
- JOIN chart ON (chart_id = id)
- WHERE link LIKE '%AR_paid%'
- $subwhere
- )|;
- $AP_PAID = qq|AND ac.trans_id IN
- (
- SELECT trans_id
- FROM acc_trans
- JOIN chart ON (chart_id = id)
- WHERE link LIKE '%AP_paid%'
- $subwhere
- )|;
- } else {
- $where .= $fromto;
- $AR_PAID = "";
- $AP_PAID = "";
- $glwhere = ""; # note! gl will be aliased as "a" later...
- }
+
my $sortorder = join ', ',
$form->sort_columns(qw(transdate reference description));
my $false = ($myconfig->{dbdriver} eq 'Pg') ? FALSE: q|'0'|;
description => 3);
map { $sortorder =~ s/$_/$ordinal{$_}/ } keys %ordinal;
- my ($null, $department_id) = split /--/, $form->{department};
- my $dpt_where;
- my $dpt_join;
+ my ($null, $department_id) = split(/--/, $form->{department});
+ my ($dpt_where, $dpt_join, @department_values);
if ($department_id) {
- $dpt_join = qq|
- JOIN department t ON (t.id = a.department_id)
- |;
- $dpt_where = qq|
- AND t.id = $department_id
- |;
+ $dpt_join = qq| JOIN department t ON (t.id = a.department_id) |;
+ $dpt_where = qq| AND t.id = ? |;
+ @department_values = ($department_id);
}
- my $project;
+ my ($project, @project_values);
if ($form->{project_id}) {
- $project = qq|
- AND ac.project_id = $form->{project_id}
- |;
+ $project = qq| AND ac.project_id = ? |;
+ @project_values = (conv_i($form->{project_id}));
}
- if ($form->{accno} || $form->{gifi_accno}) {
+ if ($form->{accno}) {
# get category for account
- $query = qq|SELECT c.category
- FROM chart c
- WHERE c.accno = '$form->{accno}'|;
-
- if ($form->{accounttype} eq 'gifi') {
- $query = qq|SELECT c.category
- FROM chart c
- WHERE c.gifi_accno = '$form->{gifi_accno}'
- AND c.charttype = 'A'|;
- }
-
- $sth = $dbh->prepare($query);
-
- $sth->execute || $form->dberror($query);
- ($form->{category}) = $sth->fetchrow_array;
- $sth->finish;
+ $query = qq|SELECT category FROM chart WHERE accno = ?|;
+ ($form->{category}) = selectrow_query($form, $dbh, $query, $form->{accno});
if ($form->{fromdate}) {
-
# get beginning balance
- $query = qq|SELECT SUM(ac.amount)
- FROM acc_trans ac
- JOIN chart c ON (ac.chart_id = c.id)
- $dpt_join
- WHERE c.accno = '$form->{accno}'
- AND ac.transdate < '$form->{fromdate}'
- $dpt_where
- $project
- |;
+ $query =
+ qq|SELECT SUM(ac.amount) | .
+ qq|FROM acc_trans ac | .
+ qq|JOIN chart c ON (ac.chart_id = c.id) | .
+ $dpt_join .
+ qq|WHERE c.accno = ? | .
+ qq|AND ac.transdate < ? | .
+ $dpt_where .
+ $project;
+ @values = ($form->{accno}, conv_date($form->{fromdate}),
+ @department_values, @project_values);
if ($form->{project_id}) {
-
- $query .= qq|
-
- UNION
-
- SELECT SUM(ac.qty * ac.sellprice)
- FROM invoice ac
- JOIN ar a ON (ac.trans_id = a.id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN chart c ON (p.income_accno_id = c.id)
- $dpt_join
- WHERE c.accno = '$form->{accno}'
- AND a.transdate < '$form->{fromdate}'
- AND c.category = 'I'
- $dpt_where
- $project
-
- UNION
-
- SELECT SUM(ac.qty * ac.sellprice)
- FROM invoice ac
- JOIN ap a ON (ac.trans_id = a.id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN chart c ON (p.expense_accno_id = c.id)
- $dpt_join
- WHERE c.accno = '$form->{accno}'
- AND a.transdate < '$form->{fromdate}'
- AND c.category = 'E'
- $dpt_where
- $project
- |;
-
- }
-
- if ($form->{accounttype} eq 'gifi') {
- $query = qq|SELECT SUM(ac.amount)
- FROM acc_trans ac
- JOIN chart c ON (ac.chart_id = c.id)
- $dpt_join
- WHERE c.gifi_accno = '$form->{gifi_accno}'
- AND ac.transdate < '$form->{fromdate}'
- $dpt_where
- $project
- |;
-
- if ($form->{project_id}) {
-
- $query .= qq|
-
- UNION
-
- SELECT SUM(ac.qty * ac.sellprice)
- FROM invoice ac
- JOIN ar a ON (ac.trans_id = a.id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN chart c ON (p.income_accno_id = c.id)
- $dpt_join
- WHERE c.gifi_accno = '$form->{gifi_accno}'
- AND a.transdate < '$form->{fromdate}'
- AND c.category = 'I'
- $dpt_where
- $project
-
- UNION
-
- SELECT SUM(ac.qty * ac.sellprice)
- FROM invoice ac
- JOIN ap a ON (ac.trans_id = a.id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN chart c ON (p.expense_accno_id = c.id)
- $dpt_join
- WHERE c.gifi_accno = '$form->{gifi_accno}'
- AND a.transdate < '$form->{fromdate}'
- AND c.category = 'E'
- $dpt_where
- $project
- |;
-
- }
+ $query .=
+ qq|UNION | .
+
+ qq|SELECT SUM(ac.qty * ac.sellprice) | .
+ qq|FROM invoice ac | .
+ qq|JOIN ar a ON (ac.trans_id = a.id) | .
+ qq|JOIN parts p ON (ac.parts_id = p.id) | .
+ qq|JOIN chart c ON (p.income_accno_id = c.id) | .
+ $dpt_join .
+ qq|WHERE c.accno = ? | .
+ qq| AND a.transdate < ? | .
+ qq| AND c.category = 'I' | .
+ $dpt_where .
+ $project .
+
+ qq|UNION | .
+
+ qq|SELECT SUM(ac.qty * ac.sellprice) | .
+ qq|FROM invoice ac | .
+ qq|JOIN ap a ON (ac.trans_id = a.id) | .
+ qq|JOIN parts p ON (ac.parts_id = p.id) | .
+ qq|JOIN chart c ON (p.expense_accno_id = c.id) | .
+ $dpt_join .
+ qq|WHERE c.accno = ? | .
+ qq| AND a.transdate < ? | .
+ qq| AND c.category = 'E' | .
+ $dpt_where .
+ $project;
+
+ push(@values,
+ $form->{accno}, conv_date($form->{transdate}),
+ @department_values, @project_values,
+ $form->{accno}, conv_date($form->{transdate}),
+ @department_values, @project_values);
}
- $sth = $dbh->prepare($query);
-
- $sth->execute || $form->dberror($query);
- ($form->{balance}) = $sth->fetchrow_array;
- $sth->finish;
+ ($form->{balance}) = selectrow_query($form, $dbh, $query, @values);
}
}
$query = "";
my $union = "";
+ @values = ();
foreach my $id (@id) {
-
- # NOTE:
- # Postgres is really picky about the order of implicit CROSS JOINs with ','
- # if you alias the tables and want to use the alias later in another JOIN.
- # the alias you want to use has to be the most recent in the list, otherwise
- # Postgres will overwrite the alias internally and complain.
- # For this reason, in the next 3 SELECTs, the 'a' alias is last in the list.
- # Don't change this, and if you do, substitute the ',' with CROSS JOIN
- # ... that also works.
+
+ # NOTE: Postgres is really picky about the order of implicit CROSS
+ # JOINs with ',' if you alias the tables and want to use the
+ # alias later in another JOIN. the alias you want to use has to
+ # be the most recent in the list, otherwise Postgres will
+ # overwrite the alias internally and complain. For this reason,
+ # in the next 3 SELECTs, the 'a' alias is last in the list.
+ # Don't change this, and if you do, substitute the ',' with CROSS
+ # JOIN ... that also works.
# get all transactions
- $query .= qq|$union
- SELECT a.id, a.reference, a.description, ac.transdate,
- $false AS invoice, ac.amount, 'gl' as module
- FROM acc_trans ac, gl a $dpt_join
- WHERE $where
- $glwhere
- $dpt_where
- $project
- AND ac.chart_id = $id
- AND ac.trans_id = a.id
- UNION
- SELECT a.id, a.invnumber, c.name, ac.transdate,
- a.invoice, ac.amount, 'ar' as module
- FROM acc_trans ac, customer c, ar a $dpt_join
- WHERE $where
- $dpt_where
- $project
- AND ac.chart_id = $id
- AND ac.trans_id = a.id
- $AR_PAID
- AND a.customer_id = c.id
- UNION
- SELECT a.id, a.invnumber, v.name, ac.transdate,
- a.invoice, ac.amount, 'ap' as module
- FROM acc_trans ac, vendor v, ap a $dpt_join
- WHERE $where
- $dpt_where
- $project
- AND ac.chart_id = $id
- AND ac.trans_id = a.id
- $AP_PAID
- AND a.vendor_id = v.id
- |;
- $union = qq|
- UNION ALL
- |;
+ $query .=
+ $union .
+ qq|SELECT a.id, a.reference, a.description, ac.transdate, | .
+ qq| $false AS invoice, ac.amount, 'gl' as module | .
+ qq|FROM acc_trans ac, gl a | .
+ $dpt_join .
+ qq|WHERE | . $where . $dpt_where . $project .
+ qq| AND ac.chart_id = ? | .
+ qq| AND ac.trans_id = a.id | .
+
+ qq|UNION ALL | .
+
+ qq|SELECT a.id, a.invnumber, c.name, ac.transdate, | .
+ qq| a.invoice, ac.amount, 'ar' as module | .
+ qq|FROM acc_trans ac, customer c, ar a | .
+ $dpt_join .
+ qq|WHERE | . $where . $dpt_where . $project .
+ qq| AND ac.chart_id = ? | .
+ qq| AND NOT a.storno | .
+ qq| AND ac.trans_id = a.id | .
+ qq| AND a.customer_id = c.id | .
+
+ qq|UNION ALL | .
+
+ qq|SELECT a.id, a.invnumber, v.name, ac.transdate, | .
+ qq| a.invoice, ac.amount, 'ap' as module | .
+ qq|FROM acc_trans ac, vendor v, ap a | .
+ $dpt_join .
+ qq|WHERE | . $where . $dpt_where . $project .
+ qq| AND ac.chart_id = ? | .
+ qq| AND ac.trans_id = a.id | .
+ qq| AND NOT a.storno | .
+ qq| AND a.vendor_id = v.id |;
+
+ push(@values,
+ @where_values, @department_values, @project_values, $id,
+ @where_values, @department_values, @project_values, $id,
+ @where_values, @department_values, @project_values, $id);
+
+ $union = qq|UNION ALL |;
if ($form->{project_id}) {
$fromdate_where =~ s/ac\./a\./;
$todate_where =~ s/ac\./a\./;
- $query .= qq|
-
- UNION ALL
-
- SELECT a.id, a.invnumber, c.name, a.transdate,
- a.invoice, ac.qty * ac.sellprice AS sellprice, 'ar' as module
- FROM ar a
- JOIN invoice ac ON (ac.trans_id = a.id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN customer c ON (a.customer_id = c.id)
- $dpt_join
- WHERE p.income_accno_id = $id
- $fromdate_where
- $todate_where
- $dpt_where
- $project
-
- UNION ALL
-
- SELECT a.id, a.invnumber, v.name, a.transdate,
- a.invoice, ac.qty * ac.sellprice AS sellprice, 'ap' as module
- FROM ap a
- JOIN invoice ac ON (ac.trans_id = a.id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN vendor v ON (a.vendor_id = v.id)
- $dpt_join
- WHERE p.expense_accno_id = $id
- $fromdate_where
- $todate_where
- $dpt_where
- $project
- |;
+ $query .=
+ qq|UNION ALL | .
+
+ qq|SELECT a.id, a.invnumber, c.name, a.transdate, | .
+ qq| a.invoice, ac.qty * ac.sellprice AS sellprice, 'ar' as module | .
+ qq|FROM ar a | .
+ qq|JOIN invoice ac ON (ac.trans_id = a.id) | .
+ qq|JOIN parts p ON (ac.parts_id = p.id) | .
+ qq|JOIN customer c ON (a.customer_id = c.id) | .
+ $dpt_join .
+ qq|WHERE p.income_accno_id = ? | .
+ $fromdate_where .
+ $todate_where .
+ $dpt_where .
+ $project .
+
+ qq|UNION ALL | .
+
+ qq|SELECT a.id, a.invnumber, v.name, a.transdate, | .
+ qq| a.invoice, ac.qty * ac.sellprice AS sellprice, 'ap' as module | .
+ qq|FROM ap a | .
+ qq|JOIN invoice ac ON (ac.trans_id = a.id) | .
+ qq|JOIN parts p ON (ac.parts_id = p.id) | .
+ qq|JOIN vendor v ON (a.vendor_id = v.id) | .
+ $dpt_join .
+ qq|WHERE p.expense_accno_id = ? | .
+ $fromdate_where .
+ $todate_where .
+ $dpt_where .
+ $project;
+
+ push(@values,
+ $id, @department_values, @project_values,
+ $id, @department_values, @project_values);
$fromdate_where =~ s/a\./ac\./;
$todate_where =~ s/a\./ac\./;
}
- $union = qq|
- UNION ALL
- |;
+ $union = qq|UNION ALL|;
}
- $query .= qq|
- ORDER BY $sortorder|;
+ my $sort = grep({ $form->{sort} eq $_ } qw(transdate reference description)) ? $form->{sort} : 'transdate';
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $query .= qq|ORDER BY $sort|;
+ $sth = prepare_execute_query($form, $dbh, $query, @values);
+ $form->{CA} = [];
while (my $ca = $sth->fetchrow_hashref(NAME_lc)) {
-
- # gl
- if ($ca->{module} eq "gl") {
- $ca->{module} = "gl";
- }
-
# ap
if ($ca->{module} eq "ap") {
$ca->{module} = ($ca->{invoice}) ? 'ir' : 'ap';
$ca->{debit} = 0;
}
- push @{ $form->{CA} }, $ca;
+ $ca->{index} = join "--", map { $ca->{$_} } qw(id reference description);
+
+ push(@{ $form->{CA} }, $ca);
}
#======================================================================
package CP;
+use SL::DBUtils;
sub new {
$main::lxdebug->enter_sub();
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT c.accno, c.description, c.link
- FROM chart c
- WHERE c.link LIKE '%$form->{ARAP}%'
- ORDER BY c.accno|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $ARAP = $form->{ARAP} eq "AR" ? "AR" : "AP";
+
+ my $query =
+ qq|SELECT accno, description, link | .
+ qq|FROM chart | .
+ qq|WHERE link LIKE ? |.
+ qq|ORDER BY accno|;
+ my $sth = prepare_execute_query($form, $dbh, $query, '%' . $ARAP . '%');
$form->{PR}{ $form->{ARAP} } = ();
$form->{PR}{"$form->{ARAP}_paid"} = ();
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- foreach my $item (split /:/, $ref->{link}) {
+ foreach my $item (split(/:/, $ref->{link})) {
if ($item eq $form->{ARAP}) {
- push @{ $form->{PR}{ $form->{ARAP} } }, $ref;
+ push(@{ $form->{PR}{ $form->{ARAP} } }, $ref);
}
if ($item eq "$form->{ARAP}_paid") {
- push @{ $form->{PR}{"$form->{ARAP}_paid"} }, $ref;
+ push(@{ $form->{PR}{"$form->{ARAP}_paid"} }, $ref);
}
}
}
$sth->finish;
# get currencies and closedto
- $query = qq|SELECT curr, closedto
- FROM defaults|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($form->{currencies}, $form->{closedto}) = $sth->fetchrow_array;
- $sth->finish;
+ $query = qq|SELECT curr, closedto FROM defaults|;
+ ($form->{currencies}, $form->{closedto}) =
+ selectrow_query($form, $dbh, $query);
$dbh->disconnect;
my $dbh = $form->dbconnect($myconfig);
- my $arap = ($form->{vc} eq 'customer') ? 'ar' : 'ap';
- my $query = qq|SELECT count(*)
- FROM $form->{vc} ct, $arap a
- WHERE a.$form->{vc}_id = ct.id
- AND a.amount != a.paid|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- my ($count) = $sth->fetchrow_array;
- $sth->finish;
-
- my $ref;
+ my $arap = ($form->{vc} eq 'customer') ? 'ar' : 'ap';
+ my $vc = $form->{vc} eq "customer" ? "customer" : "vendor";
+ my $query =
+ qq|SELECT count(*) | .
+ qq|FROM $vc ct, $arap a | .
+ qq|WHERE (a.${vc}_id = ct.id) AND (a.amount != a.paid)|;
+ my ($count) = selectrow_query($form, $dbh, $query);
# build selection list
if ($count < $myconfig->{vclimit}) {
- $query = qq|SELECT DISTINCT ct.id, ct.name
- FROM $form->{vc} ct, $arap a
- WHERE a.$form->{vc}_id = ct.id
- AND a.amount != a.paid
- ORDER BY ct.name|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{"all_$form->{vc}"} }, $ref;
- }
-
- $sth->finish;
-
+ $query =
+ qq|SELECT DISTINCT ct.id, ct.name | .
+ qq|FROM $vc ct, $arap a | .
+ qq|WHERE (a.${vc}_id = ct.id) AND (a.amount != a.paid) | .
+ qq|ORDER BY ct.name|;
+ $form->{"all_$form->{vc}"} = selectall_hashref_query($form, $dbh, $query);
}
if ($form->{ARAP} eq 'AR') {
- $query = qq|SELECT d.id, d.description
- FROM department d
- WHERE d.role = 'P'
- ORDER BY 2|;
+ $query =
+ qq|SELECT d.id, d.description | .
+ qq|FROM department d | .
+ qq|WHERE d.role = 'P' | .
+ qq|ORDER BY 2|;
} else {
- $query = qq|SELECT d.id, d.description
- FROM department d
- ORDER BY 2|;
+ $query =
+ qq|SELECT d.id, d.description | .
+ qq|FROM department d | .
+ qq|ORDER BY 2|;
}
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{all_departments} }, $ref;
- }
- $sth->finish;
+ $form->{all_departments} = selectall_hashref_query($form, $dbh, $query);
$dbh->disconnect;
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $where = qq|WHERE a.$form->{vc}_id = $form->{"$form->{vc}_id"}
- AND a.curr = '$form->{currency}'
- AND NOT a.amount = paid|;
+ my $vc = $form->{vc} eq "customer" ? "customer" : "vendor";
- my ($buysell);
- if ($form->{vc} eq 'customer') {
- $buysell = "buy";
- } else {
- $buysell = "sell";
- }
+ my $buysell = $form->{vc} eq 'customer' ? "buy" : "sell";
+ my $arap = $form->{arap} eq "ar" ? "ar" : "ap";
- my $query =
- qq|SELECT a.id, a.invnumber, a.transdate, a.amount, a.paid, a.curr
- FROM $form->{arap} a
- $where
- ORDER BY a.id|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $curr_null = $form->{curreny} ? '' : ' OR a.curr IS NULL'; # fix: after sql-injection fix, curr is inserted as NULL, before that as ''
+ my $query =
+ qq|SELECT a.id, a.invnumber, a.transdate, a.amount, a.paid, a.curr | .
+ qq|FROM $arap a | .
+ qq|WHERE (a.${vc}_id = ?) AND (a.curr = ? $curr_null) AND NOT (a.amount = paid)|;
+ qq|ORDER BY a.id|;
+ my $sth = prepare_execute_query($form, $dbh, $query,
+ conv_i($form->{"${vc}_id"}),
+ $form->{currency});
+
+ $form->{PR} = [];
while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
# if this is a foreign currency transaction get exchangerate
$form->{exchangerate} = 1;
}
- my $query = qq|SELECT fxgain_accno_id, fxloss_accno_id
- FROM defaults|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my ($fxgain_accno_id, $fxloss_accno_id) = $sth->fetchrow_array;
- $sth->finish;
-
- my ($buysell);
+ my $query =
+ qq|SELECT fxgain_accno_id, fxloss_accno_id FROM defaults|;
+ my ($fxgain_accno_id, $fxloss_accno_id) =
+ selectrow_query($form, $dbh, $query);
- if ($form->{vc} eq 'customer') {
- $buysell = "buy";
- } else {
- $buysell = "sell";
- }
+ my $buysell = $form->{vc} eq "customer" ? "buy" : "sell";
+ my $arap = $form->{arap} eq "ar" ? "ar" : "ap";
my $ml;
my $where;
if ($form->{ARAP} eq 'AR') {
$ml = 1;
- $where = qq|
- (c.link = 'AR'
- OR c.link LIKE 'AR:%')
- |;
+ $where = qq| ((c.link = 'AR') OR (c.link LIKE 'AR:%')) |;
} else {
$ml = -1;
- $where = qq|
- (c.link = 'AP'
- OR c.link LIKE '%:AP'
- OR c.link LIKE '%:AP:%')
- |;
+ $where =
+ qq| ((c.link = 'AP') OR | .
+ qq| (c.link LIKE '%:AP') OR | .
+ qq| (c.link LIKE '%:AP:%')) |;
}
$paymentamount = $form->{amount};
# $paymentamount = $form->{amount};
my $null;
- ($null, $form->{department_id}) = split /--/, $form->{department};
+ ($null, $form->{department_id}) = split(/--/, $form->{department});
$form->{department_id} *= 1;
# query to retrieve paid amount
- $query = qq|SELECT a.paid FROM ar a
- WHERE a.id = ?
- FOR UPDATE|;
- my $pth = $dbh->prepare($query) || $form->dberror($query);
+ $query =
+ qq|SELECT a.paid FROM ar a | .
+ qq|WHERE a.id = ? | .
+ qq|FOR UPDATE|;
+ my $pth = prepare_query($form, $dbh, $query);
# go through line by line
for my $i (1 .. $form->{rowcount}) {
(($paymentamount * 1000) - ($form->{"paid_$i"} * 1000)) / 1000;
# get exchangerate for original
- $query = qq|SELECT $buysell
- FROM exchangerate e
- JOIN $form->{arap} a ON (a.transdate = e.transdate)
- WHERE e.curr = '$form->{currency}'
- AND a.id = $form->{"id_$i"}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my ($exchangerate) = $sth->fetchrow_array;
- $sth->finish;
+ $query =
+ qq|SELECT $buysell | .
+ qq|FROM exchangerate e | .
+ qq|JOIN ${arap} a ON (a.transdate = e.transdate) | .
+ qq|WHERE (e.curr = ?) AND (a.id = ?)|;
+ my ($exchangerate) =
+ selectrow_query($form, $dbh, $query,
+ $form->{currency}, $form->{"id_$i"});
$exchangerate = 1 unless $exchangerate;
- $query = qq|SELECT c.id
- FROM chart c
- JOIN acc_trans a ON (a.chart_id = c.id)
- WHERE $where
- AND a.trans_id = $form->{"id_$i"}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my ($id) = $sth->fetchrow_array;
- $sth->finish;
+ $query =
+ qq|SELECT c.id | .
+ qq|FROM chart c | .
+ qq|JOIN acc_trans a ON (a.chart_id = c.id) | .
+ qq|WHERE $where | .
+ qq|AND (a.trans_id = ?)|;
+ my ($id) = selectrow_query($form, $dbh, $query, $form->{"id_$i"});
$amount = $form->round_amount($form->{"paid_$i"} * $exchangerate, 2);
# add AR/AP
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, transdate,
- amount)
- VALUES ($form->{"id_$i"}, $id, '$form->{datepaid}',
- $amount * $ml)|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount) | .
+ qq|VALUES (?, ?, ?, ?)|;
+ do_query($form, $dbh, $query, $form->{"id_$i"}, $id,
+ conv_date($form->{datepaid}), $amount * $ml);
# add payment
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, transdate,
- amount, source, memo)
- VALUES ($form->{"id_$i"},
- (SELECT c.id FROM chart c
- WHERE c.accno = '$paymentaccno'),
- '$form->{datepaid}', $form->{"paid_$i"} * $ml * -1,
- '$form->{source}', '$form->{memo}')|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, | .
+ qq| source, memo) | .
+ qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?)|;
+ my @values = (conv_i($form->{"id_$i"}), $paymentaccno,
+ conv_date($form->{datepaid}),
+ $form->{"paid_$i"} * $ml * -1, $form->{source},
+ $form->{memo});
+ do_query($form, $dbh, $query, @values);
# add exchangerate difference if currency ne defaultcurrency
$amount =
if ($amount != 0) {
# exchangerate difference
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, transdate,
- amount, cleared, fx_transaction)
- VALUES ($form->{"id_$i"},
- (SELECT c.id FROM chart c
- WHERE c.accno = '$paymentaccno'),
- '$form->{datepaid}', $amount * $ml * -1, '0', '1')|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, | .
+ qq| cleared, fx_transaction) | .
+ qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?)|;
+ @values = (conv_i($form->{"id_$i"}), $paymentaccno,
+ conv_date($form->{datepaid}), ($amount * $ml * -1), '0',
+ '1');
+ do_query($form, $dbh, $query, @values);
# gain/loss
$amount =
- $form->round_amount(
- $form->{"paid_$i"} * ($exchangerate - $form->{exchangerate}),
- 2);
+ $form->round_amount($form->{"paid_$i"} *
+ ($exchangerate - $form->{exchangerate}), 2);
if ($amount != 0) {
my $accno_id = ($amount < 0) ? $fxgain_accno_id : $fxloss_accno_id;
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, transdate,
- amount, cleared, fx_transaction)
- VALUES ($form->{"id_$i"}, $accno_id,
- '$form->{datepaid}', $amount * $ml * -1, '0', '1')|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, | .
+ qq| amount, cleared, fx_transaction) | .
+ qq|VALUES (?, ?, ?, ?, ?, ?)|;
+ @values = (conv_i($form->{"id_$i"}), $accno_id,
+ conv_date($form->{datepaid}), $amount * $ml * -1, '0',
+ '1');
+ do_query($form, $dbh, $query, @values);
}
}
$form->{"paid_$i"} =
$form->round_amount($form->{"paid_$i"} * $exchangerate, 2);
-
$pth->execute($form->{"id_$i"}) || $form->dberror;
($amount) = $pth->fetchrow_array;
$pth->finish;
$amount += $form->{"paid_$i"};
-
+
# BUG 324
if ($form->{arap} eq 'ap') {
$paid = "paid = paid + $amount";
}
# update AR/AP transaction
- $query = qq|UPDATE $form->{arap} set
- $paid,
- datepaid = '$form->{datepaid}'
- WHERE id = $form->{"id_$i"}|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|UPDATE $arap SET $paid, datepaid = ? WHERE id = ?|;
+ @values = (conv_date($form->{datepaid}), conv_i($form->{"id_$i"}));
+ do_query($form, $dbh, $query, @values);
+ # saving the history
+ $form->{id} = $form->{"id_$i"};
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|invnumber_| . $form->{"invnumber_$i"};
+ $form->{addition} = "POSTED";
+ $form->save_history($form->dbconnect($myconfig));
+ }
+ # /saving the history
}
}
sub get_tuple {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form) = @_;
+ my ( $self, $myconfig, $form ) = @_;
+
+ my $cv = $form->{db} eq "customer" ? "customer" : "vendor";
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT ct.*, b.id AS business, cp.*
- FROM $form->{db} ct
- LEFT JOIN business b on ct.business_id = b.id
- LEFT JOIN contacts cp on ct.id = cp.cp_cv_id
- WHERE ct.id = $form->{id} order by cp.cp_id limit 1|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $query =
+ qq|SELECT ct.*, b.id AS business, cp.* | .
+ qq|FROM $cv ct | .
+ qq|LEFT JOIN business b ON (ct.business_id = b.id) | .
+ qq|LEFT JOIN contacts cp ON (ct.id = cp.cp_cv_id) | .
+ qq|WHERE (ct.id = ?) | .
+ qq|ORDER BY cp.cp_id LIMIT 1|;
+ my $sth = prepare_execute_query($form, $dbh, $query, $form->{id});
my $ref = $sth->fetchrow_hashref(NAME_lc);
map { $form->{$_} = $ref->{$_} } keys %$ref;
$sth->finish;
- if ($form->{salesman_id}) {
- my $query = qq|SELECT ct.name AS salesman
- FROM $form->{db} ct
- WHERE ct.id = $form->{salesman_id}|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my ($ref) = $sth->fetchrow_array();
-
- $form->{salesman} = $ref;
-
- $sth->finish;
+ if ( $form->{salesman_id} ) {
+ my $query =
+ qq|SELECT ct.name AS salesman | .
+ qq|FROM $cv ct | .
+ qq|WHERE ct.id = ?|;
+ ($form->{salesman}) =
+ selectrow_query($form, $dbh, $query, $form->{salesman_id});
}
# check if it is orphaned
- my $arap = ($form->{db} eq 'customer') ? "ar" : "ap";
- $query = qq|SELECT a.id
- FROM $arap a
- JOIN $form->{db} ct ON (a.$form->{db}_id = ct.id)
- WHERE ct.id = $form->{id}
- UNION
- SELECT a.id
- FROM oe a
- JOIN $form->{db} ct ON (a.$form->{db}_id = ct.id)
- WHERE ct.id = $form->{id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- unless ($sth->fetchrow_array) {
- $form->{status} = "orphaned";
- }
- $sth->finish;
+ my $arap = ( $form->{db} eq 'customer' ) ? "ar" : "ap";
+ $query =
+ qq|SELECT a.id | .
+ qq|FROM $arap a | .
+ qq|JOIN $cv ct ON (a.${cv}_id = ct.id) | .
+ qq|WHERE ct.id = ? | .
+ qq|UNION | .
+ qq|SELECT a.id | .
+ qq|FROM oe a | .
+ qq|JOIN $cv ct ON (a.${cv}_id = ct.id) | .
+ qq|WHERE ct.id = ?|;
+ my ($dummy) = selectrow_query($form, $dbh, $query, $form->{id}, $form->{id});
+ $form->{status} = "orphaned" unless ($dummy);
- # get tax labels
- $query = qq|SELECT c.accno, c.description
- FROM chart c
- JOIN tax t ON (t.chart_id = c.id)
- WHERE c.link LIKE '%CT_tax%'
- ORDER BY c.accno|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- $form->{taxaccounts} .= "$ref->{accno} ";
- $form->{tax}{ $ref->{accno} }{description} = $ref->{description};
- }
- $sth->finish;
- chop $form->{taxaccounts};
-
- # get taxes for customer/vendor
- $query = qq|SELECT c.accno
- FROM chart c
- JOIN $form->{db}tax t ON (t.chart_id = c.id)
- WHERE t.$form->{db}_id = $form->{id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- $form->{tax}{ $ref->{accno} }{taxable} = 1;
- }
- $sth->finish;
+ $dbh->disconnect;
- # get business types
- $query = qq|SELECT id, description
- FROM business
- ORDER BY 1|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{all_business} }, $ref;
- }
- $sth->finish;
+ $main::lxdebug->leave_sub();
+}
- # get tax zones
- $query = qq|SELECT id, description
- FROM tax_zones|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+sub populate_drop_down_boxes {
+ $main::lxdebug->enter_sub();
+ my ($self, $myconfig, $form, $provided_dbh) = @_;
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{TAXZONE} }, $ref;
- }
- $sth->finish;
+ my $dbh = $provided_dbh ? $provided_dbh : $form->dbconnect($myconfig);
+ # get business types
+ $query = qq|SELECT id, description FROM business ORDER BY id|;
+ $form->{all_business} = selectall_hashref_query($form, $dbh, $query);
# get shipto address
- $query = qq|SELECT shipto_id, shiptoname, shiptodepartment_1
- FROM shipto WHERE trans_id=$form->{id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
-
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{SHIPTO} }, $ref;
- }
- $sth->finish;
-
+ $query =
+ qq|SELECT shipto_id, shiptoname, shiptodepartment_1 | .
+ qq|FROM shipto WHERE (trans_id = ?) AND (module = 'CT')|;
+ $form->{SHIPTO} = selectall_hashref_query($form, $dbh, $query, $form->{id});
# get contacts
- $query = qq|SELECT cp_id, cp_name
- FROM contacts WHERE cp_cv_id=$form->{id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
-
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{CONTACTS} }, $ref;
- }
- $sth->finish;
+ $query = qq|SELECT cp_id, cp_name FROM contacts WHERE cp_cv_id = ?|;
+ $form->{CONTACTS} = selectall_hashref_query($form, $dbh, $query, $form->{id});
# get languages
- $query = qq|SELECT id, description
- FROM language
- ORDER BY 1|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{languages} }, $ref;
- }
- $sth->finish;
+ $query = qq|SELECT id, description FROM language ORDER BY id|;
+ $form->{languages} = selectall_hashref_query($form, $dbh, $query);
- # get languages
- $query = qq|SELECT id, description
- FROM payment_terms
- ORDER BY 1|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{payment_terms} }, $ref;
- }
- $sth->finish;
+ # get payment terms
+ $query = qq|SELECT id, description FROM payment_terms ORDER BY sortkey|;
+ $form->{payment_terms} = selectall_hashref_query($form, $dbh, $query);
- $dbh->disconnect;
+ $dbh->disconnect() unless ($provided_dbh);
$main::lxdebug->leave_sub();
}
-## LINET
sub query_titles_and_greetings {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form) = @_;
- my (%tmp, $ref);
+ my ( $self, $myconfig, $form ) = @_;
+ my ( %tmp, $ref );
my $dbh = $form->dbconnect($myconfig);
$query =
- "SELECT DISTINCT(c.cp_greeting) FROM contacts c WHERE c.cp_greeting LIKE '%'";
- $sth = $dbh->prepare($query);
- $sth->execute() || $form->dberror($query);
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- next unless ($ref->{cp_greeting} =~ /[a-zA-Z]/);
- $tmp{ $ref->{cp_greeting} } = 1;
- }
- $sth->finish();
-
- @{ $form->{GREETINGS} } = sort(keys(%tmp));
-
- %tmp = ();
+ qq|SELECT DISTINCT(cp_greeting) | .
+ qq|FROM contacts | .
+ qq|WHERE cp_greeting ~ '[a-zA-Z]' | .
+ qq|ORDER BY cp_greeting|;
+ $form->{GREETINGS} = [ selectall_array_query($form, $dbh, $query) ];
$query =
- "SELECT greeting FROM customer UNION select greeting FROM vendor";
- $sth = $dbh->prepare($query);
- $sth->execute() || $form->dberror($query);
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- next unless ($ref->{greeting} =~ /[a-zA-Z]/);
- $tmp{ $ref->{greeting} } = 1;
- }
- $sth->finish();
-
- @{ $form->{COMPANY_GREETINGS} } = sort(keys(%tmp));
-
- %tmp = ();
+ qq|SELECT DISTINCT(greeting) | .
+ qq|FROM customer | .
+ qq|WHERE greeting ~ '[a-zA-Z]' | .
+ qq|UNION | .
+ qq|SELECT DISTINCT(greeting) | .
+ qq|FROM vendor | .
+ qq|WHERE greeting ~ '[a-zA-Z]' | .
+ qq|ORDER BY greeting|;
+ my %tmp;
+ map({ $tmp{$_} = 1; } selectall_array_query($form, $dbh, $query));
+ $form->{COMPANY_GREETINGS} = [ sort(keys(%tmp)) ];
$query =
- "SELECT DISTINCT(c.cp_title) FROM contacts c WHERE c.cp_title LIKE '%'";
- $sth = $dbh->prepare($query);
- $sth->execute() || $form->dberror($query);
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- next unless ($ref->{cp_title} =~ /[a-zA-Z]/);
- $tmp{ $ref->{cp_title} } = 1;
- }
- $sth->finish();
-
- @{ $form->{TITLES} } = sort(keys(%tmp));
-
- %tmp = ();
+ qq|SELECT DISTINCT(cp_title) | .
+ qq|FROM contacts | .
+ qq|WHERE cp_title ~ '[a-zA-Z]'|;
+ $form->{TITLES} = [ selectall_array_query($form, $dbh, $query) ];
$query =
- "SELECT DISTINCT(c.cp_abteilung) FROM contacts c WHERE c.cp_abteilung LIKE '%'";
- $sth = $dbh->prepare($query);
- $sth->execute() || $form->dberror($query);
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- $tmp{ $ref->{cp_abteilung} } = 1;
- }
- $sth->finish();
-
- @{ $form->{DEPARTMENT} } = sort(keys(%tmp));
+ qq|SELECT DISTINCT(cp_abteilung) | .
+ qq|FROM contacts | .
+ qq|WHERE cp_abteilung ~ '[a-zA-Z]'|;
+ $form->{DEPARTMENT} = [ selectall_array_query($form, $dbh, $query) ];
$dbh->disconnect();
$main::lxdebug->leave_sub();
}
-## /LINET
-
-sub taxaccounts {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- my $dbh = $form->dbconnect($myconfig);
-
- # get tax labels
- my $query = qq|SELECT accno, description
- FROM chart c, tax t
- WHERE c.link LIKE '%CT_tax%'
- AND c.id = t.chart_id
- ORDER BY accno|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my $ref = ();
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- $form->{taxaccounts} .= "$ref->{accno} ";
- $form->{tax}{ $ref->{accno} }{description} = $ref->{description};
- }
- $sth->finish;
- chop $form->{taxaccounts};
-
- # this is just for the selection for type of business
- $query = qq|SELECT id, description
- FROM business|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{all_business} }, $ref;
- }
- $sth->finish;
- # get languages
- $query = qq|SELECT id, description
- FROM language
- ORDER BY 1|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{languages} }, $ref;
- }
- $sth->finish;
-
- # get payment terms
- $query = qq|SELECT id, description
- FROM payment_terms
- ORDER BY 1|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{payment_terms} }, $ref;
- }
- $sth->finish;
-
- # get taxkeys and description
- $query = qq|SELECT id, description
- FROM tax_zones|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
-
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{TAXZONE} }, $ref;
- }
- $sth->finish;
-
-
- $dbh->disconnect;
-
- $main::lxdebug->leave_sub();
-}
sub save_customer {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form) = @_;
+ my ( $self, $myconfig, $form ) = @_;
# set pricegroup to default
- if ($form->{klass}) { }
- else { $form->{klass} = 0; }
+ $form->{klass} = 0 unless ($form->{klass});
# connect to database
- my $dbh = $form->dbconnect($myconfig);
-##LINET
- map({
- $form->{"cp_${_}"} = $form->{"selected_cp_${_}"}
- if ($form->{"selected_cp_${_}"});
- } qw(title greeting abteilung));
+ my $dbh = $form->dbconnect_noauto($myconfig);
+
+ map( {
+ $form->{"cp_${_}"} = $form->{"selected_cp_${_}"}
+ if ( $form->{"selected_cp_${_}"} );
+ } qw(title greeting abteilung) );
$form->{"greeting"} = $form->{"selected_company_greeting"}
- if ($form->{"selected_company_greeting"});
- #
- # escape '
- map { $form->{$_} =~ s/\'/\'\'/g }
- qw(customernumber name street zipcode city country homepage contact notes cp_title cp_greeting language pricegroup);
-##/LINET
+ if ( $form->{"selected_company_greeting"} );
+
# assign value discount, terms, creditlimit
- $form->{discount} = $form->parse_amount($myconfig, $form->{discount});
+ $form->{discount} = $form->parse_amount( $myconfig, $form->{discount} );
$form->{discount} /= 100;
- $form->{terms} *= 1;
- $form->{taxincluded} *= 1;
- $form->{obsolete} *= 1;
- $form->{business} *= 1;
- $form->{salesman_id} *= 1;
- $form->{payment_id} *= 1;
- $form->{taxzone_id} *= 1;
- $form->{creditlimit} = $form->parse_amount($myconfig, $form->{creditlimit});
-
- my ($query, $sth, $f_id);
+ $form->{creditlimit} = $form->parse_amount( $myconfig, $form->{creditlimit} );
- if ($form->{id}) {
+ my ( $query, $sth, $f_id );
- $query = qq|SELECT id FROM customer
- WHERE customernumber = '$form->{customernumber}'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- (${f_id}) = $sth->fetchrow_array;
- $sth->finish;
- if ((${f_id} ne $form->{id}) and (${f_id} ne "")) {
+ if ( $form->{id} ) {
+ $query = qq|SELECT id FROM customer WHERE customernumber = ?|;
+ ($f_id) = selectrow_query($form, $dbh, $query, $form->{customernumber});
+ if (($f_id ne $form->{id}) && ($f_id ne "")) {
$main::lxdebug->leave_sub();
return 3;
}
- $query = qq|DELETE FROM customertax
- WHERE customer_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
-# $query = qq|DELETE FROM shipto
-# WHERE trans_id = $form->{id} AND module = 'CT'|;
-# $dbh->do($query) || $form->dberror($query);
} else {
-
- my $uid = rand() . time;
-
- $uid .= $form->{login};
-
- $uid = substr($uid, 2, 75);
if (!$form->{customernumber} && $form->{business}) {
$form->{customernumber} =
- $form->update_business($myconfig, $form->{business});
+ $form->update_business($myconfig, $form->{business}, $dbh);
}
if (!$form->{customernumber}) {
$form->{customernumber} =
- $form->update_defaults($myconfig, "customernumber");
+ $form->update_defaults($myconfig, "customernumber", $dbh);
}
- $query = qq|SELECT c.id FROM customer c
- WHERE c.customernumber = '$form->{customernumber}'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- (${f_id}) = $sth->fetchrow_array;
- $sth->finish;
- if (${f_id} ne "") {
+ $query = qq|SELECT c.id FROM customer c WHERE c.customernumber = ?|;
+ ($f_id) = selectrow_query($form, $dbh, $query, $form->{customernumber});
+ if ($f_id ne "") {
$main::lxdebug->leave_sub();
return 3;
}
- $query = qq|INSERT INTO customer (name)
- VALUES ('$uid')|;
- $dbh->do($query) || $form->dberror($query);
-
- $query = qq|SELECT c.id FROM customer c
- WHERE c.name = '$uid'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($form->{id}) = $sth->fetchrow_array;
- $sth->finish;
- }
- $query = qq|UPDATE customer SET
- customernumber = '$form->{customernumber}',
- name = '$form->{name}',
- greeting = '$form->{greeting}',
- department_1 = '$form->{department_1}',
- department_2 = '$form->{department_2}',
- street = '$form->{street}',
- zipcode = '$form->{zipcode}',
- city = '$form->{city}',
- country = '$form->{country}',
- homepage = '$form->{homepage}',
- contact = '$form->{contact}',
- phone = '$form->{phone}',
- fax = '$form->{fax}',
- email = '$form->{email}',
- cc = '$form->{cc}',
- bcc = '$form->{bcc}',
- notes = '$form->{notes}',
- discount = $form->{discount},
- creditlimit = $form->{creditlimit},
- terms = $form->{terms},
- taxincluded = '$form->{taxincluded}',
- business_id = $form->{business},
- taxnumber = '$form->{taxnumber}',
- sic_code = '$form->{sic}',
- language = '$form->{language}',
- account_number = '$form->{account_number}',
- bank_code = '$form->{bank_code}',
- bank = '$form->{bank}',
- obsolete = '$form->{obsolete}',
- ustid = '$form->{ustid}',
- username = '$form->{username}',
- salesman_id = '$form->{salesman_id}',
- language_id = | . conv_i($form->{language_id}, "NULL") . qq|,
- payment_id = '$form->{payment_id}',
- taxzone_id = '$form->{taxzone_id}',
- user_password = | . $dbh->quote($form->{user_password}) . qq|,
- c_vendor_id = '$form->{c_vendor_id}',
- klass = '$form->{klass}'
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
-
- if ($form->{cp_id}) {
- $query = qq|UPDATE contacts SET
- cp_greeting = '$form->{cp_greeting}',
- cp_title = '$form->{cp_title}',
- cp_givenname = '$form->{cp_givenname}',
- cp_name = '$form->{cp_name}',
- cp_email = '$form->{cp_email}',
- cp_phone1 = '$form->{cp_phone1}',
- cp_phone2 = '$form->{cp_phone2}',
- cp_abteilung = | . $dbh->quote($form->{cp_abteilung}) . qq|,
- cp_fax = | . $dbh->quote($form->{cp_fax}) . qq|,
- cp_mobile1 = | . $dbh->quote($form->{cp_mobile1}) . qq|,
- cp_mobile2 = | . $dbh->quote($form->{cp_mobile2}) . qq|,
- cp_satphone = | . $dbh->quote($form->{cp_satphone}) . qq|,
- cp_satfax = | . $dbh->quote($form->{cp_satfax}) . qq|,
- cp_project = | . $dbh->quote($form->{cp_project}) . qq|,
- cp_privatphone = | . $dbh->quote($form->{cp_privatphone}) . qq|,
- cp_privatemail = | . $dbh->quote($form->{cp_privatemail}) . qq|,
- cp_birthday = | . $dbh->quote($form->{cp_birthday}) . qq|
- WHERE cp_id = $form->{cp_id}|;
- } elsif ($form->{cp_name} || $form->{cp_givenname}) {
+ $query = qq|SELECT nextval('id')|;
+ ($form->{id}) = selectrow_query($form, $dbh, $query);
+
+ $query = qq|INSERT INTO customer (id, name) VALUES (?, '')|;
+ do_query($form, $dbh, $query, $form->{id});
+ }
+
+ $query = qq|UPDATE customer SET | .
+ qq|customernumber = ?, | .
+ qq|name = ?, | .
+ qq|greeting = ?, | .
+ qq|department_1 = ?, | .
+ qq|department_2 = ?, | .
+ qq|street = ?, | .
+ qq|zipcode = ?, | .
+ qq|city = ?, | .
+ qq|country = ?, | .
+ qq|homepage = ?, | .
+ qq|contact = ?, | .
+ qq|phone = ?, | .
+ qq|fax = ?, | .
+ qq|email = ?, | .
+ qq|cc = ?, | .
+ qq|bcc = ?, | .
+ qq|notes = ?, | .
+ qq|discount = ?, | .
+ qq|creditlimit = ?, | .
+ qq|terms = ?, | .
+ qq|business_id = ?, | .
+ qq|taxnumber = ?, | .
+ qq|sic_code = ?, | .
+ qq|language = ?, | .
+ qq|account_number = ?, | .
+ qq|bank_code = ?, | .
+ qq|bank = ?, | .
+ qq|obsolete = ?, | .
+ qq|ustid = ?, | .
+ qq|username = ?, | .
+ qq|salesman_id = ?, | .
+ qq|language_id = ?, | .
+ qq|payment_id = ?, | .
+ qq|taxzone_id = ?, | .
+ qq|user_password = ?, | .
+ qq|c_vendor_id = ?, | .
+ qq|klass = ? | .
+ qq|WHERE id = ?|;
+ my @values = (
+ $form->{customernumber},
+ $form->{name},
+ $form->{greeting},
+ $form->{department_1},
+ $form->{department_2},
+ $form->{street},
+ $form->{zipcode},
+ $form->{city},
+ $form->{country},
+ $form->{homepage},
+ $form->{contact},
+ $form->{phone},
+ $form->{fax},
+ $form->{email},
+ $form->{cc},
+ $form->{bcc},
+ $form->{notes},
+ $form->{discount},
+ $form->{creditlimit},
+ conv_i($form->{terms}),
+ conv_i($form->{business}),
+ $form->{taxnumber},
+ $form->{sic},
+ $form->{language},
+ $form->{account_number},
+ $form->{bank_code},
+ $form->{bank},
+ $form->{obsolete} ? 't' : 'f',
+ $form->{ustid},
+ $form->{username},
+ conv_i($form->{salesman_id}),
+ conv_i($form->{language_id}),
+ conv_i($form->{payment_id}),
+ conv_i($form->{taxzone_id}, 0),
+ $form->{user_password},
+ $form->{c_vendor_id},
+ conv_i($form->{klass}),
+ $form->{id}
+ );
+ do_query( $form, $dbh, $query, @values );
+
+ $query = undef;
+ if ( $form->{cp_id} ) {
+ $query = qq|UPDATE contacts SET | .
+ qq|cp_greeting = ?, | .
+ qq|cp_title = ?, | .
+ qq|cp_givenname = ?, | .
+ qq|cp_name = ?, | .
+ qq|cp_email = ?, | .
+ qq|cp_phone1 = ?, | .
+ qq|cp_phone2 = ?, | .
+ qq|cp_abteilung = ?, | .
+ qq|cp_fax = ?, | .
+ qq|cp_mobile1 = ?, | .
+ qq|cp_mobile2 = ?, | .
+ qq|cp_satphone = ?, | .
+ qq|cp_satfax = ?, | .
+ qq|cp_project = ?, | .
+ qq|cp_privatphone = ?, | .
+ qq|cp_privatemail = ?, | .
+ qq|cp_birthday = ? | .
+ qq|WHERE cp_id = ?|;
+ @values = (
+ $form->{cp_greeting},
+ $form->{cp_title},
+ $form->{cp_givenname},
+ $form->{cp_name},
+ $form->{cp_email},
+ $form->{cp_phone1},
+ $form->{cp_phone2},
+ $form->{cp_abteilung},
+ $form->{cp_fax},
+ $form->{cp_mobile1},
+ $form->{cp_mobile2},
+ $form->{cp_satphone},
+ $form->{cp_satfax},
+ $form->{cp_project},
+ $form->{cp_privatphone},
+ $form->{cp_privatemail},
+ $form->{cp_birthday},
+ $form->{cp_id}
+ );
+ } elsif ( $form->{cp_name} || $form->{cp_givenname} ) {
$query =
- qq|INSERT INTO contacts ( cp_cv_id, cp_greeting, cp_title, cp_givenname, cp_name, cp_email, cp_phone1, cp_phone2, cp_abteilung, cp_fax, cp_mobile1, cp_mobile2, cp_satphone, cp_satfax, cp_project, cp_privatphone, cp_privatemail, cp_birthday)
- VALUES ($form->{id}, '$form->{cp_greeting}','$form->{cp_title}','$form->{cp_givenname}','$form->{cp_name}','$form->{cp_email}','$form->{cp_phone1}','$form->{cp_phone2}', '$form->{cp_abteilung}', | . $dbh->quote($form->{cp_fax}) . qq|,| . $dbh->quote($form->{cp_mobile1}) . qq|,| . $dbh->quote($form->{cp_mobile2}) . qq|,| . $dbh->quote($form->{cp_satphone}) . qq|,| . $dbh->quote($form->{cp_satfax}) . qq|,| . $dbh->quote($form->{cp_project}) . qq|,| . $dbh->quote($form->{cp_privatphone}) . qq|,| . $dbh->quote($form->{cp_privatemail}) . qq|,| . $dbh->quote($form->{cp_birthday}) . qq|)|;
- }
- $dbh->do($query) || $form->dberror($query);
-
- # save taxes
- foreach $item (split / /, $form->{taxaccounts}) {
- if ($form->{"tax_$item"}) {
- $query = qq|INSERT INTO customertax (customer_id, chart_id)
- VALUES ($form->{id}, (SELECT c.id
- FROM chart c
- WHERE c.accno = '$item'))|;
- $dbh->do($query) || $form->dberror($query);
- }
- }
+ qq|INSERT INTO contacts ( cp_cv_id, cp_greeting, cp_title, cp_givenname, | .
+ qq| cp_name, cp_email, cp_phone1, cp_phone2, cp_abteilung, cp_fax, cp_mobile1, | .
+ qq| cp_mobile2, cp_satphone, cp_satfax, cp_project, cp_privatphone, cp_privatemail, | .
+ qq| cp_birthday) | .
+ qq|VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
+ @values = (
+ $form->{id},
+ $form->{cp_greeting},
+ $form->{cp_title},
+ $form->{cp_givenname},
+ $form->{cp_name},
+ $form->{cp_email},
+ $form->{cp_phone1},
+ $form->{cp_phone2},
+ $form->{cp_abteilung},
+ $form->{cp_fax},
+ $form->{cp_mobile1},
+ $form->{cp_mobile2},
+ $form->{cp_satphone},
+ $form->{cp_satfax},
+ $form->{cp_project},
+ $form->{cp_privatphone},
+ $form->{cp_privatemail},
+ $form->{cp_birthday}
+ );
+ }
+ do_query( $form, $dbh, $query, @values ) if ($query);
+
# add shipto
- $form->add_shipto($dbh, $form->{id}, "CT");
+ $form->add_shipto( $dbh, $form->{id}, "CT" );
- $rc = $dbh->disconnect;
+ $rc = $dbh->commit();
+ $dbh->disconnect();
$main::lxdebug->leave_sub();
return $rc;
sub save_vendor {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form) = @_;
+ my ( $self, $myconfig, $form ) = @_;
+ $form->{taxzone_id} *= 1;
# connect to database
- my $dbh = $form->dbconnect($myconfig);
-##LINET
- map({
- $form->{"cp_${_}"} = $form->{"selected_cp_${_}"}
- if ($form->{"selected_cp_${_}"});
- } qw(title greeting abteilung));
+ my $dbh = $form->dbconnect_noauto($myconfig);
+
+ map( {
+ $form->{"cp_${_}"} = $form->{"selected_cp_${_}"}
+ if ( $form->{"selected_cp_${_}"} );
+ } qw(title greeting abteilung) );
$form->{"greeting"} = $form->{"selected_company_greeting"}
- if ($form->{"selected_company_greeting"});
- # escape '
- map { $form->{$_} =~ s/\'/\'\'/g }
- qw(vendornumber name street zipcode city country homepage contact notes cp_title cp_greeting language);
-##/LINET
- $form->{discount} = $form->parse_amount($myconfig, $form->{discount});
+ if ( $form->{"selected_company_greeting"} );
+
+ $form->{discount} = $form->parse_amount( $myconfig, $form->{discount} );
$form->{discount} /= 100;
- $form->{terms} *= 1;
- $form->{taxincluded} *= 1;
- $form->{obsolete} *= 1;
- $form->{business} *= 1;
- $form->{payment_id} *= 1;
- $form->{taxzone_id} *= 1;
- $form->{creditlimit} = $form->parse_amount($myconfig, $form->{creditlimit});
+ $form->{creditlimit} = $form->parse_amount( $myconfig, $form->{creditlimit} );
my $query;
- if ($form->{id}) {
- $query = qq|DELETE FROM vendortax
- WHERE vendor_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ if ( $form->{id} ) {
+ $query = qq|DELETE FROM shipto WHERE (trans_id = ?) AND (module = 'CT')|;
+ do_query($form, $dbh, $query, $form->{id});
- $query = qq|DELETE FROM shipto
- WHERE trans_id = $form->{id} AND module = 'CT'|;
- $dbh->do($query) || $form->dberror($query);
} else {
- my $uid = time;
- $uid .= $form->{login};
- my $uid = rand() . time;
- $uid .= $form->{login};
- $uid = substr($uid, 2, 75);
- $query = qq|INSERT INTO vendor (name)
- VALUES ('$uid')|;
- $dbh->do($query) || $form->dberror($query);
-
- $query = qq|SELECT v.id FROM vendor v
- WHERE v.name = '$uid'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($form->{id}) = $sth->fetchrow_array;
- $sth->finish;
- if (!$form->{vendornumber}) {
- $form->{vendornumber} =
- $form->update_defaults($myconfig, "vendornumber");
- }
+ $query = qq|SELECT nextval('id')|;
+ ($form->{id}) = selectrow_query($form, $dbh, $query);
- }
+ $query = qq|INSERT INTO vendor (id, name) VALUES (?, '')|;
+ do_query($form, $dbh, $query, $form->{id});
-##LINET
- $query = qq|UPDATE vendor SET
- vendornumber = '$form->{vendornumber}',
- name = '$form->{name}',
- greeting = '$form->{greeting}',
- department_1 = '$form->{department_1}',
- department_2 = '$form->{department_2}',
- street = '$form->{street}',
- zipcode = '$form->{zipcode}',
- city = '$form->{city}',
- country = '$form->{country}',
- homepage = '$form->{homepage}',
- contact = '$form->{contact}',
- phone = '$form->{phone}',
- fax = '$form->{fax}',
- email = '$form->{email}',
- cc = '$form->{cc}',
- bcc = '$form->{bcc}',
- notes = '$form->{notes}',
- terms = $form->{terms},
- discount = $form->{discount},
- creditlimit = $form->{creditlimit},
- taxincluded = '$form->{taxincluded}',
- gifi_accno = '$form->{gifi_accno}',
- business_id = $form->{business},
- taxnumber = '$form->{taxnumber}',
- sic_code = '$form->{sic}',
- language = '$form->{language}',
- account_number = '$form->{account_number}',
- bank_code = '$form->{bank_code}',
- bank = '$form->{bank}',
- obsolete = '$form->{obsolete}',
- ustid = '$form->{ustid}',
- payment_id = '$form->{payment_id}',
- taxzone_id = '$form->{taxzone_id}',
- language_id = | . conv_i($form->{language_id}, "NULL") . qq|,
- username = '$form->{username}',
- user_password = '$form->{user_password}',
- v_customer_id = '$form->{v_customer_id}'
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
-
- if ($form->{cp_id}) {
- $query = qq|UPDATE contacts SET
- cp_greeting = '$form->{cp_greeting}',
- cp_title = '$form->{cp_title}',
- cp_givenname = '$form->{cp_givenname}',
- cp_name = '$form->{cp_name}',
- cp_email = '$form->{cp_email}',
- cp_phone1 = '$form->{cp_phone1}',
- cp_phone2 = '$form->{cp_phone2}'
- WHERE cp_id = $form->{cp_id}|;
- } elsif ($form->{cp_name} || $form->{cp_givenname}) {
- $query =
- qq|INSERT INTO contacts ( cp_cv_id, cp_greeting, cp_title, cp_givenname, cp_name, cp_email, cp_phone1, cp_phone2)
- VALUES ($form->{id}, '$form->{cp_greeting}','$form->{cp_title}','$form->{cp_givenname}','$form->{cp_name}','$form->{cp_email}','$form->{cp_phone1}','$form->{cp_phone2}')|;
- }
- $dbh->do($query) || $form->dberror($query);
-
- # save taxes
- foreach $item (split / /, $form->{taxaccounts}) {
- if ($form->{"tax_$item"}) {
- $query = qq|INSERT INTO vendortax (vendor_id, chart_id)
- VALUES ($form->{id}, (SELECT c.id
- FROM chart c
- WHERE c.accno = '$item'))|;
- $dbh->do($query) || $form->dberror($query);
+ if ( !$form->{vendornumber} ) {
+ $form->{vendornumber} = $form->update_defaults( $myconfig, "vendornumber", $dbh );
}
}
+ $query =
+ qq|UPDATE vendor SET | .
+ qq| vendornumber = ?, | .
+ qq| name = ?, | .
+ qq| greeting = ?, | .
+ qq| department_1 = ?, | .
+ qq| department_2 = ?, | .
+ qq| street = ?, | .
+ qq| zipcode = ?, | .
+ qq| city = ?, | .
+ qq| country = ?, | .
+ qq| homepage = ?, | .
+ qq| contact = ?, | .
+ qq| phone = ?, | .
+ qq| fax = ?, | .
+ qq| email = ?, | .
+ qq| cc = ?, | .
+ qq| bcc = ?, | .
+ qq| notes = ?, | .
+ qq| terms = ?, | .
+ qq| discount = ?, | .
+ qq| creditlimit = ?, | .
+ qq| business_id = ?, | .
+ qq| taxnumber = ?, | .
+ qq| sic_code = ?, | .
+ qq| language = ?, | .
+ qq| account_number = ?, | .
+ qq| bank_code = ?, | .
+ qq| bank = ?, | .
+ qq| obsolete = ?, | .
+ qq| ustid = ?, | .
+ qq| payment_id = ?, | .
+ qq| taxzone_id = ?, | .
+ qq| language_id = ?, | .
+ qq| username = ?, | .
+ qq| user_password = ?, | .
+ qq| v_customer_id = ? | .
+ qq|WHERE id = ?|;
+ @values = (
+ $form->{vendornumber},
+ $form->{name},
+ $form->{greeting},
+ $form->{department_1},
+ $form->{department_2},
+ $form->{street},
+ $form->{zipcode},
+ $form->{city},
+ $form->{country},
+ $form->{homepage},
+ $form->{contact},
+ $form->{phone},
+ $form->{fax},
+ $form->{email},
+ $form->{cc},
+ $form->{bcc},
+ $form->{notes},
+ conv_i($form->{terms}),
+ $form->{discount},
+ $form->{creditlimit},
+ conv_i($form->{business}),
+ $form->{taxnumber},
+ $form->{sic},
+ $form->{language},
+ $form->{account_number},
+ $form->{bank_code},
+ $form->{bank},
+ $form->{obsolete} ? 't' : 'f',
+ $form->{ustid},
+ conv_i($form->{payment_id}),
+ conv_i($form->{taxzone_id}, 0),
+ conv_i( $form->{language_id}),
+ $form->{username},
+ $form->{user_password},
+ conv_i($form->{v_customer_id}),
+ $form->{id}
+ );
+ do_query($form, $dbh, $query, @values);
+
+ $query = undef;
+ if ( $form->{cp_id} ) {
+ $query =
+ qq|UPDATE contacts SET | .
+ qq| cp_greeting = ?, | .
+ qq| cp_title = ?, | .
+ qq| cp_givenname = ?, | .
+ qq| cp_name = ?, | .
+ qq| cp_email = ?, | .
+ qq| cp_phone1 = ?, | .
+ qq| cp_phone2 = ? | .
+ qq|WHERE cp_id = ?|;
+ @values = (
+ $form->{cp_greeting},
+ $form->{cp_title},
+ $form->{cp_givenname},
+ $form->{cp_name},
+ $form->{cp_email},
+ $form->{cp_phone1},
+ $form->{cp_phone2},
+ $form->{cp_id});
+ } elsif ( $form->{cp_name} || $form->{cp_givenname} ) {
+ $query =
+ qq|INSERT INTO contacts ( cp_cv_id, cp_greeting, cp_title, cp_givenname, cp_name, cp_email, cp_phone1, cp_phone2) | .
+ qq|VALUES (?, ?, ?, ?, ?, ?, ?, ?)|;
+ @values = (
+ conv_i($form->{id}),
+ $form->{cp_greeting},
+ $form->{cp_title},
+ $form->{cp_givenname},
+ $form->{cp_name},
+ $form->{cp_email},
+ $form->{cp_phone1},
+ $form->{cp_phone2});
+ }
+ do_query($form, $dbh, $query, @values) if ($query);
+
# add shipto
- $form->add_shipto($dbh, $form->{id}, "CT");
+ $form->add_shipto( $dbh, $form->{id}, "CT" );
- $rc = $dbh->disconnect;
+ $rc = $dbh->commit();
+ $dbh->disconnect();
$main::lxdebug->leave_sub();
return $rc;
sub delete {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form) = @_;
-
+ my ( $self, $myconfig, $form ) = @_;
# connect to database
my $dbh = $form->dbconnect($myconfig);
# delete vendor
- my $query = qq|DELETE FROM $form->{db}
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ my $cv = $form->{db} eq "customer" ? "customer" : "vendor";
+ my $query = qq|DELETE FROM $cv WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{id});
$dbh->disconnect;
sub search {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form) = @_;
+ my ( $self, $myconfig, $form ) = @_;
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $where = "1 = 1";
- $form->{sort} = "name" unless ($form->{sort});
+ my $cv = $form->{db} eq "customer" ? "customer" : "vendor";
- if ($form->{"$form->{db}number"}) {
- my $companynumber = $form->like(lc $form->{"$form->{db}number"});
- $where .= " AND lower(ct.$form->{db}number) LIKE '$companynumber'";
- }
- if ($form->{name}) {
- my $name = $form->like(lc $form->{name});
- $where .= " AND lower(ct.name) LIKE '$name'";
- }
- if ($form->{contact}) {
- my $contact = $form->like(lc $form->{contact});
- $where .= " AND lower(ct.contact) LIKE '$contact'";
- }
- if ($form->{email}) {
- my $email = $form->like(lc $form->{email});
- $where .= " AND lower(ct.email) LIKE '$email'";
+ my $where = "1 = 1";
+ my @values;
+
+ my %allowed_sort_columns =
+ map({ $_, 1 } qw(id customernumber name address contact phone fax email
+ taxnumber sic_code business invnumber ordnumber quonumber));
+ $sortorder =
+ $form->{sort} && $allowed_sort_columns{$form->{sort}} ?
+ $form->{sort} : "name";
+ $form->{sort} = $sortorder;
+ $sortorder = "country,city,street" if ($sortorder eq "address");
+
+ if ($form->{"${cv}number"}) {
+ $where .= " AND ct.${cv}number ILIKE ?";
+ push(@values, '%' . $form->{"${cv}number"} . '%');
+ }
+
+ foreach my $key (qw(name contact email)) {
+ if ($form->{$key}) {
+ $where .= " AND ct.$key ILIKE ?";
+ push(@values, '%' . $form->{$key} . '%');
+ }
}
- if ($form->{status} eq 'orphaned') {
- $where .= qq| AND ct.id NOT IN (SELECT o.$form->{db}_id
- FROM oe o, $form->{db} cv
- WHERE cv.id = o.$form->{db}_id)|;
- if ($form->{db} eq 'customer') {
- $where .= qq| AND ct.id NOT IN (SELECT a.customer_id
- FROM ar a, customer cv
- WHERE cv.id = a.customer_id)|;
+ if ( $form->{status} eq 'orphaned' ) {
+ $where .=
+ qq| AND ct.id NOT IN | .
+ qq| (SELECT o.${cv}_id FROM oe o, $cv cv WHERE cv.id = o.${cv}_id)|;
+ if ($cv eq 'customer') {
+ $where .=
+ qq| AND ct.id NOT IN | .
+ qq| (SELECT a.customer_id FROM ar a, customer cv | .
+ qq| WHERE cv.id = a.customer_id)|;
}
- if ($form->{db} eq 'vendor') {
- $where .= qq| AND ct.id NOT IN (SELECT a.vendor_id
- FROM ap a, vendor cv
- WHERE cv.id = a.vendor_id)|;
+ if ($cv eq 'vendor') {
+ $where .=
+ qq| AND ct.id NOT IN | .
+ qq| (SELECT a.vendor_id FROM ap a, vendor cv | .
+ qq| WHERE cv.id = a.vendor_id)|;
}
$form->{l_invnumber} = $form->{l_ordnumber} = $form->{l_quonumber} = "";
}
- my $query = qq|SELECT ct.*, b.description AS business
- FROM $form->{db} ct
- LEFT JOIN business b ON (ct.business_id = b.id)
- WHERE $where|;
+ if ($form->{obsolete} eq "Y") {
+ $where .= qq| AND obsolete|;
+ } elsif ($form->{obsolete} eq "N") {
+ $where .= qq| AND NOT obsolete|;
+ }
+
+ if ($form->{business_id}) {
+ $where .= qq| AND (business_id = ?)|;
+ push(@values, conv_i($form->{business_id}));
+ }
+
+ my $query =
+ qq|SELECT ct.*, b.description AS business | .
+ qq|FROM $cv ct | .
+ qq|LEFT JOIN business b ON (ct.business_id = b.id) | .
+ qq|WHERE $where|;
# redo for invoices, orders and quotations
if ($form->{l_invnumber} || $form->{l_ordnumber} || $form->{l_quonumber}) {
-
my ($ar, $union, $module);
$query = "";
if ($form->{l_invnumber}) {
- $ar = ($form->{db} eq 'customer') ? 'ar' : 'ap';
- $module = ($ar eq 'ar') ? 'is' : 'ir';
-
- $query = qq|SELECT ct.*, b.description AS business,
- a.invnumber, a.ordnumber, a.quonumber, a.id AS invid,
- '$module' AS module, 'invoice' AS formtype,
- (a.amount = a.paid) AS closed
- FROM $form->{db} ct
- JOIN $ar a ON (a.$form->{db}_id = ct.id)
- LEFT JOIN business b ON (ct.business_id = b.id)
- WHERE $where
- AND a.invoice = '1'|;
-
- $union = qq|
- UNION|;
-
+ my $ar = $cv eq 'customer' ? 'ar' : 'ap';
+ my $module = $ar eq 'ar' ? 'is' : 'ir';
+
+ $query =
+ qq|SELECT ct.*, b.description AS business, | .
+ qq| a.invnumber, a.ordnumber, a.quonumber, a.id AS invid, | .
+ qq| '$module' AS module, 'invoice' AS formtype, | .
+ qq| (a.amount = a.paid) AS closed | .
+ qq|FROM $cv ct | .
+ qq|JOIN $ar a ON (a.${cv}_id = ct.id) | .
+ qq|LEFT JOIN business b ON (ct.business_id = b.id) | .
+ qq|WHERE $where AND (a.invoice = '1')|;
+
+ $union = qq|UNION|;
}
- if ($form->{l_ordnumber}) {
- $query .= qq|$union
- SELECT ct.*, b.description AS business,
- ' ' AS invnumber, o.ordnumber, o.quonumber, o.id AS invid,
- 'oe' AS module, 'order' AS formtype,
- o.closed
- FROM $form->{db} ct
- JOIN oe o ON (o.$form->{db}_id = ct.id)
- LEFT JOIN business b ON (ct.business_id = b.id)
- WHERE $where
- AND o.quotation = '0'|;
-
- $union = qq|
- UNION|;
+ if ( $form->{l_ordnumber} ) {
+ $query .=
+ qq| $union | .
+ qq|SELECT ct.*, b.description AS business,| .
+ qq| ' ' AS invnumber, o.ordnumber, o.quonumber, o.id AS invid, | .
+ qq| 'oe' AS module, 'order' AS formtype, o.closed | .
+ qq|FROM $cv ct | .
+ qq|JOIN oe o ON (o.${cv}_id = ct.id) | .
+ qq|LEFT JOIN business b ON (ct.business_id = b.id) | .
+ qq|WHERE $where AND (o.quotation = '0')|;
+
+ $union = qq|UNION|;
}
- if ($form->{l_quonumber}) {
- $query .= qq|$union
- SELECT ct.*, b.description AS business,
- ' ' AS invnumber, o.ordnumber, o.quonumber, o.id AS invid,
- 'oe' AS module, 'quotation' AS formtype,
- o.closed
- FROM $form->{db} ct
- JOIN oe o ON (o.$form->{db}_id = ct.id)
- LEFT JOIN business b ON (ct.business_id = b.id)
- WHERE $where
- AND o.quotation = '1'|;
-
+ if ( $form->{l_quonumber} ) {
+ $query .=
+ qq| $union | .
+ qq|SELECT ct.*, b.description AS business, | .
+ qq| ' ' AS invnumber, o.ordnumber, o.quonumber, o.id AS invid, | .
+ qq| 'oe' AS module, 'quotation' AS formtype, o.closed | .
+ qq|FROM $cv ct | .
+ qq|JOIN oe o ON (o.${cv}_id = ct.id) | .
+ qq|LEFT JOIN business b ON (ct.business_id = b.id) | .
+ qq|WHERE $where AND (o.quotation = '1')|;
}
}
- $query .= qq|
- ORDER BY $form->{sort}|;
+ $query .= qq| ORDER BY $sortorder|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-##LINET
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- $ref->{address} = "";
- map { $ref->{address} .= "$ref->{$_} "; } qw(street zipcode city country);
- push @{ $form->{CT} }, $ref;
- }
-##/LINET
- $sth->finish;
- $dbh->disconnect;
+ $form->{CT} = selectall_hashref_query($form, $dbh, $query, @values);
+ map({ my $ref = $_; $ref->{address} = join(" ", map({ $ref->{$_} } qw(street zipcode city country))); }
+ @{ $form->{CT} });
$main::lxdebug->leave_sub();
}
sub get_contact {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form) = @_;
+ my ( $self, $myconfig, $form ) = @_;
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT c.*
- FROM contacts c
- WHERE c.cp_id = $form->{cp_id} order by c.cp_id limit 1|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
+ my $query =
+ qq|SELECT * FROM contacts c | .
+ qq|WHERE cp_id = ? ORDER BY cp_id limit 1|;
+ my $sth = prepare_execute_query($form, $dbh, $query, $form->{cp_id});
my $ref = $sth->fetchrow_hashref(NAME_lc);
map { $form->{$_} = $ref->{$_} } keys %$ref;
$main::lxdebug->leave_sub();
}
-
sub get_shipto {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form) = @_;
+ my ( $self, $myconfig, $form ) = @_;
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT s.*
- FROM shipto s
- WHERE s.shipto_id = $form->{shipto_id}|;
- #WHERE s.shipto_id = $form->{shipto_id} order by s.shipto_id limit 1|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $query = qq|SELECT * FROM shipto WHERE shipto_id = ?|;
+ my $sth = prepare_execute_query($form, $dbh, $query, $form->{shipto_id});
my $ref = $sth->fetchrow_hashref(NAME_lc);
sub get_delivery {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form) = @_;
- my $dbh = $form->dbconnect($myconfig);
- $tabelle = ($form->{db} eq "vendor") ? "ap" : "ar";
+ my ( $self, $myconfig, $form ) = @_;
+ my $dbh = $form->dbconnect($myconfig);
- $where = " WHERE 1=1 ";
- if ($form->{shipto_id} && $tabelle eq "ar") {
- $where .= "AND $tabelle.shipto_id=$form->{shipto_id} ";
+ my $arap = $form->{db} eq "vendor" ? "ap" : "ar";
+ my $db = $form->{db} eq "customer" ? "customer" : "vendor";
+
+ my $where = " WHERE 1=1 ";
+ my @values;
+
+ if ($form->{shipto_id} && ($arap eq "ar")) {
+ $where .= "AND ${arap}.shipto_id = ?";
+ push(@values, $form->{shipto_id});
} else {
- $where .="AND $tabelle.$form->{db}_id=$form->{id} ";
+ $where .= "AND ${arap}.${db}_id = ?";
+ push(@values, $form->{id});
}
+
if ($form->{from}) {
- $where .= "AND $tabelle.transdate >= '$form->{from}' ";
+ $where .= "AND ${arap}.transdate >= ?";
+ push(@values, conv_date($form->{from}));
}
if ($form->{to}) {
- $where .= "AND $tabelle.transdate <= '$form->{to}' ";
- }
- my $query = qq|select shiptoname, $tabelle.transdate, $tabelle.invnumber, $tabelle.ordnumber, invoice.description, qty, invoice.unit FROM $tabelle LEFT JOIN shipto ON |;
- $query .= ($tabelle eq "ar") ? qq|($tabelle.shipto_id=shipto.shipto_id) |:qq|($tabelle.id=shipto.trans_id) |;
- $query .=qq|LEFT join invoice on ($tabelle.id=invoice.trans_id) LEFT join parts ON (parts.id=invoice.parts_id) $where ORDER BY $tabelle.transdate DESC LIMIT 15|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $where .= "AND ${arap}.transdate <= ?";
+ push(@values, conv_date($form->{to}));
+ }
+ my $query =
+ qq|SELECT s.shiptoname, i.qty, | .
+ qq| ${arap}.transdate, ${arap}.invnumber, ${arap}.ordnumber, | .
+ qq| i.description, i.unit, i.sellprice | .
+ qq|FROM $arap | .
+ qq|LEFT JOIN shipto s ON | .
+ ($arap eq "ar"
+ ? qq|(ar.shipto_id = s.shipto_id) |
+ : qq|(ap.id = s.trans_id) |) .
+ qq|LEFT JOIN invoice i ON (${arap}.id = i.trans_id) | .
+ qq|LEFT join parts p ON (p.id = i.parts_id) | .
+ $where .
+ qq|ORDER BY ${arap}.transdate DESC LIMIT 15|;
+
+ $form->{DELIVERY} = selectall_hashref_query($form, $dbh, $query, @values);
-
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{DELIVERY} }, $ref;
- }
- $sth->finish;
$dbh->disconnect;
$main::lxdebug->leave_sub();
}
1;
-
use Time::HiRes qw(gettimeofday);
+use SL::DBUtils;
+
+use vars qw(@db_encodings %db_encoding_to_charset);
+
+@db_encodings = (
+ { "label" => "ASCII", "dbencoding" => "SQL_ASCII", "charset" => "ASCII" },
+ { "label" => "UTF-8 Unicode", "dbencoding" => "UNICODE", "charset" => "UTF-8" },
+ { "label" => "ISO 8859-1", "dbencoding" => "LATIN1", "charset" => "ISO-8859-1" },
+ { "label" => "ISO 8859-2", "dbencoding" => "LATIN2", "charset" => "ISO-8859-2" },
+ { "label" => "ISO 8859-3", "dbencoding" => "LATIN3", "charset" => "ISO-8859-3" },
+ { "label" => "ISO 8859-4", "dbencoding" => "LATIN4", "charset" => "ISO-8859-4" },
+ { "label" => "ISO 8859-5", "dbencoding" => "LATIN5", "charset" => "ISO-8859-5" },
+ { "label" => "ISO 8859-15", "dbencoding" => "LATIN9", "charset" => "ISO-8859-15" },
+ { "label" => "KOI8-R", "dbencoding" => "KOI8", "charset" => "KOI8-R" },
+ { "label" => "Windows CP1251", "dbencoding" => "WIN", "charset" => "CP1251" },
+ { "label" => "Windows CP866", "dbencoding" => "ALT", "charset" => "CP866" },
+);
+
+%db_encoding_to_charset = map { $_->{dbencoding}, $_->{charset} } @db_encodings;
+
+use constant DEFAULT_CHARSET => 'ISO-8859-15';
+
sub unique_id {
my ($a, $b) = gettimeofday();
return "${a}-${b}-${$}";
my (@filter_values, $filter);
if ($form->{"partnumber"}) {
- $filter .= " AND (partnumber ILIKE ?)";
+ $filter .= qq| AND (partnumber ILIKE ?)|;
push(@filter_values, '%' . $form->{"partnumber"} . '%');
}
if ($form->{"description"}) {
- $filter .= " AND (description ILIKE ?)";
+ $filter .= qq| AND (description ILIKE ?)|;
push(@filter_values, '%' . $form->{"description"} . '%');
}
substr($filter, 1, 3) = "WHERE" if ($filter);
$order_by =~ s/[^a-zA-Z_]//g;
$order_dir = $order_dir ? "ASC" : "DESC";
- my $query = "SELECT id, partnumber, description FROM parts $filter ORDER BY $order_by $order_dir";
+ my $query =
+ qq|SELECT id, partnumber, description | .
+ qq|FROM parts $filter | .
+ qq|ORDER BY $order_by $order_dir|;
my $sth = $dbh->prepare($query);
$sth->execute(@filter_values) || $form->dberror($query . " (" . join(", ", @filter_values) . ")");
my $parts = [];
my (@filter_values, $filter);
if ($form->{"projectnumber"}) {
- $filter .= " AND (projectnumber ILIKE ?)";
+ $filter .= qq| AND (projectnumber ILIKE ?)|;
push(@filter_values, '%' . $form->{"projectnumber"} . '%');
}
if ($form->{"description"}) {
- $filter .= " AND (description ILIKE ?)";
+ $filter .= qq| AND (description ILIKE ?)|;
push(@filter_values, '%' . $form->{"description"} . '%');
}
substr($filter, 1, 3) = "WHERE" if ($filter);
$order_by =~ s/[^a-zA-Z_]//g;
$order_dir = $order_dir ? "ASC" : "DESC";
- my $query = "SELECT id, projectnumber, description FROM project $filter ORDER BY $order_by $order_dir";
+ my $query =
+ qq|SELECT id, projectnumber, description | .
+ qq|FROM project $filter | .
+ qq|ORDER BY $order_by $order_dir|;
my $sth = $dbh->prepare($query);
$sth->execute(@filter_values) || $form->dberror($query . " (" . join(", ", @filter_values) . ")");
my $projects = [];
my (@filter_values, $filter);
if ($form->{"name"}) {
- $filter .= " AND (name ILIKE ?)";
+ $filter .= qq| AND (name ILIKE ?)|;
push(@filter_values, '%' . $form->{"name"} . '%');
}
substr($filter, 1, 3) = "WHERE" if ($filter);
$order_by =~ s/[^a-zA-Z_]//g;
$order_dir = $order_dir ? "ASC" : "DESC";
- my $query = "SELECT id, name FROM employee $filter ORDER BY $order_by $order_dir";
+ my $query =
+ qq|SELECT id, name | .
+ qq|FROM employee $filter | .
+ qq|ORDER BY $order_by $order_dir|;
my $sth = $dbh->prepare($query);
$sth->execute(@filter_values) || $form->dberror($query . " (" . join(", ", @filter_values) . ")");
my $employees = [];
my (@filter_values, $filter);
if ($form->{"name"}) {
- $filter .= " (name ILIKE '%$form->{name}%') AND";
+ $filter .= qq| (name ILIKE ?) AND|;
push(@filter_values, '%' . $form->{"name"} . '%');
}
- #substr($filter, 1, 3) = "WHERE" if ($filter);
$order_by =~ s/[^a-zA-Z_]//g;
$order_dir = $order_dir ? "ASC" : "DESC";
- my $query = "SELECT id, name, customernumber, (street || ', ' || zipcode || city) as address FROM customer WHERE $filter business_id=(SELECT id from business WHERE description='Endkunde') ORDER BY $order_by $order_dir";
+ my $query =
+ qq!SELECT id, name, customernumber, (street || ', ' || zipcode || city) AS address ! .
+ qq!FROM customer ! .
+ qq!WHERE $filter business_id = (SELECT id FROM business WHERE description = 'Endkunde') ! .
+ qq!ORDER BY $order_by $order_dir!;
my $sth = $dbh->prepare($query);
- $sth->execute() || $form->dberror($query . " (" . join(", ", @filter_values) . ")");
+ $sth->execute(@filter_values) ||
+ $form->dberror($query . " (" . join(", ", @filter_values) . ")");
my $delivery_customers = [];
while (my $ref = $sth->fetchrow_hashref()) {
push(@{$delivery_customers}, $ref);
my (@filter_values, $filter);
if ($form->{"name"}) {
- $filter .= " (name ILIKE '%$form->{name}%') AND";
+ $filter .= qq| (name ILIKE ?) AND|;
push(@filter_values, '%' . $form->{"name"} . '%');
}
- #substr($filter, 1, 3) = "WHERE" if ($filter);
$order_by =~ s/[^a-zA-Z_]//g;
$order_dir = $order_dir ? "ASC" : "DESC";
- my $query = "SELECT id, name, customernumber, (street || ', ' || zipcode || city) as address FROM customer WHERE $filter business_id=(SELECT id from business WHERE description='Händler') ORDER BY $order_by $order_dir";
+ my $query =
+ qq!SELECT id, name, customernumber, (street || ', ' || zipcode || city) AS address FROM customer ! .
+ qq!WHERE $filter business_id = (SELECT id FROM business WHERE description = 'Händler') ! .
+ qq!ORDER BY $order_by $order_dir!;
my $sth = $dbh->prepare($query);
- $sth->execute() || $form->dberror($query . " (" . join(", ", @filter_values) . ")");
+ $sth->execute(@filter_values) ||
+ $form->dberror($query . " (" . join(", ", @filter_values) . ")");
my $vendors = [];
while (my $ref = $sth->fetchrow_hashref()) {
push(@{$vendors}, $ref);
return $vendors;
}
+sub mkdir_with_parents {
+ $main::lxdebug->enter_sub();
+
+ my ($full_path) = @_;
+
+ my $path = "";
+
+ $full_path =~ s|/+|/|;
+
+ foreach my $part (split(m|/|, $full_path)) {
+ $path .= "/" if ($path);
+ $path .= $part;
+
+ die("Could not create directory '$path' because a file exists with " .
+ "the same name.\n") if (-f $path);
+
+ if (! -d $path) {
+ mkdir($path, 0770) || die("Could not create the directory '$path'. " .
+ "OS error: $!\n");
+ }
+ }
+
+ $main::lxdebug->leave_sub();
+}
+
+sub webdav_folder {
+ $main::lxdebug->enter_sub();
+
+ my ($form) = @_;
+
+ return $main::lxdebug->leave_sub()
+ unless ($main::webdav && $form->{id});
+
+ my ($path, $number);
+
+ $form->{WEBDAV} = [];
+
+ if ($form->{type} eq "sales_quotation") {
+ ($path, $number) = ("angebote", $form->{quonumber});
+ } elsif ($form->{type} eq "sales_order") {
+ ($path, $number) = ("bestellungen", $form->{ordnumber});
+ } elsif ($form->{type} eq "request_quotation") {
+ ($path, $number) = ("anfragen", $form->{quonumber});
+ } elsif ($form->{type} eq "purchase_order") {
+ ($path, $number) = ("lieferantenbestellungen", $form->{ordnumber});
+ } elsif ($form->{type} eq "credit_note") {
+ ($path, $number) = ("gutschriften", $form->{invnumber});
+ } elsif ($form->{vc} eq "customer") {
+ ($path, $number) = ("rechnungen", $form->{invnumber});
+ } else {
+ ($path, $number) = ("einkaufsrechnungen", $form->{invnumber});
+ }
+
+ return $main::lxdebug->leave_sub() unless ($path && $number);
+
+ $number =~ s|[/\\]|_|g;
+
+ $path = "webdav/${path}/${number}";
+
+ if (!-d $path) {
+ mkdir_with_parents($path);
+
+ } else {
+ my $base_path = substr($ENV{'SCRIPT_NAME'}, 1);
+ $base_path =~ s|[^/]+$||;
+ $base_path =~ s|/$||;
+
+ if (opendir $dir, $path) {
+ foreach my $file (sort { lc $a cmp lc $b } readdir $dir) {
+ next if (($file eq '.') || ($file eq '..'));
+
+ my $fname = $file;
+ $fname =~ s|.*/||;
+
+ my $is_directory = -d "$path/$file";
+
+ $file = join('/', map { $form->escape($_) } grep { $_ } split m|/+|, "$path/$file");
+ $file .= '/' if ($is_directory);
+
+ push @{ $form->{WEBDAV} }, {
+ 'name' => $fname,
+ 'link' => ($ENV{"HTTPS"} ? "https://" : "http://") . $ENV{'SERVER_NAME'} . "/$base_path/$file",
+ 'type' => $is_directory ? $main::locale->text('Directory') : $main::locale->text('File'),
+ };
+ }
+
+ closedir $dir;
+ }
+ }
+
+ $main::lxdebug->leave_sub();
+}
+
+sub get_vc_details {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form, $vc, $vc_id) = @_;
+
+ $vc = $vc eq "customer" ? "customer" : "vendor";
+
+ my $dbh = $form->dbconnect($myconfig);
+
+ my $query;
+
+ $query =
+ qq|SELECT
+ vc.*,
+ pt.description AS payment_terms,
+ b.description AS business,
+ l.description AS language
+ FROM ${vc} vc
+ LEFT JOIN payment_terms pt ON (vc.payment_id = pt.id)
+ LEFT JOIN business b ON (vc.business_id = b.id)
+ LEFT JOIN language l ON (vc.language_id = l.id)
+ WHERE vc.id = ?|;
+ my $ref = selectfirst_hashref_query($form, $dbh, $query, $vc_id);
+
+ if (!$ref) {
+ $dbh->disconnect();
+ $main::lxdebug->leave_sub();
+ return 0;
+ }
+
+ map { $form->{$_} = $ref->{$_} } keys %{ $ref };
+
+ map { $form->{$_} = $form->format_amount($myconfig, $form->{$_} * 1) } qw(discount creditlimit);
+
+ $query = qq|SELECT * FROM shipto WHERE (trans_id = ?)|;
+ $form->{SHIPTO} = selectall_hashref_query($form, $dbh, $query, $vc_id);
+
+ $query = qq|SELECT * FROM contacts WHERE (cp_cv_id = ?)|;
+ $form->{CONTACTS} = selectall_hashref_query($form, $dbh, $query, $vc_id);
+
+ $dbh->disconnect();
+
+ $main::lxdebug->leave_sub();
+
+ return 1;
+}
+
+sub get_shipto_by_id {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form, $shipto_id, $prefix) = @_;
+
+ $prefix ||= "";
+
+ my $dbh = $form->dbconnect($myconfig);
+
+ my $query = qq|SELECT * FROM shipto WHERE shipto_id = ?|;
+ my $ref = selectfirst_hashref_query($form, $dbh, $query, $shipto_id);
+
+ map { $form->{"${prefix}${_}"} = $ref->{$_} } keys %{ $ref } if $ref;
+
+ $dbh->disconnect();
+
+ $main::lxdebug->leave_sub();
+}
+
+sub save_email_status {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form) = @_;
+
+ my ($table, $query, $dbh);
+
+ if ($form->{script} eq 'oe.pl') {
+ $table = 'oe';
+
+ } elsif ($form->{script} eq 'is.pl') {
+ $table = 'ar';
+
+ } elsif ($form->{script} eq 'ir.pl') {
+ $table = 'ap';
+
+ }
+
+ return $main::lxdebug->leave_sub() if (!$form->{id} || !$table || !$form->{formname});
+
+ $dbh = $form->get_standard_dbh($myconfig);
+
+ my ($intnotes) = selectrow_query($form, $dbh, qq|SELECT intnotes FROM $table WHERE id = ?|, $form->{id});
+
+ $intnotes =~ s|\r||g;
+ $intnotes =~ s|\n$||;
+
+ $intnotes .= "\n\n" if ($intnotes);
+
+ my $cc = $main::locale->text('Cc') . ": $form->{cc}\n" if $form->{cc};
+ my $bcc = $main::locale->text('Bcc') . ": $form->{bcc}\n" if $form->{bcc};
+ my $now = scalar localtime;
+
+ $intnotes .= $main::locale->text('[email]') . "\n"
+ . $main::locale->text('Date') . ": $now\n"
+ . $main::locale->text('To (email)') . ": $form->{email}\n"
+ . "${cc}${bcc}"
+ . $main::locale->text('Subject') . ": $form->{subject}\n\n"
+ . $main::locale->text('Message') . ": $form->{message}";
+
+ $intnotes =~ s|\r||g;
+
+ do_query($form, $dbh, qq|UPDATE $table SET intnotes = ? WHERE id = ?|, $intnotes, $form->{id});
+
+ $form->save_status($dbh);
+
+ $dbh->commit();
+
+ $main::lxdebug->leave_sub();
+}
+
1;
$fromto =~ s/transdate/ac\.transdate/g;
- $query = qq|SELECT taxkey, rate FROM tax|;
+ $query = qq|SELECT id, taxkey, rate FROM tax|;
$sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- $taxes{ $ref->{taxkey} } = $ref->{rate};
+ $taxes{ $ref->{id} } = $ref->{rate};
}
$sth->finish();
$query =
qq|SELECT ac.oid, ac.transdate, ac.trans_id,ar.id, ac.amount, ac.taxkey, ar.invnumber, ar.duedate, ar.amount as umsatz,
- ct.name, c.accno, c.taxkey_id as charttax, c.datevautomatik, c.id, t.chart_id, t.rate FROM acc_trans ac,ar ar, customer ct,
+ ct.name, c.accno, c.taxkey_id as charttax, c.datevautomatik, c.id, t.chart_id, t.rate, t.id AS taxid, t.taxkey AS taxtaxkey FROM acc_trans ac,ar ar, customer ct,
chart c LEFT JOIN tax t ON
(t.chart_id=c.id)WHERE $fromto AND ac.trans_id=ar.id AND ac.trans_id=ar.id
AND ar.customer_id=ct.id AND ac.chart_id=c.id
UNION ALL
SELECT ac.oid, ac.transdate, ac.trans_id,ap.id, ac.amount, ac.taxkey, ap.invnumber, ap.duedate, ap.amount as umsatz,
- ct.name, c.accno, c.taxkey_id as charttax, c.datevautomatik, c.id, t.chart_id, t.rate FROM acc_trans ac, ap ap, vendor ct, chart c LEFT JOIN tax t ON
+ ct.name, c.accno, c.taxkey_id as charttax, c.datevautomatik, c.id, t.chart_id, t.rate, t.id AS taxid, t.taxkey AS taxtaxkey FROM acc_trans ac, ap ap, vendor ct, chart c LEFT JOIN tax t ON
(t.chart_id=c.id)
WHERE $fromto AND ac.trans_id=ap.id AND ap.vendor_id=ct.id AND ac.chart_id=c.id
UNION ALL
SELECT ac.oid, ac.transdate, ac.trans_id,gl.id, ac.amount, ac.taxkey, gl.reference AS invnumber, gl.transdate AS duedate, ac.amount as umsatz,
- gl.description AS name, c.accno, c.taxkey_id as charttax, c.datevautomatik, c.id, t.chart_id, t.rate FROM acc_trans ac, gl gl,
+ gl.description AS name, c.accno, c.taxkey_id as charttax, c.datevautomatik, c.id, t.chart_id, t.rate, t.id AS taxid, t.taxkey AS taxtaxkey FROM acc_trans ac, gl gl,
chart c LEFT JOIN tax t ON
(t.chart_id=c.id) WHERE $fromto AND ac.trans_id=gl.id AND ac.chart_id=c.id
ORDER BY trans_id, oid|;
push @{$i}, $ref2;
$firstrun = 0;
}
+ my %taxid_taxkeys = ();
$absumsatz = 0;
if (scalar(@{$i}) > 2) {
for my $j (0 .. (scalar(@{$i}) - 1)) {
$absumsatz = $i->[$j]->{'amount'};
$notsplitindex = $j;
}
+ if (($i->[$j]->{'taxtaxkey'}) && ($i->[$j]->{'taxid'})) {
+ $taxid_taxkeys{$i->[$j]->{'taxtaxkey'}} = $i->[$j]->{'taxid'};
+ }
}
$ml = ($i->[0]->{'umsatz'} > 0) ? 1 : -1;
for my $j (0 .. (scalar(@{$i}) - 1)) {
$g++;
} elsif (($j != $notsplitindex) && ($i->[$j]->{'chart_id'} eq "")) {
$absumsatz +=
- ($i->[$j]->{'amount'} * (1 + $taxes{ $i->[$j]->{'taxkey'} }));
+ ($i->[$j]->{'amount'} * (1 + $taxes{ $taxid_taxkeys{$i->[$j]->{'taxkey'}} }));
my %blubb = {};
map({ $blubb{$_} = $i->[$notsplitindex]->{$_}; }
keys(%{ $i->[$notsplitindex] }));
- $test = 1 + $taxes{ $i->[$j]->{'taxkey'} };
+ $test = 1 + $taxes{ $taxid_taxkeys{$i->[$j]->{'taxkey'}} };
$blubb{'amount'} =
$form->round_amount(($i->[$j]->{'amount'} * $test * -1), 2);
}
}
if (abs($absumsatz) > 0.01) {
- $form->error("Datev-Export fehlgeschlagen! Bei Transaktion $i->[0]->{trans_id}\n");
+ $form->error("Datev-Export fehlgeschlagen! Bei Transaktion $i->[0]->{trans_id} $absumsatz\n");
}
} else {
push @{ $form->{DATEV} }, \@{$i};
package SL::DBUpgrade2;
+use SL::Common;
+
require Exporter;
@ISA = qw(Exporter);
}
}
+ $control->{charset} ||= Common::DEFAULT_CHARSET;
+
_control_error($form, $file_name,
$locale->text("Missing 'tag' field."))
unless ($control->{"tag"});
push(@path, $tag);
- _control_error($form, $file_name,
- $main::locale->text("Dependency loop detected:") .
- " " . join(" -> ", @path))
- if ($controls->{$tag}->{"loop"});
+ my $ctrl = $controls->{$tag};
- $controls->{$tag}->{"loop"} = 1;
- map({ _check_for_loops($form, $file_name, $controls, $_, @path); }
- @{$controls->{$tag}->{"depends"}});
+ if ($ctrl->{"loop"} == 1) {
+ # Not done yet.
+ _control_error($form, $file_name,
+ $main::locale->text("Dependency loop detected:") .
+ " " . join(" -> ", @path))
+ } elsif ($ctrl->{"loop"} == 0) {
+ # Not checked yet.
+ $ctrl->{"loop"} = 1;
+ map({ _check_for_loops($form, $file_name, $controls, $_, @path); }
+ @{ $ctrl->{"depends"} });
+ $ctrl->{"loop"} = 2;
+ }
}
sub _control_error {
my ($form, $file_name, $message) = @_;
- my $form = $main::form;
+ $form = $main::form;
my $locale = $main::locale;
$form->error(sprintf($locale->text("Error in database control file '%s': %s"),
require Exporter;
@ISA = qw(Exporter);
-@EXPORT = qw(conv_i conv_date do_query dump_query);
+@EXPORT = qw(conv_i conv_date conv_dateq do_query selectrow_query do_statement
+ dump_query quote_db_date
+ selectfirst_hashref_query selectfirst_array_query
+ selectall_hashref_query selectall_array_query
+ prepare_execute_query prepare_query);
sub conv_i {
my ($value, $default) = @_;
return (defined($value) && "$value" ne "") ? $value : undef;
}
+sub conv_dateq {
+ my ($value) = @_;
+ if (defined($value) && "$value" ne "") {
+ $value =~ s/\'/\'\'/g;
+ return "'$value'";
+ }
+ return "NULL";
+}
+
sub do_query {
+ $main::lxdebug->enter_sub(2);
+
my ($form, $dbh, $query) = splice(@_, 0, 3);
+ dump_query(LXDebug::QUERY, '', $query, @_);
+
if (0 == scalar(@_)) {
$dbh->do($query) || $form->dberror($query);
} else {
$dbh->do($query, undef, @_) ||
$form->dberror($query . " (" . join(", ", @_) . ")");
}
+
+ $main::lxdebug->leave_sub(2);
+}
+
+sub selectrow_query { &selectfirst_array_query }
+
+sub do_statement {
+ $main::lxdebug->enter_sub(2);
+
+ my ($form, $sth, $query) = splice(@_, 0, 3);
+
+ dump_query(LXDebug::QUERY, '', $query, @_);
+
+ if (0 == scalar(@_)) {
+ $sth->execute() || $form->dberror($query);
+ } else {
+ $sth->execute(@_) ||
+ $form->dberror($query . " (" . join(", ", @_) . ")");
+ }
+
+ $main::lxdebug->leave_sub(2);
}
sub dump_query {
my ($level, $msg, $query) = splice(@_, 0, 3);
+
while ($query =~ /\?/) {
my $value = shift(@_);
$value =~ s/\'/\\\'/g;
$query =~ s/\?/$value/;
}
+ $query =~ s/[\n\s]+/ /g;
+
$msg .= " " if ($msg);
$main::lxdebug->message($level, $msg . $query);
}
+sub quote_db_date {
+ my ($str) = @_;
+
+ return "NULL" unless defined $str;
+ return "current_date" if $str =~ /current_date/;
+
+ $str =~ s/'/''/g;
+ return "'$str'";
+}
+
+sub prepare_query {
+ $main::lxdebug->enter_sub(2);
+
+ my ($form, $dbh, $query) = splice(@_, 0, 3);
+
+ dump_query(LXDebug::QUERY, '', $query, @_);
+
+ my $sth = $dbh->prepare($query) || $form->dberror($query);
+
+ $main::lxdebug->leave_sub(2);
+
+ return $sth;
+}
+
+sub prepare_execute_query {
+ $main::lxdebug->enter_sub(2);
+
+ my ($form, $dbh, $query) = splice(@_, 0, 3);
+
+ dump_query(LXDebug::QUERY, '', $query, @_);
+
+ my $sth = $dbh->prepare($query) || $form->dberror($query);
+ if (scalar(@_) != 0) {
+ $sth->execute(@_) || $form->dberror($query . " (" . join(", ", @_) . ")");
+ } else {
+ $sth->execute() || $form->dberror($query);
+ }
+
+ $main::lxdebug->leave_sub(2);
+
+ return $sth;
+}
+
+sub selectall_hashref_query {
+ $main::lxdebug->enter_sub(2);
+
+ my ($form, $dbh, $query) = splice(@_, 0, 3);
+
+ my $sth = prepare_execute_query($form, $dbh, $query, @_);
+ my $result = [];
+ while (my $ref = $sth->fetchrow_hashref()) {
+ push(@{ $result }, $ref);
+ }
+ $sth->finish();
+
+ $main::lxdebug->leave_sub(2);
+
+ return $result;
+}
+
+sub selectall_array_query {
+ $main::lxdebug->enter_sub(2);
+
+ my ($form, $dbh, $query) = splice(@_, 0, 3);
+
+ my $sth = prepare_execute_query($form, $dbh, $query, @_);
+ my @result;
+ while (my ($value) = $sth->fetchrow_array()) {
+ push(@result, $value);
+ }
+ $sth->finish();
+
+ $main::lxdebug->leave_sub(2);
+
+ return @result;
+}
+
+sub selectfirst_hashref_query {
+ $main::lxdebug->enter_sub(2);
+
+ my ($form, $dbh, $query) = splice(@_, 0, 3);
+
+ my $sth = prepare_execute_query($form, $dbh, $query, @_);
+ my $ref = $sth->fetchrow_hashref();
+ $sth->finish();
+
+ $main::lxdebug->leave_sub(2);
+
+ return $ref;
+}
+
+sub selectfirst_array_query {
+ $main::lxdebug->enter_sub(2);
+
+ my ($form, $dbh, $query) = splice(@_, 0, 3);
+
+ my $sth = prepare_execute_query($form, $dbh, $query, @_);
+ my @ret = $sth->fetchrow_array();
+ $sth->finish();
+
+ $main::lxdebug->leave_sub(2);
+
+ return @ret;
+}
+
1;
+
+
+__END__
+
+=head1 NAME
+
+SL::DBUTils.pm: All about Databaseconections in Lx
+
+=head1 SYNOPSIS
+
+ use DBUtils;
+
+ conv_i($str, $default)
+ conv_date($str)
+ conv_dateq($str)
+ quote_db_date($date)
+
+ do_query($form, $dbh, $query)
+ do_statement($form, $sth, $query)
+
+ dump_query($level, $msg, $query)
+ prepare_execute_query($form, $dbh, $query)
+
+ my $all_results_ref = selectall_hashref_query($form, $dbh, $query)
+ my $first_result_hash_ref = selectfirst_hashref_query($form, $dbh, $query);
+
+ my @first_result = selectfirst_array_query($form, $dbh, $query); # ==
+ my @first_result = selectrow_query($form, $dbh, $query);
+
+
+=head1 DESCRIPTION
+
+DBUtils is the attempt to reduce the amount of overhead it takes to retrieve information from the database in Lx-Office. Previously it would take about 15 lines of code just to get one single integer out of the database, including failure procedures and importing the necessary packages. Debugging would take even more.
+
+Using DBUtils most database procedures can be reduced to defining the query, executing it, and retrieving the result. Let DBUtils handle the rest. Whenever there is a database operation not covered in DBUtils, add it here, rather than working around it in the backend code.
+
+DBUtils relies heavily on two parameters which have to be passed to almost every function: $form and $dbh.
+ - $form is used for error handling only. It can be omitted in theory, but should not.
+ - $dbh is a handle to the databe, as returned by the DBI::connect routine. If you don't have an active connectiong, you can query $form->get_standard_dbh() to get a generic no_auto connection. Don't forget to commit in this case!
+
+
+Every function here should accomplish the follwing things:
+ - Easy debugging. Every handled query gets dumped via LXDebug, if specified there.
+ - Safe value binding. Although DBI is far from perfect in terms of binding, the rest of the bindings should happen here.
+ - Error handling. Should a query fail, an error message will be generated here instead of in the backend code invoking DBUtils.
+
+Note that binding is not perfect here either...
+
+=head2 QUOTING FUNCTIONS
+
+=over 4
+
+=item conv_i STR
+
+=item conv_i STR,DEFAULT
+
+Converts STR to an integer. If STR is empty, returns DEFAULT. If no DEFAULT is given, returns undef.
+
+=item conv_date STR
+
+Converts STR to a date string. If STR is emptry, returns undef.
+
+=item conv_dateq STR
+
+Database version of conv_date. Quotes STR before returning. Returns 'NULL' if STR is empty.
+
+=item quote_db_date STR
+
+Treats STR as a database date, quoting it. If STR equals current_date returns an escaped version which is treated as the current date by Postgres.
+Returns 'NULL' if STR is empty.
+
+=back
+
+=head2 QUERY FUNCTIONS
+
+=over 4
+
+=item do_query FORM,DBH,QUERY,ARRAY
+
+Uses DBI::do to execute QUERY on DBH using ARRAY for binding values. FORM is only needed for error handling, but should always be passed nevertheless. Use this for insertions or updates that don't need to be prepared.
+
+=item do_statement FORM,STH,QUERY,ARRAY
+
+Uses DBI::execute to execute QUERY on DBH using ARRAY for binding values. As with do_query, FORM is only used for error handling. If you are unsure what to use, refer to the documentation of DBI::do and DBI::execute.
+
+=item prepare_execute_query FORM,DBH,QUERY,ARRAY
+
+Prepares and executes QUERY on DBH using DBI::prepare and DBI::execute. ARRAY is passed as binding values to execute.
+
+=back
+
+=head2 RETRIEVAL FUNCTIONS
+
+=over 4
+
+=item selectfirst_array_query FORM,DBH,QUERY,ARRAY
+
+=item selectrow_query FORM,DBH,QUERY,ARRAY
+
+Prepares and executes a query using DBUtils functions, retireves the first row from the database, and returns it as an arrayref of the first row.
+
+=item selectfirst_hashref_query FORM,DBH,QUERY,ARRAY
+
+Prepares and executes a query using DBUtils functions, retireves the first row from the database, and returns it as a hashref of the first row.
+
+=item selectall_hashref_query FORM,DBH,QUERY,ARRAY
+
+Prepares and executes a query using DBUtils functions, retireves all data from the database, and returns it in hashref mode. This is slightly confusing, as the data structure will actually be a reference to an array, containing hashrefs for each row.
+
+=back
+
+=head2 DEBUG FUNCTIONS
+
+=over 4
+
+=item dump_query LEVEL,MSG,QUERY,ARRAY
+
+Dumps a query using LXDebug->message, using LEVEL for the debug-level of LXDebug. If MSG is given, it preceeds the QUERY dump in the logfiles. ARRAY is used to interpolate the '?' placeholders in QUERY, the resulting QUERY can be copy-pasted into a database frontend for debugging. Note that this method is also automatically called by each of the other QUERY FUNCTIONS, so there is in general little need to invoke it manually.
+
+=back
+
+=head1 EXAMPLES
+
+=over 4
+
+=item Retrieving a whole table:
+
+ $query = qq|SELECT id, pricegroup FROM pricegroup|;
+ $form->{PRICEGROUPS} = selectall_hashref_query($form, $dbh, $query);
+
+=item Retrieving a single value:
+
+ $query = qq|SELECT nextval('glid')|;
+ ($new_id) = selectrow_query($form, $dbh, $query);
+
+=item Using binding values:
+
+ $query = qq|UPDATE ar SET paid = amount + paid, storno = 't' WHERE id = ?|;
+ do_query($form, $dbh, $query, $id);
+
+=item A more complicated example, using dynamic binding values:
+
+ my @values;
+
+ if ($form->{language_values} ne "") {
+ $query = qq|SELECT l.id, l.description, tr.translation, tr.longdescription
+ FROM language l
+ LEFT OUTER JOIN translation tr ON (tr.language_id = l.id) AND (tr.parts_id = ?)|;
+ @values = (conv_i($form->{id}));
+ } else {
+ $query = qq|SELECT id, description FROM language|;
+ }
+
+ my $languages = selectall_hashref_query($form, $dbh, $query, @values);
+
+=back
+
+=head1 SEE ALSO
+
+=head1 MODULE AUTHORS
+
+Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
+Sven Schoeling E<lt>s.schoeling@linet-services.deE<gt>
+
+=head1 DOCUMENTATION AUTHORS
+
+Udo Spallek E<lt>udono@gmx.netE<gt>
+Sven Schoeling E<lt>s.schoeling@linet-services.deE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2007 by Lx-Office Community
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+=cut
package DN;
-use SL::Template;
+use SL::Common;
+use SL::DBUtils;
use SL::IS;
-use Data::Dumper;
+use SL::Mailer;
+use SL::MoreCommon;
+use SL::Template;
sub get_config {
$main::lxdebug->enter_sub();
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT dn.*
- FROM dunning_config dn
- ORDER BY dn.dunning_level|;
-
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $query =
+ qq|SELECT * | .
+ qq|FROM dunning_config | .
+ qq|ORDER BY dunning_level|;
+ $form->{DUNNING} = selectall_hashref_query($form, $dbh, $query);
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
+ foreach my $ref (@{ $form->{DUNNING} }) {
$ref->{fee} = $form->format_amount($myconfig, $ref->{fee}, 2);
- $ref->{interest} = $form->format_amount($myconfig, ($ref->{interest} * 100));
- push @{ $form->{DUNNING} }, $ref;
+ $ref->{interest_rate} = $form->format_amount($myconfig, ($ref->{interest_rate} * 100));
}
- $sth->finish;
- $dbh->disconnect;
+ $query =
+ qq|SELECT dunning_ar_amount_fee, dunning_ar_amount_interest, dunning_ar
+ FROM defaults|;
+ ($form->{AR_amount_fee}, $form->{AR_amount_interest}, $form->{AR}) = selectrow_query($form, $dbh, $query);
+
+ $dbh->disconnect();
$main::lxdebug->leave_sub();
}
-
sub save_config {
$main::lxdebug->enter_sub();
# connect to database
my $dbh = $form->dbconnect_noauto($myconfig);
+ my ($query, @values);
+
for my $i (1 .. $form->{rowcount}) {
- $form->{"active_$i"} *= 1;
- $form->{"auto_$i"} *= 1;
- $form->{"email_$i"} *= 1;
- $form->{"terms_$i"} *= 1;
- $form->{"payment_terms_$i"} *= 1;
- $form->{"email_attachment_$i"} *= 1;
$form->{"fee_$i"} = $form->parse_amount($myconfig, $form->{"fee_$i"}) * 1;
- $form->{"interest_$i"} = $form->parse_amount($myconfig, $form->{"interest_$i"})/100;
-
- if (($form->{"dunning_level_$i"} ne "") && ($form->{"dunning_description_$i"} ne "")) {
+ $form->{"interest_rate_$i"} = $form->parse_amount($myconfig, $form->{"interest_rate_$i"}) / 100;
+
+ if (($form->{"dunning_level_$i"} ne "") &&
+ ($form->{"dunning_description_$i"} ne "")) {
+ @values = (conv_i($form->{"dunning_level_$i"}), $form->{"dunning_description_$i"},
+ $form->{"email_subject_$i"}, $form->{"email_body_$i"},
+ $form->{"template_$i"}, $form->{"fee_$i"}, $form->{"interest_rate_$i"},
+ $form->{"active_$i"} ? 't' : 'f', $form->{"auto_$i"} ? 't' : 'f', $form->{"email_$i"} ? 't' : 'f',
+ $form->{"email_attachment_$i"} ? 't' : 'f', conv_i($form->{"payment_terms_$i"}), conv_i($form->{"terms_$i"}),
+ $form->{"create_invoices_for_fees_$i"} ? 't' : 'f');
if ($form->{"id_$i"}) {
- my $query = qq|UPDATE dunning_config SET
- dunning_level = | . $dbh->quote($form->{"dunning_level_$i"}) . qq|,
- dunning_description = | . $dbh->quote($form->{"dunning_description_$i"}) . qq|,
- email_subject = | . $dbh->quote($form->{"email_subject_$i"}) . qq|,
- email_body = | . $dbh->quote($form->{"email_body_$i"}) . qq|,
- template = | . $dbh->quote($form->{"template_$i"}) . qq|,
- fee = '$form->{"fee_$i"}',
- interest = '$form->{"interest_$i"}',
- active = '$form->{"active_$i"}',
- auto = '$form->{"auto_$i"}',
- email = '$form->{"email_$i"}',
- email_attachment = '$form->{"email_attachment_$i"}',
- payment_terms = $form->{"payment_terms_$i"},
- terms = $form->{"terms_$i"}
- WHERE id=$form->{"id_$i"}|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|UPDATE dunning_config SET
+ dunning_level = ?, dunning_description = ?,
+ email_subject = ?, email_body = ?,
+ template = ?, fee = ?, interest_rate = ?,
+ active = ?, auto = ?, email = ?,
+ email_attachment = ?, payment_terms = ?, terms = ?,
+ create_invoices_for_fees = ?
+ WHERE id = ?|;
+ push(@values, conv_i($form->{"id_$i"}));
} else {
- my $query = qq|INSERT INTO dunning_config (dunning_level, dunning_description, email_subject, email_body, template, fee, interest, active, auto, email, email_attachment, terms, payment_terms) VALUES (| . $dbh->quote($form->{"dunning_level_$i"}) . qq|,| . $dbh->quote($form->{"dunning_description_$i"}) . qq|,| . $dbh->quote($form->{"email_subject_$i"}) . qq|,| . $dbh->quote($form->{"email_body_$i"}) . qq|,| . $dbh->quote($form->{"template_$i"}) . qq|,'$form->{"fee_$i"}','$form->{"interest_$i"}','$form->{"active_$i"}','$form->{"auto_$i"}','$form->{"email_$i"}','$form->{"email_attachment_$i"}',$form->{"terms_$i"},$form->{"payment_terms_$i"})|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|INSERT INTO dunning_config
+ (dunning_level, dunning_description, email_subject, email_body,
+ template, fee, interest_rate, active, auto, email,
+ email_attachment, payment_terms, terms, create_invoices_for_fees)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
}
+ do_query($form, $dbh, $query, @values);
}
+
if (($form->{"dunning_description_$i"} eq "") && ($form->{"id_$i"})) {
- my $query = qq|DELETE FROM dunning_config WHERE id=$form->{"id_$i"}|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|DELETE FROM dunning_config WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{"id_$i"});
}
}
- $dbh->commit;
- $dbh->disconnect;
+ $query = qq|UPDATE defaults SET dunning_ar_amount_fee = ?, dunning_ar_amount_interest = ?, dunning_ar = ?|;
+ @values = (conv_i($form->{AR_amount_fee}), conv_i($form->{AR_amount_interest}), conv_i($form->{AR}));
+ do_query($form, $dbh, $query, @values);
+
+ $dbh->commit();
+ $dbh->disconnect();
+
+ $main::lxdebug->leave_sub();
+}
+
+sub create_invoice_for_fees {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form, $dbh, $dunning_id) = @_;
+
+ my ($query, @values, $sth, $ref);
+
+ $query = qq|SELECT dcfg.create_invoices_for_fees
+ FROM dunning d
+ LEFT JOIN dunning_config dcfg ON (d.dunning_config_id = dcfg.id)
+ WHERE d.dunning_id = ?|;
+ my ($create_invoices_for_fees) = selectrow_query($form, $dbh, $query, $dunning_id);
+
+ if (!$create_invoices_for_fees) {
+ $main::lxdebug->leave_sub();
+ return;
+ }
+
+ $query = qq|SELECT dunning_ar_amount_fee, dunning_ar_amount_interest, dunning_ar FROM defaults|;
+ ($form->{AR_amount_fee}, $form->{AR_amount_interest}, $form->{AR}) = selectrow_query($form, $dbh, $query);
+
+ $query =
+ qq|SELECT
+ fee,
+ COALESCE((
+ SELECT MAX(d_fee.fee)
+ FROM dunning d_fee
+ WHERE (d_fee.trans_id = d.trans_id)
+ AND (d_fee.dunning_id <> ?)
+ AND NOT (d_fee.fee_interest_ar_id ISNULL)
+ ), 0)
+ AS max_previous_fee,
+ interest,
+ COALESCE((
+ SELECT MAX(d_interest.interest)
+ FROM dunning d_interest
+ WHERE (d_interest.trans_id = d.trans_id)
+ AND (d_interest.dunning_id <> ?)
+ AND NOT (d_interest.fee_interest_ar_id ISNULL)
+ ), 0)
+ AS max_previous_interest
+ FROM dunning d
+ WHERE dunning_id = ?|;
+ @values = ($dunning_id, $dunning_id, $dunning_id);
+ $sth = prepare_execute_query($form, $dbh, $query, @values);
+
+ my ($fee_remaining, $interest_remaining) = (0, 0);
+ my ($fee_total, $interest_total) = (0, 0);
+
+ while (my $ref = $sth->fetchrow_hashref()) {
+ $fee_remaining += $form->round_amount($ref->{fee}, 2);
+ $fee_remaining -= $form->round_amount($ref->{max_previous_fee}, 2);
+ $fee_total += $form->round_amount($ref->{fee}, 2);
+ $interest_remaining += $form->round_amount($ref->{interest}, 2);
+ $interest_remaining -= $form->round_amount($ref->{max_previous_interest}, 2);
+ $interest_total += $form->round_amount($ref->{interest}, 2);
+ }
+
+ $sth->finish();
+
+ my $amount = $fee_remaining + $interest_remaining;
+
+ if (!$amount) {
+ $main::lxdebug->leave_sub();
+ return;
+ }
+
+ my ($ar_id) = selectrow_query($form, $dbh, qq|SELECT nextval('glid')|);
+
+ $query =
+ qq|INSERT INTO ar (id, invnumber, transdate, gldate, customer_id,
+ taxincluded, amount, netamount, paid, duedate,
+ invoice, curr, notes,
+ employee_id)
+ VALUES (
+ ?, -- id
+ ?, -- invnumber
+ current_date, -- transdate
+ current_date, -- gldate
+ -- customer_id:
+ (SELECT ar.customer_id
+ FROM dunning dn
+ LEFT JOIN ar ON (dn.trans_id = ar.id)
+ WHERE dn.dunning_id = ?
+ LIMIT 1),
+ 'f', -- taxincluded
+ ?, -- amount
+ ?, -- netamount
+ 0, -- paid
+ -- duedate:
+ (SELECT duedate FROM dunning WHERE dunning_id = ?),
+ 'f', -- invoice
+ ?, -- curr
+ ?, -- notes
+ -- employee_id:
+ (SELECT id FROM employee WHERE login = ?)
+ )|;
+ @values = ($ar_id, # id
+ $form->update_defaults($myconfig, 'invnumber', $dbh), # invnumber
+ $dunning_id, # customer_id
+ $amount,
+ $amount,
+ $dunning_id, # duedate
+ (split m/:/, $myconfig->{currency})[0], # currency
+ sprintf($main::locale->text('Automatically created invoice for fee and interest for dunning %s'), $dunning_id), # notes
+ $form->{login}); # employee_id
+ do_query($form, $dbh, $query, @values);
+
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, taxkey)
+ VALUES (?, ?, ?, current_date, current_date, 0)|;
+ $sth = prepare_query($form, $dbh, $query);
+
+ @values = ($ar_id, conv_i($form->{AR_amount_fee}), $fee_remaining);
+ do_statement($form, $sth, $query, @values);
+
+ if ($interest_remaining) {
+ @values = ($ar_id, conv_i($form->{AR_amount_interest}), $interest_remaining);
+ do_statement($form, $sth, $query, @values);
+ }
+
+ @values = ($ar_id, conv_i($form->{AR}), -1 * $amount);
+ do_statement($form, $sth, $query, @values);
+
+ $sth->finish();
+
+ $query = qq|UPDATE dunning SET fee_interest_ar_id = ? WHERE dunning_id = ?|;
+ do_query($form, $dbh, $query, $ar_id, $dunning_id);
$main::lxdebug->leave_sub();
}
sub save_dunning {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form, $rows, $userspath,$spool, $sendmail) = @_;
+ my ($self, $myconfig, $form, $rows, $userspath, $spool, $sendmail) = @_;
# connect to database
my $dbh = $form->dbconnect_noauto($myconfig);
- foreach my $row (@{ $rows }) {
-
- $form->{"interest_$row"} = $form->parse_amount($myconfig,$form->{"interest_$row"});
- $form->{"fee_$row"} = $form->parse_amount($myconfig,$form->{"fee_$row"});
- $form->{send_email} = $form->{"email_$row"};
-
- my $query = qq| UPDATE ar set dunning_id = '$form->{"next_dunning_id_$row"}' WHERE id='$form->{"inv_id_$row"}'|;
- $dbh->do($query) || $form->dberror($query);
- my $query = qq| INSERT into dunning (dunning_id,dunning_level,trans_id,fee,interest,transdate,duedate) VALUES ($form->{"next_dunning_id_$row"},(select dunning_level from dunning_config WHERE id=$form->{"next_dunning_id_$row"}),$form->{"inv_id_$row"},'$form->{"fee_$row"}', '$form->{"interest_$row"}',current_date, |.$dbh->quote($form->{"next_duedate_$row"}) . qq|)|;
- $dbh->do($query) || $form->dberror($query);
- }
-
- my $query = qq| SELECT invnumber, ordnumber, customer_id, amount, netamount, ar.transdate, ar.duedate, paid, amount-paid AS open_amount, template AS formname, email_subject, email_body, email_attachment, da.fee, da.interest, da.transdate AS dunning_date, da.duedate AS dunning_duedate FROM ar LEFT JOIN dunning_config ON (dunning_config.id=ar.dunning_id) LEFT JOIN dunning da ON (ar.id=da.trans_id) where ar.id IN $form->{inv_ids}|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- my $first = 1;
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- if ($first) {
- map({ $form->{"dn_$_"} = []; } keys(%{$ref}));
- $first = 0;
- }
- map { $ref->{$_} = $form->format_amount($myconfig, $ref->{$_}, 2) } qw(amount netamount paid open_amount fee interest);
- map { $form->{$_} = $ref->{$_} } keys %$ref;
- #print(STDERR Dumper($ref));
- map { push @{ $form->{"dn_$_"} }, $ref->{$_}} keys %$ref;
+ my ($query, @values);
+
+ my ($dunning_id) = selectrow_query($form, $dbh, qq|SELECT nextval('id')|);
+
+ my $q_update_ar = qq|UPDATE ar SET dunning_config_id = ? WHERE id = ?|;
+ my $h_update_ar = prepare_query($form, $dbh, $q_update_ar);
+
+ my $q_insert_dunning =
+ qq|INSERT INTO dunning (dunning_id, dunning_config_id, dunning_level, trans_id,
+ fee, interest, transdate, duedate)
+ VALUES (?, ?,
+ (SELECT dunning_level FROM dunning_config WHERE id = ?),
+ ?,
+ (SELECT SUM(fee)
+ FROM dunning_config
+ WHERE dunning_level <= (SELECT dunning_level FROM dunning_config WHERE id = ?)),
+ (SELECT (amount - paid) * (current_date - transdate) FROM ar WHERE id = ?)
+ * (SELECT interest_rate FROM dunning_config WHERE id = ?)
+ / 360,
+ current_date,
+ current_date + (SELECT payment_terms FROM dunning_config WHERE id = ?))|;
+ my $h_insert_dunning = prepare_query($form, $dbh, $q_insert_dunning);
+
+ my @invoice_ids;
+ my ($next_dunning_config_id, $customer_id);
+ my $send_email = 0;
+
+ foreach my $row (@{ $rows }) {
+ push @invoice_ids, $row->{invoice_id};
+ $next_dunning_config_id = $row->{next_dunning_config_id};
+ $customer_id = $row->{customer_id};
+
+ @values = ($row->{next_dunning_config_id}, $row->{invoice_id});
+ do_statement($form, $h_update_ar, $q_update_ar, @values);
+
+ $send_email |= $row->{email};
+
+ my $next_config_id = conv_i($row->{next_dunning_config_id});
+ my $invoice_id = conv_i($row->{invoice_id});
+
+ @values = ($dunning_id, $next_config_id, $next_config_id,
+ $invoice_id, $next_config_id, $invoice_id,
+ $next_config_id, $next_config_id);
+ do_statement($form, $h_insert_dunning, $q_insert_dunning, @values);
}
- $sth->finish;
- IS->customer_details($myconfig,$form);
- #print(STDERR Dumper($form->{dn_invnumber}));
- $form->{templates} = "$myconfig->{templates}";
+ $h_update_ar->finish();
+ $h_insert_dunning->finish();
+ $form->{DUNNING_PDFS_EMAIL} = [];
+ $self->create_invoice_for_fees($myconfig, $form, $dbh, $dunning_id);
- $form->{language} = $form->get_template_language(\%myconfig);
- $form->{printer_code} = $form->get_printer_code(\%myconfig);
+ $self->print_invoice_for_fees($myconfig, $form, $dunning_id, $dbh);
+ $self->print_dunning($myconfig, $form, $dunning_id, $dbh);
- if ($form->{language} ne "") {
- $form->{language} = "_" . $form->{language};
- }
+ $form->{dunning_id} = $dunning_id;
- if ($form->{printer_code} ne "") {
- $form->{printer_code} = "_" . $form->{printer_code};
+ if ($send_email) {
+ $self->send_email($myconfig, $form, $dunning_id, $dbh);
}
- $form->{IN} = "$form->{formname}$form->{language}$form->{printer_code}.html";
- if ($form->{format} eq 'postscript') {
- $form->{postscript} = 1;
- $form->{IN} =~ s/html$/tex/;
- } elsif ($form->{"format"} =~ /pdf/) {
- $form->{pdf} = 1;
- if ($form->{"format"} =~ /opendocument/) {
- $form->{IN} =~ s/html$/odt/;
- } else {
- $form->{IN} =~ s/html$/tex/;
- }
- } elsif ($form->{"format"} =~ /opendocument/) {
- $form->{"opendocument"} = 1;
- $form->{"IN"} =~ s/html$/odt/;
- }
+ $dbh->commit();
+ $dbh->disconnect();
- if ($form->{"send_email"} && ($form->{email} ne "")) {
- $form->{media} = 'email';
- }
+ $main::lxdebug->leave_sub();
+}
- $form->{keep_tmpfile} = 0;
- if ($form->{media} eq 'email') {
- $form->{subject} = qq|$form->{label} $form->{"${inv}number"}|
- unless $form->{subject};
- if (!$form->{email_attachment}) {
- $form->{do_not_attach} = 1;
- } else {
- $form->{do_not_attach} = 0;
- }
- $form->{subject} = parse_strings($myconfig, $form, $userspath, $form->{email_subject});
- $form->{message} = parse_strings($myconfig, $form, $userspath, $form->{email_body});
+sub send_email {
+ $main::lxdebug->enter_sub();
- $form->{OUT} = "$sendmail";
+ my ($self, $myconfig, $form, $dunning_id, $dbh) = @_;
- } else {
-
- my $uid = rand() . time;
+ my $query =
+ qq|SELECT
+ dcfg.email_body, dcfg.email_subject, dcfg.email_attachment,
+ c.email AS recipient
+
+ FROM dunning d
+ LEFT JOIN dunning_config dcfg ON (d.dunning_config_id = dcfg.id)
+ LEFT JOIN ar ON (d.trans_id = ar.id)
+ LEFT JOIN customer c ON (ar.customer_id = c.id)
+ WHERE (d.dunning_id = ?)
+ LIMIT 1|;
+ my $ref = selectfirst_hashref_query($form, $dbh, $query, $dunning_id);
- $uid .= $form->{login};
+ if (!$ref || !$ref->{recipient} || !$myconfig->{email}) {
+ $main::lxdebug->leave_sub();
+ return;
+ }
- $uid = substr($uid, 2, 75);
- $filename = $uid;
+ my $template = PlainTextTemplate->new(undef, $form, $myconfig);
+ my $mail = Mailer->new();
+ $mail->{from} = $myconfig->{email};
+ $mail->{to} = $ref->{recipient};
+ $mail->{subject} = $template->parse_block($ref->{email_subject});
+ $mail->{message} = $template->parse_block($ref->{email_body});
- $filename .= '.pdf';
- $form->{OUT} = ">$spool/$filename";
- push(@{ $form->{DUNNING_PDFS} }, $filename);
- $form->{keep_tmpfile} = 1;
+ if ($myconfig->{signature}) {
+ $mail->{message} .= "\n-- \n$myconfig->{signature}";
}
-
- $form->parse_template($myconfig, $userspath);
- $dbh->commit;
- $dbh->disconnect;
+ $mail->{message} =~ s/\r\n/\n/g;
+
+ if ($ref->{email_attachment} && @{ $form->{DUNNING_PDFS_EMAIL} }) {
+ $mail->{attachments} = $form->{DUNNING_PDFS_EMAIL};
+ }
+
+ $mail->send();
$main::lxdebug->leave_sub();
}
-sub get_invoices {
-
+sub set_template_options {
$main::lxdebug->enter_sub();
my ($self, $myconfig, $form) = @_;
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
+ $form->{templates} = "$myconfig->{templates}";
+ $form->{language} = $form->get_template_language($myconfig);
+ $form->{printer_code} = $form->get_printer_code($myconfig);
+
+ if ($form->{language} ne "") {
+ $form->{language} = "_" . $form->{language};
+ }
- $where = qq| WHERE 1=1 AND a.paid < a.amount AND a.duedate < current_date AND dnn.id = (select id from dunning_config WHERE dunning_level>(select case when a.dunning_id is null then 0 else (select dunning_level from dunning_config where id=a.dunning_id order by dunning_level limit 1 ) end from dunning_config limit 1) limit 1) |;
+ if ($form->{printer_code} ne "") {
+ $form->{printer_code} = "_" . $form->{printer_code};
+ }
- if ($form->{"$form->{vc}_id"}) {
- $where .= qq| AND a.$form->{vc}_id = $form->{"$form->{vc}_id"}|;
+ $form->{IN} = "$form->{formname}$form->{language}$form->{printer_code}.html";
+ $form->{pdf} = 1;
+
+ if ($form->{"format"} =~ /opendocument/) {
+ $form->{IN} =~ s/html$/odt/;
} else {
- if ($form->{ $form->{vc} }) {
- $where .= " AND lower(ct.name) LIKE '$name'";
- }
+ $form->{IN} =~ s/html$/tex/;
}
- my $sortorder = join ', ',
- ("a.id", $form->sort_columns(transdate, duedate, name));
- $sortorder = $form->{sort} if $form->{sort};
+ $main::lxdebug->leave_sub();
+}
- $where .= " AND lower(ordnumber) LIKE '$form->{ordnumber}'" if $form->{ordnumber};
- $where .= " AND lower(invnumber) LIKE '$form->{invnumber}'" if $form->{invnumber};
+sub get_invoices {
+ $main::lxdebug->enter_sub();
- $form->{minamount} = $form->parse_amount($myconfig,$form->{minamount});
- $where .= " AND a.dunning_id='$form->{dunning_level}'"
- if $form->{dunning_level};
- $where .= " AND a.ordnumber ilike '%$form->{ordnumber}%'"
- if $form->{ordnumber};
- $where .= " AND a.invnumber ilike '%$form->{invnumber}%'"
- if $form->{invnumber};
- $where .= " AND a.notes ilike '%$form->{notes}%'"
- if $form->{notes};
- $where .= " AND ct.name ilike '%$form->{customer}%'"
- if $form->{customer};
+ my ($self, $myconfig, $form) = @_;
- $where .= " AND a.amount-a.paid>'$form->{minamount}'"
- if $form->{minamount};
+ # connect to database
+ my $dbh = $form->dbconnect($myconfig);
- $where .= " ORDER by $sortorder";
+ my $where;
+ my @values;
- $paymentdate = ($form->{paymentuntil}) ? "'$form->{paymentuntil}'" : current_date;
+ $form->{customer_id} = $1 if ($form->{customer} =~ /--(\d+)$/);
- $query = qq|SELECT a.id, a.ordnumber, a.transdate, a.invnumber,a.amount, ct.name AS customername, a.customer_id, a.duedate,da.fee AS old_fee, dnn.fee as fee, dn.dunning_description, da.transdate AS dunning_date, da.duedate AS dunning_duedate, a.duedate + dnn.terms - current_date AS nextlevel, $paymentdate - a.duedate AS pastdue, dn.dunning_level, current_date + dnn.payment_terms AS next_duedate, dnn.dunning_description AS next_dunning_description, dnn.id AS next_dunning_id, dnn.interest AS interest_rate, dnn.terms
- FROM dunning_config dnn, ar a
- JOIN customer ct ON (a.customer_id = ct.id)
- LEFT JOIN dunning_config dn ON (dn.id = a.dunning_id)
- LEFT JOIN dunning da ON (da.trans_id=a.id)
- $where|;
+ if ($form->{customer_id}) {
+ $where .= qq| AND (a.customer_id = ?)|;
+ push(@values, $form->{customer_id});
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ } elsif ($form->{customer}) {
+ $where .= qq| AND (ct.name ILIKE ?)|;
+ push(@values, '%' . $form->{customer} . '%');
+ }
+ my %columns = (
+ "ordnumber" => "a.ordnumber",
+ "invnumber" => "a.invnumber",
+ "notes" => "a.notes",
+ );
+ foreach my $key (keys(%columns)) {
+ next unless ($form->{$key});
+ $where .= qq| AND $columns{$key} ILIKE ?|;
+ push(@values, '%' . $form->{$key} . '%');
+ }
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- $ref->{fee} += $ref->{old_fee};
- $ref->{interest} = ($ref->{amount} * $ref->{pastdue} * $ref->{interest_rate}) /360;
- $ref->{interest} = $form->round_amount($ref->{interest},2);
- map { $ref->{$_} = $form->format_amount($myconfig, $ref->{$_}, 2)} qw(amount fee interest);
- if ($ref->{pastdue} >= $ref->{terms}) {
- push @{ $form->{DUNNINGS} }, $ref;
- }
+ if ($form->{dunning_level}) {
+ $where .= qq| AND nextcfg.id = ?|;
+ push(@values, conv_i($form->{dunning_level}));
}
- $sth->finish;
+ $form->{minamount} = $form->parse_amount($myconfig,$form->{minamount});
+ if ($form->{minamount}) {
+ $where .= qq| AND ((a.amount - a.paid) > ?) |;
+ push(@values, $form->{minamount});
+ }
- $query = qq|select id, dunning_description FROM dunning_config order by dunning_level|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $query =
+ qq|SELECT id
+ FROM dunning_config
+ WHERE dunning_level = (SELECT MAX(dunning_level) FROM dunning_config)|;
+ my ($id_for_max_dunning_level) = selectrow_query($form, $dbh, $query);
+
+ $query =
+ qq|SELECT
+ a.id, a.ordnumber, a.transdate, a.invnumber, a.amount,
+ ct.name AS customername, a.customer_id, a.duedate,
+
+ cfg.dunning_description, cfg.dunning_level,
+
+ d.transdate AS dunning_date, d.duedate AS dunning_duedate,
+ d.fee, d.interest,
+
+ a.duedate + cfg.terms - current_date AS nextlevel,
+ current_date - COALESCE(d.duedate, a.duedate) AS pastdue,
+ current_date + cfg.payment_terms AS next_duedate,
+
+ nextcfg.dunning_description AS next_dunning_description,
+ nextcfg.id AS next_dunning_config_id,
+ nextcfg.terms, nextcfg.active, nextcfg.email
+
+ FROM ar a
+
+ LEFT JOIN customer ct ON (a.customer_id = ct.id)
+ LEFT JOIN dunning_config cfg ON (a.dunning_config_id = cfg.id)
+ LEFT JOIN dunning_config nextcfg ON
+ (nextcfg.id =
+ COALESCE(
+ (SELECT id
+ FROM dunning_config
+ WHERE dunning_level >
+ COALESCE((SELECT dunning_level
+ FROM dunning_config
+ WHERE id = a.dunning_config_id
+ ORDER BY dunning_level DESC
+ LIMIT 1),
+ 0)
+ ORDER BY dunning_level ASC
+ LIMIT 1)
+ , ?))
+ LEFT JOIN dunning d ON ((d.trans_id = a.id) AND (cfg.dunning_level = d.dunning_level))
+
+ WHERE (a.paid < a.amount)
+ AND (a.duedate < current_date)
+
+ $where
+
+ ORDER BY a.id, transdate, duedate, name|;
+ my $sth = prepare_execute_query($form, $dbh, $query, $id_for_max_dunning_level, @values);
+
+ $form->{DUNNINGS} = [];
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{DUNNING_CONFIG} }, $ref;
+ next if !$ref->{terms} || ($ref->{pastdue} < $ref->{terms});
+
+ $ref->{interest} = $form->round_amount($ref->{interest}, 2);
+ push(@{ $form->{DUNNINGS} }, $ref);
}
$sth->finish;
+ $query = qq|SELECT id, dunning_description FROM dunning_config ORDER BY dunning_level|;
+ $form->{DUNNING_CONFIG} = selectall_hashref_query($form, $dbh, $query);
+
$dbh->disconnect;
$main::lxdebug->leave_sub();
}
# connect to database
my $dbh = $form->dbconnect($myconfig);
- $where = qq| WHERE 1=1 AND da.trans_id=a.id|;
-
- if ($form->{"$form->{vc}_id"}) {
- $where .= qq| AND a.$form->{vc}_id = $form->{"$form->{vc}_id"}|;
- } else {
- if ($form->{ $form->{vc} }) {
- $where .= " AND lower(ct.name) LIKE '$name'";
- }
- }
+ $where = qq| WHERE (da.trans_id = a.id)|;
- my $sortorder = join ', ',
- ("a.id", $form->sort_columns(transdate, duedate, name));
- $sortorder = $form->{sort} if $form->{sort};
+ my @values;
- $where .= " AND lower(ordnumber) LIKE '$form->{ordnumber}'" if $form->{ordnumber};
- $where .= " AND lower(invnumber) LIKE '$form->{invnumber}'" if $form->{invnumber};
+ if ($form->{customer_id}) {
+ $where .= qq| AND (a.customer_id = ?)|;
+ push(@values, $form->{customer_id});
+ } elsif ($form->{customer}) {
+ $where .= qq| AND (ct.name ILIKE ?)|;
+ push(@values, '%' . $form->{customer} . '%');
+ }
- $form->{minamount} = $form->parse_amount($myconfig,$form->{minamount});
- $where .= " AND a.dunning_id='$form->{dunning_level}'"
- if $form->{dunning_level};
- $where .= " AND a.ordnumber ilike '%$form->{ordnumber}%'"
- if $form->{ordnumber};
- $where .= " AND a.invnumber ilike '%$form->{invnumber}%'"
- if $form->{invnumber};
- $where .= " AND a.notes ilike '%$form->{notes}%'"
- if $form->{notes};
- $where .= " AND ct.name ilike '%$form->{customer}%'"
- if $form->{customer};
- $where .= " AND a.amount > a.paid AND da.dunning_id=a.dunning_id " unless ($form->{showold});
+ my %columns = (
+ "ordnumber" => "a.ordnumber",
+ "invnumber" => "a.invnumber",
+ "notes" => "a.notes",
+ );
+ foreach my $key (keys(%columns)) {
+ next unless ($form->{$key});
+ $where .= qq| AND $columns{$key} ILIKE ?|;
+ push(@values, '%' . $form->{$key} . '%');
+ }
- $where .= " AND a.transdate >='$form->{transdatefrom}' " if ($form->{transdatefrom});
- $where .= " AND a.transdate <='$form->{transdateto}' " if ($form->{transdateto});
- $where .= " AND da.transdate >='$form->{dunningfrom}' " if ($form->{dunningfrom});
- $where .= " AND da.transdate <='$form->{dunningto}' " if ($form->{dunningto});
+ if ($form->{dunning_level}) {
+ $where .= qq| AND a.dunning_config_id = ?|;
+ push(@values, conv_i($form->{dunning_level}));
+ }
- $where .= " ORDER by $sortorder";
+ if ($form->{department_id}) {
+ $where .= qq| AND a.department_id = ?|;
+ push @values, conv_i($form->{department_id});
+ }
+ $form->{minamount} = $form->parse_amount($myconfig, $form->{minamount});
+ if ($form->{minamount}) {
+ $where .= qq| AND ((a.amount - a.paid) > ?) |;
+ push(@values, $form->{minamount});
+ }
- $query = qq|SELECT a.id, a.ordnumber, a.transdate, a.invnumber,a.amount, ct.name AS customername, a.duedate,da.fee ,da.interest, dn.dunning_description, da.transdate AS dunning_date, da.duedate AS dunning_duedate
- FROM ar a
- JOIN customer ct ON (a.customer_id = ct.id),
- dunning da LEFT JOIN dunning_config dn ON (da.dunning_id=dn.id)
- $where|;
+ if (!$form->{showold}) {
+ $where .= qq| AND (a.amount > a.paid) AND (da.dunning_config_id = a.dunning_config_id) |;
+ }
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ if ($form->{transdatefrom}) {
+ $where .= qq| AND a.transdate >= ?|;
+ push(@values, $form->{transdatefrom});
+ }
+ if ($form->{transdateto}) {
+ $where .= qq| AND a.transdate <= ?|;
+ push(@values, $form->{transdateto});
+ }
+ if ($form->{dunningfrom}) {
+ $where .= qq| AND da.transdate >= ?|;
+ push(@values, $form->{dunningfrom});
+ }
+ if ($form->{dunningto}) {
+ $where .= qq| AND da.transdate >= ?|;
+ push(@values, $form->{dunningto});
+ }
+ $query =
+ qq|SELECT a.id, a.ordnumber, a.invoice, a.transdate, a.invnumber, a.amount,
+ ct.name AS customername, ct.id AS customer_id, a.duedate, da.fee,
+ da.interest, dn.dunning_description, da.transdate AS dunning_date,
+ da.duedate AS dunning_duedate, da.dunning_id, da.dunning_config_id
+ FROM ar a
+ JOIN customer ct ON (a.customer_id = ct.id), dunning da
+ LEFT JOIN dunning_config dn ON (da.dunning_config_id = dn.id)
+ $where
+ ORDER BY name, a.id|;
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
+ $form->{DUNNINGS} = selectall_hashref_query($form, $dbh, $query, @values);
+ foreach my $ref (@{ $form->{DUNNINGS} }) {
map { $ref->{$_} = $form->format_amount($myconfig, $ref->{$_}, 2)} qw(amount fee interest);
- push @{ $form->{DUNNINGS} }, $ref;
}
- $sth->finish;
-
-
-
$dbh->disconnect;
$main::lxdebug->leave_sub();
}
-
-sub parse_strings {
+sub melt_pdfs {
$main::lxdebug->enter_sub();
- my ($myconfig, $form, $userspath, $string) = @_;
+ my ($self, $myconfig, $form, $copies) = @_;
- my $format = $form->{format};
- $form->{format} = "html";
+ # Don't allow access outside of $spool.
+ map { $_ =~ s|.*/||; } @{ $form->{DUNNING_PDFS} };
- $tmpstring = "parse_string.html";
- $tmpfile = "$myconfig->{templates}/$tmpstring";
- open(OUT, ">$tmpfile") or $form->error("$tmpfile : $!");
- print(OUT $string);
- close(OUT);
+ $copies *= 1;
+ $copies = 1 unless $copies;
+ my $inputfiles = join " ", map { "${main::spool}/$_ " x $copies } @{ $form->{DUNNING_PDFS} };
+ my $dunning_id = $form->{dunning_id};
- my $in = $form->{IN};
- $form->{IN} = $tmpstring;
- $template = HTMLTemplate->new($tmpstring, $form, $myconfig, $userspath);
+ $dunning_id =~ s|[^\d]||g;
- my $fileid = time;
- $form->{tmpfile} = "$userspath/${fileid}.$tmpstring";
- $out = $form->{OUT};
- $form->{OUT} = ">$form->{tmpfile}";
+ my $in = IO::File->new("gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=- $inputfiles |");
+ $form->error($main::locale->text('Could not spawn ghostscript.')) unless $in;
- if ($form->{OUT}) {
- open(OUT, "$form->{OUT}") or $form->error("$form->{OUT} : $!");
- }
- if (!$template->parse(*OUT)) {
- $form->cleanup();
- $form->error("$form->{IN} : " . $template->get_error());
+ my $out;
+
+ if ($form->{media} eq 'printer') {
+ $form->get_printer_code($myconfig);
+ if ($form->{printer_command}) {
+ $out = IO::File->new("| $form->{printer_command}");
+ }
+
+ $form->error($main::locale->text('Could not spawn the printer command.')) unless $out;
+
+ } else {
+ $out = IO::File->new('>-');
+ $out->print(qq|Content-Type: Application/PDF\n| .
+ qq|Content-Disposition: attachment; filename="dunning_${dunning_id}.pdf"\n\n|);
}
-
- close(OUT);
- my $result = "";
- open(IN, $form->{tmpfile}) or $form->error($form->cleanup . "$form->{tmpfile} : $!");
- while (<IN>) {
- $result .= $_;
+ while (my $line = <$in>) {
+ $out->print($line);
}
- close(IN);
-# unlink($tmpfile);
-# unlink($form->{tmpfile});
- $form->{IN} = $in;
- $form->{format} = $format;
+ $in->close();
+ $out->close();
+
+ map { unlink("${main::spool}/$_") } @{ $form->{DUNNING_PDFS} };
$main::lxdebug->leave_sub();
- return $result;
}
-sub melt_pdfs {
-
+sub print_dunning {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form, $userspath) = @_;
-
- foreach my $file (@{ $form->{DUNNING_PDFS} }) {
- $inputfiles .= " $userspath/$file ";
+ my ($self, $myconfig, $form, $dunning_id, $provided_dbh) = @_;
+
+ # connect to database
+ my $dbh = $provided_dbh ? $provided_dbh : $form->dbconnect_noauto($myconfig);
+
+ $dunning_id =~ s|[^\d]||g;
+
+ my $query =
+ qq|SELECT
+ da.fee, da.interest,
+ da.transdate AS dunning_date,
+ da.duedate AS dunning_duedate,
+
+ dcfg.template AS formname,
+ dcfg.email_subject, dcfg.email_body, dcfg.email_attachment,
+
+ ar.transdate, ar.duedate, ar.customer_id,
+ ar.invnumber, ar.ordnumber,
+ ar.amount, ar.netamount, ar.paid,
+ ar.amount - ar.paid AS open_amount,
+ ar.amount - ar.paid + da.fee + da.interest AS linetotal
+
+ FROM dunning da
+ LEFT JOIN dunning_config dcfg ON (dcfg.id = da.dunning_config_id)
+ LEFT JOIN ar ON (ar.id = da.trans_id)
+ WHERE (da.dunning_id = ?)|;
+
+ my $sth = prepare_execute_query($form, $dbh, $query, $dunning_id);
+ my $first = 1;
+ while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
+ if ($first) {
+ map({ $form->{"dn_$_"} = []; } keys(%{$ref}));
+ $first = 0;
+ }
+ map { $ref->{$_} = $form->format_amount($myconfig, $ref->{$_}, 2) } qw(amount netamount paid open_amount fee interest linetotal);
+ map { $form->{$_} = $ref->{$_} } keys %$ref;
+ map { push @{ $form->{"dn_$_"} }, $ref->{$_}} keys %$ref;
}
+ $sth->finish();
+
+ $query =
+ qq|SELECT
+ c.id AS customer_id, c.name, c.street, c.zipcode, c.city,
+ c.country, c.department_1, c.department_2, c.email, c.customernumber
+ FROM dunning d
+ LEFT JOIN ar ON (d.trans_id = ar.id)
+ LEFT JOIN customer c ON (ar.customer_id = c.id)
+ WHERE (d.dunning_id = ?)
+ LIMIT 1|;
+ $ref = selectfirst_hashref_query($form, $dbh, $query, $dunning_id);
+ map { $form->{$_} = $ref->{$_} } keys %{ $ref };
+
+ $query =
+ qq|SELECT
+ cfg.interest_rate, cfg.template AS formname,
+ cfg.email_subject, cfg.email_body, cfg.email_attachment,
+ d.transdate AS dunning_date,
+ (SELECT SUM(fee)
+ FROM dunning
+ WHERE dunning_id = ?)
+ AS fee,
+ (SELECT SUM(interest)
+ FROM dunning
+ WHERE dunning_id = ?)
+ AS total_interest,
+ (SELECT SUM(amount) - SUM(paid)
+ FROM ar
+ WHERE id IN
+ (SELECT trans_id
+ FROM dunning
+ WHERE dunning_id = ?))
+ AS total_open_amount
+ FROM dunning d
+ LEFT JOIN dunning_config cfg ON (d.dunning_config_id = cfg.id)
+ WHERE d.dunning_id = ?
+ LIMIT 1|;
+ $ref = selectfirst_hashref_query($form, $dbh, $query, $dunning_id, $dunning_id, $dunning_id, $dunning_id);
+ map { $form->{$_} = $ref->{$_} } keys %{ $ref };
+
+ $form->{interest_rate} = $form->format_amount($myconfig, $ref->{interest_rate} * 100);
+ $form->{fee} = $form->format_amount($myconfig, $ref->{fee}, 2);
+ $form->{total_interest} = $form->format_amount($myconfig, $form->round_amount($ref->{total_interest}, 2), 2);
+ $form->{total_open_amount} = $form->format_amount($myconfig, $form->round_amount($ref->{total_open_amount}, 2), 2);
+ $form->{total_amount} = $form->format_amount($myconfig, $form->round_amount($ref->{fee} + $ref->{total_interest} + $ref->{total_open_amount}, 2), 2);
+
+ $self->set_template_options($myconfig, $form);
+
+ my $filename = "dunning_${dunning_id}_" . Common::unique_id() . ".pdf";
+ $form->{OUT} = ">${main::spool}/$filename";
+ $form->{keep_tmpfile} = 1;
+
+ delete $form->{tmpfile};
+
+ push @{ $form->{DUNNING_PDFS} }, $filename;
+ push @{ $form->{DUNNING_PDFS_EMAIL} }, { 'filename' => "${main::spool}/$filename",
+ 'name' => "dunning_${dunning_id}.pdf" };
+
+ $form->parse_template($myconfig, $main::userspath);
+
+ $dbh->disconnect() unless $provided_dbh;
- my $outputfile = "$userspath/dunning.pdf";
- system("gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$outputfile $inputfiles");
- foreach my $file (@{ $form->{DUNNING_PDFS} }) {
- unlink("$userspath/$file");
+ $main::lxdebug->leave_sub();
+}
+
+sub print_invoice_for_fees {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form, $dunning_id, $provided_dbh) = @_;
+
+ my $dbh = $provided_dbh ? $provided_dbh : $form->dbconnect($myconfig);
+
+ my ($query, @values, $sth);
+
+ $query =
+ qq|SELECT
+ d.fee_interest_ar_id,
+ dcfg.template
+ FROM dunning d
+ LEFT JOIN dunning_config dcfg ON (d.dunning_config_id = dcfg.id)
+ WHERE d.dunning_id = ?|;
+ my ($ar_id, $template) = selectrow_query($form, $dbh, $query, $dunning_id);
+
+ if (!$ar_id) {
+ $main::lxdebug->leave_sub();
+ return;
}
- $out="";
+ my $saved_form = save_form();
+
+ $query = qq|SELECT SUM(fee), SUM(interest) FROM dunning WHERE id = ?|;
+ my ($fee_total, $interest_total) = selectrow_query($form, $dbh, $query, $dunning_id);
- $form->{OUT} = $out;
+ $query =
+ qq|SELECT
+ ar.invnumber, ar.transdate, ar.amount, ar.netamount,
+ ar.duedate, ar.notes, ar.notes AS invoicenotes,
- my $numbytes = (-s $outputfile);
- open(IN, $outputfile)
- or $form->error($self->cleanup . "$outputfile : $!");
+ c.name, c.department_1, c.department_2, c.street, c.zipcode, c.city, c.country,
+ c.contact, c.customernumber, c.phone, c.fax, c.email,
+ c.taxnumber, c.sic_code, c.greeting
- $form->{copies} = 1 unless $form->{media} eq 'printer';
+ FROM ar
+ LEFT JOIN customer c ON (ar.customer_id = c.id)
+ WHERE ar.id = ?|;
+ $ref = selectfirst_hashref_query($form, $dbh, $query, $ar_id);
+ map { $form->{$_} = $ref->{$_} } keys %{ $ref };
- chdir("$self->{cwd}");
+ $query = qq|SELECT * FROM employee WHERE login = ?|;
+ $ref = selectfirst_hashref_query($form, $dbh, $query, $form->{login});
+ map { $form->{"employee_${_}"} = $ref->{$_} } keys %{ $ref };
- for my $i (1 .. $form->{copies}) {
- if ($form->{OUT}) {
- open(OUT, $form->{OUT})
- or $form->error($form->cleanup . "$form->{OUT} : $!");
- } else {
+ $query = qq|SELECT * FROM acc_trans WHERE trans_id = ? ORDER BY oid ASC|;
+ $sth = prepare_execute_query($form, $dbh, $query, $ar_id);
- # launch application
- print qq|Content-Type: Application/PDF
-Content-Disposition: attachment; filename="$outputfile"
-Content-Length: $numbytes
+ my ($row, $fee, $interest) = (0, 0, 0);
-|;
+ while ($ref = $sth->fetchrow_hashref()) {
+ next if ($ref->{amount} < 0);
- open(OUT, ">-") or $form->error($form->cleanup . "$!: STDOUT");
+ $row++;
- }
+ if ($row == 1) {
+ $fee = $ref->{amount};
+ } else {
+ $interest = $ref->{amount};
+ }
+ }
- while (<IN>) {
- print OUT $_;
- }
+ $form->{fee} = $form->round_amount($fee, 2);
+ $form->{interest} = $form->round_amount($interest, 2);
+ $form->{invamount} = $form->round_amount($fee + $interest, 2);
+ $form->{dunning_id} = $dunning_id;
+ $form->{formname} = "${template}_invoice";
- close(OUT);
+ map { $form->{$_} = $form->format_amount($myconfig, $form->{$_}, 2) } qw(fee interest invamount);
- seek IN, 0, 0;
- }
+ $self->set_template_options($myconfig, $form);
+
+ my $filename = Common::unique_id() . "dunning_invoice_${dunning_id}.pdf";
+
+ $form->{OUT} = ">$main::spool/$filename";
+ $form->{keep_tmpfile} = 1;
+ delete $form->{tmpfile};
+
+ map { delete $form->{$_} } grep /^[a-z_]+_\d+$/, keys %{ $form };
+
+ $form->parse_template($myconfig, $main::userspath);
+
+ restore_form($saved_form);
+
+ push @{ $form->{DUNNING_PDFS} }, $filename;
+ push @{ $form->{DUNNING_PDFS_EMAIL} }, { 'filename' => "${main::spool}/$filename",
+ 'name' => "dunning_invoice_${dunning_id}.pdf" };
- close(IN);
- unlink("$userspath/$outputfile");
+ $dbh->disconnect() unless $provided_dbh;
$main::lxdebug->leave_sub();
}
--- /dev/null
+#======================================================================
+# LX-Office ERP
+#
+#======================================================================
+#
+# Saving and loading drafts
+#
+#======================================================================
+
+package Drafts;
+
+use YAML;
+
+use SL::Common;
+use SL::DBUtils;
+
+sub get_module {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $form) = @_;
+
+ my ($module, $submodule);
+
+ $module = $form->{"script"};
+ $module =~ s/\.pl$//;
+ if (grep({ $module eq $_ } qw(is ir ar ap))) {
+ $submodule = "invoice";
+ } else {
+ $submodule = "unknown";
+ }
+
+ $main::lxdebug->leave_sub();
+
+ return ($module, $submodule);
+}
+
+sub save {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form, $draft_id, $draft_description) = @_;
+
+ my ($dbh, $sth, $query, %saved, @dont_save, $dumped);
+
+ $dbh = $form->dbconnect_noauto($myconfig);
+
+ my ($module, $submodule) = $self->get_module($form);
+
+ $query = "SELECT COUNT(*) FROM drafts WHERE id = ?";
+ my ($res) = selectrow_query($form, $dbh, $query, $draft_id);
+
+ if (!$res) {
+ $draft_id = $module . "-" . $submodule . "-" . Common::unique_id();
+ $query = "INSERT INTO drafts (id, module, submodule) VALUES (?, ?, ?)";
+ do_query($form, $dbh, $query, $draft_id, $module, $submodule);
+ }
+
+ @dont_save = qw(login password action);
+ map({ $saved{$_} = $form->{$_};
+ delete($form->{$_}); } @dont_save);
+
+ $dumped = YAML::Dump($form);
+ map({ $form->{$_} = $saved{$_}; } @dont_save);
+
+ $query =
+ qq|UPDATE drafts SET description = ?, form = ?, employee_id = | .
+ qq| (SELECT id FROM employee WHERE login = ?) | .
+ qq|WHERE id = ?|;
+
+ do_query($form, $dbh, $query, $draft_description, $dumped, $form->{login}, $draft_id);
+
+ $dbh->commit();
+ $dbh->disconnect();
+
+ $form->{draft_id} = $draft_id;
+ $form->{draft_description} = $draft_description;
+
+ $main::lxdebug->leave_sub();
+}
+
+sub load {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form, $draft_id) = @_;
+
+ my ($dbh, $sth, $query, @values);
+
+ $dbh = $form->dbconnect($myconfig);
+
+ $query = qq|SELECT id, description, form FROM drafts WHERE id = ?|;
+
+ $sth = prepare_execute_query($form, $dbh, $query, $draft_id);
+
+ my @values;
+ if (my $ref = $sth->fetchrow_hashref()) {
+ @values = ($ref->{form}, $ref->{id}, $ref->{description});
+ }
+ $sth->finish();
+
+ $dbh->disconnect();
+
+ $main::lxdebug->leave_sub();
+
+ return @values;
+}
+
+sub remove {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form, @draft_ids) = @_;
+
+ return $main::lxdebug->leave_sub() unless (@draft_ids);
+
+ my ($dbh, $sth, $query);
+
+ $dbh = $form->dbconnect($myconfig);
+
+ $query = qq|DELETE FROM drafts WHERE id IN (| . join(", ", map { "?" } @draft_ids) . qq|)|;
+ do_query($form, $dbh, $query, @draft_ids);
+
+ $dbh->disconnect();
+
+ $main::lxdebug->leave_sub();
+}
+
+sub list {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form) = @_;
+
+ my ($dbh, $sth, $query, @values);
+
+ $dbh = $form->dbconnect($myconfig);
+
+ my ($module, $submodule) = $self->get_module($form);
+
+ my @list = ();
+ $query =
+ qq|SELECT d.id, d.description, d.itime::timestamp(0) AS itime, | .
+ qq| e.name AS employee_name | .
+ qq|FROM drafts d | .
+ qq|LEFT JOIN employee e ON d.employee_id = e.id | .
+ qq|WHERE (d.module = ?) AND (d.submodule = ?) | .
+ qq|ORDER BY d.itime|;
+ my @values = ($module, $submodule);
+
+ $sth = prepare_execute_query($form, $dbh, $query, @values);
+
+ while (my $ref = $sth->fetchrow_hashref()) {
+ push(@list, $ref);
+ }
+ $sth->finish();
+
+ $dbh->disconnect();
+
+ $main::lxdebug->leave_sub();
+
+ return @list;
+}
+
+1;
use Cwd;
use HTML::Template;
+use Template;
use SL::Template;
use CGI::Ajax;
+use SL::DBUtils;
+use SL::Mailer;
use SL::Menu;
+use SL::User;
+use SL::Common;
use CGI;
+my $standard_dbh;
+
+sub DESTROY {
+ if ($standard_dbh) {
+ $standard_dbh->disconnect();
+ undef $standard_dbh;
+ }
+}
+
sub _input_to_hash {
$main::lxdebug->enter_sub(2);
$main::lxdebug->enter_sub(2);
my ($input) = @_;
- my ($i, $loc, $key, $val);
- my (%ATTACH, $f, $header, $header_body, $len, $buf);
- my ($boundary, @list, $size, $body, $x, $blah, $name);
-
- if ($ENV{'CONTENT_TYPE'}
- && ($ENV{'CONTENT_TYPE'} =~ /multipart\/form-data; boundary=(.+)$/)) {
- $boundary = quotemeta('--' . $1);
- @list = split(/$boundary/, $input);
-
- # For some reason there are always 2 extra, that are empty
- $size = @list - 2;
-
- for ($x = 1; $x <= $size; $x++) {
- $header_body = $list[$x];
- $header_body =~ /\r\n\r\n|\n\n/;
-
- # Here we split the header and body
- $header = $`;
- $body = $'; #'
- $body =~ s/\r\n$//;
-
- # Now we try to get the file name
- $name = $header;
- $name =~ /name=\"(.+)\"/;
- ($name, $blah) = split(/\"/, $1);
-
- # If the form name is not attach, then we need to parse this like
- # regular form data
- if ($name ne "attach") {
- $body =~ s/%([0-9a-fA-Z]{2})/pack("c",hex($1))/eg;
- $ATTACH{$name} = $body;
-
- # Otherwise it is an attachment and we need to finish it up
- } elsif ($name eq "attach") {
- $header =~ /filename=\"(.+)\"/;
- $ATTACH{'FILE_NAME'} = $1;
- $ATTACH{'FILE_NAME'} =~ s/\"//g;
- $ATTACH{'FILE_NAME'} =~ s/\s//g;
- $ATTACH{'FILE_CONTENT'} = $body;
-
- for ($i = $x; $list[$i]; $i++) {
- $list[$i] =~ s/^.+name=$//;
- $list[$i] =~ /\"(\w+)\"/;
- $ATTACH{$1} = $'; #'
+
+ if (!$ENV{'CONTENT_TYPE'}
+ || ($ENV{'CONTENT_TYPE'} !~ /multipart\/form-data\s*;\s*boundary\s*=\s*(.+)$/)) {
+ $main::lxdebug->leave_sub(2);
+ return _input_to_hash($input);
+ }
+
+ my ($name, $filename, $headers_done, $content_type, $boundary_found, $need_cr);
+ my %params;
+
+ my $boundary = '--' . $1;
+
+ foreach my $line (split m/\n/, $input) {
+ last if (($line eq "${boundary}--") || ($line eq "${boundary}--\r"));
+
+ if (($line eq $boundary) || ($line eq "$boundary\r")) {
+ $params{$name} =~ s|\r?\n$|| if $name;
+
+ undef $name, $filename;
+
+ $headers_done = 0;
+ $content_type = "text/plain";
+ $boundary_found = 1;
+ $need_cr = 0;
+
+ next;
+ }
+
+ next unless $boundary_found;
+
+ if (!$headers_done) {
+ $line =~ s/[\r\n]*$//;
+
+ if (!$line) {
+ $headers_done = 1;
+ next;
+ }
+
+ if ($line =~ m|^content-disposition\s*:.*?form-data\s*;|i) {
+ if ($line =~ m|filename\s*=\s*"(.*?)"|i) {
+ $filename = $1;
+ substr $line, $-[0], $+[0] - $-[0], "";
+ }
+
+ if ($line =~ m|name\s*=\s*"(.*?)"|i) {
+ $name = $1;
+ substr $line, $-[0], $+[0] - $-[0], "";
}
+
+ $params{$name} = "";
+ $params{FILENAME} = $filename if ($filename);
+
+ next;
+ }
+
+ if ($line =~ m|^content-type\s*:\s*(.*?)$|i) {
+ $content_type = $1;
}
+
+ next;
}
- $main::lxdebug->leave_sub(2);
- return %ATTACH;
+ next unless $name;
- } else {
- $main::lxdebug->leave_sub(2);
- return _input_to_hash($input);
+ $params{$name} .= "${line}\n";
}
+
+ $params{$name} =~ s|\r?\n$|| if $name;
+
+ $main::lxdebug->leave_sub(2);
+ return %params;
}
sub new {
my $self = {};
+ if ($LXDebug::watch_form) {
+ require SL::Watchdog;
+ tie %{ $self }, 'SL::Watchdog';
+ }
+
read(STDIN, $_, $ENV{CONTENT_LENGTH});
if ($ENV{QUERY_STRING}) {
$self->{action} = lc $self->{action};
$self->{action} =~ s/( |-|,|\#)/_/g;
- $self->{version} = "2.4.1";
+ $self->{version} = "2.4.3";
$main::lxdebug->leave_sub();
sub escape {
$main::lxdebug->enter_sub(2);
- my ($self, $str, $beenthere) = @_;
-
- # for Apache 2 we escape strings twice
- #if (($ENV{SERVER_SOFTWARE} =~ /Apache\/2/) && !$beenthere) {
- # $str = $self->escape($str, 1);
- #}
+ my ($self, $str) = @_;
$str =~ s/([^a-zA-Z0-9_.-])/sprintf("%%%02x", ord($1))/ge;
my $self = shift;
if (@_) {
- for (@_) {
- print qq|<input type=hidden name="$_" value="|
- . $self->quote($self->{$_})
- . qq|">\n|;
- }
+ map({ print($main::cgi->hidden("-name" => $_, "-default" => $self->{$_}) . "\n"); } @_);
} else {
- delete $self->{header};
for (sort keys %$self) {
- print qq|<input type=hidden name="$_" value="|
- . $self->quote($self->{$_})
- . qq|">\n|;
+ next if (($_ eq "header") || (ref($self->{$_}) ne ""));
+ print($main::cgi->hidden("-name" => $_, "-default" => $self->{$_}) . "\n");
}
}
sub error {
$main::lxdebug->enter_sub();
+ $main::lxdebug->show_backtrace();
+
my ($self, $msg) = @_;
if ($ENV{HTTP_USER_AGENT}) {
$msg =~ s/\n/<br>/g;
return;
}
- my ($stylesheet, $favicon, $charset);
+ my ($stylesheet, $favicon);
if ($ENV{HTTP_USER_AGENT}) {
- if ($self->{stylesheet} && (-f "css/$self->{stylesheet}")) {
- $stylesheet =
- qq|<LINK REL="stylesheet" HREF="css/$self->{stylesheet}" TYPE="text/css" TITLE="Lx-Office stylesheet">
- |;
+ my $stylesheets = "$self->{stylesheet} $self->{stylesheets}";
+
+ $stylesheets =~ s|^\s*||;
+ $stylesheets =~ s|\s*$||;
+ foreach my $file (split m/\s+/, $stylesheets) {
+ $file =~ s|.*/||;
+ next if (! -f "css/$file");
+
+ $stylesheet .= qq|<link rel="stylesheet" href="css/$file" TYPE="text/css" TITLE="Lx-Office stylesheet">\n|;
}
$self->{favicon} = "favicon.ico" unless $self->{favicon};
|;
}
- if ($self->{charset}) {
- $charset =
- qq|<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=$self->{charset}">
- |;
- }
+ my $db_charset = $main::dbcharset ? $main::dbcharset : Common::DEFAULT_CHARSET;
+
if ($self->{landscape}) {
$pagelayout = qq|<style type="text/css">
\@page { size:landscape; }
</style>|;
}
- if ($self->{fokus}) {
- $fokus = qq|<script type="text/javascript">
-<!--
-function fokus(){document.$self->{fokus}.focus();}
-//-->
-</script>|;
- }
+
+ my $fokus = qq| document.$self->{fokus}.focus();| if ($self->{"fokus"});
#Set Calendar
my $jsscript = "";
($self->{title})
? "$self->{title} - $self->{titlebar}"
: $self->{titlebar};
- $ajax = "";
+ my $ajax = "";
foreach $item (@ { $self->{AJAX} }) {
$ajax .= $item->show_javascript();
}
- print qq|Content-Type: text/html
+ print qq|Content-Type: text/html; charset=${db_charset};
<html>
<head>
$stylesheet
$pagelayout
$favicon
- $charset
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=${db_charset}">
$jsscript
$ajax
- $fokus
+
+ <script type="text/javascript">
+ <!--
+ function fokus() {
+ $fokus
+ }
+ //-->
+ </script>
+
<meta name="robots" content="noindex,nofollow" />
<script type="text/javascript" src="js/highlight_input.js"></script>
<link rel="stylesheet" type="text/css" href="css/tabcontent.css" />
-
+
<script type="text/javascript" src="js/tabcontent.js">
-
+
/***********************************************
- * Tab Content script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
+ * Tab Content script- Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
-
+
</script>
$extra_code
$main::lxdebug->leave_sub();
}
-sub parse_html_template {
+sub _prepare_html_template {
$main::lxdebug->enter_sub();
my ($self, $file, $additional_params) = @_;
my $language;
- if (!defined($main::myconfig) || !defined($main::myconfig{"countrycode"})) {
+ if (!defined(%main::myconfig) || !defined($main::myconfig{"countrycode"})) {
$language = $main::language;
} else {
$language = $main::myconfig{"countrycode"};
}
+ $language = "de" unless ($language);
if (-f "templates/webpages/${file}_${language}.html") {
if ((-f ".developer") &&
(-f "templates/webpages/${file}_master.html") &&
((stat("templates/webpages/${file}_master.html"))[9] >
(stat("templates/webpages/${file}_${language}.html"))[9])) {
- my $info = "Developper information: templates/webpages/${file}_master.html is newer than the localized version.\n" .
+ my $info = "Developer information: templates/webpages/${file}_master.html is newer than the localized version.\n" .
"Please re-run 'locales.pl' in 'locale/${language}'.";
print(qq|<pre>$info</pre>|);
die($info);
die($info);
}
- my $template = HTML::Template->new("filename" => $file,
- "die_on_bad_params" => 0,
- "strict" => 0,
- "case_sensitive" => 1,
- "loop_context_vars" => 1,
- "global_vars" => 1);
-
- $additional_params = {} unless ($additional_params);
if ($self->{"DEBUG"}) {
$additional_params->{"DEBUG"} = $self->{"DEBUG"};
}
$additional_params->{"myconfig_jsc_dateformat"} = $jsc_dateformat;
}
- $additional_params->{"conf_jscalendar"} = $main::jscalendar;
- $additional_params->{"conf_lizenzen"} = $main::lizenzen;
- $additional_params->{"conf_latex_templates"} = $main::latex;
+ $additional_params->{"conf_webdav"} = $main::webdav;
+ $additional_params->{"conf_lizenzen"} = $main::lizenzen;
+ $additional_params->{"conf_latex_templates"} = $main::latex;
$additional_params->{"conf_opendocument_templates"} = $main::opendocument_templates;
- my @additional_param_names = keys(%{$additional_params});
+ if (%main::debug_options) {
+ map { $additional_params->{'DEBUG_' . uc($_)} = $main::debug_options{$_} } keys %main::debug_options;
+ }
+
+ $main::lxdebug->leave_sub();
+
+ return $file;
+}
+
+sub parse_html_template {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $file, $additional_params) = @_;
+
+ $additional_params ||= { };
+
+ $file = $self->_prepare_html_template($file, $additional_params);
+
+ my $template = HTML::Template->new("filename" => $file,
+ "die_on_bad_params" => 0,
+ "strict" => 0,
+ "case_sensitive" => 1,
+ "loop_context_vars" => 1,
+ "global_vars" => 1);
+
foreach my $key ($template->param()) {
- my $param = $self->{$key};
- $param = $additional_params->{$key} if (grep(/^${key}$/, @additional_param_names));
+ my $param = $additional_params->{$key} || $self->{$key};
$param = [] if (($template->query("name" => $key) eq "LOOP") && (ref($param) ne "ARRAY"));
$template->param($key => $param);
}
my $output = $template->output();
+ $output = $main::locale->{iconv}->convert($output) if ($main::locale);
+
+ $main::lxdebug->leave_sub();
+
+ return $output;
+}
+
+sub parse_html_template2 {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $file, $additional_params) = @_;
+
+ $additional_params ||= { };
+
+ $file = $self->_prepare_html_template($file, $additional_params);
+
+ my $template = Template->new({ 'INTERPOLATE' => 0,
+ 'EVAL_PERL' => 0,
+ 'ABSOLUTE' => 1,
+ 'CACHE_SIZE' => 0,
+ }) || die;
+
+ map { $additional_params->{$_} ||= $self->{$_} } keys %{ $self };
+
+ my $output;
+ $template->process($file, $additional_params, \$output);
+
+ $output = $main::locale->{iconv}->convert($output) if ($main::locale);
+
$main::lxdebug->leave_sub();
return $output;
# set dateform for jsscript
# default
- $ifFormat = "%d.%m.%Y";
- if ($myconfig->{dateformat} eq "dd.mm.yy") {
- $ifFormat = "%d.%m.%Y";
- } else {
- if ($myconfig->{dateformat} eq "dd-mm-yy") {
- $ifFormat = "%d-%m-%Y";
- } else {
- if ($myconfig->{dateformat} eq "dd/mm/yy") {
- $ifFormat = "%d/%m/%Y";
- } else {
- if ($myconfig->{dateformat} eq "mm/dd/yy") {
- $ifFormat = "%m/%d/%Y";
- } else {
- if ($myconfig->{dateformat} eq "mm-dd-yy") {
- $ifFormat = "%m-%d-%Y";
- } else {
- if ($myconfig->{dateformat} eq "yyyy-mm-dd") {
- $ifFormat = "%Y-%m-%d";
- }
- }
- }
- }
- }
- }
+ my %dateformats = (
+ "dd.mm.yy" => "%d.%m.%Y",
+ "dd-mm-yy" => "%d-%m-%Y",
+ "dd/mm/yy" => "%d/%m/%Y",
+ "mm/dd/yy" => "%m/%d/%Y",
+ "mm-dd-yy" => "%m-%d-%Y",
+ "yyyy-mm-dd" => "%Y-%m-%d",
+ );
+
+ my $ifFormat = defined($dateformats{$myconfig{"dateformat"}}) ?
+ $dateformats{$myconfig{"dateformat"}} : "%d.%m.%Y";
+ my @triggers;
while ($#_ >= 2) {
push @triggers, qq|
Calendar.setup(
{
inputField : "| . (shift) . qq|",
ifFormat :"$ifFormat",
- align : "| . (shift) . qq|",
+ align : "| . (shift) . qq|",
button : "| . (shift) . qq|"
}
);
if ($self->{callback}) {
- ($script, $argv) = split(/\?/, $self->{callback});
+ ($script, $argv) = split(/\?/, $self->{callback}, 2);
+ $script =~ s|.*/||;
+ $script =~ s|[^a-zA-Z0-9_\.]||g;
exec("perl", "$script", $argv);
} else {
$main::lxdebug->enter_sub(2);
my ($self, $myconfig, $amount, $places, $dash) = @_;
-
+
if ($amount eq "") {
$amount = 0;
}
my $neg = ($amount =~ s/-//);
- $amount = $self->round_amount($amount, $places) if ($places =~ /\d/);
+ if (defined($places) && ($places ne '')) {
+ if ($places < 0) {
+ $amount *= 1;
+ $places *= -1;
+
+ my ($actual_places) = ($amount =~ /\.(\d+)/);
+ $actual_places = length($actual_places);
+ $places = $actual_places > $places ? $actual_places : $places;
+ }
+
+ $amount = $self->round_amount($amount, $places);
+ }
my @d = map { s/\d//g; reverse split // } my $tmp = $myconfig->{numberformat}; # get delim chars
my @p = split(/\./, $amount); # split amount at decimal point
($dash =~ /DRCR/) ? ($neg ? "$amount DR" : "$amount CR" ) :
($neg ? "-$amount" : "$amount" ) ;
};
-
+
$main::lxdebug->leave_sub(2);
return $amount;
my ($self, $myconfig, $amount) = @_;
- if ($myconfig->{in_numberformat} == 1) {
- # Extra input number format 1000.00 or 1000,00
- $amount =~ s/,/\./g;
- $amount = scalar reverse $amount;
- $amount =~ s/\./DOT/;
- $amount =~ s/\.//g;
- $amount =~ s/DOT/\./;
- $amount = scalar reverse $amount;
- $main::lxdebug->leave_sub(2);
- return ($amount * 1);
- }
-
if ( ($myconfig->{numberformat} eq '1.000,00')
|| ($myconfig->{numberformat} eq '1000,00')) {
$amount =~ s/\.//g;
$main::lxdebug->enter_sub();
my ($self, $myconfig, $userspath) = @_;
- my $template;
+ my ($template, $out);
+
+ local (*IN, *OUT);
$self->{"cwd"} = getcwd();
$self->{"tmpdir"} = $self->{cwd} . "/${userspath}";
(!$self->{"format"} && ($self->{"IN"} =~ /xml$/i))) {
$template = XMLTemplate->new($self->{"IN"}, $self, $myconfig, $userspath);
} elsif ( $self->{"format"} =~ /elsterwinston/i ) {
- $template = XMLTemplate->new($self->{"IN"}, $self, $myconfig, $userspath);
+ $template = XMLTemplate->new($self->{"IN"}, $self, $myconfig, $userspath);
} elsif ( $self->{"format"} =~ /elstertaxbird/i ) {
$template = XMLTemplate->new($self->{"IN"}, $self, $myconfig, $userspath);
} elsif ( defined $self->{'format'}) {
} elsif ( $self->{'format'} eq '' ) {
$self->error("No Outputformat given: $self->{'format'}");
} else { #Catch the rest
- $self->error("Outputformat not defined: $self->{'format'}");
+ $self->error("Outputformat not defined: $self->{'format'}");
}
# Copy the notes from the invoice/sales order etc. back to the variable "notes" because that is where most templates expect it to be.
co_ustid taxnumber duns));
map({ $self->{"employee_${_}"} =~ s/\\n/\n/g; }
qw(company address signature));
+ map({ $self->{$_} =~ s/\\n/\n/g; } qw(company address signature));
$self->{copies} = 1 if (($self->{copies} *= 1) <= 0);
# OUT is used for the media, screen, printer, email
# for postscript we store a copy in a temporary file
my $fileid = time;
- $self->{tmpfile} = "$userspath/${fileid}.$self->{IN}" if ( $self->{tmpfile} eq '' );
+ my $prepend_userspath;
+
+ if (!$self->{tmpfile}) {
+ $self->{tmpfile} = "${fileid}.$self->{IN}";
+ $prepend_userspath = 1;
+ }
+
+ $prepend_userspath = 1 if substr($self->{tmpfile}, 0, length $userspath) eq $userspath;
+
+ $self->{tmpfile} =~ s|.*/||;
+ $self->{tmpfile} =~ s/[^a-zA-Z0-9\._\ \-]//g;
+ $self->{tmpfile} = "$userspath/$self->{tmpfile}" if $prepend_userspath;
+
if ($template->uses_temp_file() || $self->{media} eq 'email') {
$out = $self->{OUT};
$self->{OUT} = ">$self->{tmpfile}";
if ($self->{media} eq 'email') {
- use SL::Mailer;
-
my $mail = new Mailer;
map { $mail->{$_} = $self->{$_} }
- qw(cc bcc subject message version format charset);
- $mail->{to} = qq|$self->{email}|;
+ qw(cc bcc subject message version format);
+ $mail->{charset} = $main::dbcharset ? $main::dbcharset : Common::DEFAULT_CHARSET;
+ $mail->{to} = $self->{EMAIL_RECIPIENT} ? $self->{EMAIL_RECIPIENT} : $self->{email};
$mail->{from} = qq|"$myconfig->{name}" <$myconfig->{email}>|;
$mail->{fileid} = "$fileid.";
$myconfig->{signature} =~ s/\\r\\n/\\n/g;
} else {
- @{ $mail->{attachments} } = ($self->{tmpfile}) unless ($self->{do_not_attach});
+ if (!$self->{"do_not_attach"}) {
+ @{ $mail->{attachments} } =
+ ({ "filename" => $self->{"tmpfile"},
+ "name" => $self->{"attachment_filename"} ?
+ $self->{"attachment_filename"} : $self->{"tmpfile"} });
+ }
$mail->{message} =~ s/\r\n/\n/g;
$myconfig->{signature} =~ s/\\n/\n/g;
}
- my $err = $mail->send($out);
+ my $err = $mail->send();
$self->error($self->cleanup . "$err") if ($err);
} else {
open(OUT, $self->{OUT})
or $self->error($self->cleanup . "$self->{OUT} : $!");
} else {
- $self->{attachment_filename} = $self->{tmpfile} if ($self->{attachment_filename} eq '');
+ $self->{attachment_filename} = ($self->{attachment_filename})
+ ? $self->{attachment_filename}
+ : $self->generate_attachment_filename();
+
# launch application
print qq|Content-Type: | . $template->get_mime_type() . qq|
Content-Disposition: attachment; filename="$self->{attachment_filename}"
$main::lxdebug->leave_sub();
}
+sub get_formname_translation {
+ my ($self, $formname) = @_;
+
+ $formname ||= $self->{formname};
+
+ my %formname_translations = (
+ bin_list => $main::locale->text('Bin List'),
+ credit_note => $main::locale->text('Credit Note'),
+ invoice => $main::locale->text('Invoice'),
+ packing_list => $main::locale->text('Packing List'),
+ pick_list => $main::locale->text('Pick List'),
+ proforma => $main::locale->text('Proforma Invoice'),
+ purchase_order => $main::locale->text('Purchase Order'),
+ request_quotation => $main::locale->text('RFQ'),
+ sales_order => $main::locale->text('Confirmation'),
+ sales_quotation => $main::locale->text('Quotation'),
+ storno_invoice => $main::locale->text('Storno Invoice'),
+ storno_packing_list => $main::locale->text('Storno Packing List'),
+ );
+
+ return $formname_translations{$formname}
+}
+
+sub generate_attachment_filename {
+ my ($self) = @_;
+
+ my $attachment_filename = $self->get_formname_translation();
+ my $prefix =
+ (grep { $self->{"type"} eq $_ } qw(invoice credit_note)) ? "inv"
+ : ($self->{"type"} =~ /_quotation$/) ? "quo"
+ : "ord";
+
+ if ($attachment_filename && $self->{"${prefix}number"}) {
+ $attachment_filename .= "_" . $self->{"${prefix}number"}
+ . ( $self->{format} =~ /pdf/i ? ".pdf"
+ : $self->{format} =~ /postscript/i ? ".ps"
+ : $self->{format} =~ /opendocument/i ? ".odt"
+ : $self->{format} =~ /html/i ? ".html"
+ : "");
+ $attachment_filename =~ s/ /_/g;
+ my %umlaute = ( "ä" => "ae", "ö" => "oe", "ü" => "ue",
+ "Ä" => "Ae", "Ö" => "Oe", "Ü" => "Ue", "ß" => "ss");
+ map { $attachment_filename =~ s/$_/$umlaute{$_}/g } keys %umlaute;
+ } else {
+ $attachment_filename = "";
+ }
+
+ return $attachment_filename;
+}
+
sub cleanup {
$main::lxdebug->enter_sub();
# Database routines used throughout
sub dbconnect {
- $main::lxdebug->enter_sub();
+ $main::lxdebug->enter_sub(2);
my ($self, $myconfig) = @_;
$dbh->do($myconfig->{dboptions}) || $self->dberror($myconfig->{dboptions});
}
- $main::lxdebug->leave_sub();
+ $main::lxdebug->leave_sub(2);
return $dbh;
}
$main::lxdebug->enter_sub();
my ($self, $myconfig) = @_;
-
+
# connect to database
$dbh =
DBI->connect($myconfig->{dbconnect}, $myconfig->{dbuser},
return $dbh;
}
+sub get_standard_dbh {
+ $main::lxdebug->enter_sub(2);
+
+ my ($self, $myconfig) = @_;
+
+ $standard_dbh ||= $self->dbconnect_noauto($myconfig);
+
+ $main::lxdebug->leave_sub(2);
+
+ return $standard_dbh;
+}
+
sub update_balance {
$main::lxdebug->enter_sub();
- my ($self, $dbh, $table, $field, $where, $value) = @_;
+ my ($self, $dbh, $table, $field, $where, $value, @values) = @_;
# if we have a value, go do it
if ($value != 0) {
# retrieve balance from table
my $query = "SELECT $field FROM $table WHERE $where FOR UPDATE";
- my $sth = $dbh->prepare($query);
-
- $sth->execute || $self->dberror($query);
+ my $sth = prepare_execute_query($self, $dbh, $query, @values);
my ($balance) = $sth->fetchrow_array;
$sth->finish;
# update balance
$query = "UPDATE $table SET $field = $balance WHERE $where";
- $dbh->do($query) || $self->dberror($query);
+ do_query($self, $dbh, $query, @values);
}
$main::lxdebug->leave_sub();
}
if ($curr eq '') {
$main::lxdebug->leave_sub();
return;
+ }
+ my $query = qq|SELECT curr FROM defaults|;
+
+ my ($currency) = selectrow_query($self, $dbh, $query);
+ my ($defaultcurrency) = split m/:/, $currency;
+
+
+ if ($curr eq $defaultcurrency) {
+ $main::lxdebug->leave_sub();
+ return;
}
my $query = qq|SELECT e.curr FROM exchangerate e
- WHERE e.curr = '$curr'
- AND e.transdate = '$transdate'
- FOR UPDATE|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
+ WHERE e.curr = ? AND e.transdate = ?
+ FOR UPDATE|;
+ my $sth = prepare_execute_query($self, $dbh, $query, $curr, $transdate);
+
+ if ($buy == 0) {
+ $buy = "";
+ }
+ if ($sell == 0) {
+ $sell = "";
+ }
+
+ $buy = conv_i($buy, "NULL");
+ $sell = conv_i($sell, "NULL");
my $set;
if ($buy != 0 && $sell != 0) {
if ($sth->fetchrow_array) {
$query = qq|UPDATE exchangerate
SET $set
- WHERE curr = '$curr'
- AND transdate = '$transdate'|;
+ WHERE curr = ?
+ AND transdate = ?|;
+
} else {
$query = qq|INSERT INTO exchangerate (curr, buy, sell, transdate)
- VALUES ('$curr', $buy, $sell, '$transdate')|;
+ VALUES (?, $buy, $sell, ?)|;
}
$sth->finish;
- $dbh->do($query) || $self->dberror($query);
+ do_query($self, $dbh, $query, $curr, $transdate);
$main::lxdebug->leave_sub();
}
my $dbh = $self->dbconnect($myconfig);
- my ($buy, $sell) = (0, 0);
+ my ($buy, $sell);
+
$buy = $rate if $fld eq 'buy';
$sell = $rate if $fld eq 'sell';
+
$self->update_exchangerate($dbh, $currency, $transdate, $buy, $sell);
+
$dbh->disconnect;
$main::lxdebug->leave_sub();
unless ($transdate) {
$main::lxdebug->leave_sub();
- return "";
+ return 1;
+ }
+
+ my $query = qq|SELECT curr FROM defaults|;
+
+ my ($currency) = selectrow_query($self, $dbh, $query);
+ my ($defaultcurrency) = split m/:/, $currency;
+
+ if ($currency eq $defaultcurrency) {
+ $main::lxdebug->leave_sub();
+ return 1;
}
my $query = qq|SELECT e.$fld FROM exchangerate e
- WHERE e.curr = '$curr'
- AND e.transdate = '$transdate'|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
+ WHERE e.curr = ? AND e.transdate = ?|;
+ my ($exchangerate) = selectrow_query($self, $dbh, $query, $curr, $transdate);
- my ($exchangerate) = $sth->fetchrow_array;
- $sth->finish;
- if ($exchangerate == 0) {
- $exchangerate = 1;
+
+ $main::lxdebug->leave_sub();
+
+ return $exchangerate;
+}
+
+sub check_exchangerate {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $currency, $transdate, $fld) = @_;
+
+ unless ($transdate) {
+ $main::lxdebug->leave_sub();
+ return "";
+ }
+
+ my ($defaultcurrency) = $self->get_default_currency($myconfig);
+
+ if ($currency eq $defaultcurrency) {
+ $main::lxdebug->leave_sub();
+ return 1;
}
+ my $dbh = $self->get_standard_dbh($myconfig);
+ my $query = qq|SELECT e.$fld FROM exchangerate e
+ WHERE e.curr = ? AND e.transdate = ?|;
+
+ my ($exchangerate) = selectrow_query($self, $dbh, $query, $currency, $transdate);
+
+ $exchangerate = 1 if ($exchangerate eq "");
+
$main::lxdebug->leave_sub();
return $exchangerate;
}
+sub get_default_currency {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig) = @_;
+ my $dbh = $self->get_standard_dbh($myconfig);
+
+ my $query = qq|SELECT curr FROM defaults|;
+
+ my ($curr) = selectrow_query($self, $dbh, $query);
+ my ($defaultcurrency) = split m/:/, $curr;
+
+ $main::lxdebug->leave_sub();
+
+ return $defaultcurrency;
+}
+
+
sub set_payment_options {
$main::lxdebug->enter_sub();
my ($self, $myconfig, $transdate) = @_;
- if ($self->{payment_id}) {
+ return $main::lxdebug->leave_sub() unless ($self->{payment_id});
- my $dbh = $self->dbconnect($myconfig);
+ my $dbh = $self->get_standard_dbh($myconfig);
+ my $query =
+ qq|SELECT p.terms_netto, p.terms_skonto, p.percent_skonto, p.description_long | .
+ qq|FROM payment_terms p | .
+ qq|WHERE p.id = ?|;
- my $query = qq|SELECT p.terms_netto, p.terms_skonto, p.percent_skonto, p.description_long FROM payment_terms p
- WHERE p.id = $self->{payment_id}|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
- ($self->{terms_netto}, $self->{terms_skonto}, $self->{percent_skonto}, $self->{payment_terms}) = $sth->fetchrow_array;
+ ($self->{terms_netto}, $self->{terms_skonto}, $self->{percent_skonto},
+ $self->{payment_terms}) =
+ selectrow_query($self, $dbh, $query, $self->{payment_id});
- if ($transdate eq "") {
- if ($self->{invdate}) {
- $transdate = $self->{invdate};
- } else {
- $transdate = $self->{transdate};
- }
+ if ($transdate eq "") {
+ if ($self->{invdate}) {
+ $transdate = $self->{invdate};
+ } else {
+ $transdate = $self->{transdate};
}
+ }
- $sth->finish;
- my $query = qq|SELECT date '$transdate' + $self->{terms_netto} AS netto_date,date '$transdate' + $self->{terms_skonto} AS skonto_date FROM payment_terms
- LIMIT 1|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
- ($self->{netto_date}, $self->{skonto_date}) = $sth->fetchrow_array;
- $sth->finish;
+ $query =
+ qq|SELECT ?::date + ?::integer AS netto_date, ?::date + ?::integer AS skonto_date | .
+ qq|FROM payment_terms|;
+ ($self->{netto_date}, $self->{skonto_date}) =
+ selectrow_query($self, $dbh, $query, $transdate, $self->{terms_netto}, $transdate, $self->{terms_skonto});
- my $total = ($self->{invtotal}) ? $self->{invtotal} : $self->{ordtotal};
+ my ($invtotal, $total);
+ my (%amounts, %formatted_amounts);
- $self->{skonto_amount} = $self->format_amount($myconfig, ($self->parse_amount($myconfig, $total) * $self->{percent_skonto}), 2);
+ if ($self->{type} =~ /_order$/) {
+ $amounts{invtotal} = $self->{ordtotal};
+ $amounts{total} = $self->{ordtotal};
- $self->{payment_terms} =~ s/<%netto_date%>/$self->{netto_date}/g;
- $self->{payment_terms} =~ s/<%skonto_date%>/$self->{skonto_date}/g;
- $self->{payment_terms} =~ s/<%skonto_amount%>/$self->{skonto_amount}/g;
- $self->{payment_terms} =~ s/<%total%>/$self->{total}/g;
- $self->{payment_terms} =~ s/<%invtotal%>/$self->{invtotal}/g;
- $self->{payment_terms} =~ s/<%currency%>/$self->{currency}/g;
- $self->{payment_terms} =~ s/<%terms_netto%>/$self->{terms_netto}/g;
- $self->{payment_terms} =~ s/<%account_number%>/$self->{account_number}/g;
- $self->{payment_terms} =~ s/<%bank%>/$self->{bank}/g;
- $self->{payment_terms} =~ s/<%bank_code%>/$self->{bank_code}/g;
+ } elsif ($self->{type} =~ /_quotation$/) {
+ $amounts{invtotal} = $self->{quototal};
+ $amounts{total} = $self->{quototal};
- $dbh->disconnect;
+ } else {
+ $amounts{invtotal} = $self->{invtotal};
+ $amounts{total} = $self->{total};
}
- $main::lxdebug->leave_sub();
+ map { $amounts{$_} = $self->parse_amount($myconfig, $amounts{$_}) } keys %amounts;
-}
+ $amounts{skonto_amount} = $amounts{invtotal} * $self->{percent_skonto};
+ $amounts{invtotal_wo_skonto} = $amounts{invtotal} * (1 - $self->{percent_skonto});
+ $amounts{total_wo_skonto} = $amounts{total} * (1 - $self->{percent_skonto});
-sub check_exchangerate {
- $main::lxdebug->enter_sub();
+ foreach (keys %amounts) {
+ $amounts{$_} = $self->round_amount($amounts{$_}, 2);
+ $formatted_amounts{$_} = $self->format_amount($myconfig, $amounts{$_}, 2);
+ }
- my ($self, $myconfig, $currency, $transdate, $fld) = @_;
+ if ($self->{"language_id"}) {
+ $query =
+ qq|SELECT t.description_long, l.output_numberformat, l.output_dateformat, l.output_longdates | .
+ qq|FROM translation_payment_terms t | .
+ qq|LEFT JOIN language l ON t.language_id = l.id | .
+ qq|WHERE (t.language_id = ?) AND (t.payment_terms_id = ?)|;
+ my ($description_long, $output_numberformat, $output_dateformat,
+ $output_longdates) =
+ selectrow_query($self, $dbh, $query,
+ $self->{"language_id"}, $self->{"payment_id"});
- unless ($transdate) {
- $main::lxdebug->leave_sub();
- return "";
- }
+ $self->{payment_terms} = $description_long if ($description_long);
- my $dbh = $self->dbconnect($myconfig);
+ if ($output_dateformat) {
+ foreach my $key (qw(netto_date skonto_date)) {
+ $self->{$key} =
+ $main::locale->reformat_date($myconfig, $self->{$key},
+ $output_dateformat,
+ $output_longdates);
+ }
+ }
- my $query = qq|SELECT e.$fld FROM exchangerate e
- WHERE e.curr = '$currency'
- AND e.transdate = '$transdate'|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
+ if ($output_numberformat &&
+ ($output_numberformat ne $myconfig->{"numberformat"})) {
+ my $saved_numberformat = $myconfig->{"numberformat"};
+ $myconfig->{"numberformat"} = $output_numberformat;
+ map { $formatted_amounts{$_} = $self->format_amount($myconfig, $amounts{$_}) } keys %amounts;
+ $myconfig->{"numberformat"} = $saved_numberformat;
+ }
+ }
- my ($exchangerate) = $sth->fetchrow_array;
- $sth->finish;
- $dbh->disconnect;
+ $self->{payment_terms} =~ s/<%netto_date%>/$self->{netto_date}/g;
+ $self->{payment_terms} =~ s/<%skonto_date%>/$self->{skonto_date}/g;
+ $self->{payment_terms} =~ s/<%currency%>/$self->{currency}/g;
+ $self->{payment_terms} =~ s/<%terms_netto%>/$self->{terms_netto}/g;
+ $self->{payment_terms} =~ s/<%account_number%>/$self->{account_number}/g;
+ $self->{payment_terms} =~ s/<%bank%>/$self->{bank}/g;
+ $self->{payment_terms} =~ s/<%bank_code%>/$self->{bank_code}/g;
+
+ map { $self->{payment_terms} =~ s/<%${_}%>/$formatted_amounts{$_}/g; } keys %formatted_amounts;
$main::lxdebug->leave_sub();
- return $exchangerate;
}
sub get_template_language {
my $template_code = "";
if ($self->{language_id}) {
-
- my $dbh = $self->dbconnect($myconfig);
-
-
- my $query = qq|SELECT l.template_code FROM language l
- WHERE l.id = $self->{language_id}|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
- ($template_code) = $sth->fetchrow_array;
- $sth->finish;
- $dbh->disconnect;
+ my $dbh = $self->get_standard_dbh($myconfig);
+ my $query = qq|SELECT template_code FROM language WHERE id = ?|;
+ ($template_code) = selectrow_query($self, $dbh, $query, $self->{language_id});
}
$main::lxdebug->leave_sub();
my $template_code = "";
if ($self->{printer_id}) {
+ my $dbh = $self->get_standard_dbh($myconfig);
+ my $query = qq|SELECT template_code, printer_command FROM printers WHERE id = ?|;
+ ($template_code, $self->{printer_command}) = selectrow_query($self, $dbh, $query, $self->{printer_id});
+ }
- my $dbh = $self->dbconnect($myconfig);
-
-
- my $query = qq|SELECT p.template_code,p.printer_command FROM printers p
- WHERE p.id = $self->{printer_id}|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
- ($template_code, $self->{printer_command}) = $sth->fetchrow_array;
- $sth->finish;
- $dbh->disconnect;
- }
-
- $main::lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $template_code;
}
my $template_code = "";
if ($self->{shipto_id}) {
-
- my $dbh = $self->dbconnect($myconfig);
-
-
- my $query = qq|SELECT s.* FROM shipto s
- WHERE s.shipto_id = $self->{shipto_id}|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
- $ref = $sth->fetchrow_hashref(NAME_lc);
- map { $self->{$_} = $ref->{$_} } keys %$ref;
- $sth->finish;
- $dbh->disconnect;
+ my $dbh = $self->get_standard_dbh($myconfig);
+ my $query = qq|SELECT * FROM shipto WHERE shipto_id = ?|;
+ my $ref = selectfirst_hashref_query($self, $dbh, $query, $self->{shipto_id});
+ map({ $self->{$_} = $ref->{$_} } keys(%$ref));
}
$main::lxdebug->leave_sub();
-
}
sub add_shipto {
$main::lxdebug->enter_sub();
my ($self, $dbh, $id, $module) = @_;
-##LINET
+
my $shipto;
- foreach my $item (
- qw(name department_1 department_2 street zipcode city country contact phone fax email)
- ) {
+ my @values;
+
+ foreach my $item (qw(name department_1 department_2 street zipcode city country
+ contact phone fax email)) {
if ($self->{"shipto$item"}) {
$shipto = 1 if ($self->{$item} ne $self->{"shipto$item"});
}
- $self->{"shipto$item"} =~ s/\'/\'\'/g;
+ push(@values, $self->{"shipto${item}"});
}
+
if ($shipto) {
if ($self->{shipto_id}) {
- my $query = qq| UPDATE shipto set
- shiptoname = '$self->{shiptoname}',
- shiptodepartment_1 = '$self->{shiptodepartment_1}',
- shiptodepartment_2 = '$self->{shiptodepartment_2}',
- shiptostreet = '$self->{shiptostreet}',
- shiptozipcode = '$self->{shiptozipcode}',
- shiptocity = '$self->{shiptocity}',
- shiptocountry = '$self->{shiptocountry}',
- shiptocontact = '$self->{shiptocontact}',
- shiptophone = '$self->{shiptophone}',
- shiptofax = '$self->{shiptofax}',
- shiptoemail = '$self->{shiptoemail}'
- WHERE shipto_id = $self->{shipto_id}|;
- $dbh->do($query) || $self->dberror($query);
+ my $query = qq|UPDATE shipto set
+ shiptoname = ?,
+ shiptodepartment_1 = ?,
+ shiptodepartment_2 = ?,
+ shiptostreet = ?,
+ shiptozipcode = ?,
+ shiptocity = ?,
+ shiptocountry = ?,
+ shiptocontact = ?,
+ shiptophone = ?,
+ shiptofax = ?,
+ shiptoemail = ?
+ WHERE shipto_id = ?|;
+ do_query($self, $dbh, $query, @values, $self->{shipto_id});
} else {
- my $query =
- qq|INSERT INTO shipto (trans_id, shiptoname, shiptodepartment_1, shiptodepartment_2, shiptostreet,
- shiptozipcode, shiptocity, shiptocountry, shiptocontact,
- shiptophone, shiptofax, shiptoemail, module) VALUES ($id,
- '$self->{shiptoname}', '$self->{shiptodepartment_1}', '$self->{shiptodepartment_2}', '$self->{shiptostreet}',
- '$self->{shiptozipcode}', '$self->{shiptocity}',
- '$self->{shiptocountry}', '$self->{shiptocontact}',
- '$self->{shiptophone}', '$self->{shiptofax}',
- '$self->{shiptoemail}', '$module')|;
- $dbh->do($query) || $self->dberror($query);
+ my $query = qq|SELECT * FROM shipto
+ WHERE shiptoname = ? AND
+ shiptodepartment_1 = ? AND
+ shiptodepartment_2 = ? AND
+ shiptostreet = ? AND
+ shiptozipcode = ? AND
+ shiptocity = ? AND
+ shiptocountry = ? AND
+ shiptocontact = ? AND
+ shiptophone = ? AND
+ shiptofax = ? AND
+ shiptoemail = ? AND
+ module = ? AND
+ trans_id = ?|;
+ my $insert_check = selectfirst_hashref_query($self, $dbh, $query, @values, $module, $id);
+ if(!$insert_check){
+ $query =
+ qq|INSERT INTO shipto (trans_id, shiptoname, shiptodepartment_1, shiptodepartment_2,
+ shiptostreet, shiptozipcode, shiptocity, shiptocountry,
+ shiptocontact, shiptophone, shiptofax, shiptoemail, module)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
+ do_query($self, $dbh, $query, $id, @values, $module);
+ }
}
}
-##/LINET
+
$main::lxdebug->leave_sub();
}
my ($self, $dbh) = @_;
- my $query = qq|SELECT e.id, e.name FROM employee e
- WHERE e.login = '$self->{login}'|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
+ my $query = qq|SELECT id, name FROM employee WHERE login = ?|;
+ ($self->{"employee_id"}, $self->{"employee"}) = selectrow_query($self, $dbh, $query, $self->{login});
+ $self->{"employee_id"} *= 1;
- ($self->{employee_id}, $self->{employee}) = $sth->fetchrow_array;
- $self->{employee_id} *= 1;
+ $main::lxdebug->leave_sub();
+}
- $sth->finish;
+sub get_salesman {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $salesman_id) = @_;
+
+ $main::lxdebug->leave_sub() and return unless $salesman_id;
+
+ my $dbh = $self->get_standard_dbh($myconfig);
+
+ my ($login) =
+ selectrow_query($self, $dbh, qq|SELECT login FROM employee WHERE id = ?|,
+ $salesman_id);
+
+ if ($login) {
+ my $user = new User($main::memberfile, $login);
+ map({ $self->{"salesman_$_"} = $user->{$_}; }
+ qw(address businessnumber co_ustid company duns email fax name
+ taxnumber tel));
+ $self->{salesman_login} = $login;
+
+ $self->{salesman_name} = $login
+ if ($self->{salesman_name} eq "");
+
+ map({ $self->{"salesman_$_"} =~ s/\\n/\n/g; } qw(address company));
+ }
$main::lxdebug->leave_sub();
}
my ($self, $myconfig) = @_;
- my $dbh = $self->dbconnect($myconfig);
- my $query = qq|SELECT current_date+terms_netto FROM payment_terms
- WHERE id = '$self->{payment_id}'|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
+ my $dbh = $self->get_standard_dbh($myconfig);
+ my $query = qq|SELECT current_date + terms_netto FROM payment_terms WHERE id = ?|;
+ ($self->{duedate}) = selectrow_query($self, $dbh, $query, $self->{payment_id});
- ($self->{duedate}) = $sth->fetchrow_array;
+ $main::lxdebug->leave_sub();
+}
- $sth->finish;
+sub _get_contacts {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $dbh, $id, $key) = @_;
+
+ $key = "all_contacts" unless ($key);
+
+ my $query =
+ qq|SELECT cp_id, cp_cv_id, cp_name, cp_givenname, cp_abteilung | .
+ qq|FROM contacts | .
+ qq|WHERE cp_cv_id = ? | .
+ qq|ORDER BY lower(cp_name)|;
+
+ $self->{$key} = selectall_hashref_query($self, $dbh, $query, $id);
$main::lxdebug->leave_sub();
}
-# get other contact for transaction and form - html/tex
-sub get_contact {
+sub _get_projects {
$main::lxdebug->enter_sub();
- my ($self, $dbh, $id) = @_;
+ my ($self, $dbh, $key) = @_;
- my $query = qq|SELECT c.*
- FROM contacts c
- WHERE cp_id=$id|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
+ my ($all, $old_id, $where, @values);
- $ref = $sth->fetchrow_hashref(NAME_lc);
+ if (ref($key) eq "HASH") {
+ my $params = $key;
- push @{ $self->{$_} }, $ref;
+ $key = "ALL_PROJECTS";
+
+ foreach my $p (keys(%{$params})) {
+ if ($p eq "all") {
+ $all = $params->{$p};
+ } elsif ($p eq "old_id") {
+ $old_id = $params->{$p};
+ } elsif ($p eq "key") {
+ $key = $params->{$p};
+ }
+ }
+ }
+
+ if (!$all) {
+ $where = "WHERE active ";
+ if ($old_id) {
+ if (ref($old_id) eq "ARRAY") {
+ my @ids = grep({ $_ } @{$old_id});
+ if (@ids) {
+ $where .= " OR id IN (" . join(",", map({ "?" } @ids)) . ") ";
+ push(@values, @ids);
+ }
+ } else {
+ $where .= " OR (id = ?) ";
+ push(@values, $old_id);
+ }
+ }
+ }
+
+ my $query =
+ qq|SELECT id, projectnumber, description, active | .
+ qq|FROM project | .
+ $where .
+ qq|ORDER BY lower(projectnumber)|;
+
+ $self->{$key} = selectall_hashref_query($self, $dbh, $query, @values);
- $sth->finish;
$main::lxdebug->leave_sub();
}
-# get contacts for id, if no contact return {"","","","",""}
-sub get_contacts {
+sub _get_shipto {
$main::lxdebug->enter_sub();
- my ($self, $dbh, $id) = @_;
+ my ($self, $dbh, $vc_id, $key) = @_;
- my $query = qq|SELECT c.cp_id, c.cp_cv_id, c.cp_name, c.cp_givenname, c.cp_abteilung
- FROM contacts c
- WHERE cp_cv_id=$id|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
+ $key = "all_shipto" unless ($key);
- my $i = 0;
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $self->{all_contacts} }, $ref;
- $i++;
+ # get shipping addresses
+ my $query = qq|SELECT * FROM shipto WHERE trans_id = ?|;
+
+ $self->{$key} = selectall_hashref_query($self, $dbh, $query, $vc_id);
+
+ $main::lxdebug->leave_sub();
+}
+
+sub _get_printers {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $dbh, $key) = @_;
+
+ $key = "all_printers" unless ($key);
+
+ my $query = qq|SELECT id, printer_description, printer_command, template_code FROM printers|;
+
+ $self->{$key} = selectall_hashref_query($self, $dbh, $query);
+
+ $main::lxdebug->leave_sub();
+}
+
+sub _get_charts {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $dbh, $params) = @_;
+
+ $key = $params->{key};
+ $key = "all_charts" unless ($key);
+
+ my $transdate = quote_db_date($params->{transdate});
+
+ my $query =
+ qq|SELECT c.id, c.accno, c.description, c.link, tk.taxkey_id, tk.tax_id | .
+ qq|FROM chart c | .
+ qq|LEFT JOIN taxkeys tk ON | .
+ qq|(tk.id = (SELECT id FROM taxkeys | .
+ qq| WHERE taxkeys.chart_id = c.id AND startdate <= $transdate | .
+ qq| ORDER BY startdate DESC LIMIT 1)) | .
+ qq|ORDER BY c.accno|;
+
+ $self->{$key} = selectall_hashref_query($self, $dbh, $query);
+
+ $main::lxdebug->leave_sub();
+}
+
+sub _get_taxcharts {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $dbh, $key) = @_;
+
+ $key = "all_taxcharts" unless ($key);
+
+ my $query = qq|SELECT * FROM tax ORDER BY taxkey|;
+
+ $self->{$key} = selectall_hashref_query($self, $dbh, $query);
+
+ $main::lxdebug->leave_sub();
+}
+
+sub _get_taxzones {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $dbh, $key) = @_;
+
+ $key = "all_taxzones" unless ($key);
+
+ my $query = qq|SELECT * FROM tax_zones ORDER BY id|;
+
+ $self->{$key} = selectall_hashref_query($self, $dbh, $query);
+
+ $main::lxdebug->leave_sub();
+}
+
+sub _get_employees {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $dbh, $default_key, $key) = @_;
+
+ $key = $default_key unless ($key);
+ $self->{$key} = selectall_hashref_query($self, $dbh, qq|SELECT * FROM employee ORDER BY name|);
+
+ $main::lxdebug->leave_sub();
+}
+
+sub _get_business_types {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $dbh, $key) = @_;
+
+ $key = "all_business_types" unless ($key);
+ $self->{$key} =
+ selectall_hashref_query($self, $dbh, qq|SELECT * FROM business|);
+
+ $main::lxdebug->leave_sub();
+}
+
+sub _get_languages {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $dbh, $key) = @_;
+
+ $key = "all_languages" unless ($key);
+
+ my $query = qq|SELECT * FROM language ORDER BY id|;
+
+ $self->{$key} = selectall_hashref_query($self, $dbh, $query);
+
+ $main::lxdebug->leave_sub();
+}
+
+sub _get_dunning_configs {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $dbh, $key) = @_;
+
+ $key = "all_dunning_configs" unless ($key);
+
+ my $query = qq|SELECT * FROM dunning_config ORDER BY dunning_level|;
+
+ $self->{$key} = selectall_hashref_query($self, $dbh, $query);
+
+ $main::lxdebug->leave_sub();
+}
+
+sub _get_currencies {
+$main::lxdebug->enter_sub();
+
+ my ($self, $dbh, $key) = @_;
+
+ $key = "all_currencies" unless ($key);
+
+ my $query = qq|SELECT curr AS currency FROM defaults|;
+
+ $self->{$key} = [split(/\:/ , selectfirst_hashref_query($self, $dbh, $query)->{currency})];
+
+ $main::lxdebug->leave_sub();
+}
+
+sub _get_payments {
+$main::lxdebug->enter_sub();
+
+ my ($self, $dbh, $key) = @_;
+
+ $key = "all_payments" unless ($key);
+
+ my $query = qq|SELECT * FROM payment_terms ORDER BY id|;
+
+ $self->{$key} = selectall_hashref_query($self, $dbh, $query);
+
+ $main::lxdebug->leave_sub();
+}
+
+sub _get_customers {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $dbh, $key) = @_;
+
+ $key = "all_customers" unless ($key);
+
+ my $query = qq|SELECT * FROM customer WHERE NOT obsolete ORDER BY name|;
+
+ $self->{$key} = selectall_hashref_query($self, $dbh, $query);
+
+ $main::lxdebug->leave_sub();
+}
+
+sub _get_vendors {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $dbh, $key) = @_;
+
+ $key = "all_vendors" unless ($key);
+
+ my $query = qq|SELECT * FROM vendor WHERE NOT obsolete ORDER BY name|;
+
+ $self->{$key} = selectall_hashref_query($self, $dbh, $query);
+
+ $main::lxdebug->leave_sub();
+}
+
+sub _get_departments {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $dbh, $key) = @_;
+
+ $key = "all_departments" unless ($key);
+
+ my $query = qq|SELECT * FROM department ORDER BY description|;
+
+ $self->{$key} = selectall_hashref_query($self, $dbh, $query);
+
+ $main::lxdebug->leave_sub();
+}
+
+sub get_lists {
+ $main::lxdebug->enter_sub();
+
+ my $self = shift;
+ my %params = @_;
+
+ my $dbh = $self->get_standard_dbh(\%main::myconfig);
+ my ($sth, $query, $ref);
+
+ my $vc = $self->{"vc"} eq "customer" ? "customer" : "vendor";
+ my $vc_id = $self->{"${vc}_id"};
+
+ if ($params{"contacts"}) {
+ $self->_get_contacts($dbh, $vc_id, $params{"contacts"});
}
- if ($i == 0) {
- push @{ $self->{all_contacts} }, { { "", "", "", "", "", "" } };
+ if ($params{"shipto"}) {
+ $self->_get_shipto($dbh, $vc_id, $params{"shipto"});
}
- $sth->finish;
+
+ if ($params{"projects"} || $params{"all_projects"}) {
+ $self->_get_projects($dbh, $params{"all_projects"} ?
+ $params{"all_projects"} : $params{"projects"},
+ $params{"all_projects"} ? 1 : 0);
+ }
+
+ if ($params{"printers"}) {
+ $self->_get_printers($dbh, $params{"printers"});
+ }
+
+ if ($params{"languages"}) {
+ $self->_get_languages($dbh, $params{"languages"});
+ }
+
+ if ($params{"charts"}) {
+ $self->_get_charts($dbh, $params{"charts"});
+ }
+
+ if ($params{"taxcharts"}) {
+ $self->_get_taxcharts($dbh, $params{"taxcharts"});
+ }
+
+ if ($params{"taxzones"}) {
+ $self->_get_taxzones($dbh, $params{"taxzones"});
+ }
+
+ if ($params{"employees"}) {
+ $self->_get_employees($dbh, "all_employees", $params{"employees"});
+ }
+
+ if ($params{"salesmen"}) {
+ $self->_get_employees($dbh, "all_salesmen", $params{"salesmen"});
+ }
+
+ if ($params{"business_types"}) {
+ $self->_get_business_types($dbh, $params{"business_types"});
+ }
+
+ if ($params{"dunning_configs"}) {
+ $self->_get_dunning_configs($dbh, $params{"dunning_configs"});
+ }
+
+ if($params{"currencies"}) {
+ $self->_get_currencies($dbh, $params{"currencies"});
+ }
+
+ if($params{"customers"}) {
+ $self->_get_customers($dbh, $params{"customers"});
+ }
+
+ if($params{"vendors"}) {
+ $self->_get_vendors($dbh, $params{"vendors"});
+ }
+
+ if($params{"payments"}) {
+ $self->_get_payments($dbh, $params{"payments"});
+ }
+
+ if($params{"departments"}) {
+ $self->_get_departments($dbh, $params{"departments"});
+ }
+
$main::lxdebug->leave_sub();
}
my ($self, $myconfig, $table) = @_;
# connect to database
- my $dbh = $self->dbconnect($myconfig);
+ my $dbh = $self->get_standard_dbh($myconfig);
- my $name = $self->like(lc $self->{$table});
- my $customernumber = $self->like(lc $self->{customernumber});
+ $table = $table eq "customer" ? "customer" : "vendor";
+ my $arap = $self->{arap} eq "ar" ? "ar" : "ap";
- if ($self->{customernumber} ne "") {
- $query = qq~SELECT c.id, c.name,
- c.street || ' ' || c.zipcode || ' ' || c.city || ' ' || c.country AS address
- FROM $table c
- WHERE (lower(c.customernumber) LIKE '$customernumber') AND (not c.obsolete)
- ORDER BY c.name~;
- } else {
- $query = qq~SELECT c.id, c.name,
- c.street || ' ' || c.zipcode || ' ' || c.city || ' ' || c.country AS address
- FROM $table c
- WHERE (lower(c.name) LIKE '$name') AND (not c.obsolete)
- ORDER BY c.name~;
- }
+ my ($query, @values);
- if ($self->{openinvoices}) {
- $query = qq~SELECT DISTINCT c.id, c.name,
- c.street || ' ' || c.zipcode || ' ' || c.city || ' ' || c.country AS address
- FROM $self->{arap} a
- JOIN $table c ON (a.${table}_id = c.id)
- WHERE NOT a.amount = a.paid
- AND lower(c.name) LIKE '$name'
- ORDER BY c.name~;
- }
- my $sth = $dbh->prepare($query);
-
- $sth->execute || $self->dberror($query);
+ if (!$self->{openinvoices}) {
+ my $where;
+ if ($self->{customernumber} ne "") {
+ $where = qq|(vc.customernumber ILIKE ?)|;
+ push(@values, '%' . $self->{customernumber} . '%');
+ } else {
+ $where = qq|(vc.name ILIKE ?)|;
+ push(@values, '%' . $self->{$table} . '%');
+ }
- my $i = 0;
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push(@{ $self->{name_list} }, $ref);
- $i++;
+ $query =
+ qq~SELECT vc.id, vc.name,
+ vc.street || ' ' || vc.zipcode || ' ' || vc.city || ' ' || vc.country AS address
+ FROM $table vc
+ WHERE $where AND (NOT vc.obsolete)
+ ORDER BY vc.name~;
+ } else {
+ $query =
+ qq~SELECT DISTINCT vc.id, vc.name,
+ vc.street || ' ' || vc.zipcode || ' ' || vc.city || ' ' || vc.country AS address
+ FROM $arap a
+ JOIN $table vc ON (a.${table}_id = vc.id)
+ WHERE NOT (a.amount = a.paid) AND (vc.name ILIKE ?)
+ ORDER BY vc.name~;
+ push(@values, '%' . $self->{$table} . '%');
}
- $sth->finish;
- $dbh->disconnect;
+
+ $self->{name_list} = selectall_hashref_query($self, $dbh, $query, @values);
$main::lxdebug->leave_sub();
- return $i;
+ return scalar(@{ $self->{name_list} });
}
# the selection sub is used in the AR, AP, IS, IR and OE module
my ($self, $myconfig, $table, $module) = @_;
my $ref;
- my $dbh = $self->dbconnect($myconfig);
+ my $dbh = $self->get_standard_dbh($myconfig);
+
+ $table = $table eq "customer" ? "customer" : "vendor";
my $query = qq|SELECT count(*) FROM $table|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
- my ($count) = $sth->fetchrow_array;
- $sth->finish;
+ my ($count) = selectrow_query($self, $dbh, $query);
# build selection list
if ($count < $myconfig->{vclimit}) {
- $query = qq|SELECT id, name
- FROM $table WHERE not obsolete
- ORDER BY name|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $self->{"all_$table"} }, $ref;
- }
-
- $sth->finish;
-
+ $query = qq|SELECT id, name, salesman_id
+ FROM $table WHERE NOT obsolete
+ ORDER BY name|;
+ $self->{"all_$table"} = selectall_hashref_query($self, $dbh, $query);
}
# get self
# setup sales contacts
$query = qq|SELECT e.id, e.name
- FROM employee e
- WHERE e.sales = '1'
- AND NOT e.id = $self->{employee_id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $self->{all_employees} }, $ref;
- }
- $sth->finish;
+ FROM employee e
+ WHERE (e.sales = '1') AND (NOT e.id = ?)|;
+ $self->{all_employees} = selectall_hashref_query($self, $dbh, $query, $self->{employee_id});
# this is for self
- push @{ $self->{all_employees} },
- { id => $self->{employee_id},
- name => $self->{employee} };
+ push(@{ $self->{all_employees} },
+ { id => $self->{employee_id},
+ name => $self->{employee} });
# sort the whole thing
@{ $self->{all_employees} } =
if ($module eq 'AR') {
# prepare query for departments
- $query = qq|SELECT d.id, d.description
- FROM department d
- WHERE d.role = 'P'
- ORDER BY 2|;
+ $query = qq|SELECT id, description
+ FROM department
+ WHERE role = 'P'
+ ORDER BY description|;
} else {
- $query = qq|SELECT d.id, d.description
- FROM department d
- ORDER BY 2|;
+ $query = qq|SELECT id, description
+ FROM department
+ ORDER BY description|;
}
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $self->{all_departments} }, $ref;
- }
- $sth->finish;
+ $self->{all_departments} = selectall_hashref_query($self, $dbh, $query);
# get languages
$query = qq|SELECT id, description
FROM language
- ORDER BY 1|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
+ ORDER BY id|;
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $self->{languages} }, $ref;
- }
- $sth->finish;
+ $self->{languages} = selectall_hashref_query($self, $dbh, $query);
# get printer
$query = qq|SELECT printer_description, id
FROM printers
- ORDER BY 1|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $self->{printers} }, $ref;
- }
- $sth->finish;
+ ORDER BY printer_description|;
+ $self->{printers} = selectall_hashref_query($self, $dbh, $query);
# get payment terms
$query = qq|SELECT id, description
FROM payment_terms
- ORDER BY 1|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
+ ORDER BY sortkey|;
+
+ $self->{payment_terms} = selectall_hashref_query($self, $dbh, $query);
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $self->{payment_terms} }, $ref;
- }
- $sth->finish;
- $dbh->disconnect;
$main::lxdebug->leave_sub();
}
-
sub language_payment {
$main::lxdebug->enter_sub();
my ($self, $myconfig) = @_;
- undef $self->{languages};
- undef $self->{payment_terms};
- undef $self->{printers};
- my $ref;
- my $dbh = $self->dbconnect($myconfig);
+ my $dbh = $self->get_standard_dbh($myconfig);
# get languages
my $query = qq|SELECT id, description
- FROM language
- ORDER BY 1|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
+ FROM language
+ ORDER BY id|;
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $self->{languages} }, $ref;
- }
- $sth->finish;
+ $self->{languages} = selectall_hashref_query($self, $dbh, $query);
# get printer
$query = qq|SELECT printer_description, id
FROM printers
- ORDER BY 1|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
+ ORDER BY printer_description|;
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $self->{printers} }, $ref;
- }
- $sth->finish;
+ $self->{printers} = selectall_hashref_query($self, $dbh, $query);
# get payment terms
$query = qq|SELECT id, description
FROM payment_terms
- ORDER BY 1|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
+ ORDER BY sortkey|;
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $self->{payment_terms} }, $ref;
- }
- $sth->finish;
+ $self->{payment_terms} = selectall_hashref_query($self, $dbh, $query);
# get buchungsgruppen
$query = qq|SELECT id, description
FROM buchungsgruppen|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
- $self->{BUCHUNGSGRUPPEN} = [];
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $self->{BUCHUNGSGRUPPEN} }, $ref;
- }
- $sth->finish;
+ $self->{BUCHUNGSGRUPPEN} = selectall_hashref_query($self, $dbh, $query);
- $dbh->disconnect;
$main::lxdebug->leave_sub();
}
my ($self, $myconfig, $table) = @_;
- my $dbh = $self->dbconnect($myconfig);
- my $where = "1 = 1";
+ my $dbh = $self->get_standard_dbh($myconfig);
+ my $where;
- if (defined $table) {
- if ($table eq 'customer') {
- $where = " d.role = 'P'";
- }
+ if ($table eq 'customer') {
+ $where = "WHERE role = 'P' ";
}
- my $query = qq|SELECT d.id, d.description
- FROM department d
- WHERE $where
- ORDER BY 2|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $self->{all_departments} }, $ref;
- }
- $sth->finish;
+ my $query = qq|SELECT id, description
+ FROM department
+ $where
+ ORDER BY description|;
+ $self->{all_departments} = selectall_hashref_query($self, $dbh, $query);
- $dbh->disconnect;
+ delete($self->{all_departments}) unless (@{ $self->{all_departments} });
$main::lxdebug->leave_sub();
}
sub create_links {
$main::lxdebug->enter_sub();
- my ($self, $module, $myconfig, $table) = @_;
+ my ($self, $module, $myconfig, $table, $provided_dbh) = @_;
+
+ my ($fld, $arap);
+ if ($table eq "customer") {
+ $fld = "buy";
+ $arap = "ar";
+ } else {
+ $table = "vendor";
+ $fld = "sell";
+ $arap = "ap";
+ }
$self->all_vc($myconfig, $table, $module);
# get last customers or vendors
- my ($query, $sth);
+ my ($query, $sth, $ref);
- my $dbh = $self->dbconnect($myconfig);
+ my $dbh = $provided_dbh ? $provided_dbh : $self->get_standard_dbh($myconfig);
my %xkeyref = ();
if (!$self->{id}) {
my $transdate = "current_date";
if ($self->{transdate}) {
- $transdate = qq|'$self->{transdate}'|;
+ $transdate = $dbh->quote($self->{transdate});
}
-
+
# now get the account numbers
$query = qq|SELECT c.accno, c.description, c.link, c.taxkey_id, tk.tax_id
FROM chart c, taxkeys tk
- WHERE c.link LIKE '%$module%' AND c.id=tk.chart_id AND tk.id = (SELECT id from taxkeys where taxkeys.chart_id =c.id AND startdate<=$transdate ORDER BY startdate desc LIMIT 1)
+ WHERE (c.link LIKE ?) AND (c.id = tk.chart_id) AND tk.id =
+ (SELECT id FROM taxkeys WHERE (taxkeys.chart_id = c.id) AND (startdate <= $transdate) ORDER BY startdate DESC LIMIT 1)
ORDER BY c.accno|;
-
+
$sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
+
+ do_statement($self, $sth, $query, '%' . $module . '%');
+
$self->{accounts} = "";
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
-
+ while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
+
foreach my $key (split(/:/, $ref->{link})) {
if ($key =~ /$module/) {
-
+
# cross reference for keys
$xkeyref{ $ref->{accno} } = $key;
-
+
push @{ $self->{"${module}_links"}{$key} },
{ accno => $ref->{accno},
description => $ref->{description},
taxkey => $ref->{taxkey_id},
tax_id => $ref->{tax_id} };
-
+
$self->{accounts} .= "$ref->{accno} " unless $key =~ /tax/;
}
}
}
# get taxkeys and description
- $query = qq|SELECT id, taxkey, taxdescription
- FROM tax|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
- $ref = $sth->fetchrow_hashref(NAME_lc);
-
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $self->{TAXKEY} }, $ref;
- }
-
- $sth->finish;
-
-
- # get tax zones
- $query = qq|SELECT id, description
- FROM tax_zones|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
-
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $self->{TAXZONE} }, $ref;
- }
- $sth->finish;
+ $query = qq|SELECT id, taxkey, taxdescription FROM tax|;
+ $self->{TAXKEY} = selectall_hashref_query($self, $dbh, $query);
if (($module eq "AP") || ($module eq "AR")) {
-
# get tax rates and description
- $query = qq| SELECT * FROM tax t|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
- $self->{TAX} = ();
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $self->{TAX} }, $ref;
- }
- $sth->finish;
+ $query = qq|SELECT * FROM tax|;
+ $self->{TAX} = selectall_hashref_query($self, $dbh, $query);
}
if ($self->{id}) {
- my $arap = ($table eq 'customer') ? 'ar' : 'ap';
-
- $query = qq|SELECT a.cp_id, a.invnumber, a.transdate,
- a.${table}_id, a.datepaid, a.duedate, a.ordnumber,
- a.taxincluded, a.curr AS currency, a.notes, a.intnotes,
- c.name AS $table, a.department_id, d.description AS department,
- a.amount AS oldinvtotal, a.paid AS oldtotalpaid,
- a.employee_id, e.name AS employee, a.gldate, a.type
- FROM $arap a
- JOIN $table c ON (a.${table}_id = c.id)
- LEFT JOIN employee e ON (e.id = a.employee_id)
- LEFT JOIN department d ON (d.id = a.department_id)
- WHERE a.id = $self->{id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
+ $query =
+ qq|SELECT
+ a.cp_id, a.invnumber, a.transdate, a.${table}_id, a.datepaid,
+ a.duedate, a.ordnumber, a.taxincluded, a.curr AS currency, a.notes,
+ a.intnotes, a.department_id, a.amount AS oldinvtotal,
+ a.paid AS oldtotalpaid, a.employee_id, a.gldate, a.type,
+ c.name AS $table,
+ d.description AS department,
+ e.name AS employee
+ FROM $arap a
+ JOIN $table c ON (a.${table}_id = c.id)
+ LEFT JOIN employee e ON (e.id = a.employee_id)
+ LEFT JOIN department d ON (d.id = a.department_id)
+ WHERE a.id = ?|;
+ $ref = selectfirst_hashref_query($self, $dbh, $query, $self->{id});
- $ref = $sth->fetchrow_hashref(NAME_lc);
foreach $key (keys %$ref) {
$self->{$key} = $ref->{$key};
}
- $sth->finish;
-
my $transdate = "current_date";
if ($self->{transdate}) {
- $transdate = qq|'$self->{transdate}'|;
+ $transdate = $dbh->quote($self->{transdate});
}
-
+
# now get the account numbers
$query = qq|SELECT c.accno, c.description, c.link, c.taxkey_id, tk.tax_id
- FROM chart c, taxkeys tk
- WHERE c.link LIKE '%$module%' AND (((tk.chart_id=c.id) AND NOT(c.link like '%_tax%')) OR (NOT(tk.chart_id=c.id) AND (c.link like '%_tax%'))) AND (((tk.id = (SELECT id from taxkeys where taxkeys.chart_id =c.id AND startdate<=$transdate ORDER BY startdate desc LIMIT 1)) AND NOT(c.link like '%_tax%')) OR (c.link like '%_tax%'))
+ FROM chart c
+ LEFT JOIN taxkeys tk ON (tk.chart_id = c.id)
+ WHERE c.link LIKE ?
+ AND (tk.id = (SELECT id FROM taxkeys WHERE taxkeys.chart_id = c.id AND startdate <= $transdate ORDER BY startdate DESC LIMIT 1)
+ OR c.link LIKE '%_tax%')
ORDER BY c.accno|;
-
+
$sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
+ do_statement($self, $sth, $query, "%$module%");
+
$self->{accounts} = "";
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
-
+ while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
+
foreach my $key (split(/:/, $ref->{link})) {
if ($key =~ /$module/) {
-
+
# cross reference for keys
$xkeyref{ $ref->{accno} } = $key;
-
+
push @{ $self->{"${module}_links"}{$key} },
{ accno => $ref->{accno},
description => $ref->{description},
taxkey => $ref->{taxkey_id},
tax_id => $ref->{tax_id} };
-
+
$self->{accounts} .= "$ref->{accno} " unless $key =~ /tax/;
}
}
# get amounts from individual entries
- $query = qq|SELECT c.accno, c.description, a.source, a.amount, a.memo,
- a.transdate, a.cleared, a.project_id, p.projectnumber, a.taxkey, t.rate, t.id
- FROM acc_trans a
- JOIN chart c ON (c.id = a.chart_id)
- LEFT JOIN project p ON (p.id = a.project_id)
- LEFT JOIN tax t ON (t.id=(SELECT tk.tax_id from taxkeys tk WHERE (tk.taxkey_id=a.taxkey) AND ((CASE WHEN a.chart_id IN (SELECT chart_id FROM taxkeys WHERE taxkey_id=a.taxkey) THEN tk.chart_id=a.chart_id ELSE 1=1 END) OR (c.link='%tax%')) AND startdate <=a.transdate ORDER BY startdate DESC LIMIT 1))
- WHERE a.trans_id = $self->{id}
- AND a.fx_transaction = '0'
- ORDER BY a.oid,a.transdate|;
+ $query =
+ qq|SELECT
+ c.accno, c.description,
+ a.source, a.amount, a.memo, a.transdate, a.cleared, a.project_id, a.taxkey,
+ p.projectnumber,
+ t.rate, t.id
+ FROM acc_trans a
+ LEFT JOIN chart c ON (c.id = a.chart_id)
+ LEFT JOIN project p ON (p.id = a.project_id)
+ LEFT JOIN tax t ON (t.id= (SELECT tk.tax_id FROM taxkeys tk
+ WHERE (tk.taxkey_id=a.taxkey) AND
+ ((CASE WHEN a.chart_id IN (SELECT chart_id FROM taxkeys WHERE taxkey_id = a.taxkey)
+ THEN tk.chart_id = a.chart_id
+ ELSE 1 = 1
+ END)
+ OR (c.link='%tax%')) AND
+ (startdate <= a.transdate) ORDER BY startdate DESC LIMIT 1))
+ WHERE a.trans_id = ?
+ AND a.fx_transaction = '0'
+ ORDER BY a.oid, a.transdate|;
$sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
- my $fld = ($table eq 'customer') ? 'buy' : 'sell';
+ do_statement($self, $sth, $query, $self->{id});
# get exchangerate for currency
$self->{exchangerate} =
- $self->get_exchangerate($dbh, $self->{currency}, $self->{transdate},
- $fld);
+ $self->get_exchangerate($dbh, $self->{currency}, $self->{transdate}, $fld);
my $index = 0;
# store amounts in {acc_trans}{$key} for multiple accounts
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
$ref->{exchangerate} =
- $self->get_exchangerate($dbh, $self->{currency}, $ref->{transdate},
- $fld);
+ $self->get_exchangerate($dbh, $self->{currency}, $ref->{transdate}, $fld);
if (!($xkeyref{ $ref->{accno} } =~ /tax/)) {
$index++;
}
}
$sth->finish;
- $query = qq|SELECT d.curr AS currencies, d.closedto, d.revtrans,
- (SELECT c.accno FROM chart c
- WHERE d.fxgain_accno_id = c.id) AS fxgain_accno,
- (SELECT c.accno FROM chart c
- WHERE d.fxloss_accno_id = c.id) AS fxloss_accno
- FROM defaults d|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
- $ref = $sth->fetchrow_hashref(NAME_lc);
+ $query =
+ qq|SELECT
+ d.curr AS currencies, d.closedto, d.revtrans,
+ (SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id) AS fxgain_accno,
+ (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno
+ FROM defaults d|;
+ $ref = selectfirst_hashref_query($self, $dbh, $query);
map { $self->{$_} = $ref->{$_} } keys %$ref;
- $sth->finish;
} else {
# get date
- $query = qq|SELECT current_date AS transdate,
- d.curr AS currencies, d.closedto, d.revtrans,
- (SELECT c.accno FROM chart c
- WHERE d.fxgain_accno_id = c.id) AS fxgain_accno,
- (SELECT c.accno FROM chart c
- WHERE d.fxloss_accno_id = c.id) AS fxloss_accno
- FROM defaults d|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
- $ref = $sth->fetchrow_hashref(NAME_lc);
+ $query =
+ qq|SELECT
+ current_date AS transdate, d.curr AS currencies, d.closedto, d.revtrans,
+ (SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id) AS fxgain_accno,
+ (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno
+ FROM defaults d|;
+ $ref = selectfirst_hashref_query($self, $dbh, $query);
map { $self->{$_} = $ref->{$_} } keys %$ref;
- $sth->finish;
if ($self->{"$self->{vc}_id"}) {
$self->lastname_used($dbh, $myconfig, $table, $module);
- my $fld = ($table eq 'customer') ? 'buy' : 'sell';
-
# get exchangerate for currency
$self->{exchangerate} =
- $self->get_exchangerate($dbh, $self->{currency}, $self->{transdate},
- $fld);
+ $self->get_exchangerate($dbh, $self->{currency}, $self->{transdate}, $fld);
}
}
- $sth->finish;
-
- $dbh->disconnect;
-
$main::lxdebug->leave_sub();
}
my ($self, $dbh, $myconfig, $table, $module) = @_;
my $arap = ($table eq 'customer') ? "ar" : "ap";
+ $table = $table eq "customer" ? "customer" : "vendor";
my $where = "1 = 1";
if ($self->{type} =~ /_order/) {
}
my $query = qq|SELECT MAX(id) FROM $arap
- WHERE $where
- AND ${table}_id > 0|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
- my ($trans_id) = $sth->fetchrow_array;
- $sth->finish;
+ WHERE $where AND ${table}_id > 0|;
+ my ($trans_id) = selectrow_query($self, $dbh, $query);
$trans_id *= 1;
- $query = qq|SELECT ct.name, a.curr, a.${table}_id,
- current_date + ct.terms AS duedate, a.department_id,
- d.description AS department
- FROM $arap a
- JOIN $table ct ON (a.${table}_id = ct.id)
- LEFT JOIN department d ON (a.department_id = d.id)
- WHERE a.id = $trans_id|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
- ($self->{$table}, $self->{currency}, $self->{"${table}_id"},
- $self->{duedate}, $self->{department_id}, $self->{department})
- = $sth->fetchrow_array;
- $sth->finish;
+ $query =
+ qq|SELECT
+ a.curr, a.${table}_id, a.department_id,
+ d.description AS department,
+ ct.name, current_date + ct.terms AS duedate
+ FROM $arap a
+ LEFT JOIN $table ct ON (a.${table}_id = ct.id)
+ LEFT JOIN department d ON (a.department_id = d.id)
+ WHERE a.id = ?|;
+ ($self->{currency}, $self->{"${table}_id"}, $self->{department_id},
+ $self->{department}, $self->{$table}, $self->{duedate})
+ = selectrow_query($self, $dbh, $query, $trans_id);
$main::lxdebug->leave_sub();
}
my ($self, $myconfig, $thisdate, $days) = @_;
- my $dbh = $self->dbconnect($myconfig);
- my ($sth, $query);
+ my $dbh = $self->get_standard_dbh($myconfig);
+ my $query;
$days *= 1;
if ($thisdate) {
my $dateformat = $myconfig->{dateformat};
$dateformat .= "yy" if $myconfig->{dateformat} !~ /^y/;
-
- $query = qq|SELECT to_date('$thisdate', '$dateformat') + $days AS thisdate
- FROM defaults|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
+ $thisdate = $dbh->quote($thisdate);
+ $query = qq|SELECT to_date($thisdate, '$dateformat') + $days AS thisdate|;
} else {
- $query = qq|SELECT current_date AS thisdate
- FROM defaults|;
- $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
+ $query = qq|SELECT current_date AS thisdate|;
}
- ($thisdate) = $sth->fetchrow_array;
- $sth->finish;
-
- $dbh->disconnect;
+ ($thisdate) = selectrow_query($self, $dbh, $query);
$main::lxdebug->leave_sub();
my $dbh = $self->dbconnect_noauto($myconfig);
my $query = qq|DELETE FROM status
- WHERE formname = '$self->{formname}'
- AND trans_id = ?|;
- my $sth = $dbh->prepare($query) || $self->dberror($query);
+ WHERE (formname = ?) AND (trans_id = ?)|;
+ my $sth = prepare_query($self, $dbh, $query);
if ($self->{formname} =~ /(check|receipt)/) {
for $i (1 .. $self->{rowcount}) {
- $sth->execute($self->{"id_$i"} * 1) || $self->dberror($query);
- $sth->finish;
+ do_statement($self, $sth, $query, $self->{formname}, $self->{"id_$i"} * 1);
}
} else {
- $sth->execute($self->{id}) || $self->dberror($query);
- $sth->finish;
+ do_statement($self, $sth, $query, $self->{formname}, $self->{id});
}
+ $sth->finish();
my $printed = ($self->{printed} =~ /$self->{formname}/) ? "1" : "0";
my $emailed = ($self->{emailed} =~ /$self->{formname}/) ? "1" : "0";
my %queued = split / /, $self->{queued};
+ my @values;
if ($self->{formname} =~ /(check|receipt)/) {
# this is a check or receipt, add one entry for each lineitem
my ($accno) = split /--/, $self->{account};
- $query = qq|INSERT INTO status (trans_id, printed, spoolfile, formname,
- chart_id) VALUES (?, '$printed',
- '$queued{$self->{formname}}', '$self->{prinform}',
- (SELECT c.id FROM chart c WHERE c.accno = '$accno'))|;
- $sth = $dbh->prepare($query) || $self->dberror($query);
+ $query = qq|INSERT INTO status (trans_id, printed, spoolfile, formname, chart_id)
+ VALUES (?, ?, ?, ?, (SELECT c.id FROM chart c WHERE c.accno = ?))|;
+ @values = ($printed, $queued{$self->{formname}}, $self->{prinform}, $accno);
+ $sth = prepare_query($self, $dbh, $query);
for $i (1 .. $self->{rowcount}) {
if ($self->{"checked_$i"}) {
- $sth->execute($self->{"id_$i"}) || $self->dberror($query);
- $sth->finish;
+ do_statement($self, $sth, $query, $self->{"id_$i"}, @values);
}
}
+ $sth->finish();
+
} else {
- $query = qq|INSERT INTO status (trans_id, printed, emailed,
- spoolfile, formname)
- VALUES ($self->{id}, '$printed', '$emailed',
- '$queued{$self->{formname}}', '$self->{formname}')|;
- $dbh->do($query) || $self->dberror($query);
+ $query = qq|INSERT INTO status (trans_id, printed, emailed, spoolfile, formname)
+ VALUES (?, ?, ?, ?, ?)|;
+ do_query($self, $dbh, $query, $self->{id}, $printed, $emailed,
+ $queued{$self->{formname}}, $self->{formname});
}
$dbh->commit;
my $emailforms = $self->{emailed};
my $query = qq|DELETE FROM status
- WHERE formname = '$self->{formname}'
- AND trans_id = $self->{id}|;
- $dbh->do($query) || $self->dberror($query);
+ WHERE (formname = ?) AND (trans_id = ?)|;
+ do_query($self, $dbh, $query, $self->{formname}, $self->{id});
# this only applies to the forms
# checks and receipts are posted when printed or queued
$printed = ($self->{printed} =~ /$self->{formname}/) ? "1" : "0";
$emailed = ($self->{emailed} =~ /$self->{formname}/) ? "1" : "0";
- $query = qq|INSERT INTO status (trans_id, printed, emailed,
- spoolfile, formname)
- VALUES ($self->{id}, '$printed', '$emailed',
- '$queued{$formname}', '$formname')|;
- $dbh->do($query) || $self->dberror($query);
+ $query = qq|INSERT INTO status (trans_id, printed, emailed, spoolfile, formname)
+ VALUES (?, ?, ?, ?, ?)|;
+ do_query($self, $dbh, $query, $self->{id}, $printed, $emailed, $queued{$formname}, $formname);
$formnames =~ s/$self->{formname}//;
$emailforms =~ s/$self->{formname}//;
$emailed = ($emailforms =~ /$self->{formname}/) ? "1" : "0";
$query = qq|INSERT INTO status (trans_id, printed, emailed, formname)
- VALUES ($self->{id}, '$printed', '$emailed', '$formname')|;
- $dbh->do($query) || $self->dberror($query);
+ VALUES (?, ?, ?, ?)|;
+ do_query($self, $dbh, $query, $self->{id}, $printed, $emailed, $formname);
}
$main::lxdebug->leave_sub();
}
-sub update_defaults {
+#--- 4 locale ---#
+# $main::locale->text('SAVED')
+# $main::locale->text('DELETED')
+# $main::locale->text('ADDED')
+# $main::locale->text('PAYMENT POSTED')
+# $main::locale->text('POSTED')
+# $main::locale->text('POSTED AS NEW')
+# $main::locale->text('ELSE')
+# $main::locale->text('SAVED FOR DUNNING')
+# $main::locale->text('DUNNING STARTED')
+# $main::locale->text('PRINTED')
+# $main::locale->text('MAILED')
+# $main::locale->text('SCREENED')
+# $main::locale->text('CANCELED')
+# $main::locale->text('invoice')
+# $main::locale->text('proforma')
+# $main::locale->text('sales_order')
+# $main::locale->text('packing_list')
+# $main::locale->text('pick_list')
+# $main::locale->text('purchase_order')
+# $main::locale->text('bin_list')
+# $main::locale->text('sales_quotation')
+# $main::locale->text('request_quotation')
+
+sub save_history {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $fld) = @_;
-
- my $dbh = $self->dbconnect_noauto($myconfig);
- my $query = qq|SELECT $fld FROM defaults FOR UPDATE|;
- my $sth = $dbh->prepare($query);
+ my $self = shift();
+ my $dbh = shift();
- $sth->execute || $self->dberror($query);
- my ($var) = $sth->fetchrow_array;
- $sth->finish;
+ if(!exists $self->{employee_id}) {
+ &get_employee($self, $dbh);
+ }
- $var++;
+ my $query =
+ qq|INSERT INTO history_erp (trans_id, employee_id, addition, what_done, snumbers) | .
+ qq|VALUES (?, (SELECT id FROM employee WHERE login = ?), ?, ?, ?)|;
+ my @values = (conv_i($self->{id}), $self->{login},
+ $self->{addition}, $self->{what_done}, "$self->{snumbers}");
+ do_query($self, $dbh, $query, @values);
- $query = qq|UPDATE defaults
- SET $fld = '$var'|;
- $dbh->do($query) || $self->dberror($query);
+ $main::lxdebug->leave_sub();
+}
- $dbh->commit;
- $dbh->disconnect;
+sub get_history {
+ $main::lxdebug->enter_sub();
+ my ($self, $dbh, $trans_id, $restriction, $order) = @_;
+ my ($orderBy, $desc) = split(/\-\-/, $order);
+ $order = " ORDER BY " . ($order eq "" ? " h.itime " : ($desc == 1 ? $orderBy . " DESC " : $orderBy . " "));
+ my @tempArray;
+ my $i = 0;
+ if ($trans_id ne "") {
+ my $query =
+ qq|SELECT h.employee_id, h.itime::timestamp(0) AS itime, h.addition, h.what_done, emp.name, h.snumbers, h.trans_id AS id | .
+ qq|FROM history_erp h | .
+ qq|LEFT JOIN employee emp ON (emp.id = h.employee_id) | .
+ qq|WHERE trans_id = | . $trans_id
+ . $restriction . qq| |
+ . $order;
+
+ my $sth = $dbh->prepare($query) || $self->dberror($query);
+
+ $sth->execute() || $self->dberror("$query");
+
+ while(my $hash_ref = $sth->fetchrow_hashref()) {
+ $hash_ref->{addition} = $main::locale->text($hash_ref->{addition});
+ $hash_ref->{what_done} = $main::locale->text($hash_ref->{what_done});
+ $hash_ref->{snumbers} =~ s/^.+_(.*)$/$1/g;
+ $tempArray[$i++] = $hash_ref;
+ }
+ $main::lxdebug->leave_sub() and return \@tempArray
+ if ($i > 0 && $tempArray[0] ne "");
+ }
$main::lxdebug->leave_sub();
-
- return $var;
+ return 0;
}
-sub update_business {
+sub update_defaults {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $business_id) = @_;
+ my ($self, $myconfig, $fld, $provided_dbh) = @_;
- my $dbh = $self->dbconnect_noauto($myconfig);
- my $query =
- qq|SELECT customernumberinit FROM business WHERE id=$business_id FOR UPDATE|;
- my $sth = $dbh->prepare($query);
+ my $dbh;
+ if ($provided_dbh) {
+ $dbh = $provided_dbh;
+ } else {
+ $dbh = $self->dbconnect_noauto($myconfig);
+ }
+ my $query = qq|SELECT $fld FROM defaults FOR UPDATE|;
+ my $sth = $dbh->prepare($query);
$sth->execute || $self->dberror($query);
my ($var) = $sth->fetchrow_array;
$sth->finish;
- if ($var ne "") {
- $var++;
+
+ if ($var =~ m/\d+$/) {
+ my $new_var = (substr $var, $-[0]) * 1 + 1;
+ my $len_diff = length($var) - $-[0] - length($new_var);
+ $var = substr($var, 0, $-[0]) . ($len_diff > 0 ? '0' x $len_diff : '') . $new_var;
+
+ } else {
+ $var = $var . '1';
}
- $query = qq|UPDATE business
- SET customernumberinit = '$var' WHERE id=$business_id|;
- $dbh->do($query) || $self->dberror($query);
- $dbh->commit;
- $dbh->disconnect;
+ $query = qq|UPDATE defaults SET $fld = ?|;
+ do_query($self, $dbh, $query, $var);
+
+ if (!$provided_dbh) {
+ $dbh->commit;
+ $dbh->disconnect;
+ }
$main::lxdebug->leave_sub();
return $var;
}
-sub get_salesman {
+sub update_business {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $salesman) = @_;
+ my ($self, $myconfig, $business_id, $provided_dbh) = @_;
- my $dbh = $self->dbconnect($myconfig);
+ my $dbh;
+ if ($provided_dbh) {
+ $dbh = $provided_dbh;
+ } else {
+ $dbh = $self->dbconnect_noauto($myconfig);
+ }
my $query =
- qq|SELECT id, name FROM customer WHERE (customernumber ilike '%$salesman%' OR name ilike '%$salesman%') AND business_id in (SELECT id from business WHERE salesman)|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
+ qq|SELECT customernumberinit FROM business
+ WHERE id = ? FOR UPDATE|;
+ my ($var) = selectrow_query($self, $dbh, $query, $business_id);
- my $i = 0;
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push(@{ $self->{salesman_list} }, $ref);
- $i++;
+ if ($var =~ m/\d+$/) {
+ my $new_var = (substr $var, $-[0]) * 1 + 1;
+ my $len_diff = length($var) - $-[0] - length($new_var);
+ $var = substr($var, 0, $-[0]) . ($len_diff > 0 ? '0' x $len_diff : '') . $new_var;
+
+ } else {
+ $var = $var . '1';
}
- $dbh->commit;
+
+ $query = qq|UPDATE business
+ SET customernumberinit = ?
+ WHERE id = ?|;
+ do_query($self, $dbh, $query, $var, $business_id);
+
+ if (!$provided_dbh) {
+ $dbh->commit;
+ $dbh->disconnect;
+ }
+
$main::lxdebug->leave_sub();
- return $i;
+ return $var;
}
sub get_partsgroup {
my ($self, $myconfig, $p) = @_;
- my $dbh = $self->dbconnect($myconfig);
+ my $dbh = $self->get_standard_dbh($myconfig);
my $query = qq|SELECT DISTINCT pg.id, pg.partsgroup
FROM partsgroup pg
- JOIN parts p ON (p.partsgroup_id = pg.id)|;
+ JOIN parts p ON (p.partsgroup_id = pg.id) |;
+ my @values;
if ($p->{searchitems} eq 'part') {
- $query .= qq|
- WHERE p.inventory_accno_id > 0|;
+ $query .= qq|WHERE p.inventory_accno_id > 0|;
}
if ($p->{searchitems} eq 'service') {
- $query .= qq|
- WHERE p.inventory_accno_id IS NULL|;
+ $query .= qq|WHERE p.inventory_accno_id IS NULL|;
}
if ($p->{searchitems} eq 'assembly') {
- $query .= qq|
- WHERE p.assembly = '1'|;
+ $query .= qq|WHERE p.assembly = '1'|;
}
if ($p->{searchitems} eq 'labor') {
- $query .= qq|
- WHERE p.inventory_accno_id > 0 AND p.income_accno_id IS NULL|;
+ $query .= qq|WHERE (p.inventory_accno_id > 0) AND (p.income_accno_id IS NULL)|;
}
- $query .= qq|
- ORDER BY partsgroup|;
+ $query .= qq|ORDER BY partsgroup|;
if ($p->{all}) {
$query = qq|SELECT id, partsgroup FROM partsgroup
if ($p->{language_code}) {
$query = qq|SELECT DISTINCT pg.id, pg.partsgroup,
- t.description AS translation
+ t.description AS translation
FROM partsgroup pg
- JOIN parts p ON (p.partsgroup_id = pg.id)
- LEFT JOIN translation t ON (t.trans_id = pg.id AND t.language_code = '$p->{language_code}')
- ORDER BY translation|;
+ JOIN parts p ON (p.partsgroup_id = pg.id)
+ LEFT JOIN translation t ON ((t.trans_id = pg.id) AND (t.language_code = ?))
+ ORDER BY translation|;
+ @values = ($p->{language_code});
}
- my $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
+ $self->{all_partsgroup} = selectall_hashref_query($self, $dbh, $query, @values);
- $self->{all_partsgroup} = ();
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $self->{all_partsgroup} }, $ref;
- }
- $sth->finish;
- $dbh->disconnect;
$main::lxdebug->leave_sub();
}
my ($self, $myconfig, $p) = @_;
- my $dbh = $self->dbconnect($myconfig);
+ my $dbh = $self->get_standard_dbh($myconfig);
my $query = qq|SELECT p.id, p.pricegroup
FROM pricegroup p|;
- $query .= qq|
- ORDER BY pricegroup|;
+ $query .= qq| ORDER BY pricegroup|;
if ($p->{all}) {
$query = qq|SELECT id, pricegroup FROM pricegroup
ORDER BY pricegroup|;
}
- my $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
- $self->{all_pricegroup} = ();
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $self->{all_pricegroup} }, $ref;
- }
- $sth->finish;
- $dbh->disconnect;
+ $self->{all_pricegroup} = selectall_hashref_query($self, $dbh, $query);
$main::lxdebug->leave_sub();
}
-sub audittrail {
- my ($self, $dbh, $myconfig, $audittrail) = @_;
-
- # table, $reference, $formname, $action, $id, $transdate) = @_;
-
- my $query;
- my $rv;
- my $disconnect;
-
- if (!$dbh) {
- $dbh = $self->dbconnect($myconfig);
- $disconnect = 1;
- }
-
- # if we have an id add audittrail, otherwise get a new timestamp
-
- if ($audittrail->{id}) {
-
- $query = qq|SELECT audittrail FROM defaults|;
-
- if ($dbh->selectrow_array($query)) {
- my ($null, $employee_id) = $self->get_employee($dbh);
-
- if ($self->{audittrail} && !$myconfig) {
- chop $self->{audittrail};
-
- my @a = split /\|/, $self->{audittrail};
- my %newtrail = ();
- my $key;
- my $i;
- my @flds = qw(tablename reference formname action transdate);
-
- # put into hash and remove dups
- while (@a) {
- $key = "$a[2]$a[3]";
- $i = 0;
- $newtrail{$key} = { map { $_ => $a[$i++] } @flds };
- splice @a, 0, 5;
- }
-
- $query = qq|INSERT INTO audittrail (trans_id, tablename, reference,
- formname, action, employee_id, transdate)
- VALUES ($audittrail->{id}, ?, ?,
- ?, ?, $employee_id, ?)|;
- my $sth = $dbh->prepare($query) || $self->dberror($query);
-
- foreach $key (
- sort {
- $newtrail{$a}{transdate} cmp $newtrail{$b}{transdate}
- } keys %newtrail
- ) {
- $i = 1;
- for (@flds) { $sth->bind_param($i++, $newtrail{$key}{$_}) }
-
- $sth->execute || $self->dberror;
- $sth->finish;
- }
- }
-
- if ($audittrail->{transdate}) {
- $query = qq|INSERT INTO audittrail (trans_id, tablename, reference,
- formname, action, employee_id, transdate) VALUES (
- $audittrail->{id}, '$audittrail->{tablename}', |
- . $dbh->quote($audittrail->{reference}) . qq|,
- '$audittrail->{formname}', '$audittrail->{action}',
- $employee_id, '$audittrail->{transdate}')|;
- } else {
- $query = qq|INSERT INTO audittrail (trans_id, tablename, reference,
- formname, action, employee_id) VALUES ($audittrail->{id},
- '$audittrail->{tablename}', |
- . $dbh->quote($audittrail->{reference}) . qq|,
- '$audittrail->{formname}', '$audittrail->{action}',
- $employee_id)|;
- }
- $dbh->do($query);
- }
- } else {
-
- $query = qq|SELECT current_timestamp FROM defaults|;
- my ($timestamp) = $dbh->selectrow_array($query);
-
- $rv =
- "$audittrail->{tablename}|$audittrail->{reference}|$audittrail->{formname}|$audittrail->{action}|$timestamp|";
- }
-
- $dbh->disconnect if $disconnect;
-
- $rv;
-
-}
-
-package Locale;
+sub all_years {
+# usage $form->all_years($myconfig, [$dbh])
+# return list of all years where bookings found
+# (@all_years)
-sub new {
$main::lxdebug->enter_sub();
- my ($type, $country, $NLS_file) = @_;
- my $self = {};
-
- if ($country && -d "locale/$country") {
- local *IN;
- $self->{countrycode} = $country;
- if (open(IN, "locale/$country/$NLS_file")) {
- my $code = join("", <IN>);
- eval($code);
- close(IN);
- }
- }
-
- $self->{NLS_file} = $NLS_file;
-
- push @{ $self->{LONG_MONTH} },
- ("January", "February", "March", "April",
- "May ", "June", "July", "August",
- "September", "October", "November", "December");
- push @{ $self->{SHORT_MONTH} },
- (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec));
-
- $main::lxdebug->leave_sub();
-
- bless $self, $type;
-}
-
-sub text {
- my ($self, $text) = @_;
-
- return (exists $self->{texts}{$text}) ? $self->{texts}{$text} : $text;
-}
+ my ($self, $myconfig, $dbh) = @_;
-sub findsub {
- $main::lxdebug->enter_sub();
+ $dbh ||= $self->get_standard_dbh($myconfig);
- my ($self, $text) = @_;
+ # get years
+ my $query = qq|SELECT (SELECT MIN(transdate) FROM acc_trans),
+ (SELECT MAX(transdate) FROM acc_trans)|;
+ my ($startdate, $enddate) = selectrow_query($self, $dbh, $query);
- if (exists $self->{subs}{$text}) {
- $text = $self->{subs}{$text};
+ if ($myconfig->{dateformat} =~ /^yy/) {
+ ($startdate) = split /\W/, $startdate;
+ ($enddate) = split /\W/, $enddate;
} else {
- if ($self->{countrycode} && $self->{NLS_file}) {
- Form->error(
- "$text not defined in locale/$self->{countrycode}/$self->{NLS_file}");
- }
- }
-
- $main::lxdebug->leave_sub();
-
- return $text;
-}
-
-sub date {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $date, $longformat) = @_;
-
- my $longdate = "";
- my $longmonth = ($longformat) ? 'LONG_MONTH' : 'SHORT_MONTH';
-
- if ($date) {
-
- # get separator
- $spc = $myconfig->{dateformat};
- $spc =~ s/\w//g;
- $spc = substr($spc, 1, 1);
-
- if ($date =~ /\D/) {
- if ($myconfig->{dateformat} =~ /^yy/) {
- ($yy, $mm, $dd) = split /\D/, $date;
- }
- if ($myconfig->{dateformat} =~ /^mm/) {
- ($mm, $dd, $yy) = split /\D/, $date;
- }
- if ($myconfig->{dateformat} =~ /^dd/) {
- ($dd, $mm, $yy) = split /\D/, $date;
- }
- } else {
- $date = substr($date, 2);
- ($yy, $mm, $dd) = ($date =~ /(..)(..)(..)/);
- }
-
- $dd *= 1;
- $mm--;
- $yy = ($yy < 70) ? $yy + 2000 : $yy;
- $yy = ($yy >= 70 && $yy <= 99) ? $yy + 1900 : $yy;
-
- if ($myconfig->{dateformat} =~ /^dd/) {
- if (defined $longformat && $longformat == 0) {
- $mm++;
- $dd = "0$dd" if ($dd < 10);
- $mm = "0$mm" if ($mm < 10);
- $longdate = "$dd$spc$mm$spc$yy";
- } else {
- $longdate = "$dd";
- $longdate .= ($spc eq '.') ? ". " : " ";
- $longdate .= &text($self, $self->{$longmonth}[$mm]) . " $yy";
- }
- } elsif ($myconfig->{dateformat} eq "yyyy-mm-dd") {
-
- # Use German syntax with the ISO date style "yyyy-mm-dd" because
- # Lx-Office is mainly used in Germany or German speaking countries.
- if (defined $longformat && $longformat == 0) {
- $mm++;
- $dd = "0$dd" if ($dd < 10);
- $mm = "0$mm" if ($mm < 10);
- $longdate = "$yy-$mm-$dd";
- } else {
- $longdate = "$dd. ";
- $longdate .= &text($self, $self->{$longmonth}[$mm]) . " $yy";
- }
- } else {
- if (defined $longformat && $longformat == 0) {
- $mm++;
- $dd = "0$dd" if ($dd < 10);
- $mm = "0$mm" if ($mm < 10);
- $longdate = "$mm$spc$dd$spc$yy";
- } else {
- $longdate = &text($self, $self->{$longmonth}[$mm]) . " $dd, $yy";
- }
- }
-
- }
-
- $main::lxdebug->leave_sub();
-
- return $longdate;
-}
-
-sub parse_date {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $date, $longformat) = @_;
-
- unless ($date) {
- $main::lxdebug->leave_sub();
- return ();
+ (@_) = split /\W/, $startdate;
+ $startdate = $_[2];
+ (@_) = split /\W/, $enddate;
+ $enddate = $_[2];
}
- # get separator
- $spc = $myconfig->{dateformat};
- $spc =~ s/\w//g;
- $spc = substr($spc, 1, 1);
+ my @all_years;
+ $startdate = substr($startdate,0,4);
+ $enddate = substr($enddate,0,4);
- if ($date =~ /\D/) {
- if ($myconfig->{dateformat} =~ /^yy/) {
- ($yy, $mm, $dd) = split /\D/, $date;
- } elsif ($myconfig->{dateformat} =~ /^mm/) {
- ($mm, $dd, $yy) = split /\D/, $date;
- } elsif ($myconfig->{dateformat} =~ /^dd/) {
- ($dd, $mm, $yy) = split /\D/, $date;
- }
- } else {
- $date = substr($date, 2);
- ($yy, $mm, $dd) = ($date =~ /(..)(..)(..)/);
+ while ($enddate >= $startdate) {
+ push @all_years, $enddate--;
}
- $dd *= 1;
- $mm *= 1;
- $yy = ($yy < 70) ? $yy + 2000 : $yy;
- $yy = ($yy >= 70 && $yy <= 99) ? $yy + 1900 : $yy;
-
- $main::lxdebug->leave_sub();
- return ($yy, $mm, $dd);
-}
-
-sub reformat_date {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $date, $output_format, $longformat) = @_;
-
- $main::lxdebug->leave_sub() and return "" unless ($date);
-
- my ($yy, $mm, $dd) = $self->parse_date($myconfig, $date);
-
- $output_format =~ /d+/;
- substr($output_format, $-[0], $+[0] - $-[0]) =
- sprintf("%0" . (length($&)) . "d", $dd);
-
- $output_format =~ /m+/;
- substr($output_format, $-[0], $+[0] - $-[0]) =
- sprintf("%0" . (length($&)) . "d", $mm);
-
- $output_format =~ /y+/;
- if (length($&) == 2) {
- $yy -= $yy >= 2000 ? 2000 : 1900;
- }
- substr($output_format, $-[0], $+[0] - $-[0]) =
- sprintf("%0" . (length($&)) . "d", $yy);
+ return @all_years;
$main::lxdebug->leave_sub();
-
- return $output_format;
}
1;
package GL;
use Data::Dumper;
+use SL::DBUtils;
sub delete_transaction {
my ($self, $myconfig, $form) = @_;
# connect to database
my $dbh = $form->dbconnect_noauto($myconfig);
- my $query = qq|DELETE FROM gl WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
-
- $query = qq|DELETE FROM acc_trans WHERE trans_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ my @values = (conv_i($form->{id}));
+ do_query($form, $dbh, qq|DELETE FROM acc_trans WHERE trans_id = ?|, @values);
+ do_query($form, $dbh, qq|DELETE FROM gl WHERE id = ?|, @values);
# commit and redirect
my $rc = $dbh->commit;
my $i;
- # check if debit and credit balances
-
- if ($form->{storno}) {
- $debit = $debit * -1;
- $credit = $credit * -1;
- $tax = $tax * -1;
- $form->{reference} = "Storno-" . $form->{reference};
- $form->{description} = "Storno-" . $form->{description};
- }
-
# connect to database, turn off AutoCommit
my $dbh = $form->dbconnect_noauto($myconfig);
# if there is a $form->{id} replace the old transaction
# delete all acc_trans entries and add the new ones
- # escape '
- map { $form->{$_} =~ s/\'/\'\'/g } qw(reference description notes);
-
if (!$form->{taxincluded}) {
$form->{taxincluded} = 0;
}
if ($form->{id}) {
# delete individual transactions
- $query = qq|DELETE FROM acc_trans
- WHERE trans_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|DELETE FROM acc_trans WHERE trans_id = ?|;
+ @values = (conv_i($form->{id}));
+ do_query($form, $dbh, $query, @values);
} else {
- my $uid = time;
- $uid .= $form->{login};
-
- $query = qq|INSERT INTO gl (reference, employee_id)
- VALUES ('$uid', (SELECT e.id FROM employee e
- WHERE e.login = '$form->{login}'))|;
- $dbh->do($query) || $form->dberror($query);
-
- $query = qq|SELECT g.id FROM gl g
- WHERE g.reference = '$uid'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($form->{id}) = $sth->fetchrow_array;
- $sth->finish;
+ $query = qq|SELECT nextval('glid')|;
+ ($form->{id}) = selectrow_query($form, $dbh, $query);
+ $query =
+ qq|INSERT INTO gl (id, employee_id) | .
+ qq|VALUES (?, (SELECT id FROM employee WHERE login = ?))|;
+ @values = ($form->{id}, $form->{login});
+ do_query($form, $dbh, $query, @values);
}
- my ($null, $department_id) = split /--/, $form->{department};
+ my ($null, $department_id) = split(/--/, $form->{department});
$department_id *= 1;
- $query = qq|UPDATE gl SET
- reference = '$form->{reference}',
- description = '$form->{description}',
- notes = '$form->{notes}',
- transdate = '$form->{transdate}',
- department_id = $department_id,
- taxincluded = '$form->{taxincluded}'
- WHERE id = $form->{id}|;
+ $query =
+ qq|UPDATE gl SET
+ reference = ?, description = ?, notes = ?,
+ transdate = ?, department_id = ?, taxincluded = ?,
+ storno = ?, storno_id = ?
+ WHERE id = ?|;
- $dbh->do($query) || $form->dberror($query);
- ($taxkey, $rate) = split(/--/, $form->{taxkey});
+ @values = ($form->{reference}, $form->{description}, $form->{notes},
+ conv_date($form->{transdate}), $department_id, $form->{taxincluded},
+ $form->{storno} ? 't' : 'f', conv_i($form->{storno_id}),
+ conv_i($form->{id}));
+ do_query($form, $dbh, $query, @values);
# insert acc_trans transactions
for $i (1 .. $form->{rowcount}) {
- my $taxkey;
- my $rate;
# extract accno
- print(STDERR $form->{"taxchart_$i"}, "TAXCHART\n");
my ($accno) = split(/--/, $form->{"accno_$i"});
- my ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
- ($form->{"tax_id_$i"}, $NULL) = split /--/, $form->{"taxchart_$i"};
+ ($form->{"tax_id_$i"}) = split(/--/, $form->{"taxchart_$i"});
if ($form->{"tax_id_$i"} ne "") {
- $query = qq|SELECT t.taxkey, t.rate
- FROM tax t
- WHERE t.id=$form->{"tax_id_$i"}|;
-
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- ($taxkey, $rate) =
- $sth->fetchrow_array;
- $sth->finish;
+ $query = qq|SELECT taxkey, rate FROM tax WHERE id = ?|;
+ ($taxkey, $rate) = selectrow_query($form, $dbh, $query, conv_i($form->{"tax_id_$i"}));
}
my $amount = 0;
$posted = 0;
}
+ $project_id = conv_i($form->{"project_id_$i"});
+
# if there is an amount, add the record
if ($amount != 0) {
- $project_id =
- ($form->{"project_id_$i"}) ? $form->{"project_id_$i"} : 'NULL';
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
- source, memo, project_id, taxkey)
- VALUES
- ($form->{id}, (SELECT c.id
- FROM chart c
- WHERE c.accno = '$accno'),
- $amount, '$form->{transdate}', |
- . $dbh->quote($form->{"source_$i"}) . qq|, |
- . $dbh->quote($form->{"memo_$i"}) . qq|,
- $project_id, $taxkey)|;
-
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
+ source, memo, project_id, taxkey)
+ VALUES (?, (SELECT id FROM chart WHERE accno = ?),
+ ?, ?, ?, ?, ?, ?)|;
+ @values = (conv_i($form->{id}), $accno, $amount, conv_date($form->{transdate}),
+ $form->{"source_$i"}, $form->{"memo_$i"}, $project_id, $taxkey);
+ do_query($form, $dbh, $query, @values);
}
if ($tax != 0) {
-
# add taxentry
- $amount = $tax;
-
- $project_id =
- ($form->{"project_id_$i"}) ? $form->{"project_id_$i"} : 'NULL';
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
- source, memo, project_id, taxkey)
- VALUES
- ($form->{id}, (SELECT t.chart_id
- FROM tax t
- WHERE t.id = $form->{"tax_id_$i"}),
- $amount, '$form->{transdate}', |
- . $dbh->quote($form->{"source_$i"}) . qq|, |
- . $dbh->quote($form->{"memo_$i"}) . qq|,
- $project_id, $taxkey)|;
-
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
+ source, memo, project_id, taxkey)
+ VALUES (?, (SELECT chart_id FROM tax WHERE id = ?),
+ ?, ?, ?, ?, ?, ?)|;
+ @values = (conv_i($form->{id}), conv_i($form->{"tax_id_$i"}),
+ $tax, conv_date($form->{transdate}), $form->{"source_$i"},
+ $form->{"memo_$i"}, $project_id, $taxkey);
+ do_query($form, $dbh, $query, @values);
}
}
- my %audittrail = (tablename => 'gl',
- reference => $form->{reference},
- formname => 'transaction',
- action => 'posted',
- id => $form->{id});
-
- # $form->audittrail($dbh, "", \%audittrail);
+ if ($form->{storno} && $form->{storno_id}) {
+ do_query($form, $dbh, qq|UPDATE gl SET storno = 't' WHERE id = ?|, conv_i($form->{storno_id}));
+ }
# commit and redirect
my $rc = $dbh->commit;
$dbh->disconnect;
$main::lxdebug->leave_sub();
- $rc;
-
+ return $rc;
}
sub all_transactions {
my ($query, $sth, $source, $null);
my ($glwhere, $arwhere, $apwhere) = ("1 = 1", "1 = 1", "1 = 1");
+ my (@glvalues, @arvalues, @apvalues);
if ($form->{reference}) {
- $source = $form->like(lc $form->{reference});
- $glwhere .= " AND lower(g.reference) LIKE '$source'";
- $arwhere .= " AND lower(a.invnumber) LIKE '$source'";
- $apwhere .= " AND lower(a.invnumber) LIKE '$source'";
+ $glwhere .= qq| AND g.reference ILIKE ?|;
+ $arwhere .= qq| AND a.invnumber ILIKE ?|;
+ $apwhere .= qq| AND a.invnumber ILIKE ?|;
+ push(@glvalues, '%' . $form->{reference} . '%');
+ push(@arvalues, '%' . $form->{reference} . '%');
+ push(@apvalues, '%' . $form->{reference} . '%');
}
+
if ($form->{department}) {
- ($null, $source) = split /--/, $form->{department};
- $glwhere .= " AND g.department_id = $source";
- $arwhere .= " AND a.department_id = $source";
- $apwhere .= " AND a.department_id = $source";
+ my ($null, $department) = split /--/, $form->{department};
+ $glwhere .= qq| AND g.department_id = ?|;
+ $arwhere .= qq| AND a.department_id = ?|;
+ $apwhere .= qq| AND a.department_id = ?|;
+ push(@glvalues, $department);
+ push(@arvalues, $department);
+ push(@apvalues, $department);
}
if ($form->{source}) {
- $source = $form->like(lc $form->{source});
- $glwhere .= " AND lower(ac.source) LIKE '$source'";
- $arwhere .= " AND lower(ac.source) LIKE '$source'";
- $apwhere .= " AND lower(ac.source) LIKE '$source'";
+ $glwhere .= " AND ac.source ILIKE ?";
+ $arwhere .= " AND ac.source ILIKE ?";
+ $apwhere .= " AND ac.source ILIKE ?";
+ push(@glvalues, '%' . $form->{source} . '%');
+ push(@arvalues, '%' . $form->{source} . '%');
+ push(@apvalues, '%' . $form->{source} . '%');
}
+
if ($form->{datefrom}) {
- $glwhere .= " AND ac.transdate >= '$form->{datefrom}'";
- $arwhere .= " AND ac.transdate >= '$form->{datefrom}'";
- $apwhere .= " AND ac.transdate >= '$form->{datefrom}'";
+ $glwhere .= " AND ac.transdate >= ?";
+ $arwhere .= " AND ac.transdate >= ?";
+ $apwhere .= " AND ac.transdate >= ?";
+ push(@glvalues, $form->{datefrom});
+ push(@arvalues, $form->{datefrom});
+ push(@apvalues, $form->{datefrom});
}
+
if ($form->{dateto}) {
- $glwhere .= " AND ac.transdate <= '$form->{dateto}'";
- $arwhere .= " AND ac.transdate <= '$form->{dateto}'";
- $apwhere .= " AND ac.transdate <= '$form->{dateto}'";
+ $glwhere .= " AND ac.transdate <= ?";
+ $arwhere .= " AND ac.transdate <= ?";
+ $apwhere .= " AND ac.transdate <= ?";
+ push(@glvalues, $form->{dateto});
+ push(@arvalues, $form->{dateto});
+ push(@apvalues, $form->{dateto});
}
+
if ($form->{description}) {
- my $description = $form->like(lc $form->{description});
- $glwhere .= " AND lower(g.description) LIKE '$description'";
- $arwhere .= " AND lower(ct.name) LIKE '$description'";
- $apwhere .= " AND lower(ct.name) LIKE '$description'";
+ $glwhere .= " AND g.description ILIKE ?";
+ $arwhere .= " AND ct.name ILIKE ?";
+ $apwhere .= " AND ct.name ILIKE ?";
+ push(@glvalues, '%' . $form->{description} . '%');
+ push(@arvalues, '%' . $form->{description} . '%');
+ push(@apvalues, '%' . $form->{description} . '%');
}
+
if ($form->{notes}) {
- my $notes = $form->like(lc $form->{notes});
- $glwhere .= " AND lower(g.notes) LIKE '$notes'";
- $arwhere .= " AND lower(a.notes) LIKE '$notes'";
- $apwhere .= " AND lower(a.notes) LIKE '$notes'";
+ $glwhere .= " AND g.notes ILIKE ?";
+ $arwhere .= " AND a.notes ILIKE ?";
+ $apwhere .= " AND a.notes ILIKE ?";
+ push(@glvalues, '%' . $form->{notes} . '%');
+ push(@arvalues, '%' . $form->{notes} . '%');
+ push(@apvalues, '%' . $form->{notes} . '%');
}
+
if ($form->{accno}) {
$glwhere .= " AND c.accno = '$form->{accno}'";
$arwhere .= " AND c.accno = '$form->{accno}'";
$apwhere .= " AND c.accno = '$form->{accno}'";
}
- if ($form->{gifi_accno}) {
- $glwhere .= " AND c.gifi_accno = '$form->{gifi_accno}'";
- $arwhere .= " AND c.gifi_accno = '$form->{gifi_accno}'";
- $apwhere .= " AND c.gifi_accno = '$form->{gifi_accno}'";
- }
+
if ($form->{category} ne 'X') {
$glwhere .=
- " AND gl.id in (SELECT trans_id FROM acc_trans ac2 WHERE ac2.chart_id IN (SELECT id FROM chart c2 WHERE c2.category = '$form->{category}'))";
+ qq| AND gl.id in (SELECT trans_id FROM acc_trans ac2 WHERE ac2.chart_id IN
+ (SELECT id FROM chart c2 WHERE c2.category = ?))|;
$arwhere .=
- " AND ar.id in (SELECT trans_id FROM acc_trans ac2 WHERE ac2.chart_id IN (SELECT id FROM chart c2 WHERE c2.category = '$form->{category}'))";
+ qq| AND ar.id in (SELECT trans_id FROM acc_trans ac2 WHERE ac2.chart_id IN
+ (SELECT id FROM chart c2 WHERE c2.category = ?))|;
$apwhere .=
- " AND ap.id in (SELECT trans_id FROM acc_trans ac2 WHERE ac2.chart_id IN (SELECT id FROM chart c2 WHERE c2.category = '$form->{category}'))";
+ qq| AND ap.id in (SELECT trans_id FROM acc_trans ac2 WHERE ac2.chart_id IN
+ (SELECT id FROM chart c2 WHERE c2.category = ?))|;
+ push(@glvalues, $form->{category});
+ push(@arvalues, $form->{category});
+ push(@apvalues, $form->{category});
}
- if ($form->{accno}) {
-
- # get category for account
- $query = qq|SELECT c.category
- FROM chart c
- WHERE c.accno = '$form->{accno}'|;
- $sth = $dbh->prepare($query);
-
- $sth->execute || $form->dberror($query);
- ($form->{ml}) = $sth->fetchrow_array;
- $sth->finish;
-
- if ($form->{datefrom}) {
- $query = qq|SELECT SUM(ac.amount)
- FROM acc_trans ac, chart c
- WHERE ac.chart_id = c.id
- AND c.accno = '$form->{accno}'
- AND ac.transdate < date '$form->{datefrom}'
- |;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($form->{balance}) = $sth->fetchrow_array;
- $sth->finish;
- }
+ if ($form->{project_id}) {
+ $glwhere .= qq| AND g.id IN (SELECT DISTINCT trans_id FROM acc_trans WHERE project_id = ?)|;
+ $arwhere .=
+ qq| AND ((a.globalproject_id = ?) OR
+ (a.id IN (SELECT DISTINCT trans_id FROM acc_trans WHERE project_id = ?)))|;
+ $apwhere .=
+ qq| AND ((a.globalproject_id = ?) OR
+ (a.id IN (SELECT DISTINCT trans_id FROM acc_trans WHERE project_id = ?)))|;
+ my $project_id = conv_i($form->{project_id});
+ push(@glvalues, $project_id);
+ push(@arvalues, $project_id, $project_id);
+ push(@apvalues, $project_id, $project_id);
}
- if ($form->{gifi_accno}) {
+ my ($project_columns, %project_join);
+ if ($form->{"l_projectnumbers"}) {
+ $project_columns = qq|, ac.project_id, pr.projectnumber|;
+ $project_join = qq|LEFT JOIN project pr ON (ac.project_id = pr.id)|;
+ }
+ if ($form->{accno}) {
# get category for account
- $query = qq|SELECT c.category
- FROM chart c
- WHERE c.gifi_accno = '$form->{gifi_accno}'|;
- $sth = $dbh->prepare($query);
-
- $sth->execute || $form->dberror($query);
- ($form->{ml}) = $sth->fetchrow_array;
- $sth->finish;
+ $query = qq|SELECT category FROM chart WHERE accno = ?|;
+ ($form->{ml}) = selectrow_query($form, $dbh, $query, $form->{accno});
if ($form->{datefrom}) {
- $query = qq|SELECT SUM(ac.amount)
- FROM acc_trans ac, chart c
- WHERE ac.chart_id = c.id
- AND c.gifi_accno = '$form->{gifi_accno}'
- AND ac.transdate < date '$form->{datefrom}'
- |;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($form->{balance}) = $sth->fetchrow_array;
- $sth->finish;
+ $query =
+ qq|SELECT SUM(ac.amount)
+ FROM acc_trans ac
+ LEFT JOIN chart c ON (ac.chart_id = c.id)
+ WHERE (c.accno = ?) AND (ac.transdate < ?)|;
+ ($form->{balance}) = selectrow_query($form, $dbh, $query, $form->{accno}, conv_date($form->{datefrom}));
}
}
my $false = ($myconfig->{dbdriver} eq 'Pg') ? FALSE: q|'0'|;
- my $sortorder = join ', ',
- $form->sort_columns(qw(transdate reference source description accno));
- my %ordinal = (transdate => 6,
- reference => 4,
- source => 7,
- description => 5);
- map { $sortorder =~ s/$_/$ordinal{$_}/ } keys %ordinal;
+ my $sortorder;
if ($form->{sort}) {
+ $form->{sort} =~ s/[^a-zA-Z_]//g;
$sortorder = $form->{sort} . ",";
- } else {
- $sortorder = "";
}
my $query =
- qq|SELECT ac.oid AS acoid, g.id, 'gl' AS type, $false AS invoice, g.reference, ac.taxkey, c.link,
- g.description, ac.transdate, ac.source, ac.trans_id,
- ac.amount, c.accno, c.gifi_accno, g.notes, t.chart_id, ac.oid
- FROM gl g, acc_trans ac, chart c LEFT JOIN tax t ON
- (t.chart_id=c.id)
- WHERE $glwhere
- AND ac.chart_id = c.id
- AND g.id = ac.trans_id
- UNION
- SELECT ac.oid AS acoid, a.id, 'ar' AS type, a.invoice, a.invnumber, ac.taxkey, c.link,
- ct.name, ac.transdate, ac.source, ac.trans_id,
- ac.amount, c.accno, c.gifi_accno, a.notes, t.chart_id, ac.oid
- FROM ar a, acc_trans ac, customer ct, chart c LEFT JOIN tax t ON
- (t.chart_id=c.id)
- WHERE $arwhere
- AND ac.chart_id = c.id
- AND a.customer_id = ct.id
- AND a.id = ac.trans_id
- UNION
- SELECT ac.oid AS acoid, a.id, 'ap' AS type, a.invoice, a.invnumber, ac.taxkey, c.link,
- ct.name, ac.transdate, ac.source, ac.trans_id,
- ac.amount, c.accno, c.gifi_accno, a.notes, t.chart_id, ac.oid
- FROM ap a, acc_trans ac, vendor ct, chart c LEFT JOIN tax t ON
- (t.chart_id=c.id)
- WHERE $apwhere
- AND ac.chart_id = c.id
- AND a.vendor_id = ct.id
- AND a.id = ac.trans_id
- ORDER BY $sortorder transdate,acoid, trans_id, taxkey DESC|;
+ qq|SELECT
+ ac.oid AS acoid, g.id, 'gl' AS type, $false AS invoice, g.reference, ac.taxkey, c.link,
+ g.description, ac.transdate, ac.source, ac.trans_id,
+ ac.amount, c.accno, g.notes, t.chart_id, ac.oid
+ $project_columns
+ FROM gl g, acc_trans ac $project_join, chart c
+ LEFT JOIN tax t ON (t.chart_id = c.id)
+ WHERE $glwhere
+ AND (ac.chart_id = c.id)
+ AND (g.id = ac.trans_id)
+
+ UNION
+
+ SELECT ac.oid AS acoid, a.id, 'ar' AS type, a.invoice, a.invnumber, ac.taxkey, c.link,
+ ct.name, ac.transdate, ac.source, ac.trans_id,
+ ac.amount, c.accno, a.notes, t.chart_id, ac.oid
+ $project_columns
+ FROM ar a, acc_trans ac $project_join, customer ct, chart c
+ LEFT JOIN tax t ON (t.chart_id=c.id)
+ WHERE $arwhere
+ AND (ac.chart_id = c.id)
+ AND (a.customer_id = ct.id)
+ AND (a.id = ac.trans_id)
+
+ UNION
+
+ SELECT ac.oid AS acoid, a.id, 'ap' AS type, a.invoice, a.invnumber, ac.taxkey, c.link,
+ ct.name, ac.transdate, ac.source, ac.trans_id,
+ ac.amount, c.accno, a.notes, t.chart_id, ac.oid
+ $project_columns
+ FROM ap a, acc_trans ac $project_join, vendor ct, chart c
+ LEFT JOIN tax t ON (t.chart_id=c.id)
+ WHERE $apwhere
+ AND (ac.chart_id = c.id)
+ AND (a.vendor_id = ct.id)
+ AND (a.id = ac.trans_id)
+
+ ORDER BY $sortorder transdate, trans_id, acoid, taxkey DESC|;
+
+ my @values = (@glvalues, @arvalues, @apvalues);
# Show all $query in Debuglevel LXDebug::QUERY
$callingdetails = (caller (0))[3];
- $main::lxdebug->message(LXDebug::QUERY, "$callingdetails \$query=\n $query");
-
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ dump_query(LXDebug::QUERY, "$callingdetails", $query, @values);
+
+ $sth = prepare_execute_query($form, $dbh, $query, @values);
my $trans_id = "";
my $trans_id2 = "";
+ my ($i, $j, $k, $l, $ref, $ref2);
+
+ $form->{GL} = [];
while (my $ref0 = $sth->fetchrow_hashref(NAME_lc)) {
-
+
$trans_id = $ref0->{id};
-
+
if ($trans_id != $trans_id2) { # first line of a booking
-
+
if ($trans_id2) {
- push @{ $form->{GL} }, $ref;
+ push(@{ $form->{GL} }, $ref);
$balance = 0;
}
-
+
$ref = $ref0;
$trans_id2 = $ref->{id};
$ref->{module} = "ar";
}
}
-
+
+ $ref->{"projectnumbers"} = {};
+ $ref->{"projectnumbers"}->{$ref->{"projectnumber"}} = 1 if ($ref->{"projectnumber"});
+
$balance = $ref->{amount};
-
- # Linenumbers of General Ledger
+
+ # Linenumbers of General Ledger
$k = 0; # Debit # AP # Soll
$l = 0; # Credit # AR # Haben
$i = 0; # Debit Tax # AP_tax # VSt
$j = 0; # Credit Tax # AR_tax # USt
-
+
if ($ref->{chart_id} > 0) { # all tax accounts first line, no line increasing
if ($ref->{amount} < 0) {
if ($ref->{link} =~ /AR_tax/) {
$ref->{credit_tax}{$j} = $ref->{amount};
- $ref->{credit_tax_accno}{$j} = $ref->{accno};
+ $ref->{credit_tax_accno}{$j} = $ref->{accno};
}
if ($ref->{link} =~ /AP_tax/) {
$ref->{debit_tax}{$i} = $ref->{amount} * -1;
- $ref->{debit_tax_accno}{$i} = $ref->{accno};
+ $ref->{debit_tax_accno}{$i} = $ref->{accno};
}
} else {
if ($ref->{link} =~ /AR_tax/) {
$ref->{credit_tax}{$j} = $ref->{amount};
- $ref->{credit_tax_accno}{$j} = $ref->{accno};
+ $ref->{credit_tax_accno}{$j} = $ref->{accno};
}
if ($ref->{link} =~ /AP_tax/) {
$ref->{debit_tax}{$i} = $ref->{amount} * -1;
- $ref->{debit_tax_accno}{$i} = $ref->{accno};
+ $ref->{debit_tax_accno}{$i} = $ref->{accno};
}
}
} else { #all other accounts first line
$ref->{debit}{$k} = $ref->{amount} * -1;
$ref->{debit_accno}{$k} = $ref->{accno};
$ref->{debit_taxkey}{$k} = $ref->{taxkey};
+ $ref->{ac_transdate}{$k} = $ref->{transdate};
} else {
$ref->{credit}{$l} = $ref->{amount} * 1;
$ref->{credit_accno}{$l} = $ref->{accno};
$ref->{credit_taxkey}{$l} = $ref->{taxkey};
+ $ref->{ac_transdate}{$l} = $ref->{transdate};
}
} else { # following lines of a booking, line increasing
$ref2 = $ref0;
- $trans_old =$trans_id2;
+ $trans_old = $trans_id2;
$trans_id2 = $ref2->{id};
-
+
$balance =
(int($balance * 100000) + int(100000 * $ref2->{amount})) / 100000;
+ $ref->{"projectnumbers"}->{$ref2->{"projectnumber"}} = 1 if ($ref2->{"projectnumber"});
if ($ref2->{chart_id} > 0) { # all tax accounts, following lines
if ($ref2->{amount} < 0) {
$j++;
}
$ref->{credit_tax}{$j} = $ref2->{amount};
- $ref->{credit_tax_accno}{$j} = $ref2->{accno};
+ $ref->{credit_tax_accno}{$j} = $ref2->{accno};
}
if ($ref2->{link} =~ /AP_tax/) {
if ($ref->{debit_tax_accno}{$i} ne "") {
$i++;
}
$ref->{debit_tax}{$i} = $ref2->{amount} * -1;
- $ref->{debit_tax_accno}{$i} = $ref2->{accno};
+ $ref->{debit_tax_accno}{$i} = $ref2->{accno};
}
} else {
if ($ref2->{link} =~ /AR_tax/) {
$j++;
}
$ref->{credit_tax}{$j} = $ref2->{amount};
- $ref->{credit_tax_accno}{$j} = $ref2->{accno};
+ $ref->{credit_tax_accno}{$j} = $ref2->{accno};
}
if ($ref2->{link} =~ /AP_tax/) {
if ($ref->{debit_tax_accno}{$i} ne "") {
$i++;
}
$ref->{debit_tax}{$i} = $ref2->{amount} * -1;
- $ref->{debit_tax_accno}{$i} = $ref2->{accno};
+ $ref->{debit_tax_accno}{$i} = $ref2->{accno};
}
}
} else { # all other accounts, following lines
$ref->{debit}{$k} = $ref2->{amount} * - 1;
$ref->{debit_accno}{$k} = $ref2->{accno};
$ref->{debit_taxkey}{$k} = $ref2->{taxkey};
+ $ref->{ac_transdate}{$k} = $ref2->{transdate};
} else {
if ($ref->{credit_accno}{$l} ne "") {
$l++;
$ref->{credit}{$l} = $ref2->{amount};
$ref->{credit_accno}{$l} = $ref2->{accno};
$ref->{credit_taxkey}{$l} = $ref2->{taxkey};
+ $ref->{ac_transdate}{$l} = $ref2->{transdate};
}
}
}
$sth->finish;
if ($form->{accno}) {
- $query =
- qq|SELECT c.description FROM chart c WHERE c.accno = '$form->{accno}'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($form->{account_description}) = $sth->fetchrow_array;
- $sth->finish;
+ $query = qq|SELECT c.description FROM chart c WHERE c.accno = ?|;
+ ($form->{account_description}) = selectrow_query($form, $dbh, $query, $form->{accno});
}
- if ($form->{gifi_accno}) {
- $query =
- qq|SELECT g.description FROM gifi g WHERE g.accno = '$form->{gifi_accno}'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($form->{gifi_account_description}) = $sth->fetchrow_array;
- $sth->finish;
- }
- $main::lxdebug->leave_sub();
$dbh->disconnect;
+ $main::lxdebug->leave_sub();
}
sub transaction {
my ($self, $myconfig, $form) = @_;
$main::lxdebug->enter_sub();
- my ($query, $sth, $ref);
+ my ($query, $sth, $ref, @values);
# connect to database
my $dbh = $form->dbconnect($myconfig);
+ $query = qq|SELECT closedto, revtrans FROM defaults|;
+ ($form->{closedto}, $form->{revtrans}) = selectrow_query($form, $dbh, $query);
+
+ $query = qq|SELECT id, gldate
+ FROM gl
+ WHERE id = (SELECT max(id) FROM gl)|;
+ ($form->{previous_id}, $form->{previous_gldate}) = selectrow_query($form, $dbh, $query);
+
if ($form->{id}) {
- $query = "SELECT closedto, revtrans
- FROM defaults";
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($form->{closedto}, $form->{revtrans}) = $sth->fetchrow_array;
- $sth->finish;
-
- $query = "SELECT g.reference, g.description, g.notes, g.transdate,
- d.description AS department, e.name as employee, g.taxincluded, g.gldate
- FROM gl g
- LEFT JOIN department d ON (d.id = g.department_id)
- LEFT JOIN employee e ON (e.id = g.employee_id)
- WHERE g.id = $form->{id}";
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- $ref = $sth->fetchrow_hashref(NAME_lc);
+ $query =
+ qq|SELECT g.reference, g.description, g.notes, g.transdate, g.storno, g.storno_id,
+ d.description AS department, e.name AS employee, g.taxincluded, g.gldate
+ FROM gl g
+ LEFT JOIN department d ON (d.id = g.department_id)
+ LEFT JOIN employee e ON (e.id = g.employee_id)
+ WHERE g.id = ?|;
+ $ref = selectfirst_hashref_query($form, $dbh, $query, conv_i($form->{id}));
map { $form->{$_} = $ref->{$_} } keys %$ref;
- $sth->finish;
# retrieve individual rows
- $query = qq|SELECT c.accno, t.taxkey AS accnotaxkey, a.amount, a.memo,
- a.transdate, a.cleared, a.project_id, p.projectnumber,(SELECT p.projectnumber FROM project p
- WHERE a.project_id = p.id) AS projectnumber, a.taxkey, t.rate AS taxrate, t.id, (SELECT c1.accno FROM chart c1, tax t1 WHERE t1.id=t.id AND c1.id=t.chart_id) AS taxaccno, (SELECT tk.tax_id FROM taxkeys tk WHERE tk.chart_id =a.chart_id AND tk.startdate<=a.transdate ORDER BY tk.startdate desc LIMIT 1) AS tax_id
- FROM acc_trans a
- JOIN chart c ON (c.id = a.chart_id)
- LEFT JOIN project p ON (p.id = a.project_id)
- LEFT JOIN tax t ON (t.id=(SELECT tk.tax_id from taxkeys tk WHERE (tk.taxkey_id=a.taxkey) AND ((CASE WHEN a.chart_id IN (SELECT chart_id FROM taxkeys WHERE taxkey_id=a.taxkey) THEN tk.chart_id=a.chart_id ELSE 1=1 END) OR (c.link LIKE '%tax%')) AND startdate <=a.transdate ORDER BY startdate DESC LIMIT 1))
- WHERE a.trans_id = $form->{id}
- AND a.fx_transaction = '0'
- ORDER BY a.oid,a.transdate|;
-
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- $form->{GL} = [];
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{GL} }, $ref;
- }
-
- # get tax description
- $query = qq| SELECT * FROM tax t order by t.taxkey|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- $form->{TAX} = [];
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{TAX} }, $ref;
- }
+ $query =
+ qq|SELECT c.accno, t.taxkey AS accnotaxkey, a.amount, a.memo, a.source,
+ a.transdate, a.cleared, a.project_id, p.projectnumber,
+ a.taxkey, t.rate AS taxrate, t.id,
+ (SELECT c1.accno
+ FROM chart c1, tax t1
+ WHERE (t1.id = t.id) AND (c1.id = t.chart_id)) AS taxaccno,
+ (SELECT tk.tax_id
+ FROM taxkeys tk
+ WHERE (tk.chart_id = a.chart_id) AND (tk.startdate <= a.transdate)
+ ORDER BY tk.startdate desc LIMIT 1) AS tax_id
+ FROM acc_trans a
+ JOIN chart c ON (c.id = a.chart_id)
+ LEFT JOIN project p ON (p.id = a.project_id)
+ LEFT JOIN tax t ON
+ (t.id =
+ (SELECT tk.tax_id
+ FROM taxkeys tk
+ WHERE (tk.taxkey_id = a.taxkey) AND
+ ((CASE WHEN a.chart_id IN
+ (SELECT chart_id FROM taxkeys WHERE taxkey_id = a.taxkey)
+ THEN tk.chart_id = a.chart_id
+ ELSE 1 = 1
+ END)
+ OR (c.link LIKE '%tax%'))
+ AND (startdate <= a.transdate)
+ ORDER BY startdate DESC LIMIT 1))
+ WHERE (a.trans_id = ?)
+ AND (a.fx_transaction = '0')
+ ORDER BY a.oid, a.transdate|;
+ $form->{GL} = selectall_hashref_query($form, $dbh, $query, conv_i($form->{id}));
- $sth->finish;
} else {
- $query = "SELECT closedto, revtrans FROM defaults";
- ($form->{closedto}, $form->{revtrans}) = $dbh->selectrow_array($query);
$query =
- "SELECT COALESCE(" .
- " (SELECT transdate FROM gl WHERE id = " .
- " (SELECT MAX(id) FROM gl) LIMIT 1), " .
- " current_date)";
- ($form->{transdate}) = $dbh->selectrow_array($query);
-
- # get tax description
- $query = qq| SELECT * FROM tax t order by t.taxkey|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- $form->{TAX} = ();
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{TAX} }, $ref;
- }
+ qq|SELECT COALESCE(
+ (SELECT transdate
+ FROM gl
+ WHERE id = (SELECT MAX(id) FROM gl)
+ LIMIT 1),
+ current_date)|;
+ ($form->{transdate}) = selectrow_query($form, $dbh, $query);
}
- $sth->finish;
- my $transdate = "current_date";
- if ($form->{transdate}) {
- $transdate = qq|'$form->{transdate}'|;
- }
+ # get tax description
+ $query = qq|SELECT * FROM tax ORDER BY taxkey|;
+ $form->{TAX} = selectall_hashref_query($form, $dbh, $query);
+
# get chart of accounts
- $query = qq|SELECT c.accno, c.description, c.link, tk.taxkey_id, tk.tax_id
- FROM chart c
- LEFT JOIN taxkeys tk ON (tk.id = (SELECT id from taxkeys where taxkeys.chart_id =c.id AND startdate<=$transdate ORDER BY startdate desc LIMIT 1))
- ORDER BY c.accno|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- $form->{chart} = ();
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{chart} }, $ref;
- }
- $sth->finish;
+ $query =
+ qq|SELECT c.accno, c.description, c.link, tk.taxkey_id, tk.tax_id
+ FROM chart c
+ LEFT JOIN taxkeys tk ON (tk.id =
+ (SELECT id
+ FROM taxkeys
+ WHERE (taxkeys.chart_id = c.id)
+ AND (startdate <= ?)
+ ORDER BY startdate DESC
+ LIMIT 1))
+ ORDER BY c.accno|;
+ $form->{chart} = selectall_hashref_query($form, $dbh, $query, conv_date($form->{transdate}));
+
+ $dbh->disconnect;
- $sth->finish;
$main::lxdebug->leave_sub();
+}
- $dbh->disconnect;
+sub storno {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $form, $myconfig, $id) = @_;
+
+ my ($query, $new_id, $storno_row, $acc_trans_rows);
+ my $dbh = $form->get_standard_dbh($myconfig);
+
+ $query = qq|SELECT nextval('glid')|;
+ ($new_id) = selectrow_query($form, $dbh, $query);
+
+ $query = qq|SELECT * FROM gl WHERE id = ?|;
+ $storno_row = selectfirst_hashref_query($form, $dbh, $query, $id);
+ $storno_row->{id} = $new_id;
+ $storno_row->{storno_id} = $id;
+ $storno_row->{storno} = 't';
+ $storno_row->{reference} = 'Storno-' . $storno_row->{reference};
+
+ delete @$storno_row{qw(itime mtime)};
+
+ $query = sprintf 'INSERT INTO gl (%s) VALUES (%s)', join(', ', keys %$storno_row), join(', ', map '?', values %$storno_row);
+ do_query($form, $dbh, $query, (values %$storno_row));
+
+ $query = qq|UPDATE gl SET storno = 't' WHERE id = ?|;
+ do_query($form, $dbh, $query, $id);
+
+ # now copy acc_trans entries
+ $query = qq|SELECT * FROM acc_trans WHERE trans_id = ?|;
+ my $rowref = selectall_hashref_query($form, $dbh, $query, $id);
+
+ for my $row (@$rowref) {
+ delete @$row{qw(itime mtime)};
+ $query = sprintf 'INSERT INTO acc_trans (%s) VALUES (%s)', join(', ', keys %$row), join(', ', map '?', values %$row);
+ $row->{trans_id} = $new_id;
+ $row->{amount} *= -1;
+ do_query($form, $dbh, $query, (values %$row));
+ }
+
+ $dbh->commit;
+
+ $main::lxdebug->leave_sub();
}
1;
-
package IC;
use Data::Dumper;
+use SL::DBUtils;
sub get_part {
$main::lxdebug->enter_sub();
# connect to db
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT p.*,
- c1.accno AS inventory_accno,
- c2.accno AS income_accno,
- c3.accno AS expense_accno,
- pg.partsgroup
- FROM parts p
- LEFT JOIN chart c1 ON (p.inventory_accno_id = c1.id)
- LEFT JOIN chart c2 ON (p.income_accno_id = c2.id)
- LEFT JOIN chart c3 ON (p.expense_accno_id = c3.id)
- LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
- WHERE p.id = $form->{id}|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- my $ref = $sth->fetchrow_hashref(NAME_lc);
+ my $sth;
+
+ my $query =
+ qq|SELECT p.*,
+ c1.accno AS inventory_accno,
+ c2.accno AS income_accno,
+ c3.accno AS expense_accno,
+ pg.partsgroup
+ FROM parts p
+ LEFT JOIN chart c1 ON (p.inventory_accno_id = c1.id)
+ LEFT JOIN chart c2 ON (p.income_accno_id = c2.id)
+ LEFT JOIN chart c3 ON (p.expense_accno_id = c3.id)
+ LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
+ WHERE p.id = ? |;
+ my $ref = selectfirst_hashref_query($form, $dbh, $query, conv_i($form->{id}));
# copy to $form variables
map { $form->{$_} = $ref->{$_} } (keys %{$ref});
- $sth->finish;
-
my %oid = ('Pg' => 'a.oid',
'Oracle' => 'a.rowid');
$form->{item} = 'assembly';
# retrieve assembly items
- $query = qq|SELECT p.id, p.partnumber, p.description,
- p.sellprice, p.weight, a.qty, a.bom, p.unit,
- pg.partsgroup
- FROM parts p
- JOIN assembly a ON (a.parts_id = p.id)
- LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
- WHERE a.id = $form->{id}
- ORDER BY $oid{$myconfig->{dbdriver}}|;
-
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $query =
+ qq|SELECT p.id, p.partnumber, p.description,
+ p.sellprice, p.weight, a.qty, a.bom, p.unit,
+ pg.partsgroup
+ FROM parts p
+ JOIN assembly a ON (a.parts_id = p.id)
+ LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
+ WHERE (a.id = ?)
+ ORDER BY $oid{$myconfig->{dbdriver}}|;
+ $sth = prepare_execute_query($form, $dbh, $query, conv_i($form->{id}));
$form->{assembly_rows} = 0;
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
$form->{amount}{IC_expense} = $form->{expense_accno};
$form->{amount}{IC_cogs} = $form->{expense_accno};
+ my @pricegroups = ();
+ my @pricegroups_not_used = ();
+
# get prices
$query =
- qq|SELECT p.parts_id, p.pricegroup_id, p.price, (SELECT pg.pricegroup FROM pricegroup pg WHERE pg.id=p.pricegroup_id) AS pricegroup FROM prices p
- WHERE parts_id = $form->{id}
- ORDER by pricegroup|;
-
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- @pricegroups = ();
- @pricegroups_not_used = ();
+ qq|SELECT p.parts_id, p.pricegroup_id, p.price,
+ (SELECT pg.pricegroup
+ FROM pricegroup pg
+ WHERE pg.id = p.pricegroup_id) AS pricegroup
+ FROM prices p
+ WHERE (parts_id = ?)
+ ORDER BY pricegroup|;
+ $sth = prepare_execute_query($form, $dbh, $query, conv_i($form->{id}));
#for pricegroups
my $i = 1;
- while (
- ($form->{"klass_$i"}, $form->{"pricegroup_id_$i"},
+ while (($form->{"klass_$i"}, $form->{"pricegroup_id_$i"},
$form->{"price_$i"}, $form->{"pricegroup_$i"})
- = $sth->fetchrow_array
- ) {
+ = $sth->fetchrow_array()) {
$form->{"price_$i"} = $form->round_amount($form->{"price_$i"}, 5);
- $form->{"price_$i"} =
- $form->format_amount($myconfig, $form->{"price_$i"}, 5);
+ $form->{"price_$i"} = $form->format_amount($myconfig, $form->{"price_$i"}, -2);
push @pricegroups, $form->{"pricegroup_id_$i"};
$i++;
}
$sth->finish;
# get pricegroups
- $query = qq|SELECT p.id, p.pricegroup FROM pricegroup p|;
-
- $pkq = $dbh->prepare($query);
- $pkq->execute || $form->dberror($query);
- while ($pkr = $pkq->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{PRICEGROUPS} }, $pkr;
- }
- $pkq->finish;
+ $query = qq|SELECT id, pricegroup FROM pricegroup|;
+ $form->{PRICEGROUPS} = selectall_hashref_query($form, $dbh, $query);
#find not used pricegroups
- while ($tmp = pop @{ $form->{PRICEGROUPS} }) {
- my $insert = 0;
- foreach $item (@pricegroups) {
+ while ($tmp = pop(@{ $form->{PRICEGROUPS} })) {
+ my $in_use = 0;
+ foreach my $item (@pricegroups) {
if ($item eq $tmp->{id}) {
-
- #drop
- $insert = 1;
+ $in_use = 1;
+ last;
}
}
- if ($insert == 0) {
- push @pricegroups_not_used, $tmp;
- }
+ push(@pricegroups_not_used, $tmp) unless ($in_use);
}
# if not used pricegroups are avaible
foreach $name (@pricegroups_not_used) {
$form->{"klass_$i"} = "$name->{id}";
$form->{"price_$i"} = $form->round_amount($form->{sellprice}, 5);
- $form->{"price_$i"} =
- $form->format_amount($myconfig, $form->{"price_$i"}, 5);
+ $form->{"price_$i"} = $form->format_amount($myconfig, $form->{"price_$i"}, -2);
$form->{"pricegroup_id_$i"} = "$name->{id}";
$form->{"pricegroup_$i"} = "$name->{pricegroup}";
$i++;
# get makes
if ($form->{makemodel}) {
- $query = qq|SELECT m.make, m.model FROM makemodel m
- WHERE m.parts_id = $form->{id}|;
-
+ $query = qq|SELECT m.make, m.model FROM makemodel m | .
+ qq|WHERE m.parts_id = ?|;
+ @values = ($form->{id});
$sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute(@values) || $form->dberror("$query (" . join(', ', @values) . ")");
my $i = 1;
while (($form->{"make_$i"}, $form->{"model_$i"}) = $sth->fetchrow_array)
# get translations
$form->{language_values} = "";
- $query = qq|SELECT language_id, translation FROM translation WHERE parts_id = $form->{id}|;
- $trq = $dbh->prepare($query);
- $trq->execute || $form->dberror($query);
+ $query = qq|SELECT language_id, translation FROM translation WHERE parts_id = ?|;
+ my $trq = prepare_execute_query($form, $dbh, $query, conv_i($form->{id}));
while ($tr = $trq->fetchrow_hashref(NAME_lc)) {
$form->{language_values} .= "---+++---".$tr->{language_id}."--++--".$tr->{translation};
}
$trq->finish;
# now get accno for taxes
- $query = qq|SELECT c.accno
- FROM chart c, partstax pt
- WHERE pt.chart_id = c.id
- AND pt.parts_id = $form->{id}|;
-
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
+ $query =
+ qq|SELECT c.accno
+ FROM chart c, partstax pt
+ WHERE (pt.chart_id = c.id) AND (pt.parts_id = ?)|;
+ $sth = prepare_execute_query($form, $dbh, $query, conv_i($form->{id}));
while (($key) = $sth->fetchrow_array) {
$form->{amount}{$key} = $key;
}
$sth->finish;
# is it an orphan
- $query = qq|SELECT i.parts_id
- FROM invoice i
- WHERE i.parts_id = $form->{id}
- UNION
- SELECT o.parts_id
- FROM orderitems o
- WHERE o.parts_id = $form->{id}
- UNION
- SELECT a.parts_id
- FROM assembly a
- WHERE a.parts_id = $form->{id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($form->{orphaned}) = $sth->fetchrow_array;
+ $query =
+ qq|SELECT i.parts_id
+ FROM invoice i
+ WHERE (i.parts_id = ?)
+
+ UNION
+
+ SELECT o.parts_id
+ FROM orderitems o
+ WHERE (o.parts_id = ?)
+
+ UNION
+
+ SELECT a.parts_id
+ FROM assembly a
+ WHERE (a.parts_id = ?)|;
+ @values = (conv_i($form->{id}), conv_i($form->{id}), conv_i($form->{id}));
+ ($form->{orphaned}) = selectrow_query($form, $dbh, $query, @values);
$form->{orphaned} = !$form->{orphaned};
- $sth->finish;
$form->{"unit_changeable"} = 1;
foreach my $table (qw(invoice assembly orderitems inventory license)) {
- $query = "SELECT COUNT(*) FROM $table WHERE parts_id = ?";
- my ($count) = $dbh->selectrow_array($query, undef, $form->{"id"});
- $form->dberror($query . " (" . $form->{"id"} . ")") if ($dbh->err);
+ $query = qq|SELECT COUNT(*) FROM $table WHERE parts_id = ?|;
+ my ($count) = selectrow_query($form, $dbh, $query, conv_i($form->{"id"}));
if ($count) {
$form->{"unit_changeable"} = 0;
$main::lxdebug->enter_sub();
my ($self, $myconfig, $form) = @_;
- my $dbh = $form->dbconnect($myconfig);
- my $i = 1;
- my @pricegroups_not_used = ();
-
- # get pricegroups
- my $query = qq|SELECT p.id, p.pricegroup FROM pricegroup p|;
- my $pkq = $dbh->prepare($query);
- $pkq->execute || $form->dberror($query);
- while ($pkr = $pkq->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{PRICEGROUPS} }, $pkr;
- }
- $pkq->finish;
-
- #find not used pricegroups
- while ($tmp = pop @{ $form->{PRICEGROUPS} }) {
- push @pricegroups_not_used, $tmp;
- }
+ my $dbh = $form->dbconnect($myconfig);
- # if not used pricegroups are avaible
- if (@pricegroups_not_used) {
+ # get pricegroups
+ my $query = qq|SELECT id, pricegroup FROM pricegroup|;
+ my $pricegroups = selectall_hashref_query($form, $dbh, $query);
- foreach $name (@pricegroups_not_used) {
- $form->{"klass_$i"} = "$name->{id}";
- $form->{"price_$i"} = $form->round_amount($form->{sellprice}, 5);
- $form->{"price_$i"} =
- $form->format_amount($myconfig, $form->{"price_$i"}, 5);
- $form->{"pricegroup_id_$i"} = "$name->{id}";
- $form->{"pricegroup_$i"} = "$name->{pricegroup}";
- $i++;
- }
+ my $i = 1;
+ foreach $pg (@{ $pricegroups }) {
+ $form->{"klass_$i"} = "$pg->{id}";
+ $form->{"price_$i"} = $form->format_amount($myconfig, $form->{"price_$i"}, -2);
+ $form->{"pricegroup_id_$i"} = "$pg->{id}";
+ $form->{"pricegroup_$i"} = "$pg->{pricegroup}";
+ $i++;
}
#correct rows
my $dbh = $form->dbconnect($myconfig);
# get buchungsgruppen
- $query = qq|SELECT id, description
- FROM buchungsgruppen|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- $form->{BUCHUNGSGRUPPEN} = [];
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push(@{ $form->{BUCHUNGSGRUPPEN} }, $ref);
- }
- $sth->finish;
+ $query = qq|SELECT id, description FROM buchungsgruppen ORDER BY sortkey|;
+ $form->{BUCHUNGSGRUPPEN} = selectall_hashref_query($form, $dbh, $query);
$main::lxdebug->leave_sub();
}
$main::lxdebug->enter_sub();
my ($self, $myconfig, $form) = @_;
- $form->{IC_expense} = "1000";
- $form->{IC_income} = "2000";
-
- if ($form->{item} ne 'service') {
- $form->{IC} = $form->{IC_expense};
- }
-
- ($form->{inventory_accno}) = split(/--/, $form->{IC});
- ($form->{expense_accno}) = split(/--/, $form->{IC_expense});
- ($form->{income_accno}) = split(/--/, $form->{IC_income});
-
+ my @values;
# connect to database, turn off AutoCommit
my $dbh = $form->dbconnect_noauto($myconfig);
# if there is a $form->{id} then replace the old entry
# delete all makemodel entries and add the new ones
- # escape '
- map { $form->{$_} =~ s/\'/\'\'/g } qw(partnumber description notes unit);
-
# undo amount formatting
map { $form->{$_} = $form->parse_amount($myconfig, $form->{$_}) }
qw(rop weight listprice sellprice gv lastcost stock);
- # set date to NULL if nothing entered
- $form->{priceupdate} =
- ($form->{priceupdate}) ? qq|'$form->{priceupdate}'| : "NULL";
+ my $makemodel = (($form->{make_1}) || ($form->{model_1})) ? 1 : 0;
- $form->{makemodel} = (($form->{make_1}) || ($form->{model_1})) ? 1 : 0;
-
- $form->{alternate} = 0;
$form->{assembly} = ($form->{item} eq 'assembly') ? 1 : 0;
- $form->{obsolete} *= 1;
- $form->{shop} *= 1;
- $form->{onhand} *= 1;
- $form->{ve} *= 1;
- $form->{ge} *= 1;
- $form->{buchungsgruppen_id} *= 1;
- $form->{not_discountable} *= 1;
- $form->{payment_id} *= 1;
my ($query, $sth);
if ($form->{id}) {
# get old price
- $query = qq|SELECT p.sellprice, p.weight
- FROM parts p
- WHERE p.id = $form->{id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- my ($sellprice, $weight) = $sth->fetchrow_array;
- $sth->finish;
+ $query = qq|SELECT sellprice, weight FROM parts WHERE id = ?|;
+ my ($sellprice, $weight) = selectrow_query($form, $dbh, $query, conv_i($form->{id}));
# if item is part of an assembly adjust all assemblies
- $query = qq|SELECT a.id, a.qty
- FROM assembly a
- WHERE a.parts_id = $form->{id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $query = qq|SELECT id, qty FROM assembly WHERE parts_id = ?|;
+ $sth = prepare_execute_query($form, $dbh, $query, conv_i($form->{id}));
while (my ($id, $qty) = $sth->fetchrow_array) {
&update_assembly($dbh, $form, $id, $qty, $sellprice * 1, $weight * 1);
}
$sth->finish;
if ($form->{item} ne 'service') {
-
# delete makemodel records
- $query = qq|DELETE FROM makemodel
- WHERE parts_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, qq|DELETE FROM makemodel WHERE parts_id = ?|, conv_i($form->{id}));
}
if ($form->{item} eq 'assembly') {
}
# delete assembly records
- $query = qq|DELETE FROM assembly
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, qq|DELETE FROM assembly WHERE id = ?|, conv_i($form->{id}));
$form->{onhand} += $form->{stock};
}
# delete tax records
- $query = qq|DELETE FROM partstax
- WHERE parts_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, qq|DELETE FROM partstax WHERE parts_id = ?|, conv_i($form->{id}));
# delete translations
- $query = qq|DELETE FROM translation
- WHERE parts_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, qq|DELETE FROM translation WHERE parts_id = ?|, conv_i($form->{id}));
} else {
- my $uid = rand() . time;
- $uid .= $form->{login};
-
- $query = qq|SELECT p.id FROM parts p
- WHERE p.partnumber = '$form->{partnumber}'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- ($form->{id}) = $sth->fetchrow_array;
- $sth->finish;
-
- if ($form->{id} ne "") {
+ my ($count) = selectrow_query($form, $dbh, qq|SELECT COUNT(*) FROM parts WHERE partnumber = ?|, $form->{partnumber});
+ if ($count) {
$main::lxdebug->leave_sub();
return 3;
}
- $query = qq|INSERT INTO parts (partnumber, description)
- VALUES ('$uid', 'dummy')|;
- $dbh->do($query) || $form->dberror($query);
-
- $query = qq|SELECT p.id FROM parts p
- WHERE p.partnumber = '$uid'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- ($form->{id}) = $sth->fetchrow_array;
- $sth->finish;
+ ($form->{id}) = selectrow_query($form, $dbh, qq|SELECT nextval('id')|);
+ do_query($form, $dbh, qq|INSERT INTO parts (id, partnumber) VALUES (?, '')|, $form->{id});
$form->{orphaned} = 1;
$form->{onhand} = $form->{stock} if $form->{item} eq 'assembly';
- if ($form->{partnumber} eq "" && $form->{inventory_accno} eq "") {
+ if ($form->{partnumber} eq "" && $form->{"item"} eq "service") {
$form->{partnumber} = $form->update_defaults($myconfig, "servicenumber");
}
- if ($form->{partnumber} eq "" && $form->{inventory_accno} ne "") {
+ if ($form->{partnumber} eq "" && $form->{"item"} ne "service") {
$form->{partnumber} = $form->update_defaults($myconfig, "articlenumber");
}
my $partsgroup_id = 0;
if ($form->{partsgroup}) {
- ($partsgroup, $partsgroup_id) = split /--/, $form->{partsgroup};
+ ($partsgroup, $partsgroup_id) = split(/--/, $form->{partsgroup});
}
- $query = qq|UPDATE parts SET
- partnumber = '$form->{partnumber}',
- description = '$form->{description}',
- makemodel = '$form->{makemodel}',
- alternate = '$form->{alternate}',
- assembly = '$form->{assembly}',
- listprice = $form->{listprice},
- sellprice = $form->{sellprice},
- lastcost = $form->{lastcost},
- weight = $form->{weight},
- priceupdate = $form->{priceupdate},
- unit = '$form->{unit}',
- notes = '$form->{notes}',
- formel = '$form->{formel}',
- rop = $form->{rop},
- bin = '$form->{bin}',
- buchungsgruppen_id = '$form->{buchungsgruppen_id}',
- payment_id = '$form->{payment_id}',
- inventory_accno_id = (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{inventory_accno}'),
- income_accno_id = (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{income_accno}'),
- expense_accno_id = (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{expense_accno}'),
- obsolete = '$form->{obsolete}',
- image = '$form->{image}',
- drawing = '$form->{drawing}',
- shop = '$form->{shop}',
- ve = '$form->{ve}',
- gv = '$form->{gv}',
- not_discountable = '$form->{not_discountable}',
- microfiche = '$form->{microfiche}',
- partsgroup_id = $partsgroup_id
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ my ($subq_inventory, $subq_expense, $subq_income);
+ if ($form->{"item"} eq "part") {
+ $subq_inventory =
+ qq|(SELECT bg.inventory_accno_id
+ FROM buchungsgruppen bg
+ WHERE bg.id = | . conv_i($form->{"buchungsgruppen_id"}, 'NULL') . qq|)|;
+ } else {
+ $subq_inventory = "NULL";
+ }
+
+ if ($form->{"item"} ne "assembly") {
+ $subq_expense =
+ qq|(SELECT bg.expense_accno_id_0
+ FROM buchungsgruppen bg
+ WHERE bg.id = | . conv_i($form->{"buchungsgruppen_id"}, 'NULL') . qq|)|;
+ } else {
+ $subq_expense = "NULL";
+ }
+
+ $query =
+ qq|UPDATE parts SET
+ partnumber = ?,
+ description = ?,
+ makemodel = ?,
+ alternate = 'f',
+ assembly = ?,
+ listprice = ?,
+ sellprice = ?,
+ lastcost = ?,
+ weight = ?,
+ priceupdate = ?,
+ unit = ?,
+ notes = ?,
+ formel = ?,
+ rop = ?,
+ bin = ?,
+ buchungsgruppen_id = ?,
+ payment_id = ?,
+ inventory_accno_id = $subq_inventory,
+ income_accno_id = (SELECT bg.income_accno_id_0 FROM buchungsgruppen bg WHERE bg.id = ?),
+ expense_accno_id = $subq_expense,
+ obsolete = ?,
+ image = ?,
+ drawing = ?,
+ shop = ?,
+ ve = ?,
+ gv = ?,
+ ean = ?,
+ not_discountable = ?,
+ microfiche = ?,
+ partsgroup_id = ?
+ WHERE id = ?|;
+ @values = ($form->{partnumber},
+ $form->{description},
+ $makemodel ? 't' : 'f',
+ $form->{assembly} ? 't' : 'f',
+ $form->{listprice},
+ $form->{sellprice},
+ $form->{lastcost},
+ $form->{weight},
+ conv_date($form->{priceupdate}),
+ $form->{unit},
+ $form->{notes},
+ $form->{formel},
+ $form->{rop},
+ $form->{bin},
+ conv_i($form->{buchungsgruppen_id}),
+ conv_i($form->{payment_id}),
+ conv_i($form->{buchungsgruppen_id}),
+ $form->{obsolete} ? 't' : 'f',
+ $form->{image},
+ $form->{drawing},
+ $form->{shop} ? 't' : 'f',
+ conv_i($form->{ve}),
+ conv_i($form->{gv}),
+ $form->{ean},
+ $form->{not_discountable} ? 't' : 'f',
+ $form->{microfiche},
+ conv_i($partsgroup_id),
+ conv_i($form->{id})
+ );
+ do_query($form, $dbh, $query, @values);
# delete translation records
- $query = qq|DELETE FROM translation
- WHERE parts_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, qq|DELETE FROM translation WHERE parts_id = ?|, conv_i($form->{id}));
if ($form->{language_values} ne "") {
- split /---\+\+\+---/,$form->{language_values};
- foreach $item (@_) {
- my ($language_id, $translation, $longdescription) = split /--\+\+--/, $item;
+ foreach $item (split(/---\+\+\+---/, $form->{language_values})) {
+ my ($language_id, $translation, $longdescription) = split(/--\+\+--/, $item);
if ($translation ne "") {
- $query = qq|INSERT into translation (parts_id, language_id, translation, longdescription) VALUES
- ($form->{id}, $language_id, | . $dbh->quote($translation) . qq|, | . $dbh->quote($longdescription) . qq| )|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|INSERT into translation (parts_id, language_id, translation, longdescription)
+ VALUES ( ?, ?, ?, ? )|;
+ @values = (conv_i($form->{id}), conv_i($language_id), $translation, $longdescription);
+ do_query($form, $dbh, $query, @values);
}
}
}
+
# delete price records
- $query = qq|DELETE FROM prices
- WHERE parts_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, qq|DELETE FROM prices WHERE parts_id = ?|, conv_i($form->{id}));
+
# insert price records only if different to sellprice
for my $i (1 .. $form->{price_rows}) {
if ($form->{"price_$i"} eq "0") {
|| $form->{"pricegroup_id_$i"})
and $form->{"price_$i"} != $form->{sellprice}
) {
- $klass = $form->parse_amount($myconfig, $form->{"klass_$i"});
+ #$klass = $form->parse_amount($myconfig, $form->{"klass_$i"});
$price = $form->parse_amount($myconfig, $form->{"price_$i"});
$pricegroup_id =
$form->parse_amount($myconfig, $form->{"pricegroup_id_$i"});
- $query = qq|INSERT INTO prices (parts_id, pricegroup_id, price)
- VALUES($form->{id},$pricegroup_id,$price)|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|INSERT INTO prices (parts_id, pricegroup_id, price) | .
+ qq|VALUES(?, ?, ?)|;
+ @values = (conv_i($form->{id}), conv_i($pricegroup_id), $price);
+ do_query($form, $dbh, $query, @values);
}
}
if (($form->{"make_$i"}) || ($form->{"model_$i"})) {
map { $form->{"${_}_$i"} =~ s/\'/\'\'/g } qw(make model);
- $query = qq|INSERT INTO makemodel (parts_id, make, model)
- VALUES ($form->{id},
- '$form->{"make_$i"}', '$form->{"model_$i"}')|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|INSERT INTO makemodel (parts_id, make, model) | .
+ qq|VALUES (?, ?, ?)|;
+ @values = (conv_i($form->{id}), $form->{"make_$i"}, $form->{"model_$i"});
+ do_query($form, $dbh, $query, @values);
}
}
}
# insert taxes
- foreach $item (split / /, $form->{taxaccounts}) {
+ foreach $item (split(/ /, $form->{taxaccounts})) {
if ($form->{"IC_tax_$item"}) {
- $query = qq|INSERT INTO partstax (parts_id, chart_id)
- VALUES ($form->{id},
- (SELECT c.id
- FROM chart c
- WHERE c.accno = '$item'))|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|INSERT INTO partstax (parts_id, chart_id)
+ VALUES (?, (SELECT id FROM chart WHERE accno = ?))|;
+ @values = (conv_i($form->{id}), $item);
+ do_query($form, $dbh, $query, @values);
}
}
if ($form->{"qty_$i"} != 0) {
$form->{"bom_$i"} *= 1;
- $query = qq|INSERT INTO assembly (id, parts_id, qty, bom)
- VALUES ($form->{id}, $form->{"id_$i"},
- $form->{"qty_$i"}, '$form->{"bom_$i"}')|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|INSERT INTO assembly (id, parts_id, qty, bom) | .
+ qq|VALUES (?, ?, ?, ?)|;
+ @values = (conv_i($form->{id}), conv_i($form->{"id_$i"}), conv_i($form->{"qty_$i"}), $form->{"bom_$i"} ? 't' : 'f');
+ do_query($form, $dbh, $query, @values);
}
}
$form->get_employee($dbh);
# add inventory record
- $query = qq|INSERT INTO inventory (warehouse_id, parts_id, qty,
- shippingdate, employee_id) VALUES (
- 0, $form->{id}, $form->{stock}, '$shippingdate',
- $form->{employee_id})|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|INSERT INTO inventory (warehouse_id, parts_id, qty, shippingdate, employee_id)
+ VALUES (0, ?, ?, '$shippingdate', ?)|;
+ @values = (conv_i($form->{id}), $form->{stock}, conv_i($form->{employee_id}));
+ do_query($form, $dbh, $query, @values);
}
# get tax rates and description
$accno_id =
($form->{vc} eq "customer") ? $form->{income_accno} : $vendor_accno;
- $query = qq|SELECT c.accno, c.description, t.rate, t.taxnumber
- FROM chart c, tax t
- WHERE c.id=t.chart_id AND t.taxkey in (SELECT taxkey_id from chart where accno = '$accno_id')
- ORDER BY c.accno|;
- $stw = $dbh->prepare($query);
-
- $stw->execute || $form->dberror($query);
+ $query =
+ qq|SELECT c.accno, c.description, t.rate, t.taxnumber
+ FROM chart c, tax t
+ WHERE (c.id = t.chart_id) AND (t.taxkey IN (SELECT taxkey_id FROM chart where accno = ?))
+ ORDER BY c.accno|;
+ $stw = prepare_execute_query($form, $dbh, $query, $accno_id);
$form->{taxaccount} = "";
while ($ptr = $stw->fetchrow_hashref(NAME_lc)) {
-
- # if ($customertax{$ref->{accno}}) {
$form->{taxaccount} .= "$ptr->{accno} ";
if (!($form->{taxaccount2} =~ /$ptr->{accno}/)) {
$form->{"$ptr->{accno}_rate"} = $ptr->{rate};
$form->{"$ptr->{accno}_taxnumber"} = $ptr->{taxnumber};
$form->{taxaccount2} .= " $ptr->{accno} ";
}
-
}
# commit
my ($dbh, $form, $id, $qty, $sellprice, $weight) = @_;
- my $query = qq|SELECT a.id, a.qty
- FROM assembly a
- WHERE a.parts_id = $id|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $query = qq|SELECT id, qty FROM assembly WHERE parts_id = ?|;
+ my $sth = prepare_execute_query($form, $dbh, $query, conv_i($id));
while (my ($pid, $aqty) = $sth->fetchrow_array) {
&update_assembly($dbh, $form, $pid, $aqty * $qty, $sellprice, $weight);
}
$sth->finish;
- $query = qq|UPDATE parts
- SET sellprice = sellprice +
- $qty * ($form->{sellprice} - $sellprice),
- weight = weight +
- $qty * ($form->{weight} - $weight)
- WHERE id = $id|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|UPDATE parts SET sellprice = sellprice + ?, weight = weight + ?
+ WHERE id = ?|;
+ @values = ($qty * ($form->{sellprice} - $sellprice),
+ $qty * ($form->{weight} - $weight), conv_i($id));
+ do_query($form, $dbh, $query, @values);
$main::lxdebug->leave_sub();
}
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $where = '1 = 1';
+ my $where = qq|NOT p.obsolete|;
+ my @values;
if ($form->{partnumber}) {
- my $partnumber = $form->like(lc $form->{partnumber});
- $where .= " AND lower(p.partnumber) LIKE '$partnumber'";
+ $where .= qq| AND (p.partnumber ILIKE ?)|;
+ push(@values, '%' . $form->{partnumber} . '%');
}
if ($form->{description}) {
- my $description = $form->like(lc $form->{description});
- $where .= " AND lower(p.description) LIKE '$description'";
+ $where .= qq| AND (p.description ILIKE ?)|;
+ push(@values, '%' . $form->{description} . '%');
}
- $where .= " AND NOT p.obsolete = '1'";
# retrieve assembly items
- my $query = qq|SELECT p.id, p.partnumber, p.description,
- p.bin, p.onhand, p.rop,
- (SELECT sum(p2.inventory_accno_id)
- FROM parts p2, assembly a
- WHERE p2.id = a.parts_id
- AND a.id = p.id) AS inventory
- FROM parts p
- WHERE $where
- AND assembly = '1'|;
-
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $query =
+ qq|SELECT p.id, p.partnumber, p.description,
+ p.bin, p.onhand, p.rop,
+ (SELECT sum(p2.inventory_accno_id)
+ FROM parts p2, assembly a
+ WHERE (p2.id = a.parts_id) AND (a.id = p.id)) AS inventory
+ FROM parts p
+ WHERE NOT p.obsolete AND p.assembly $where|;
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{assembly_items} }, $ref if $ref->{inventory};
- }
- $sth->finish;
+ $form->{assembly_items} = selectall_hashref_query($form, $dbh, $query, @values);
$dbh->disconnect;
my ($dbh, $form, $id, $qty) = @_;
- my $query = qq|SELECT p.id, p.inventory_accno_id, p.assembly, a.qty
- FROM parts p, assembly a
- WHERE a.parts_id = p.id
- AND a.id = $id|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $query =
+ qq|SELECT p.id, p.inventory_accno_id, p.assembly, a.qty
+ FROM parts p, assembly a
+ WHERE (a.parts_id = p.id) AND (a.id = ?)|;
+ my $sth = prepare_execute_query($form, $dbh, $query, conv_i($id));
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
$sth->finish;
# update assembly
- my $rc = $form->update_balance($dbh, "parts", "onhand", qq|id = $id|, $qty);
+ my $rc = $form->update_balance($dbh, "parts", "onhand", qq|id = ?|, $qty, $id);
$main::lxdebug->leave_sub();
$main::lxdebug->enter_sub();
my ($self, $myconfig, $form) = @_;
-
+ my @values = (conv_i($form->{id}));
# connect to database, turn off AutoCommit
my $dbh = $form->dbconnect_noauto($myconfig);
- # first delete prices of pricegroup
- my $query = qq|DELETE FROM prices
- WHERE parts_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
-
- my $query = qq|DELETE FROM parts
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ my %columns = ( "assembly" => "id", "alternate" => "id", "parts" => "id" );
- $query = qq|DELETE FROM partstax
- WHERE parts_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
-
- # check if it is a part, assembly or service
- if ($form->{item} ne 'service') {
- $query = qq|DELETE FROM makemodel
- WHERE parts_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
- }
-
- if ($form->{item} eq 'assembly') {
-
- # delete inventory
- $query = qq|DELETE FROM inventory
- WHERE parts_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
-
- $query = qq|DELETE FROM assembly
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
- }
-
- if ($form->{item} eq 'alternate') {
- $query = qq|DELETE FROM alternate
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ for my $table (qw(prices partstax makemodel inventory assembly parts)) {
+ my $column = defined($columns{$table}) ? $columns{$table} : "parts_id";
+ do_query($form, $dbh, qq|DELETE FROM $table WHERE $column = ?|, @values);
}
# commit
my $i = $form->{assembly_rows};
my $var;
- my $where = "1 = 1";
+ my $where = qq|1 = 1|;
+ my @values;
- if ($form->{"partnumber_$i"}) {
- $var = $form->like(lc $form->{"partnumber_$i"});
- $where .= " AND lower(p.partnumber) LIKE '$var'";
- }
- if ($form->{"description_$i"}) {
- $var = $form->like(lc $form->{"description_$i"});
- $where .= " AND lower(p.description) LIKE '$var'";
- }
- if ($form->{"partsgroup_$i"}) {
- $var = $form->like(lc $form->{"partsgroup_$i"});
- $where .= " AND lower(pg.partsgroup) LIKE '$var'";
+ my %columns = ("partnumber" => "p", "description" => "p", "partsgroup" => "pg");
+
+ while (my ($column, $table) = each(%columns)) {
+ next unless ($form->{"${column}_$i"});
+ $where .= qq| AND ${table}.${column} ILIKE ?|;
+ push(@values, '%' . $form->{"${column}_$i"} . '%');
}
if ($form->{id}) {
- $where .= " AND NOT p.id = $form->{id}";
+ $where .= qq| AND NOT (p.id = ?)|;
+ push(@values, conv_i($form->{id}));
}
if ($partnumber) {
- $where .= " ORDER BY p.partnumber";
+ $where .= qq| ORDER BY p.partnumber|;
} else {
- $where .= " ORDER BY p.description";
+ $where .= qq| ORDER BY p.description|;
}
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT p.id, p.partnumber, p.description, p.sellprice,
- p.weight, p.onhand, p.unit,
- pg.partsgroup
- FROM parts p
- LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
- WHERE $where|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{item_list} }, $ref;
- }
+ my $query =
+ qq|SELECT p.id, p.partnumber, p.description, p.sellprice, p.weight, p.onhand, p.unit, pg.partsgroup
+ FROM parts p
+ LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
+ WHERE $where|;
+ $form->{item_list} = selectall_hashref_query($form, $dbh, $query, @values);
- $sth->finish;
$dbh->disconnect;
$main::lxdebug->leave_sub();
}
+#
+# Report for Wares.
+# Warning, deep magic ahead.
+# This function gets all parts from the database according to the filters specified
+#
+# filter strings:
+# partnumber ean description partsgroup serialnumber make model drawing microfiche
+# transdatefrom transdateto sort
+#
+# exclusives:
+# itemstatus = active | onhand | short | obsolete | orphaned
+# searchitems = part | assembly | service
+#
+# column flags:
+# l_partnumber l_description l_listprice l_sellprice l_lastcost l_priceupdate l_weight l_unit l_bin l_rop l_image l_drawing l_microfiche l_partsgroup
+#
+# binary flags:
+# bought sold onorder ordered rfq quoted onhand short
+# l_serialnumber l_linetotal l_subtotal l_soldtotal l_deliverydate
+# revers top100
+#
sub all_parts {
$main::lxdebug->enter_sub();
my ($self, $myconfig, $form) = @_;
- my $where = '1 = 1';
- my $var;
+ my $where = qq|1 = 1|;
+ my (@values, $var, $flds, $group, $limit);
- my $group;
- my $limit;
-
- foreach my $item (qw(partnumber drawing microfiche)) {
- if ($form->{$item}) {
- $var = $form->like(lc $form->{$item});
- $where .= " AND lower(p.$item) LIKE '$var'";
+ foreach my $item (qw(partnumber drawing microfiche ean pg.partsgroup)) {
+ my $column = $item;
+ $column =~ s/.*\.//; # get rid of table prefixes
+ if ($form->{$column}) {
+ $where .= qq| AND ($item ILIKE ?)|;
+ push(@values, "%$form->{$column}%");
}
}
# special case for description
- if ($form->{description}) {
- unless ( $form->{bought}
- || $form->{sold}
- || $form->{onorder}
- || $form->{ordered}
- || $form->{rfq}
- || $form->{quoted}) {
- $var = $form->like(lc $form->{description});
- $where .= " AND lower(p.description) LIKE '$var'";
- }
+ if ($form->{description}
+ && !( $form->{bought} || $form->{sold} || $form->{onorder}
+ || $form->{ordered} || $form->{rfq} || $form->{quoted})) {
+ $where .= qq| AND (p.description ILIKE ?)|;
+ push(@values, "%$form->{description}%");
}
# special case for serialnumber
- if ($form->{l_serialnumber}) {
- if ($form->{serialnumber}) {
- $var = $form->like(lc $form->{serialnumber});
- $where .= " AND lower(serialnumber) LIKE '$var'";
- }
+ if ($form->{l_serialnumber} && $form->{serialnumber}) {
+ $where .= qq| AND (serialnumber ILIKE ?)|;
+ push(@values, "%$form->{serialnumber}%");
}
if ($form->{searchitems} eq 'part') {
- $where .= " AND p.inventory_accno_id > 0";
+ $where .= qq| AND (p.inventory_accno_id > 0) |;
}
+
if ($form->{searchitems} eq 'assembly') {
$form->{bought} = "";
- $where .= " AND p.assembly = '1'";
+ $where .= qq| AND p.assembly|;
}
- if ($form->{searchitems} eq 'service') {
- $where .= " AND p.inventory_accno_id IS NULL AND NOT p.assembly = '1'";
+ if ($form->{searchitems} eq 'service') {
+ $where .= qq| AND (p.inventory_accno_id IS NULL) AND NOT (p.assembly = '1')|;
# irrelevant for services
- $form->{make} = $form->{model} = "";
+ map { $form->{$_} = '' } qw(make model);
}
# items which were never bought, sold or on an order
if ($form->{itemstatus} eq 'orphaned') {
- $form->{onhand} = $form->{short} = 0;
- $form->{bought} = $form->{sold} = 0;
- $form->{onorder} = $form->{ordered} = 0;
- $form->{rfq} = $form->{quoted} = 0;
-
- $form->{transdatefrom} = $form->{transdateto} = "";
+ map { $form->{$_} = 0 } qw(onhand short bought sold onorder ordered rfq quoted);
+ map { $form->{$_} = '' } qw(transdatefrom transdateto);
- $where .= " AND p.onhand = 0
- AND p.id NOT IN (SELECT p.id FROM parts p, invoice i
- WHERE p.id = i.parts_id)
- AND p.id NOT IN (SELECT p.id FROM parts p, assembly a
- WHERE p.id = a.parts_id)
- AND p.id NOT IN (SELECT p.id FROM parts p, orderitems o
- WHERE p.id = o.parts_id)";
+ $where .=
+ qq| AND (p.onhand = 0)
+ AND p.id NOT IN
+ (
+ SELECT DISTINCT parts_id FROM invoice
+ UNION
+ SELECT DISTINCT parts_id FROM assembly
+ UNION
+ SELECT DISTINCT parts_id FROM orderitems
+ )|;
}
- if ($form->{itemstatus} eq 'active') {
- $where .= " AND p.obsolete = '0'";
- }
- if ($form->{itemstatus} eq 'obsolete') {
- $where .= " AND p.obsolete = '1'";
- $form->{onhand} = $form->{short} = 0;
- }
- if ($form->{itemstatus} eq 'onhand') {
- $where .= " AND p.onhand > 0";
- }
- if ($form->{itemstatus} eq 'short') {
- $where .= " AND p.onhand < p.rop";
- }
- if ($form->{make}) {
- $var = $form->like(lc $form->{make});
- $where .= " AND p.id IN (SELECT DISTINCT ON (m.parts_id) m.parts_id
- FROM makemodel m WHERE lower(m.make) LIKE '$var')";
- }
- if ($form->{model}) {
- $var = $form->like(lc $form->{model});
- $where .= " AND p.id IN (SELECT DISTINCT ON (m.parts_id) m.parts_id
- FROM makemodel m WHERE lower(m.model) LIKE '$var')";
+ my %status2condition = (
+ active => " AND (p.obsolete = '0')",
+ obsolete => " AND (p.obsolete = '1')",
+ onhand => " AND (p.onhand > 0)",
+ short => " AND (p.onhand < p.rop)",
+ );
+ $where .= $status2condition{$form->{itemstatus}};
+
+ $form->{onhand} = $form->{short} = 0 if ($form->{itemstatus} eq 'obsolete');
+
+ my @subcolumns;
+ foreach my $column (qw(make model)) {
+ push @subcolumns, $column if $form->{$column};
}
- if ($form->{partsgroup}) {
- $var = $form->like(lc $form->{partsgroup});
- $where .= " AND lower(pg.partsgroup) LIKE '$var'";
+ if (@subcolumns) {
+ $where .= qq| AND p.id IN (SELECT DISTINCT parts_id FROM makemodel WHERE | . (join " AND ", map { "($_ ILIKE ?)"; } @subcolumns) . ")";
+ push @values, map { '%' . $form->{$_} . '%' } @subcolumns;
}
+
if ($form->{l_soldtotal}) {
- $where .= " AND p.id=i.parts_id AND i.qty >= 0";
- $group =
- " GROUP BY p.id,p.partnumber,p.description,p.onhand,p.unit,p.bin, p.sellprice,p.listprice,p.lastcost,p.priceupdate,pg.partsgroup";
- }
- if ($form->{top100}) {
- $limit = " LIMIT 100";
+ $where .= qq| AND (p.id = i.parts_id) AND (i.qty >= 0)|;
+ $group = qq| GROUP BY p.id, p.partnumber, p.description, p.onhand, p.unit, p.bin, p.sellprice, p.listprice, p.lastcost, p.priceupdate, pg.partsgroup|;
}
- # tables revers?
- if ($form->{revers} == 1) {
- $form->{desc} = " DESC";
- } else {
- $form->{desc} = "";
- }
+ $limit = qq| LIMIT 100| if ($form->{top100});
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $sortorder = $form->{sort};
- $sortorder .= $form->{desc};
- $sortorder = $form->{sort} if $form->{sort};
+ my @sort_cols = qw(id partnumber description partsgroup bin priceupdate onhand
+ invnumber ordnumber quonumber name drawing microfiche
+ serialnumber soldtotal deliverydate);
+
+ my $sortorder = "partnumber";
+ $sortorder = $form->{sort} if ($form->{sort} && grep({ $_ eq $form->{sort} } @sort_cols));
+ $sortorder .= " DESC" if ($form->{revers});
my $query = "";
if ($form->{l_soldtotal}) {
$form->{soldtotal} = 'soldtotal';
$query =
- qq|SELECT p.id,p.partnumber,p.description,p.onhand,p.unit,p.bin,p.sellprice,p.listprice,
- p.lastcost,p.priceupdate,pg.partsgroup,sum(i.qty) as soldtotal FROM parts
- p LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id), invoice i
- WHERE $where
- $group
- ORDER BY $sortorder
- $limit|;
+ qq|SELECT p.id, p.partnumber, p.description, p.onhand, p.unit,
+ p.bin, p.sellprice, p.listprice, p.lastcost,
+ p.priceupdate, pg.partsgroup,sum(i.qty) AS soldtotal
+ FROM parts p
+ LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id), invoice i
+ WHERE $where
+ $group
+ ORDER BY $sortorder $limit|;
} else {
- $query = qq|SELECT p.id, p.partnumber, p.description, p.onhand, p.unit,
- p.bin, p.sellprice, p.listprice, p.lastcost, p.rop, p.weight,
- p.priceupdate, p.image, p.drawing, p.microfiche,
- pg.partsgroup
- FROM parts p
- LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
- WHERE $where
- $group
- ORDER BY $sortorder|;
+ $query =
+ qq|SELECT p.id, p.partnumber, p.description, p.onhand, p.unit,
+ p.bin, p.sellprice, p.listprice, p.lastcost, p.rop, p.weight,
+ p.priceupdate, p.image, p.drawing, p.microfiche,
+ pg.partsgroup
+ FROM parts p
+ LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
+ WHERE $where
+ $group
+ ORDER BY $sortorder $limit|;
}
+ my @all_values = @values;
+
# rebuild query for bought and sold items
if ( $form->{bought}
|| $form->{sold}
|| $form->{ordered}
|| $form->{rfq}
|| $form->{quoted}) {
-
- my @a = qw(partnumber description bin priceupdate name);
-
- push @a, qw(invnumber serialnumber) if ($form->{bought} || $form->{sold});
- push @a, "ordnumber" if ($form->{onorder} || $form->{ordered});
- push @a, "quonumber" if ($form->{rfq} || $form->{quoted});
-
my $union = "";
$query = "";
+ @all_values = ();
if ($form->{bought} || $form->{sold}) {
+ my @invvalues = @values;
my $invwhere = "$where";
- $invwhere .= " AND i.assemblyitem = '0'";
- $invwhere .= " AND a.transdate >= '$form->{transdatefrom}'"
- if $form->{transdatefrom};
- $invwhere .= " AND a.transdate <= '$form->{transdateto}'"
- if $form->{transdateto};
+ $invwhere .= qq| AND i.assemblyitem = '0'|;
+
+ if ($form->{transdatefrom}) {
+ $invwhere .= qq| AND a.transdate >= ?|;
+ push(@invvalues, $form->{transdatefrom});
+ }
+
+ if ($form->{transdateto}) {
+ $invwhere .= qq| AND a.transdate <= ?|;
+ push(@invvalues, $form->{transdateto});
+ }
if ($form->{description}) {
- $var = $form->like(lc $form->{description});
- $invwhere .= " AND lower(i.description) LIKE '$var'";
+ $invwhere .= qq| AND i.description ILIKE ?|;
+ push(@invvalues, '%' . $form->{description} . '%');
}
- my $flds = qq|p.id, p.partnumber, i.description, i.serialnumber,
- i.qty AS onhand, i.unit, p.bin, i.sellprice,
- p.listprice, p.lastcost, p.rop, p.weight,
- p.priceupdate, p.image, p.drawing, p.microfiche,
- pg.partsgroup,
- a.invnumber, a.ordnumber, a.quonumber, i.trans_id,
- ct.name, i.deliverydate|;
+ $flds =
+ qq|p.id, p.partnumber, i.description, i.serialnumber,
+ i.qty AS onhand, i.unit, p.bin, i.sellprice,
+ p.listprice, p.lastcost, p.rop, p.weight,
+ p.priceupdate, p.image, p.drawing, p.microfiche,
+ pg.partsgroup,
+ a.invnumber, a.ordnumber, a.quonumber, i.trans_id,
+ ct.name, i.deliverydate|;
if ($form->{bought}) {
- $query = qq|
- SELECT $flds, 'ir' AS module, '' AS type,
- 1 AS exchangerate
- FROM invoice i
- JOIN parts p ON (p.id = i.parts_id)
- JOIN ap a ON (a.id = i.trans_id)
- JOIN vendor ct ON (a.vendor_id = ct.id)
- LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
- WHERE $invwhere|;
- $union = "
- UNION";
+ $query =
+ qq|SELECT $flds, 'ir' AS module, '' AS type, 1 AS exchangerate
+ FROM invoice i
+ JOIN parts p ON (p.id = i.parts_id)
+ JOIN ap a ON (a.id = i.trans_id)
+ JOIN vendor ct ON (a.vendor_id = ct.id)
+ LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
+ WHERE $invwhere|;
+
+ $union = qq| UNION |;
+
+ push(@all_values, @invvalues);
}
if ($form->{sold}) {
- $query .= qq|$union
- SELECT $flds, 'is' AS module, '' AS type,
- 1 As exchangerate
- FROM invoice i
- JOIN parts p ON (p.id = i.parts_id)
- JOIN ar a ON (a.id = i.trans_id)
- JOIN customer ct ON (a.customer_id = ct.id)
- LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
- WHERE $invwhere|;
- $union = "
- UNION";
+ $query .=
+ qq|$union
+
+ SELECT $flds, 'is' AS module, '' AS type, 1 As exchangerate
+ FROM invoice i
+ JOIN parts p ON (p.id = i.parts_id)
+ JOIN ar a ON (a.id = i.trans_id)
+ JOIN customer ct ON (a.customer_id = ct.id)
+ LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
+ WHERE $invwhere|;
+ $union = qq| UNION |;
+
+ push(@all_values, @invvalues);
}
}
if ($form->{onorder} || $form->{ordered}) {
- my $ordwhere = "$where
- AND o.quotation = '0'";
- $ordwhere .= " AND o.transdate >= '$form->{transdatefrom}'"
- if $form->{transdatefrom};
- $ordwhere .= " AND o.transdate <= '$form->{transdateto}'"
- if $form->{transdateto};
+ my @ordvalues = @values;
+ my $ordwhere = $where . qq| AND o.quotation = '0'|;
- if ($form->{description}) {
- $var = $form->like(lc $form->{description});
- $ordwhere .= " AND lower(oi.description) LIKE '$var'";
+ if ($form->{transdatefrom}) {
+ $ordwhere .= qq| AND o.transdate >= ?|;
+ push(@ordvalues, $form->{transdatefrom});
}
- $flds =
- qq|p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber,
- oi.qty AS onhand, oi.unit, p.bin, oi.sellprice,
- p.listprice, p.lastcost, p.rop, p.weight,
- p.priceupdate, p.image, p.drawing, p.microfiche,
- pg.partsgroup,
- '' AS invnumber, o.ordnumber, o.quonumber, oi.trans_id,
- ct.name|;
+ if ($form->{transdateto}) {
+ $ordwhere .= qq| AND o.transdate <= ?|;
+ push(@ordvalues, $form->{transdateto});
+ }
+
+ if ($form->{description}) {
+ $ordwhere .= qq| AND oi.description ILIKE ?|;
+ push(@ordvalues, '%' . $form->{description} . '%');
+ }
if ($form->{ordered}) {
- $query .= qq|$union
- SELECT $flds, 'oe' AS module, 'sales_order' AS type,
- (SELECT buy FROM exchangerate ex
- WHERE ex.curr = o.curr
- AND ex.transdate = o.transdate) AS exchangerate
- FROM orderitems oi
- JOIN parts p ON (oi.parts_id = p.id)
- JOIN oe o ON (oi.trans_id = o.id)
- JOIN customer ct ON (o.customer_id = ct.id)
- LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
- WHERE $ordwhere
- AND o.customer_id > 0|;
- $union = "
- UNION";
+ $query .=
+ qq|$union
+
+ SELECT p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber,
+ oi.qty AS onhand, oi.unit, p.bin, oi.sellprice,
+ p.listprice, p.lastcost, p.rop, p.weight,
+ p.priceupdate, p.image, p.drawing, p.microfiche,
+ pg.partsgroup,
+ '' AS invnumber, o.ordnumber, o.quonumber, oi.trans_id,
+ ct.name, NULL AS deliverydate,
+ 'oe' AS module, 'sales_order' AS type,
+ (SELECT buy FROM exchangerate ex
+ WHERE ex.curr = o.curr AND ex.transdate = o.transdate) AS exchangerate
+ FROM orderitems oi
+ JOIN parts p ON (oi.parts_id = p.id)
+ JOIN oe o ON (oi.trans_id = o.id)
+ JOIN customer ct ON (o.customer_id = ct.id)
+ LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
+ WHERE $ordwhere AND (o.customer_id > 0)|;
+ $union = qq| UNION |;
+
+ push(@all_values, @ordvalues);
}
if ($form->{onorder}) {
- $flds =
- qq|p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber,
- oi.qty * -1 AS onhand, oi.unit, p.bin, oi.sellprice,
- p.listprice, p.lastcost, p.rop, p.weight,
- p.priceupdate, p.image, p.drawing, p.microfiche,
- pg.partsgroup,
- '' AS invnumber, o.ordnumber, o.quonumber, oi.trans_id,
- ct.name|;
-
- $query .= qq|$union
- SELECT $flds, 'oe' AS module, 'purchase_order' AS type,
- (SELECT sell FROM exchangerate ex
- WHERE ex.curr = o.curr
- AND ex.transdate = o.transdate) AS exchangerate
- FROM orderitems oi
- JOIN parts p ON (oi.parts_id = p.id)
- JOIN oe o ON (oi.trans_id = o.id)
- JOIN vendor ct ON (o.vendor_id = ct.id)
- LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
- WHERE $ordwhere
- AND o.vendor_id > 0|;
+ $query .=
+ qq|$union
+
+ SELECT p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber,
+ oi.qty * -1 AS onhand, oi.unit, p.bin, oi.sellprice,
+ p.listprice, p.lastcost, p.rop, p.weight,
+ p.priceupdate, p.image, p.drawing, p.microfiche,
+ pg.partsgroup,
+ '' AS invnumber, o.ordnumber, o.quonumber, oi.trans_id,
+ ct.name, NULL AS deliverydate,
+ 'oe' AS module, 'purchase_order' AS type,
+ (SELECT sell FROM exchangerate ex
+ WHERE ex.curr = o.curr AND (ex.transdate = o.transdate)) AS exchangerate
+ FROM orderitems oi
+ JOIN parts p ON (oi.parts_id = p.id)
+ JOIN oe o ON (oi.trans_id = o.id)
+ JOIN vendor ct ON (o.vendor_id = ct.id)
+ LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
+ WHERE $ordwhere AND (o.vendor_id > 0)|;
+ $union = qq| UNION |;
+
+ push(@all_values, @ordvalues);
}
}
if ($form->{rfq} || $form->{quoted}) {
- my $quowhere = "$where
- AND o.quotation = '1'";
- $quowhere .= " AND o.transdate >= '$form->{transdatefrom}'"
- if $form->{transdatefrom};
- $quowhere .= " AND o.transdate <= '$form->{transdateto}'"
- if $form->{transdateto};
+ my $quowhere = $where . qq| AND o.quotation = '1'|;
+ my @quovalues = @values;
- if ($form->{description}) {
- $var = $form->like(lc $form->{description});
- $quowhere .= " AND lower(oi.description) LIKE '$var'";
+ if ($form->{transdatefrom}) {
+ $quowhere .= qq| AND o.transdate >= ?|;
+ push(@quovalues, $form->{transdatefrom});
}
- $flds =
- qq|p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber,
- oi.qty AS onhand, oi.unit, p.bin, oi.sellprice,
- p.listprice, p.lastcost, p.rop, p.weight,
- p.priceupdate, p.image, p.drawing, p.microfiche,
- pg.partsgroup,
- '' AS invnumber, o.ordnumber, o.quonumber, oi.trans_id,
- ct.name|;
+ if ($form->{transdateto}) {
+ $quowhere .= qq| AND o.transdate <= ?|;
+ push(@quovalues, $form->{transdateto});
+ }
+
+ if ($form->{description}) {
+ $quowhere .= qq| AND oi.description ILIKE ?|;
+ push(@quovalues, '%' . $form->{description} . '%');
+ }
if ($form->{quoted}) {
- $query .= qq|$union
- SELECT $flds, 'oe' AS module, 'sales_quotation' AS type,
- (SELECT buy FROM exchangerate ex
- WHERE ex.curr = o.curr
- AND ex.transdate = o.transdate) AS exchangerate
- FROM orderitems oi
- JOIN parts p ON (oi.parts_id = p.id)
- JOIN oe o ON (oi.trans_id = o.id)
- JOIN customer ct ON (o.customer_id = ct.id)
- LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
- WHERE $quowhere
- AND o.customer_id > 0|;
- $union = "
- UNION";
+ $query .=
+ qq|$union
+
+ SELECT
+ p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber,
+ oi.qty AS onhand, oi.unit, p.bin, oi.sellprice,
+ p.listprice, p.lastcost, p.rop, p.weight,
+ p.priceupdate, p.image, p.drawing, p.microfiche,
+ pg.partsgroup,
+ '' AS invnumber, o.ordnumber, o.quonumber, oi.trans_id,
+ ct.name, NULL AS deliverydate, 'oe' AS module, 'sales_quotation' AS type,
+ (SELECT buy FROM exchangerate ex
+ WHERE (ex.curr = o.curr) AND (ex.transdate = o.transdate)) AS exchangerate
+ FROM orderitems oi
+ JOIN parts p ON (oi.parts_id = p.id)
+ JOIN oe o ON (oi.trans_id = o.id)
+ JOIN customer ct ON (o.customer_id = ct.id)
+ LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
+ WHERE $quowhere
+ AND o.customer_id > 0|;
+ $union = qq| UNION |;
+
+ push(@all_values, @quovalues);
}
if ($form->{rfq}) {
- $flds =
- qq|p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber,
- oi.qty * -1 AS onhand, oi.unit, p.bin, oi.sellprice,
- p.listprice, p.lastcost, p.rop, p.weight,
- p.priceupdate, p.image, p.drawing, p.microfiche,
- pg.partsgroup,
- '' AS invnumber, o.ordnumber, o.quonumber, oi.trans_id,
- ct.name|;
-
- $query .= qq|$union
- SELECT $flds, 'oe' AS module, 'request_quotation' AS type,
- (SELECT sell FROM exchangerate ex
- WHERE ex.curr = o.curr
- AND ex.transdate = o.transdate) AS exchangerate
- FROM orderitems oi
- JOIN parts p ON (oi.parts_id = p.id)
- JOIN oe o ON (oi.trans_id = o.id)
- JOIN vendor ct ON (o.vendor_id = ct.id)
- LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
- WHERE $quowhere
- AND o.vendor_id > 0|;
+ $query .=
+ qq|$union
+
+ SELECT p.id, p.partnumber, oi.description, oi.serialnumber AS serialnumber,
+ oi.qty * -1 AS onhand, oi.unit, p.bin, oi.sellprice,
+ p.listprice, p.lastcost, p.rop, p.weight,
+ p.priceupdate, p.image, p.drawing, p.microfiche,
+ pg.partsgroup,
+ '' AS invnumber, o.ordnumber, o.quonumber, oi.trans_id,
+ ct.name, NULL AS deliverydate,
+ 'oe' AS module, 'request_quotation' AS type,
+ (SELECT sell FROM exchangerate ex
+ WHERE (ex.curr = o.curr) AND (ex.transdate = o.transdate)) AS exchangerate
+ FROM orderitems oi
+ JOIN parts p ON (oi.parts_id = p.id)
+ JOIN oe o ON (oi.trans_id = o.id)
+ JOIN vendor ct ON (o.vendor_id = ct.id)
+ LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
+ WHERE $quowhere
+ AND o.vendor_id > 0|;
+
+ push(@all_values, @quovalues);
}
}
- $query .= qq|
- ORDER BY $sortorder|;
+ $query .= qq| ORDER BY | . $sortorder;
}
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{parts} }, $ref;
- }
-
- $sth->finish;
+ $form->{parts} = selectall_hashref_query($form, $dbh, $query, @all_values);
+ my @assemblies;
# include individual items for assemblies
if ($form->{searchitems} eq 'assembly' && $form->{bom}) {
- foreach $item (@{ $form->{parts} }) {
- push @assemblies, $item;
- $query = qq|SELECT p.id, p.partnumber, p.description, a.qty AS onhand,
- p.unit, p.bin,
- p.sellprice, p.listprice, p.lastcost,
- p.rop, p.weight, p.priceupdate,
- p.image, p.drawing, p.microfiche
- FROM parts p, assembly a
- WHERE p.id = a.parts_id
- AND a.id = $item->{id}|;
+ $query =
+ qq|SELECT p.id, p.partnumber, p.description, a.qty AS onhand,
+ p.unit, p.bin,
+ p.sellprice, p.listprice, p.lastcost,
+ p.rop, p.weight, p.priceupdate,
+ p.image, p.drawing, p.microfiche
+ FROM parts p, assembly a
+ WHERE (p.id = a.parts_id) AND (a.id = ?)|;
+ $sth = prepare_query($form, $dbh, $query);
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ foreach $item (@{ $form->{parts} }) {
+ push(@assemblies, $item);
+ do_statement($form, $sth, $query, conv_i($item->{id}));
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
+ while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
$ref->{assemblyitem} = 1;
- push @assemblies, $ref;
+ push(@assemblies, $ref);
}
$sth->finish;
-
- push @assemblies, { id => $item->{id} };
-
}
# copy assemblies to $form->{parts}
- @{ $form->{parts} } = @assemblies;
+ $form->{parts} = \@assemblies;
}
$dbh->disconnect;
$main::lxdebug->enter_sub();
my ($self, $myconfig, $form) = @_;
-
+ my @where_values;
my $where = '1 = 1';
my $var;
my $group;
my $limit;
- foreach my $item (qw(partnumber drawing microfiche make model)) {
- if ($form->{$item}) {
- $var = $form->like(lc $form->{$item});
+ my @where_values;
- # make will build later Bugfix 145
- if ($item ne 'make') {
- $where .= " AND lower(p.$item) LIKE '$var'";
- }
+ if ($item ne 'make') {
+ foreach my $item (qw(partnumber drawing microfiche make model pg.partsgroup)) {
+ my $column = $item;
+ $column =~ s/.*\.//;
+ next unless ($form->{$column});
+ $where .= qq| AND $item ILIKE ?|;
+ push(@where_values, '%' . $form->{$column} . '%');
}
}
# special case for description
- if ($form->{description}) {
- unless ( $form->{bought}
- || $form->{sold}
- || $form->{onorder}
- || $form->{ordered}
- || $form->{rfq}
- || $form->{quoted}) {
- $var = $form->like(lc $form->{description});
- $where .= " AND lower(p.description) LIKE '$var'";
- }
+ if ($form->{description}
+ && !( $form->{bought} || $form->{sold} || $form->{onorder}
+ || $form->{ordered} || $form->{rfq} || $form->{quoted})) {
+ $where .= qq| AND (p.description ILIKE ?)|;
+ push(@where_values, '%' . $form->{description} . '%');
}
# special case for serialnumber
- if ($form->{l_serialnumber}) {
- if ($form->{serialnumber}) {
- $var = $form->like(lc $form->{serialnumber});
- $where .= " AND lower(serialnumber) LIKE '$var'";
- }
+ if ($form->{l_serialnumber} && $form->{serialnumber}) {
+ $where .= qq| AND serialnumber ILIKE ?|;
+ push(@where_values, '%' . $form->{serialnumber} . '%');
}
$form->{transdatefrom} = $form->{transdateto} = "";
- $where .= " AND p.onhand = 0
- AND p.id NOT IN (SELECT p.id FROM parts p, invoice i
- WHERE p.id = i.parts_id)
- AND p.id NOT IN (SELECT p.id FROM parts p, assembly a
- WHERE p.id = a.parts_id)
- AND p.id NOT IN (SELECT p.id FROM parts p, orderitems o
- WHERE p.id = o.parts_id)";
+ $where .=
+ qq| AND (p.onhand = 0)
+ AND p.id NOT IN
+ (
+ SELECT DISTINCT parts_id FROM invoice
+ UNION
+ SELECT DISTINCT parts_id FROM assembly
+ UNION
+ SELECT DISTINCT parts_id FROM orderitems
+ )|;
}
if ($form->{itemstatus} eq 'active') {
- $where .= " AND p.obsolete = '0'";
+ $where .= qq| AND p.obsolete = '0'|;
}
+
if ($form->{itemstatus} eq 'obsolete') {
- $where .= " AND p.obsolete = '1'";
+ $where .= qq| AND p.obsolete = '1'|;
$form->{onhand} = $form->{short} = 0;
}
+
if ($form->{itemstatus} eq 'onhand') {
- $where .= " AND p.onhand > 0";
+ $where .= qq| AND p.onhand > 0|;
}
+
if ($form->{itemstatus} eq 'short') {
- $where .= " AND p.onhand < p.rop";
- }
- if ($form->{make}) {
- $var = $form->like(lc $form->{make});
- $where .= " AND p.id IN (SELECT DISTINCT ON (m.parts_id) m.parts_id
- FROM makemodel m WHERE lower(m.make) LIKE '$var')";
- }
- if ($form->{model}) {
- $var = $form->like(lc $form->{model});
- $where .= " AND p.id IN (SELECT DISTINCT ON (m.parts_id) m.parts_id
- FROM makemodel m WHERE lower(m.model) LIKE '$var')";
- }
- if ($form->{partsgroup}) {
- $var = $form->like(lc $form->{partsgroup});
- $where .= " AND lower(pg.partsgroup) LIKE '$var'";
+ $where .= qq| AND p.onhand < p.rop|;
}
+ foreach my $column (qw(make model)) {
+ next unless ($form->{$colum});
+ $where .= qq| AND p.id IN (SELECT DISTINCT parts_id FROM makemodel WHERE $column ILIKE ?|;
+ push(@where_values, '%' . $form->{$column} . '%');
+ }
# connect to database
my $dbh = $form->dbconnect_noauto($myconfig);
- if ($form->{"sellprice"} ne "") {
- my $update = "";
- my $faktor = $form->parse_amount($myconfig,$form->{"sellprice"});
- if ($form->{"sellprice_type"} eq "percent") {
- my $faktor = $form->parse_amount($myconfig,$form->{"sellprice"})/100 +1;
- $update = "sellprice* $faktor";
- } else {
- $update = "sellprice+$faktor";
- }
-
- $query = qq|UPDATE parts set sellprice=$update WHERE id IN (SELECT p.id
- FROM parts p
- LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
- WHERE $where)|;
- $dbh->do($query);
- }
-
- if ($form->{"listprice"} ne "") {
- my $update = "";
- my $faktor = $form->parse_amount($myconfig,$form->{"listprice"});
- if ($form->{"listprice_type"} eq "percent") {
- my $faktor = $form->parse_amount($myconfig,$form->{"sellprice"})/100 +1;
- $update = "listprice* $faktor";
- } else {
- $update = "listprice+$faktor";
- }
-
- $query = qq|UPDATE parts set listprice=$update WHERE id IN (SELECT p.id
- FROM parts p
- LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
- WHERE $where)|;
-
- $dbh->do($query);
- }
+ for my $column (qw(sellprice listprice)) {
+ next if ($form->{$column} eq "");
+ my $value = $form->parse_amount($myconfig, $form->{$column});
+ my $operator = '+';
+ if ($form->{"${column}_type"} eq "percent") {
+ $value = ($value / 100) + 1;
+ $operator = '*';
+ }
+ $query =
+ qq|UPDATE parts SET $column = $column $operator ?
+ WHERE id IN
+ (SELECT p.id
+ FROM parts p
+ LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
+ WHERE $where)|;
+ do_query($from, $dbh, $query, $value, @where_values);
+ }
+
+ my $q_add =
+ qq|UPDATE prices SET price = price + ?
+ WHERE parts_id IN
+ (SELECT p.id
+ FROM parts p
+ LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
+ WHERE $where) AND (pricegroup_id = ?)|;
+ my $sth_add = prepare_query($form, $dbh, $q_add);
+
+ my $q_multiply =
+ qq|UPDATE prices SET price = price * ?
+ WHERE parts_id IN
+ (SELECT p.id
+ FROM parts p
+ LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
+ WHERE $where) AND (pricegroup_id = ?)|;
+ my $sth_multiply = prepare_query($form, $dbh, $q_multiply);
for my $i (1 .. $form->{price_rows}) {
+ next if ($form->{"price_$i"} eq "");
- my $query = "";
-
-
- if ($form->{"price_$i"} ne "") {
- my $update = "";
- my $faktor = $form->parse_amount($myconfig,$form->{"price_$i"});
- if ($form->{"pricegroup_type_$i"} eq "percent") {
- my $faktor = $form->parse_amount($myconfig,$form->{"sellprice"})/100 +1;
- $update = "price* $faktor";
- } else {
- $update = "price+$faktor";
- }
-
- $query = qq|UPDATE prices set price=$update WHERE parts_id IN (SELECT p.id
- FROM parts p
- LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
- WHERE $where) AND pricegroup_id=$form->{"pricegroup_id_$i"}|;
-
- $dbh->do($query);
+ my $value = $form->parse_amount($myconfig, $form->{"price_$i"});
+
+ if ($form->{"pricegroup_type_$i"} eq "percent") {
+ do_statement($form, $sth_multiply, $q_multiply, ($value / 100) + 1, @where_values, conv_i($form->{"pricegroup_id_$i"}));
+ } else {
+ do_statement($form, $sth_add, $q_add, $value, @where_values, conv_i($form->{"pricegroup_id_$i"}));
}
}
-
+ $sth_add->finish();
+ $sth_multiply->finish();
my $rc= $dbh->commit;
$dbh->disconnect;
+
$main::lxdebug->leave_sub();
return $rc;
# connect to database
my $dbh = $form->dbconnect($myconfig);
+ my @values = ('%' . $module . '%');
+
if ($form->{id}) {
- $query = qq|SELECT c.accno, c.description, c.link, c.id,
- p.inventory_accno_id, p.income_accno_id, p.expense_accno_id
- FROM chart c, parts p
- WHERE c.link LIKE '%$module%'
- AND p.id = $form->{id}
- ORDER BY c.accno|;
+ $query =
+ qq|SELECT c.accno, c.description, c.link, c.id,
+ p.inventory_accno_id, p.income_accno_id, p.expense_accno_id
+ FROM chart c, parts p
+ WHERE (c.link LIKE ?) AND (p.id = ?)
+ ORDER BY c.accno|;
+ push(@values, conv_i($form->{id}));
+
} else {
- $query = qq|SELECT c.accno, c.description, c.link, c.id,
- d.inventory_accno_id, d.income_accno_id, d.expense_accno_id
- FROM chart c, defaults d
- WHERE c.link LIKE '%$module%'
- ORDER BY c.accno|;
+ $query =
+ qq|SELECT c.accno, c.description, c.link, c.id,
+ d.inventory_accno_id, d.income_accno_id, d.expense_accno_id
+ FROM chart c, defaults d
+ WHERE c.link LIKE ?
+ ORDER BY c.accno|;
}
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $sth = prepare_execute_query($form, $dbh, $query, @values);
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- foreach my $key (split /:/, $ref->{link}) {
+ foreach my $key (split(/:/, $ref->{link})) {
if ($key =~ /$module/) {
if ( ($ref->{id} eq $ref->{inventory_accno_id})
|| ($ref->{id} eq $ref->{income_accno_id})
$sth->finish;
# get buchungsgruppen
- $query = qq|SELECT id, description
- FROM buchungsgruppen|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- $form->{BUCHUNGSGRUPPEN} = [];
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{BUCHUNGSGRUPPEN} }, $ref;
- }
- $sth->finish;
+ $form->{BUCHUNGSGRUPPEN} = selectall_hashref_query($form, $dbh, qq|SELECT id, description FROM buchungsgruppen|);
# get payment terms
- $query = qq|SELECT id, description
- FROM payment_terms
- ORDER BY 1|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $self->{payment_terms} }, $ref;
- }
- $sth->finish;
+ $form->{payment_terms} = selectall_hashref_query($form, $dbh, qq|SELECT id, description FROM payment_terms ORDER BY sortkey|);
if (!$form->{id}) {
- $query = qq|SELECT current_date FROM defaults|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($form->{priceupdate}) = $sth->fetchrow_array;
- $sth->finish;
+ ($form->{priceupdate}) = selectrow_query($form, $dbh, qq|SELECT current_date|);
}
$dbh->disconnect;
my ($self, $myconfig, $form, $sortorder) = @_;
my $dbh = $form->dbconnect($myconfig);
- my $order = " p.partnumber";
- my $where = "1 = 1";
+ my $order = qq| p.partnumber|;
+ my $where = qq|1 = 1|;
+ my @values;
if ($sortorder eq "all") {
- $where .= " AND p.partnumber LIKE '%$form->{partnumber}%'";
- $where .= " AND p.description LIKE '%$form->{description}%'";
- } else {
- if ($sortorder eq "partnumber") {
- $where .= " AND p.partnumber LIKE '%$form->{partnumber}%'";
- $order = qq|p.$sortorder|;
- }
- if ($sortorder eq "description") {
- $where .= " AND p.description LIKE '%$form->{description}%'";
- }
+ $where .= qq| AND (partnumber ILIKE ?) AND (description ILIKE ?)|;
+ push(@values, '%' . $form->{partnumber} . '%', '%' . $form->{description} . '%');
+
+ } elsif ($sortorder eq "partnumber") {
+ $where .= qq| AND (partnumber ILIKE ?)|;
+ push(@values, '%' . $form->{partnumber} . '%');
+
+ } elsif ($sortorder eq "description") {
+ $where .= qq| AND (description ILIKE ?)|;
+ push(@values, '%' . $form->{description} . '%');
+ $order = "description";
+
}
my $query =
- qq|SELECT p.id, p.partnumber, p.description, p.unit, p.sellprice FROM parts p WHERE $where ORDER BY $order|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
+ qq|SELECT id, partnumber, description, unit, sellprice
+ FROM parts
+ WHERE $where ORDER BY $order|;
+
+ my $sth = prepare_execute_query($form, $dbh, $query, @values);
+
my $j = 0;
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
if (($ref->{partnumber} eq "*") && ($ref->{description} eq "")) {
- } else {
- $j++;
- $form->{"id_$j"} = $ref->{id};
- $form->{"partnumber_$j"} = $ref->{partnumber};
- $form->{"description_$j"} = $ref->{description};
- $form->{"unit_$j"} = $ref->{unit};
- $form->{"sellprice_$j"} = $ref->{sellprice};
- $form->{"soldtotal_$j"} = get_soldtotal($dbh, $ref->{id});
- } #fi
+ next;
+ }
+
+ $j++;
+ $form->{"id_$j"} = $ref->{id};
+ $form->{"partnumber_$j"} = $ref->{partnumber};
+ $form->{"description_$j"} = $ref->{description};
+ $form->{"unit_$j"} = $ref->{unit};
+ $form->{"sellprice_$j"} = $ref->{sellprice};
+ $form->{"soldtotal_$j"} = get_soldtotal($dbh, $ref->{id});
} #while
$form->{rows} = $j;
$sth->finish;
my ($dbh, $id) = @_;
- my $query =
- qq|SELECT sum(i.qty) as totalsold FROM invoice i WHERE i.parts_id = $id|;
-
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my $sum = 0;
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
-
- $sum = $ref->{totalsold};
- } #while
- $sth->finish;
-
- if ($sum eq undef) {
- $sum = 0;
- } #fi
+ my $query = qq|SELECT sum(qty) FROM invoice WHERE parts_id = ?|;
+ my ($sum) = selectrow_query($form, $dbh, $query, conv_i($id));
+ $sum ||= 0;
$main::lxdebug->leave_sub();
return $sum;
} #end get_soldtotal
-sub retrieve_item {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
- my $i = $form->{rowcount};
- my $where = "NOT p.obsolete = '1'";
-
- if ($form->{"partnumber_$i"}) {
- my $partnumber = $form->like(lc $form->{"partnumber_$i"});
- $where .= " AND lower(p.partnumber) LIKE '$partnumber'";
- }
- if ($form->{"description_$i"}) {
- my $description = $form->like(lc $form->{"description_$i"});
- $where .= " AND lower(p.description) LIKE '$description'";
- }
-
- if ($form->{"partsgroup_$i"}) {
- my $partsgroup = $form->like(lc $form->{"partsgroup_$i"});
- $where .= " AND lower(pg.partsgroup) LIKE '$partsgroup'";
- }
-
- if ($form->{"description_$i"}) {
- $where .= " ORDER BY description";
- } else {
- $where .= " ORDER BY partnumber";
- }
-
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
-
- my $query = qq|SELECT p.id, p.partnumber, p.description, p.sellprice,
- p.listprice,
- c1.accno AS inventory_accno,
- c2.accno AS income_accno,
- c3.accno AS expense_accno,
- p.unit, p.assembly, p.bin, p.onhand, p.notes AS partnotes,
- pg.partsgroup
- FROM parts p
- LEFT JOIN chart c1 ON (p.inventory_accno_id = c1.id)
- LEFT JOIN chart c2 ON (p.income_accno_id = c2.id)
- LEFT JOIN chart c3 ON (p.expense_accno_id = c3.id)
- LEFT JOIN partsgroup pg ON (pg.id = p.partsgroup_id)
- WHERE $where|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- #while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
-
- # get tax rates and description
- #$accno_id = ($form->{vc} eq "customer") ? $ref->{income_accno} : $ref->{inventory_accno};
- #$query = qq|SELECT c.accno, c.description, t.rate, t.taxnumber
- # FROM chart c, tax t
- # WHERE c.id=t.chart_id AND t.taxkey in (SELECT taxkey_id from chart where accno = '$accno_id')
- # ORDER BY accno|;
- # $stw = $dbh->prepare($query);
- #$stw->execute || $form->dberror($query);
-
- #$ref->{taxaccounts} = "";
- #while ($ptr = $stw->fetchrow_hashref(NAME_lc)) {
-
- # $form->{"$ptr->{accno}_rate"} = $ptr->{rate};
- # $form->{"$ptr->{accno}_description"} = $ptr->{description};
- # $form->{"$ptr->{accno}_taxnumber"} = $ptr->{taxnumber};
- # $form->{taxaccounts} .= "$ptr->{accno} ";
- # $ref->{taxaccounts} .= "$ptr->{accno} ";
-
- #}
-
- #$stw->finish;
- #chop $ref->{taxaccounts};
-
- push @{ $form->{item_list} }, $ref;
-
- #}
- $sth->finish;
- $dbh->disconnect;
-
- $main::lxdebug->leave_sub();
-}
-
sub retrieve_languages {
$main::lxdebug->enter_sub();
# connect to database
my $dbh = $form->dbconnect($myconfig);
- if ($form->{id}) {
- $where .= "tr.parts_id=$form->{id}";
- }
-
+ my @values;
+ my $where;
if ($form->{language_values} ne "") {
- $query = qq|SELECT l.id, l.description, tr.translation, tr.longdescription
- FROM language l LEFT OUTER JOIN translation tr ON (tr.language_id=l.id AND $where)|;
+ $query =
+ qq|SELECT l.id, l.description, tr.translation, tr.longdescription
+ FROM language l
+ LEFT OUTER JOIN translation tr ON (tr.language_id = l.id) AND (tr.parts_id = ?)|;
+ @values = (conv_i($form->{id}));
+
} else {
- $query = qq|SELECT l.id, l.description
- FROM language l|;
+ $query = qq|SELECT id, description FROM language|;
}
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push(@{$languages}, $ref);
- }
- $sth->finish;
+ my $languages = selectall_hashref_query($form, $dbh, $query, @values);
$dbh->disconnect;
$main::lxdebug->leave_sub();
- return $languages;
+ return $languages;
}
sub follow_account_chain {
- $main::lxdebug->enter_sub();
+ $main::lxdebug->enter_sub(2);
my ($self, $form, $dbh, $transdate, $accno_id, $accno) = @_;
my ($query, $sth);
$query =
- "SELECT c.new_chart_id, date($transdate) >= c.valid_from AS is_valid, " .
- " cnew.accno " .
- "FROM chart c " .
- "LEFT JOIN chart cnew ON c.new_chart_id = cnew.id " .
- "WHERE (c.id = ?) AND NOT c.new_chart_id ISNULL AND (c.new_chart_id > 0)";
- $sth = $dbh->prepare($query);
+ qq|SELECT c.new_chart_id, date($transdate) >= c.valid_from AS is_valid, | .
+ qq| cnew.accno | .
+ qq|FROM chart c | .
+ qq|LEFT JOIN chart cnew ON c.new_chart_id = cnew.id | .
+ qq|WHERE (c.id = ?) AND NOT c.new_chart_id ISNULL AND (c.new_chart_id > 0)|;
+ $sth = prepare_query($form, $dbh, $query);
while (1) {
- $sth->execute($accno_id) || $form->dberror($query . " ($accno_id)");
+ do_statement($form, $sth, $query, $accno_id);
$ref = $sth->fetchrow_hashref();
last unless ($ref && $ref->{"is_valid"} &&
!grep({ $_ == $ref->{"new_chart_id"} } @visited_accno_ids));
push(@visited_accno_ids, $accno_id);
}
- $main::lxdebug->leave_sub();
+ $main::lxdebug->leave_sub(2);
return ($accno_id, $accno);
}
sub retrieve_accounts {
- $main::lxdebug->enter_sub();
+ $main::lxdebug->enter_sub(2);
- my ($self, $myconfig, $form, $parts_id, $index, $copy_accnos) = @_;
+ my ($self, $myconfig, $form, $parts_id, $index) = @_;
my ($query, $sth, $dbh);
- return $main::lxdebug->leave_sub() if (!defined($form->{"taxzone_id"}));
+ $form->{"taxzone_id"} *= 1;
- $dbh = $form->dbconnect($myconfig);
+ $dbh = $form->get_standard_dbh($myconfig);
my $transdate = "";
if ($form->{type} eq "invoice") {
} else {
$transdate = $form->{deliverydate};
}
- } elsif ($form->{type} eq "credit_note") {
+ } elsif (($form->{type} eq "credit_note") || ($form->{script} eq 'ir.pl')) {
$transdate = $form->{invdate};
} else {
$transdate = $form->{transdate};
}
$query =
- "SELECT " .
- " p.inventory_accno_id AS is_part, " .
- " bg.inventory_accno_id, " .
- " bg.income_accno_id_$form->{taxzone_id} AS income_accno_id, " .
- " bg.expense_accno_id_$form->{taxzone_id} AS expense_accno_id, " .
- " c1.accno AS inventory_accno, " .
- " c2.accno AS income_accno, " .
- " c3.accno AS expense_accno " .
- "FROM parts p " .
- "LEFT JOIN buchungsgruppen bg ON p.buchungsgruppen_id = bg.id " .
- "LEFT JOIN chart c1 ON bg.inventory_accno_id = c1.id " .
- "LEFT JOIN chart c2 ON bg.income_accno_id_$form->{taxzone_id} = c2.id " .
- "LEFT JOIN chart c3 ON bg.expense_accno_id_$form->{taxzone_id} = c3.id " .
- "WHERE p.id = ?";
- $sth = $dbh->prepare($query);
- $sth->execute($parts_id) || $form->dberror($query . " ($parts_id)");
- my $ref = $sth->fetchrow_hashref();
- $sth->finish();
-
-# $main::lxdebug->message(0, "q $query");
-
- if (!$ref) {
- $dbh->disconnect();
- return $main::lxdebug->leave_sub();
- }
+ qq|SELECT | .
+ qq| p.inventory_accno_id AS is_part, | .
+ qq| bg.inventory_accno_id, | .
+ qq| bg.income_accno_id_$form->{taxzone_id} AS income_accno_id, | .
+ qq| bg.expense_accno_id_$form->{taxzone_id} AS expense_accno_id, | .
+ qq| c1.accno AS inventory_accno, | .
+ qq| c2.accno AS income_accno, | .
+ qq| c3.accno AS expense_accno | .
+ qq|FROM parts p | .
+ qq|LEFT JOIN buchungsgruppen bg ON p.buchungsgruppen_id = bg.id | .
+ qq|LEFT JOIN chart c1 ON bg.inventory_accno_id = c1.id | .
+ qq|LEFT JOIN chart c2 ON bg.income_accno_id_$form->{taxzone_id} = c2.id | .
+ qq|LEFT JOIN chart c3 ON bg.expense_accno_id_$form->{taxzone_id} = c3.id | .
+ qq|WHERE p.id = ?|;
+ my $ref = selectfirst_hashref_query($form, $dbh, $query, $parts_id);
+
+ return $main::lxdebug->leave_sub(2) if (!$ref);
$ref->{"inventory_accno_id"} = undef unless ($ref->{"is_part"});
my $accno_id = $accounts{"${inc_exp}_accno_id"};
$query =
- "SELECT c.accno, t.taxdescription AS description, t.rate, t.taxnumber " .
- "FROM tax t " .
- "LEFT JOIN chart c ON c.id = t.chart_id " .
- "WHERE t.id IN " .
- " (SELECT tk.tax_id " .
- " FROM taxkeys tk " .
- " WHERE tk.chart_id = $accno_id AND startdate <= $transdate " .
- " ORDER BY startdate DESC LIMIT 1) ";
- $sth = $dbh->prepare($query);
- $sth->execute() || $form->dberror($query);
- $ref = $sth->fetchrow_hashref();
- $sth->finish();
- $dbh->disconnect();
+ qq|SELECT c.accno, t.taxdescription AS description, t.rate, t.taxnumber | .
+ qq|FROM tax t | .
+ qq|LEFT JOIN chart c ON c.id = t.chart_id | .
+ qq|WHERE t.id IN | .
+ qq| (SELECT tk.tax_id | .
+ qq| FROM taxkeys tk | .
+ qq| WHERE tk.chart_id = ? AND startdate <= | . quote_db_date($transdate) .
+ qq| ORDER BY startdate DESC LIMIT 1) |;
+ $ref = selectfirst_hashref_query($form, $dbh, $query, $accno_id);
unless ($ref) {
- $main::lxdebug->leave_sub();
+ $main::lxdebug->leave_sub(2);
return;
}
# " || taxaccounts_$index " . $form->{"taxaccounts_$index"} .
# " || taxaccounts " . $form->{"taxaccounts"});
- $main::lxdebug->leave_sub();
+ $main::lxdebug->leave_sub(2);
}
+
1;
package IR;
use SL::AM;
+use SL::Common;
+use SL::DBUtils;
+use SL::MoreCommon;
sub post_invoice {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form) = @_;
+ my ($self, $myconfig, $form, $provided_dbh, $payments_only) = @_;
# connect to database, turn off autocommit
- my $dbh = $form->dbconnect_noauto($myconfig);
+ my $dbh = $provided_dbh ? $provided_dbh : $form->dbconnect_noauto($myconfig);
+ $form->{defaultcurrency} = $form->get_default_currency($myconfig);
- my ($query, $sth, $null, $project_id);
+ my ($query, $sth, @values, $project_id);
+ my ($allocated, $taxrate, $taxamount, $taxdiff, $item);
+ my ($amount, $linetotal, $lastinventoryaccno, $lastexpenseaccno);
+ my ($netamount, $invoicediff, $expensediff) = (0, 0, 0);
my $exchangerate = 0;
- my $allocated;
- my $taxrate;
- my $taxamount;
- my $taxdiff;
- my $item;
-
- my $service_units = AM->retrieve_units($myconfig,$form,"service");
- my $part_units = AM->retrieve_units($myconfig,$form,"dimension");
-
- if ($form->{id}) {
-
- &reverse_invoice($dbh, $form);
- } else {
- my $uid = rand() . time;
-
- $uid .= $form->{login};
+ my $all_units = AM->retrieve_units($myconfig, $form);
- $uid = substr($uid, 2, 75);
-
- $query = qq|INSERT INTO ap (invnumber, employee_id)
- VALUES ('$uid', (SELECT e.id FROM employee e
- WHERE e.login = '$form->{login}'))|;
- $dbh->do($query) || $form->dberror($query);
+ if (!$payments_only) {
+ if ($form->{id}) {
+ &reverse_invoice($dbh, $form);
- $query = qq|SELECT a.id FROM ap a
- WHERE a.invnumber = '$uid'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ } else {
+ ($form->{id}) = selectrow_query($form, $dbh, qq|SELECT nextval('glid')|);
- ($form->{id}) = $sth->fetchrow_array;
- $sth->finish;
+ do_query($form, $dbh, qq|INSERT INTO ap (id, invnumber) VALUES (?, '')|, $form->{id});
+ }
}
- ($null, $form->{contact_id}) = split /--/, $form->{contact};
- $form->{contact_id} *= 1;
-
- map { $form->{$_} =~ s/\'/\'\'/g } qw(invnumber ordnumber quonumber);
+ my ($currencies) = selectfirst_array_query($form, $dbh, qq|SELECT curr FROM defaults|);
+ my $defaultcurrency = (split m/:/, $currencies)[0];
- my ($amount, $linetotal, $lastinventoryaccno, $lastexpenseaccno);
- my ($netamount, $invoicediff, $expensediff) = (0, 0, 0);
-
- if ($form->{currency} eq $form->{defaultcurrency}) {
+ if ($form->{currency} eq $defaultcurrency) {
$form->{exchangerate} = 1;
} else {
$exchangerate =
? $exchangerate
: $form->parse_amount($myconfig, $form->{exchangerate});
+ $form->{exchangerate} = 1 unless ($form->{exchangerate} * 1);
+
+ my %item_units;
+ my $q_item_unit = qq|SELECT unit FROM parts WHERE id = ?|;
+ my $h_item_unit = prepare_query($form, $dbh, $q_item_unit);
+
for my $i (1 .. $form->{rowcount}) {
+ next unless $form->{"id_$i"};
+
$form->{"qty_$i"} = $form->parse_amount($myconfig, $form->{"qty_$i"});
-
+
if ($form->{storno}) {
$form->{"qty_$i"} *= -1;
}
if ($main::eur) {
$form->{"inventory_accno_$i"} = $form->{"expense_accno_$i"};
}
-
- if ($form->{"qty_$i"} != 0) {
-
- # get item baseunit
- $query = qq|SELECT p.unit
- FROM parts p
- WHERE p.id = $form->{"id_$i"}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my ($item_unit) = $sth->fetchrow_array();
- $sth->finish;
-
- if ($form->{"inventory_accno_$i"}) {
- if (defined($part_units->{$item_unit}->{factor}) && $part_units->{$item_unit}->{factor} ne '' && $part_units->{$item_unit}->{factor} ne '0') {
- $basefactor = $part_units->{$form->{"unit_$i"}}->{factor} / $part_units->{$item_unit}->{factor};
- } else {
- $basefactor = 1;
- }
- $baseqty = $form->{"qty_$i"} * $basefactor;
+
+ # get item baseunit
+ if (!$item_units{$form->{"id_$i"}}) {
+ do_statement($form, $h_item_unit, $q_item_unit, $form->{"id_$i"});
+ ($item_units{$form->{"id_$i"}}) = $h_item_unit->fetchrow_array();
+ }
+
+ my $item_unit = $item_units{$form->{"id_$i"}};
+
+ if (defined($all_units->{$item_unit}->{factor})
+ && ($all_units->{$item_unit}->{factor} ne '')
+ && ($all_units->{$item_unit}->{factor} * 1 != 0)) {
+ $basefactor = $all_units->{$form->{"unit_$i"}}->{factor} / $all_units->{$item_unit}->{factor};
+ } else {
+ $basefactor = 1;
+ }
+ $baseqty = $form->{"qty_$i"} * $basefactor;
+
+ @taxaccounts = split / /, $form->{"taxaccounts_$i"};
+ $taxdiff = 0;
+ $allocated = 0;
+ $taxrate = 0;
+
+ $form->{"sellprice_$i"} = $form->parse_amount($myconfig, $form->{"sellprice_$i"});
+ my $fxsellprice = $form->{"sellprice_$i"};
+
+ my ($dec) = ($fxsellprice =~ /\.(\d+)/);
+ $dec = length $dec;
+ my $decimalplaces = ($dec > 2) ? $dec : 2;
+
+ map { $taxrate += $form->{"${_}_rate"} } @taxaccounts;
+
+ if ($form->{"inventory_accno_$i"}) {
+
+ $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2);
+
+ if ($form->{taxincluded}) {
+ $taxamount = $linetotal * ($taxrate / (1 + $taxrate));
+ $form->{"sellprice_$i"} = $form->{"sellprice_$i"} * (1 / (1 + $taxrate));
} else {
- if (defined($service_units->{$item_unit}->{factor}) && $service_units->{$item_unit}->{factor} ne '' && $service_units->{$item_unit}->{factor} ne '0') {
- $basefactor = $service_units->{$form->{"unit_$i"}}->{factor} / $service_units->{$item_unit}->{factor};
+ $taxamount = $linetotal * $taxrate;
+ }
+
+ $netamount += $linetotal;
+
+ if ($form->round_amount($taxrate, 7) == 0) {
+ if ($form->{taxincluded}) {
+ foreach $item (@taxaccounts) {
+ $taxamount =
+ $form->round_amount($linetotal * $form->{"${item}_rate"} / (1 + abs($form->{"${item}_rate"})), 2);
+ $taxdiff += $taxamount;
+ $form->{amount}{ $form->{id} }{$item} -= $taxamount;
+ }
+ $form->{amount}{ $form->{id} }{ $taxaccounts[0] } += $taxdiff;
+
} else {
- $basefactor = 1;
+ map { $form->{amount}{ $form->{id} }{$_} -= $linetotal * $form->{"${_}_rate"} } @taxaccounts;
}
- $baseqty = $form->{"qty_$i"} * $basefactor;
+
+ } else {
+ map { $form->{amount}{ $form->{id} }{$_} -= $taxamount * $form->{"${_}_rate"} / $taxrate } @taxaccounts;
}
- map { $form->{"${_}_$i"} =~ s/\'/\'\'/g }
- qw(partnumber description unit);
+ # add purchase to inventory, this one is without the tax!
+ $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * $form->{exchangerate};
+ $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2) * $form->{exchangerate};
+ $linetotal = $form->round_amount($linetotal, 2);
+
+ # this is the difference for the inventory
+ $invoicediff += ($amount - $linetotal);
- @taxaccounts = split / /, $form->{"taxaccounts_$i"};
- $taxdiff = 0;
- $allocated = 0;
- $taxrate = 0;
+ $form->{amount}{ $form->{id} }{ $form->{"inventory_accno_$i"} } -= $linetotal;
+ # adjust and round sellprice
$form->{"sellprice_$i"} =
- $form->parse_amount($myconfig, $form->{"sellprice_$i"});
- my $fxsellprice = $form->{"sellprice_$i"};
+ $form->round_amount($form->{"sellprice_$i"} * $form->{exchangerate}, $decimalplaces);
- my ($dec) = ($fxsellprice =~ /\.(\d+)/);
- $dec = length $dec;
- my $decimalplaces = ($dec > 2) ? $dec : 2;
+ $lastinventoryaccno = $form->{"inventory_accno_$i"};
- map { $taxrate += $form->{"${_}_rate"} } @taxaccounts;
+ next if $payments_only;
- if ($form->{"inventory_accno_$i"}) {
+ # update parts table
+ $query = qq|UPDATE parts SET lastcost = ? WHERE id = ?|;
+ @values = ($form->{"sellprice_$i"}, conv_i($form->{"id_$i"}));
+ do_query($form, $dbh, $query, @values);
- $linetotal =
- $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2);
+ if (!$form->{shipped}) {
+ $form->update_balance($dbh, "parts", "onhand", qq|id = ?|, $baseqty, $form->{"id_$i"})
+ }
- if ($form->{taxincluded}) {
- $taxamount = $linetotal * ($taxrate / (1 + $taxrate));
- $form->{"sellprice_$i"} =
- $form->{"sellprice_$i"} * (1 / (1 + $taxrate));
- } else {
- $taxamount = $linetotal * $taxrate;
+ # check if we sold the item already and
+ # make an entry for the expense and inventory
+ $query =
+ qq|SELECT i.id, i.qty, i.allocated, i.trans_id,
+ p.inventory_accno_id, p.expense_accno_id, a.transdate
+ FROM invoice i, ar a, parts p
+ WHERE (i.parts_id = p.id)
+ AND (i.parts_id = ?)
+ AND ((i.base_qty + i.allocated) > 0)
+ AND (i.trans_id = a.id)
+ ORDER BY transdate|;
+ $sth = prepare_execute_query($form, $dbh, $query, conv_i($form->{"id_$i"}));
+
+ my $totalqty = $base_qty;
+
+ while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
+
+ my $qty = $ref->{base_qty} + $ref->{allocated};
+
+ if (($qty - $totalqty) > 0) {
+ $qty = $totalqty;
}
- $netamount += $linetotal;
-
- if ($form->round_amount($taxrate, 7) == 0) {
- if ($form->{taxincluded}) {
- foreach $item (@taxaccounts) {
- $taxamount =
- $form->round_amount($linetotal * $form->{"${item}_rate"} /
- (1 + abs($form->{"${item}_rate"})),
- 2);
- $taxdiff += $taxamount;
- $form->{amount}{ $form->{id} }{$item} -= $taxamount;
- }
- $form->{amount}{ $form->{id} }{ $taxaccounts[0] } += $taxdiff;
- } else {
- map {
- $form->{amount}{ $form->{id} }{$_} -=
- $linetotal * $form->{"${_}_rate"}
- } @taxaccounts;
- }
- } else {
- map {
- $form->{amount}{ $form->{id} }{$_} -=
- $taxamount * $form->{"${_}_rate"} / $taxrate
- } @taxaccounts;
+ $linetotal = $form->round_amount(($form->{"sellprice_$i"} * $qty) / $basefactor, 2);
+
+ if ($ref->{allocated} < 0) {
+
+ # we have an entry for it already, adjust amount
+ $form->update_balance($dbh, "acc_trans", "amount",
+ qq| (trans_id = $ref->{trans_id})
+ AND (chart_id = $ref->{inventory_accno_id})
+ AND (transdate = '$ref->{transdate}')|,
+ $linetotal);
+
+ $form->update_balance($dbh, "acc_trans", "amount",
+ qq| (trans_id = $ref->{trans_id})
+ AND (chart_id = $ref->{expense_accno_id})
+ AND (transdate = '$ref->{transdate}')|,
+ $linetotal * -1);
+
+ } elsif ($linetotal != 0) {
+ # add entry for inventory, this one is for the sold item
+ $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey)
+ VALUES (?, ?, ?, ?, (SELECT taxkey_id FROM chart WHERE id = ?))|;
+ @values = ($ref->{trans_id}, $ref->{inventory_accno_id}, $linetotal,
+ $ref->{transdate}, $ref->{inventory_accno_id});
+ do_query($form, $dbh, $query, @values);
+
+ # add expense
+ $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey)
+ VALUES (?, ?, ?, ?, (SELECT taxkey from tax WHERE chart_id = ?))|;
+ @values = ($ref->{trans_id}, $ref->{expense_accno_id}, ($linetotal * -1),
+ $ref->{transdate}, $ref->{expense_accno_id});
+ do_query($form, $dbh, $query, @values);
}
- # add purchase to inventory, this one is without the tax!
- $amount =
- $form->{"sellprice_$i"} * $form->{"qty_$i"} * $form->{exchangerate};
- $linetotal =
- $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2) *
- $form->{exchangerate};
- $linetotal = $form->round_amount($linetotal, 2);
-
- # this is the difference for the inventory
- $invoicediff += ($amount - $linetotal);
-
- $form->{amount}{ $form->{id} }{ $form->{"inventory_accno_$i"} } -=
- $linetotal;
-
- # adjust and round sellprice
- $form->{"sellprice_$i"} =
- $form->round_amount($form->{"sellprice_$i"} * $form->{exchangerate},
- $decimalplaces);
-
- # update parts table
- $query = qq|UPDATE parts SET
- lastcost = $form->{"sellprice_$i"}
- WHERE id = $form->{"id_$i"}|;
-
- $dbh->do($query) || $form->dberror($query);
-
- $form->update_balance($dbh, "parts", "onhand",
- qq|id = $form->{"id_$i"}|,
- $baseqty)
- unless $form->{shipped};
-
- # check if we sold the item already and
- # make an entry for the expense and inventory
- $query = qq|SELECT i.id, i.qty, i.allocated, i.trans_id,
- p.inventory_accno_id, p.expense_accno_id, a.transdate
- FROM invoice i, ar a, parts p
- WHERE i.parts_id = p.id
- AND i.parts_id = $form->{"id_$i"}
- AND (i.base_qty + i.allocated) > 0
- AND i.trans_id = a.id
- ORDER BY transdate|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my $totalqty = $base_qty;
-
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
-
- my $qty = $ref->{base_qty} + $ref->{allocated};
-
- if (($qty - $totalqty) > 0) {
- $qty = $totalqty;
- }
+ # update allocated for sold item
+ $form->update_balance($dbh, "invoice", "allocated", qq|id = $ref->{id}|, $qty * -1);
- $linetotal = $form->round_amount(($form->{"sellprice_$i"} * $qty) / $basefactor, 2);
-
- if ($ref->{allocated} < 0) {
-
- # we have an entry for it already, adjust amount
- $form->update_balance(
- $dbh,
- "acc_trans",
- "amount",
- qq|trans_id = $ref->{trans_id} AND chart_id = $ref->{inventory_accno_id} AND transdate = '$ref->{transdate}'|,
- $linetotal);
-
- $form->update_balance(
- $dbh,
- "acc_trans",
- "amount",
- qq|trans_id = $ref->{trans_id} AND chart_id = $ref->{expense_accno_id} AND transdate = '$ref->{transdate}'|,
- $linetotal * -1);
-
- } else {
-
- # add entry for inventory, this one is for the sold item
- if ($linetotal != 0) {
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate)
- VALUES ($ref->{trans_id}, $ref->{inventory_accno_id},
- $linetotal, '$ref->{transdate}')|;
- $dbh->do($query) || $form->dberror($query);
-
- # add expense
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate, taxkey)
- VALUES ($ref->{trans_id}, $ref->{expense_accno_id},
- | . ($linetotal * -1) . qq|, '$ref->{transdate}',
- (SELECT taxkey from tax WHERE chart_id = $ref->{expense_accno_id}))|;
- $dbh->do($query) || $form->dberror($query);
- }
- }
+ $allocated += $qty;
- # update allocated for sold item
- $form->update_balance($dbh, "invoice", "allocated",
- qq|id = $ref->{id}|,
- $qty * -1);
+ last if (($totalqty -= $qty) <= 0);
+ }
- $allocated += $qty;
+ $sth->finish();
- last if (($totalqty -= $qty) <= 0);
- }
+ } else {
- $sth->finish;
+ $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2);
- $lastinventoryaccno = $form->{"inventory_accno_$i"};
+ if ($form->{taxincluded}) {
+ $taxamount = $linetotal * ($taxrate / (1 + $taxrate));
+ $form->{"sellprice_$i"} = $form->{"sellprice_$i"} * (1 / (1 + $taxrate));
} else {
+ $taxamount = $linetotal * $taxrate;
+ }
- $linetotal =
- $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2);
+ $netamount += $linetotal;
+ if ($form->round_amount($taxrate, 7) == 0) {
if ($form->{taxincluded}) {
- $taxamount = $linetotal * ($taxrate / (1 + $taxrate));
-
- $form->{"sellprice_$i"} =
- $form->{"sellprice_$i"} * (1 / (1 + $taxrate));
- } else {
- $taxamount = $linetotal * $taxrate;
- }
-
- $netamount += $linetotal;
-
- if ($form->round_amount($taxrate, 7) == 0) {
- if ($form->{taxincluded}) {
- foreach $item (@taxaccounts) {
- $taxamount =
- $linetotal * $form->{"${item}_rate"} /
- (1 + abs($form->{"${item}_rate"}));
- $totaltax += $taxamount;
- $form->{amount}{ $form->{id} }{$item} -= $taxamount;
- }
- } else {
- map {
- $form->{amount}{ $form->{id} }{$_} -=
- $linetotal * $form->{"${_}_rate"}
- } @taxaccounts;
+ foreach $item (@taxaccounts) {
+ $taxamount =
+ $linetotal * $form->{"${item}_rate"}
+ / (1 + abs($form->{"${item}_rate"}));
+ $totaltax += $taxamount;
+ $form->{amount}{ $form->{id} }{$item} -= $taxamount;
}
+
} else {
- map {
- $form->{amount}{ $form->{id} }{$_} -=
- $taxamount * $form->{"${_}_rate"} / $taxrate
- } @taxaccounts;
+ map { $form->{amount}{ $form->{id} }{$_} -= $linetotal * $form->{"${_}_rate"} } @taxaccounts;
}
- $amount =
- $form->{"sellprice_$i"} * $form->{"qty_$i"} * $form->{exchangerate};
- $linetotal =
- $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2) *
- $form->{exchangerate};
- $linetotal = $form->round_amount($linetotal, 2);
+ } else {
+ map { $form->{amount}{ $form->{id} }{$_} -= $taxamount * $form->{"${_}_rate"} / $taxrate } @taxaccounts;
+ }
- # this is the difference for expense
- $expensediff += ($amount - $linetotal);
+ $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * $form->{exchangerate};
+ $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2) * $form->{exchangerate};
+ $linetotal = $form->round_amount($linetotal, 2);
- # add amount to expense
- $form->{amount}{ $form->{id} }{ $form->{"expense_accno_$i"} } -=
- $linetotal;
+ # this is the difference for expense
+ $expensediff += ($amount - $linetotal);
- $lastexpenseaccno = $form->{"expense_accno_$i"};
+ # add amount to expense
+ $form->{amount}{ $form->{id} }{ $form->{"expense_accno_$i"} } -= $linetotal;
- # adjust and round sellprice
- $form->{"sellprice_$i"} =
- $form->round_amount($form->{"sellprice_$i"} * $form->{exchangerate},
- $decimalplaces);
+ $lastexpenseaccno = $form->{"expense_accno_$i"};
- # update lastcost
- $query = qq|UPDATE parts SET
- lastcost = $form->{"sellprice_$i"}
- WHERE id = $form->{"id_$i"}|;
+ # adjust and round sellprice
+ $form->{"sellprice_$i"} = $form->round_amount($form->{"sellprice_$i"} * $form->{exchangerate}, $decimalplaces);
- $dbh->do($query) || $form->dberror($query);
+ next if $payments_only;
- }
-
- $project_id = 'NULL';
- if ($form->{"projectnumber_$i"}) {
- $project_id = $form->{"projectnumber_$i"};
- }
- $deliverydate =
- ($form->{"deliverydate_$i"})
- ? qq|'$form->{"deliverydate_$i"}'|
- : "NULL";
-
- # save detail record in invoice table
- $query = qq|INSERT INTO invoice (trans_id, parts_id, description, qty, base_qty,
- sellprice, fxsellprice, allocated, unit, deliverydate,
- project_id, serialnumber)
- VALUES ($form->{id}, $form->{"id_$i"},
- '$form->{"description_$i"}', | . ($form->{"qty_$i"} * -1) . qq|, | . ($baseqty * -1) . qq|,
- $form->{"sellprice_$i"}, $fxsellprice, $allocated,
- '$form->{"unit_$i"}', $deliverydate, (SELECT id FROM project WHERE projectnumber = '$project_id'),
- '$form->{"serialnumber_$i"}')|;
- $dbh->do($query) || $form->dberror($query);
+ # update lastcost
+ $query = qq|UPDATE parts SET lastcost = ? WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{"sellprice_$i"}, conv_i($form->{"id_$i"}));
}
+
+ next if $payments_only;
+
+ # save detail record in invoice table
+ $query =
+ qq|INSERT INTO invoice (trans_id, parts_id, description, qty, base_qty,
+ sellprice, fxsellprice, allocated, unit, deliverydate,
+ project_id, serialnumber)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
+ @values = (conv_i($form->{id}), conv_i($form->{"id_$i"}),
+ $form->{"description_$i"}, $form->{"qty_$i"} * -1,
+ $baseqty * -1, $form->{"sellprice_$i"}, $fxsellprice, $allocated,
+ $form->{"unit_$i"}, conv_date($form->{deliverydate}),
+ conv_i($form->{"project_id_$i"}), $form->{"serialnumber_$i"});
+ do_query($form, $dbh, $query, @values);
}
+ $h_item_unit->finish();
+
+ my $project_id = conv_i($form->{"globalproject_id"});
+
$form->{datepaid} = $form->{invdate};
# all amounts are in natural state, netamount includes the taxes
# total payments
for my $i (1 .. $form->{paidaccounts}) {
- $form->{"paid_$i"} = $form->parse_amount($myconfig, $form->{"paid_$i"});
- $form->{paid} += $form->{"paid_$i"};
- $form->{datepaid} = $form->{"datepaid_$i"} if ($form->{"datepaid_$i"});
+ $form->{"paid_$i"} = $form->parse_amount($myconfig, $form->{"paid_$i"});
+ $form->{paid} += $form->{"paid_$i"};
+ $form->{datepaid} = $form->{"datepaid_$i"} if ($form->{"datepaid_$i"});
}
my ($tax, $paiddiff) = (0, 0);
$netamount = $amount;
foreach $item (split / /, $form->{taxaccounts}) {
- $amount = $form->{amount}{ $form->{id} }{$item} * $form->{exchangerate};
+ $amount = $form->{amount}{ $form->{id} }{$item} * $form->{exchangerate};
$form->{amount}{ $form->{id} }{$item} = $form->round_amount($amount, 2);
- $amount = $form->{amount}{ $form->{id} }{$item} * -1;
- $tax += $amount;
+
+ $amount = $form->{amount}{ $form->{id} }{$item} * -1;
+ $tax += $amount;
$netamount -= $amount;
}
$amount = $form->round_amount($netamount * $form->{exchangerate}, 2);
$paiddiff = $amount - $netamount * $form->{exchangerate};
$netamount = $amount;
+
foreach my $item (split / /, $form->{taxaccounts}) {
- $form->{amount}{ $form->{id} }{$item} =
- $form->round_amount($form->{amount}{ $form->{id} }{$item}, 2);
- $amount =
- $form->round_amount(
- $form->{amount}{ $form->{id} }{$item} * $form->{exchangerate} * -1,
- 2);
- $paiddiff +=
- $amount - $form->{amount}{ $form->{id} }{$item} *
- $form->{exchangerate} * -1;
- $form->{amount}{ $form->{id} }{$item} =
- $form->round_amount($amount * -1, 2);
- $amount = $form->{amount}{ $form->{id} }{$item} * -1;
- $tax += $amount;
+ $form->{amount}{ $form->{id} }{$item} = $form->round_amount($form->{amount}{ $form->{id} }{$item}, 2);
+ $amount = $form->round_amount( $form->{amount}{ $form->{id} }{$item} * $form->{exchangerate} * -1, 2);
+ $paiddiff += $amount - $form->{amount}{ $form->{id} }{$item} * $form->{exchangerate} * -1;
+ $form->{amount}{ $form->{id} }{$item} = $form->round_amount($amount * -1, 2);
+ $amount = $form->{amount}{ $form->{id} }{$item} * -1;
+ $tax += $amount;
}
}
$form->{amount}{ $form->{id} }{ $form->{AP} } = $netamount + $tax;
if ($form->{paid} != 0) {
- $form->{paid} =
- $form->round_amount($form->{paid} * $form->{exchangerate} + $paiddiff,
- 2);
+ $form->{paid} = $form->round_amount($form->{paid} * $form->{exchangerate} + $paiddiff, 2);
}
# update exchangerate
- if (($form->{currency} ne $form->{defaultcurrency}) && !$exchangerate) {
- $form->update_exchangerate($dbh, $form->{currency}, $form->{invdate}, 0,
- $form->{exchangerate});
+ if (($form->{currency} ne $defaultcurrency) && !$exchangerate) {
+ $form->update_exchangerate($dbh, $form->{currency}, $form->{invdate}, 0, $form->{exchangerate});
}
# record acc_trans transactions
foreach my $trans_id (keys %{ $form->{amount} }) {
foreach my $accno (keys %{ $form->{amount}{$trans_id} }) {
- if (
- ($form->{amount}{$trans_id}{$accno} =
- $form->round_amount($form->{amount}{$trans_id}{$accno}, 2)
- ) != 0
- ) {
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate, taxkey)
- VALUES ($trans_id, (SELECT c.id FROM chart c
- WHERE c.accno = '$accno'),
- $form->{amount}{$trans_id}{$accno}, '$form->{invdate}',
- (SELECT taxkey_id FROM chart WHERE accno = '$accno'))|;
- $dbh->do($query) || $form->dberror($query);
- }
+ $form->{amount}{$trans_id}{$accno} = $form->round_amount($form->{amount}{$trans_id}{$accno}, 2);
+
+ next if ($payments_only || !$form->{amount}{$trans_id}{$accno});
+
+ $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id)
+ VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?,
+ (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|;
+ @values = ($trans_id, $accno, $form->{amount}{$trans_id}{$accno},
+ conv_date($form->{invdate}), $accno, $project_id);
+ do_query($form, $dbh, $query, @values);
}
}
# deduct payment differences from paiddiff
for my $i (1 .. $form->{paidaccounts}) {
if ($form->{"paid_$i"} != 0) {
- $amount =
- $form->round_amount($form->{"paid_$i"} * $form->{exchangerate}, 2);
+ $amount = $form->round_amount($form->{"paid_$i"} * $form->{exchangerate}, 2);
$paiddiff -= $amount - $form->{"paid_$i"} * $form->{exchangerate};
}
}
# force AP entry if 0
- $form->{amount}{ $form->{id} }{ $form->{AP} } = $form->{paid}
- if ($form->{amount}{ $form->{id} }{ $form->{AP} } == 0);
+ if ($form->{amount}{ $form->{id} }{ $form->{AP} } == 0) {
+ $form->{amount}{ $form->{id} }{ $form->{AP} } = $form->{paid};
+ }
# record payments and offsetting AP
for my $i (1 .. $form->{paidaccounts}) {
+ next if ($form->{"paid_$i"} == 0);
+
+ my ($accno) = split /--/, $form->{"AP_paid_$i"};
+ $form->{"datepaid_$i"} = $form->{invdate} unless ($form->{"datepaid_$i"});
+ $form->{datepaid} = $form->{"datepaid_$i"};
+
+ $amount = $form->round_amount($form->{"paid_$i"} * $form->{exchangerate} + $paiddiff, 2) * -1;
+
+ # record AP
+ if ($form->{amount}{ $form->{id} }{ $form->{AP} } != 0) {
+ $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id)
+ VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?,
+ (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|;
+ @values = (conv_i($form->{id}), $form->{AP}, $amount,
+ $form->{"datepaid_$i"}, $form->{AP}, $project_id);
+ do_query($form, $dbh, $query, @values);
+ }
- if ($form->{"paid_$i"} != 0) {
- my ($accno) = split /--/, $form->{"AP_paid_$i"};
- $form->{"datepaid_$i"} = $form->{invdate}
- unless ($form->{"datepaid_$i"});
- $form->{datepaid} = $form->{"datepaid_$i"};
-
- $amount = (
- $form->round_amount(
- $form->{"paid_$i"} * $form->{exchangerate} + $paiddiff, 2
- )
- ) * -1;
-
- # record AP
-
- if ($form->{amount}{ $form->{id} }{ $form->{AP} } != 0) {
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate)
- VALUES ($form->{id}, (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{AP}'),
- $amount, '$form->{"datepaid_$i"}')|;
- $dbh->do($query) || $form->dberror($query);
- }
-
- # record payment
-
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
- source, memo)
- VALUES ($form->{id}, (SELECT c.id FROM chart c
- WHERE c.accno = '$accno'),
- $form->{"paid_$i"}, '$form->{"datepaid_$i"}',
- '$form->{"source_$i"}', '$form->{"memo_$i"}')|;
- $dbh->do($query) || $form->dberror($query);
+ # record payment
+ $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, source, memo, taxkey, project_id)
+ VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?,
+ (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|;
+ @values = (conv_i($form->{id}), $accno, $form->{"paid_$i"}, $form->{"datepaid_$i"},
+ $form->{"source_$i"}, $form->{"memo_$i"}, $accno, $project_id);
+ do_query($form, $dbh, $query, @values);
+
+ $exchangerate = 0;
+
+ if ($form->{currency} eq $defaultcurrency) {
+ $form->{"exchangerate_$i"} = 1;
+ } else {
+ $exchangerate = $form->check_exchangerate($myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'sell');
+
+ $form->{"exchangerate_$i"} =
+ ($exchangerate)
+ ? $exchangerate
+ : $form->parse_amount($myconfig, $form->{"exchangerate_$i"});
+ }
- $exchangerate = 0;
+ # exchangerate difference
+ $form->{fx}{$accno}{ $form->{"datepaid_$i"} } +=
+ $form->{"paid_$i"} * ($form->{"exchangerate_$i"} - 1) + $paiddiff;
- if ($form->{currency} eq $form->{defaultcurrency}) {
- $form->{"exchangerate_$i"} = 1;
- } else {
- $exchangerate =
- $form->check_exchangerate($myconfig, $form->{currency},
- $form->{"datepaid_$i"}, 'sell');
-
- $form->{"exchangerate_$i"} =
- ($exchangerate)
- ? $exchangerate
- : $form->parse_amount($myconfig, $form->{"exchangerate_$i"});
- }
+ # gain/loss
+ $amount =
+ ($form->{"paid_$i"} * $form->{exchangerate}) -
+ ($form->{"paid_$i"} * $form->{"exchangerate_$i"});
+ if ($amount > 0) {
+ $form->{fx}{ $form->{fxgain_accno} }{ $form->{"datepaid_$i"} } += $amount;
- # exchangerate difference
- $form->{fx}{$accno}{ $form->{"datepaid_$i"} } +=
- $form->{"paid_$i"} * ($form->{"exchangerate_$i"} - 1) + $paiddiff;
-
- # gain/loss
- $amount =
- ($form->{"paid_$i"} * $form->{exchangerate}) -
- ($form->{"paid_$i"} * $form->{"exchangerate_$i"});
- if ($amount > 0) {
- $form->{fx}{ $form->{fxgain_accno} }{ $form->{"datepaid_$i"} } +=
- $amount;
- } else {
- $form->{fx}{ $form->{fxloss_accno} }{ $form->{"datepaid_$i"} } +=
- $amount;
- }
+ } else {
+ $form->{fx}{ $form->{fxloss_accno} }{ $form->{"datepaid_$i"} } += $amount;
+ }
- $paiddiff = 0;
+ $paiddiff = 0;
- # update exchange rate
- if (($form->{currency} ne $form->{defaultcurrency}) && !$exchangerate) {
- $form->update_exchangerate($dbh, $form->{currency},
- $form->{"datepaid_$i"},
- 0, $form->{"exchangerate_$i"});
- }
+ # update exchange rate
+ if (($form->{currency} ne $defaultcurrency) && !$exchangerate) {
+ $form->update_exchangerate($dbh, $form->{currency},
+ $form->{"datepaid_$i"},
+ 0, $form->{"exchangerate_$i"});
}
}
# record exchange rate differences and gains/losses
foreach my $accno (keys %{ $form->{fx} }) {
foreach my $transdate (keys %{ $form->{fx}{$accno} }) {
- if (
- ($form->{fx}{$accno}{$transdate} =
- $form->round_amount($form->{fx}{$accno}{$transdate}, 2)
- ) != 0
- ) {
-
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate, cleared, fx_transaction)
- VALUES ($form->{id}, (SELECT c.id FROM chart c
- WHERE c.accno = '$accno'),
- $form->{fx}{$accno}{$transdate}, '$transdate', '0', '1')|;
- $dbh->do($query) || $form->dberror($query);
- }
+ $form->{fx}{$accno}{$transdate} = $form->round_amount($form->{fx}{$accno}{$transdate}, 2);
+ next if ($form->{fx}{$accno}{$transdate} == 0);
+
+ $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, cleared, fx_transaction, taxkey, project_id)
+ VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, '0', '1', 0, ?)|;
+ @values = (conv_i($form->{id}), $accno, $form->{fx}{$accno}{$transdate}, conv_date($transdate), $project_id);
+ do_query($form, $dbh, $query, @values);
}
}
- $amount = $netamount + $tax;
+ if ($payments_only) {
+ $query = qq|UPDATE ap SET paid = ?, datepaid = ? WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{paid}, $form->{paid} ? conv_date($form->{datepaid}) : undef, conv_i($form->{id}));
- # set values which could be empty
- $form->{taxincluded} *= 1;
- my $datepaid = ($form->{paid}) ? qq|'$form->{datepaid}'| : "NULL";
- my $duedate = ($form->{duedate}) ? qq|'$form->{duedate}'| : "NULL";
+ if (!$provided_dbh) {
+ $dbh->commit();
+ $dbh->disconnect();
+ }
- ($null, $form->{department_id}) = split(/--/, $form->{department});
- $form->{department_id} *= 1;
- $form->{payment_id} *= 1;
- $form->{language_id} *= 1;
- $form->{taxzone_id} *= 1;
- $form->{storno} *= 1;
+ $main::lxdebug->leave_sub();
+ return;
+ }
+ $amount = $netamount + $tax;
- $form->{invnumber} = $form->{id} unless $form->{invnumber};
+ # set values which could be empty
+ my $taxzone_id = $form->{taxzone_id} * 1;
+ $form->{department_id} = (split /--/, $form->{department})[1];
+ $form->{invnumber} = $form->{id} unless $form->{invnumber};
+
+ $taxzone_id = 0 if ((3 < $taxzone_id) || (0 > $taxzone_id));
# save AP record
- $query = qq|UPDATE ap set
- invnumber = '$form->{invnumber}',
- ordnumber = '$form->{ordnumber}',
- quonumber = '$form->{quonumber}',
- transdate = '$form->{invdate}',
- vendor_id = $form->{vendor_id},
- amount = $amount,
- netamount = $netamount,
- paid = $form->{paid},
- datepaid = $datepaid,
- duedate = $duedate,
- invoice = '1',
- taxzone_id = '$form->{taxzone_id}',
- taxincluded = '$form->{taxincluded}',
- notes = '$form->{notes}',
- intnotes = '$form->{intnotes}',
- curr = '$form->{currency}',
- department_id = $form->{department_id},
- storno = '$form->{storno}',
- cp_id = $form->{contact_id}
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|UPDATE ap SET
+ invnumber = ?,
+ ordnumber = ?,
+ quonumber = ?,
+ transdate = ?,
+ orddate = ?,
+ quodate = ?,
+ vendor_id = ?,
+ amount = ?,
+ netamount = ?,
+ paid = ?,
+ datepaid = ?,
+ duedate = ?,
+ invoice = '1',
+ taxzone_id = ?,
+ taxincluded = ?,
+ notes = ?,
+ intnotes = ?,
+ curr = ?,
+ department_id = ?,
+ storno = ?,
+ storno_id = ?,
+ globalproject_id = ?,
+ cp_id = ?,
+ employee_id = ?
+ WHERE id = ?|;
+ @values = ($form->{invnumber}, $form->{ordnumber}, $form->{quonumber},
+ conv_date($form->{invdate}), conv_date($form->{orddate}), conv_date($form->{quodate}),
+ conv_i($form->{vendor_id}), $amount, $netamount, $form->{paid},
+ $form->{paid} ? conv_date($form->{datepaid}) : undef,
+ conv_date($form->{duedate}), $taxzone_id,
+ $form->{taxincluded} ? 't' : 'f',
+ $form->{notes}, $form->{intnotes}, $form->{currency}, conv_i($form->{department_id}),
+ $form->{storno} ? 't' : 'f', conv_i($form->{storno_id}),
+ conv_i($form->{globalproject_id}), conv_i($form->{cp_id}),
+ conv_i($form->{employee_id}),
+ conv_i($form->{id}));
+ do_query($form, $dbh, $query, @values);
if ($form->{storno}) {
- $query = qq| update ap set paid=paid+amount where id=$form->{storno_id}|;
- $dbh->do($query) || $form->dberror($query);
- $query = qq| update ap set storno='$form->{storno}' where id=$form->{storno_id}|;
- $dbh->do($query) || $form->dberror($query);
- $query = qq§ update ap set intnotes='Rechnung storniert am $form->{invdate} ' || intnotes where id=$form->{storno_id}§;
- $dbh->do($query) || $form->dberror($query);
-
- $query = qq| update ap set paid=amount where id=$form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|UPDATE ap SET paid = paid + amount WHERE id = ?|;
+ do_query($form, $dbh, $query, conv_i($form->{storno_id}));
+
+ $query = qq|UPDATE ap SET storno = 't' WHERE id = ?|;
+ do_query($form, $dbh, $query, conv_i($form->{storno_id}));
+
+ $query = qq!UPDATE ap SET intnotes = ? || intnotes WHERE id = ?!;
+ do_query($form, $dbh, $query, 'Rechnung storniert am $form->{invdate} ', conv_i($form->{storno_id}));
+
+ $query = qq|UPDATE ap SET paid = amount WHERE id = ?|;
+ do_query($form, $dbh, $query, conv_i($form->{id}));
}
$form->add_shipto($dbh, $form->{id}, "AP");
# delete zero entries
- $query = qq|DELETE FROM acc_trans
- WHERE amount = 0|;
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, qq|DELETE FROM acc_trans WHERE amount = 0|);
- if ($form->{webdav}) {
- &webdav_folder($myconfig, $form);
- }
+ Common::webdav_folder($form) if ($main::webdav);
- my $rc = $dbh->commit;
- $dbh->disconnect;
+ my $rc = 1;
+
+ if (!$provided_dbh) {
+ $rc = $dbh->commit();
+ $dbh->disconnect();
+ }
$main::lxdebug->leave_sub();
my ($dbh, $form) = @_;
# reverse inventory items
- my $query = qq|SELECT i.parts_id, p.inventory_accno_id, p.expense_accno_id,
- i.qty, i.allocated, i.sellprice
- FROM invoice i, parts p
- WHERE i.parts_id = p.id
- AND i.trans_id = $form->{id}|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $query =
+ qq|SELECT i.parts_id, p.inventory_accno_id, p.expense_accno_id, i.qty, i.allocated, i.sellprice
+ FROM invoice i, parts p
+ WHERE (i.parts_id = p.id)
+ AND (i.trans_id = ?)|;
+ my $sth = prepare_execute_query($form, $dbh, $query, conv_i($form->{id}));
my $netamount = 0;
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
$netamount += $form->round_amount($ref->{sellprice} * $ref->{qty} * -1, 2);
- if ($ref->{inventory_accno_id}) {
-
- # update onhand
- $form->update_balance($dbh, "parts", "onhand", qq|id = $ref->{parts_id}|,
- $ref->{qty});
-
- # if $ref->{allocated} > 0 than we sold that many items
- if ($ref->{allocated} > 0) {
-
- # get references for sold items
- $query = qq|SELECT i.id, i.trans_id, i.allocated, a.transdate
- FROM invoice i, ar a
- WHERE i.parts_id = $ref->{parts_id}
- AND i.allocated < 0
- AND i.trans_id = a.id
- ORDER BY transdate DESC|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while (my $pthref = $sth->fetchrow_hashref(NAME_lc)) {
- my $qty = $ref->{allocated};
- if (($ref->{allocated} + $pthref->{allocated}) > 0) {
- $qty = $pthref->{allocated} * -1;
- }
-
- my $amount = $form->round_amount($ref->{sellprice} * $qty, 2);
+ next unless $ref->{inventory_accno_id};
- #adjust allocated
- $form->update_balance($dbh, "invoice", "allocated",
- qq|id = $pthref->{id}|, $qty);
+ # update onhand
+ $form->update_balance($dbh, "parts", "onhand", qq|id = $ref->{parts_id}|, $ref->{qty});
- $form->update_balance(
- $dbh,
- "acc_trans",
- "amount",
- qq|trans_id = $pthref->{trans_id} AND chart_id = $ref->{expense_accno_id} AND transdate = '$pthref->{transdate}'|,
- $amount);
+ # if $ref->{allocated} > 0 than we sold that many items
+ next if ($ref->{allocated} <= 0);
- $form->update_balance(
- $dbh,
- "acc_trans",
- "amount",
- qq|trans_id = $pthref->{trans_id} AND chart_id = $ref->{inventory_accno_id} AND transdate = '$pthref->{transdate}'|,
- $amount * -1);
+ # get references for sold items
+ $query =
+ qq|SELECT i.id, i.trans_id, i.allocated, a.transdate
+ FROM invoice i, ar a
+ WHERE (i.parts_id = ?)
+ AND (i.allocated < 0)
+ AND (i.trans_id = a.id)
+ ORDER BY transdate DESC|;
+ my $sth2 = prepare_execute_query($form, $dbh, $query, $ref->{parts_id});
- last if (($ref->{allocated} -= $qty) <= 0);
+ while (my $pthref = $sth2->fetchrow_hashref(NAME_lc)) {
+ my $qty = $ref->{allocated};
+ if (($ref->{allocated} + $pthref->{allocated}) > 0) {
+ $qty = $pthref->{allocated} * -1;
}
- $sth->finish;
+
+ my $amount = $form->round_amount($ref->{sellprice} * $qty, 2);
+
+ #adjust allocated
+ $form->update_balance($dbh, "invoice", "allocated", qq|id = $pthref->{id}|, $qty);
+
+ $form->update_balance($dbh, "acc_trans", "amount",
+ qq| (trans_id = $pthref->{trans_id})
+ AND (chart_id = $ref->{expense_accno_id})
+ AND (transdate = '$pthref->{transdate}')|,
+ $amount);
+
+ $form->update_balance($dbh, "acc_trans", "amount",
+ qq| (trans_id = $pthref->{trans_id})
+ AND (chart_id = $ref->{inventory_accno_id})
+ AND (transdate = '$pthref->{transdate}')|,
+ $amount * -1);
+
+ last if (($ref->{allocated} -= $qty) <= 0);
}
- }
+ $sth2->finish();
}
- $sth->finish;
+ $sth->finish();
+
+ my $id = conv_i($form->{id});
# delete acc_trans
- $query = qq|DELETE FROM acc_trans
- WHERE trans_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|DELETE FROM acc_trans WHERE trans_id = ?|;
+ do_query($form, $dbh, $query, $id);
# delete invoice entries
- $query = qq|DELETE FROM invoice
- WHERE trans_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|DELETE FROM invoice WHERE trans_id = ?|;
+ do_query($form, $dbh, $query, $id);
- $query = qq|DELETE FROM shipto
- WHERE trans_id = $form->{id} AND module = 'AP'|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|DELETE FROM shipto WHERE (trans_id = ?) AND (module = 'AP')|;
+ do_query($form, $dbh, $query, $id);
$main::lxdebug->leave_sub();
}
&reverse_invoice($dbh, $form);
# delete zero entries
- my $query = qq|DELETE FROM acc_trans
- WHERE amount = 0|;
- $dbh->do($query) || $form->dberror($query);
+ my $query = qq|DELETE FROM acc_trans WHERE amount = 0|;
+ do_query($form, $dbh, $query);
# delete AP record
- my $query = qq|DELETE FROM ap
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ my $query = qq|DELETE FROM ap WHERE id = ?|;
+ do_query($form, $dbh, $query, conv_i($form->{id}));
my $rc = $dbh->commit;
$dbh->disconnect;
my ($self, $myconfig, $form) = @_;
# connect to database
- my $dbh = $form->dbconnect_noauto($myconfig);
+ my $dbh = $form->dbconnect($myconfig);
- my $query;
-
- if ($form->{id}) {
-
- # get default accounts and last invoice number
- $query = qq|SELECT (SELECT c.accno FROM chart c
- WHERE d.inventory_accno_id = c.id) AS inventory_accno,
- (SELECT c.accno FROM chart c
- WHERE d.income_accno_id = c.id) AS income_accno,
- (SELECT c.accno FROM chart c
- WHERE d.expense_accno_id = c.id) AS expense_accno,
- (SELECT c.accno FROM chart c
- WHERE d.fxgain_accno_id = c.id) AS fxgain_accno,
- (SELECT c.accno FROM chart c
- WHERE d.fxloss_accno_id = c.id) AS fxloss_accno,
- d.curr AS currencies
- FROM defaults d|;
- } else {
- $query = qq|SELECT (SELECT c.accno FROM chart c
- WHERE d.inventory_accno_id = c.id) AS inventory_accno,
- (SELECT c.accno FROM chart c
- WHERE d.income_accno_id = c.id) AS income_accno,
- (SELECT c.accno FROM chart c
- WHERE d.expense_accno_id = c.id) AS expense_accno,
- (SELECT c.accno FROM chart c
- WHERE d.fxgain_accno_id = c.id) AS fxgain_accno,
- (SELECT c.accno FROM chart c
- WHERE d.fxloss_accno_id = c.id) AS fxloss_accno,
- d.curr AS currencies,
- current_date AS invdate
- FROM defaults d|;
+ my ($query, $sth, $ref, $q_invdate);
+
+ if (!$form->{id}) {
+ $q_invdate = qq|, COALESCE((SELECT transdate FROM ar WHERE id = (SELECT MAX(id) FROM ar)), current_date) AS invdate|;
+ if ($form->{vendor_id}) {
+ my $vendor_id = $dbh->quote($form->{vendor_id} * 1);
+ $q_invdate .=
+ qq|, COALESCE((SELECT transdate FROM ar WHERE id = (SELECT MAX(id) FROM ar)), current_date) +
+ COALESCE((SELECT pt.terms_netto
+ FROM vendor v
+ LEFT JOIN payment_terms pt ON (v.payment_id = pt.id)
+ WHERE v.id = $vendor_id),
+ 0) AS duedate|;
+ }
}
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- my $ref = $sth->fetchrow_hashref(NAME_lc);
+ # get default accounts and last invoice number
+
+ $query=
+ qq|SELECT
+ (SELECT c.accno FROM chart c WHERE d.inventory_accno_id = c.id) AS inventory_accno,
+ (SELECT c.accno FROM chart c WHERE d.income_accno_id = c.id) AS income_accno,
+ (SELECT c.accno FROM chart c WHERE d.expense_accno_id = c.id) AS expense_accno,
+ (SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id) AS fxgain_accno,
+ (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno,
+ d.curr AS currencies
+ $q_invdate
+ FROM defaults d|;
+ $ref = selectfirst_hashref_query($form, $dbh, $query);
map { $form->{$_} = $ref->{$_} } keys %$ref;
- $sth->finish;
- if ($form->{id}) {
+ if (!$form->{id}) {
+ $dbh->disconnect();
+ $main::lxdebug->leave_sub();
- # retrieve invoice
- $query = qq|SELECT a.cp_id, a.invnumber, a.transdate AS invdate, a.duedate,
- a.ordnumber, a.quonumber, a.paid, a.taxincluded, a.notes, a.taxzone_id, a.storno, a.gldate,
- a.intnotes, a.curr AS currency
- FROM ap a
- WHERE a.id = $form->{id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- $ref = $sth->fetchrow_hashref(NAME_lc);
- map { $form->{$_} = $ref->{$_} } keys %$ref;
- $sth->finish;
+ return;
+ }
- $form->{exchangerate} =
- $form->get_exchangerate($dbh, $form->{currency}, $form->{invdate},
- "sell");
+ # retrieve invoice
+ $query =
+ qq|SELECT cp_id, invnumber, transdate AS invdate, duedate,
+ orddate, quodate, globalproject_id,
+ ordnumber, quonumber, paid, taxincluded, notes, taxzone_id, storno, gldate,
+ intnotes, curr AS currency
+ FROM ap
+ WHERE id = ?|;
+ $ref = selectfirst_hashref_query($form, $dbh, $query, conv_i($form->{id}));
+ map { $form->{$_} = $ref->{$_} } keys %$ref;
- # get shipto
- $query = qq|SELECT s.* FROM shipto s
- WHERE s.trans_id = $form->{id} AND s.module = 'AP'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $form->{exchangerate} = $form->get_exchangerate($dbh, $form->{currency}, $form->{invdate}, "sell");
- $ref = $sth->fetchrow_hashref(NAME_lc);
- delete($ref->{id});
- map { $form->{$_} = $ref->{$_} } keys %$ref;
- $sth->finish;
+ # get shipto
+ $query = qq|SELECT * FROM shipto WHERE (trans_id = ?) AND (module = 'AP')|;
+ $ref = selectfirst_hashref_query($form, $dbh, $query, conv_i($form->{id}));
+ delete $ref->{id};
+ map { $form->{$_} = $ref->{$_} } keys %$ref;
- my $transdate =
- $form->{invdate} ? $dbh->quote($form->{invdate}) : "current_date";
+ my $transdate = $form->{invdate} ? $dbh->quote($form->{invdate}) : "current_date";
+ my $taxzone_id = $form->{taxzone_id} * 1;
+
+ $taxzone_id = 0 if ((3 < $taxzone_id) || (0 > $taxzone_id));
+
+ # retrieve individual items
+ $query =
+ qq|SELECT
+ c1.accno AS inventory_accno,
+ c1.new_chart_id AS inventory_new_chart,
+ date($transdate) - c1.valid_from AS inventory_valid,
+
+ c2.accno AS income_accno,
+ c2.new_chart_id AS income_new_chart,
+ date($transdate) - c2.valid_from AS income_valid,
+
+ c3.accno AS expense_accno,
+ c3.new_chart_id AS expense_new_chart,
+ date($transdate) - c3.valid_from AS expense_valid,
+
+ i.description, i.qty, i.fxsellprice AS sellprice,
+ i.parts_id AS id, i.unit, i.deliverydate, i.project_id, i.serialnumber,
+
+ p.partnumber, p.inventory_accno_id AS part_inventory_accno_id, p.bin,
+ pr.projectnumber,
+ pg.partsgroup
+
+ FROM invoice i
+ JOIN parts p ON (i.parts_id = p.id)
+ LEFT JOIN chart c1 ON
+ ((SELECT inventory_accno_id
+ FROM buchungsgruppen
+ WHERE id = p.buchungsgruppen_id) = c1.id)
+ LEFT JOIN chart c2 ON
+ ((SELECT income_accno_id_${taxzone_id}
+ FROM buchungsgruppen
+ WHERE id = p.buchungsgruppen_id) = c2.id)
+ LEFT JOIN chart c3 ON
+ ((SELECT expense_accno_id_${taxzone_id}
+ FROM buchungsgruppen
+ WHERE id = p.buchungsgruppen_id) = c3.id)
+ LEFT JOIN project pr ON (i.project_id = pr.id)
+ LEFT JOIN partsgroup pg ON (pg.id = p.partsgroup_id)
+
+ WHERE i.trans_id = ?
+
+ ORDER BY i.id|;
+ $sth = prepare_execute_query($form, $dbh, $query, conv_i($form->{id}));
- if(!$form->{taxzone_id}) {
- $form->{taxzone_id} = 0;
+ while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
+ if (!$ref->{"part_inventory_accno_id"}) {
+ map({ delete($ref->{$_}); } qw(inventory_accno inventory_new_chart inventory_valid));
}
- # retrieve individual items
- $query = qq|SELECT c1.accno AS inventory_accno, c1.new_chart_id AS inventory_new_chart, date($transdate) - c1.valid_from as inventory_valid,
- c2.accno AS income_accno, c2.new_chart_id AS income_new_chart, date($transdate) - c2.valid_from as income_valid,
- c3.accno AS expense_accno, c3.new_chart_id AS expense_new_chart, date($transdate) - c3.valid_from as expense_valid,
- p.partnumber, i.description, i.qty, i.fxsellprice AS sellprice, p.inventory_accno_id AS part_inventory_accno_id,
- i.parts_id AS id, i.unit, p.bin, i.deliverydate,
- pr.projectnumber,
- i.project_id, i.serialnumber,
- pg.partsgroup
- FROM invoice i
- JOIN parts p ON (i.parts_id = p.id)
- LEFT JOIN chart c1 ON ((select inventory_accno_id from buchungsgruppen where id=p.buchungsgruppen_id) = c1.id)
- LEFT JOIN chart c2 ON ((select income_accno_id_$form->{taxzone_id} from buchungsgruppen where id=p.buchungsgruppen_id) = c2.id)
- LEFT JOIN chart c3 ON ((select expense_accno_id_$form->{taxzone_id} from buchungsgruppen where id=p.buchungsgruppen_id) = c3.id)
- LEFT JOIN project pr ON (i.project_id = pr.id)
- LEFT JOIN partsgroup pg ON (pg.id = p.partsgroup_id)
- WHERE i.trans_id = $form->{id}
- ORDER BY i.id|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- if (!$ref->{"part_inventory_accno_id"}) {
- map({ delete($ref->{$_}); } qw(inventory_accno inventory_new_chart inventory_valid));
- }
- delete($ref->{"part_inventory_accno_id"});
-
- while ($ref->{inventory_new_chart} && ($ref->{inventory_valid} >=0)) {
- my $query = qq| SELECT accno AS inventory_accno, new_chart_id AS inventory_new_chart, date($transdate) - valid_from AS inventory_valid FROM chart WHERE id = $ref->{inventory_new_chart}|;
- my $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
- ($ref->{inventory_accno}, $ref->{inventory_new_chart}, $ref->{inventory_valid}) = $stw->fetchrow_array;
- $stw->finish;
- }
-
- while ($ref->{income_new_chart} && ($ref->{income_valid} >=0)) {
- my $query = qq| SELECT accno AS income_accno, new_chart_id AS income_new_chart, date($transdate) - valid_from AS income_valid FROM chart WHERE id = $ref->{income_new_chart}|;
- my $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
- ($ref->{income_accno}, $ref->{income_new_chart}, $ref->{income_valid}) = $stw->fetchrow_array;
- $stw->finish;
- }
-
- while ($ref->{expense_new_chart} && ($ref->{expense_valid} >=0)) {
- my $query = qq| SELECT accno AS expense_accno, new_chart_id AS expense_new_chart, date($transdate) - valid_from AS expense_valid FROM chart WHERE id = $ref->{expense_new_chart}|;
- my $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
- ($ref->{expense_accno}, $ref->{expense_new_chart}, $ref->{expense_valid}) = $stw->fetchrow_array;
- $stw->finish;
+ delete($ref->{"part_inventory_accno_id"});
+
+ foreach my $type (qw(inventory income expense)) {
+ while ($ref->{"${type}_new_chart"} && ($ref->{"${type}_valid"} >=0)) {
+ my $query =
+ qq|SELECT accno, new_chart_id, date($transdate) - valid_from
+ FROM chart
+ WHERE id = ?|;
+ ($ref->{"${type}_accno"},
+ $ref->{"${type}_new_chart"},
+ $ref->{"${type}_valid"})
+ = selectrow_query($form, $dbh, $query, $ref->{"${type}_new_chart"});
}
+ }
- # get tax rates and description
- $accno_id =
- ($form->{vc} eq "customer") ? $ref->{income_accno} : $ref->{expense_accno};
- $query = qq|SELECT c.accno, t.taxdescription, t.rate, t.taxnumber
- FROM tax t LEFT JOIN chart c on (c.id=t.chart_id)
- WHERE t.id in (SELECT tk.tax_id from taxkeys tk where tk.chart_id = (SELECT id from chart WHERE accno='$accno_id') AND startdate<=$transdate ORDER BY startdate desc LIMIT 1)
- ORDER BY c.accno|;
- $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
- $ref->{taxaccounts} = "";
- my $i = 0;
- while ($ptr = $stw->fetchrow_hashref(NAME_lc)) {
-
- # if ($customertax{$ref->{accno}}) {
- if (($ptr->{accno} eq "") && ($ptr->{rate} == 0)) {
- $i++;
- $ptr->{accno} = $i;
- }
- $ref->{taxaccounts} .= "$ptr->{accno} ";
- if (!($form->{taxaccounts} =~ /$ptr->{accno}/)) {
- $form->{"$ptr->{accno}_rate"} = $ptr->{rate};
- $form->{"$ptr->{accno}_description"} = $ptr->{taxdescription};
- $form->{"$ptr->{accno}_taxnumber"} = $ptr->{taxnumber};
- $form->{taxaccounts} .= "$ptr->{accno} ";
- }
+ # get tax rates and description
+ my $accno_id = ($form->{vc} eq "customer") ? $ref->{income_accno} : $ref->{expense_accno};
+ $query =
+ qq|SELECT c.accno, t.taxdescription, t.rate, t.taxnumber
+ FROM tax t
+ LEFT JOIN chart c ON (c.id = t.chart_id)
+ WHERE t.id in
+ (SELECT tk.tax_id
+ FROM taxkeys tk
+ WHERE tk.chart_id =
+ (SELECT id
+ FROM chart
+ WHERE accno = ?)
+ AND (startdate <= $transdate)
+ ORDER BY startdate DESC
+ LIMIT 1)
+ ORDER BY c.accno|;
+ my $stw = prepare_execute_query($form, $dbh, $query, $accno_id);
+ $ref->{taxaccounts} = "";
+ my $i = 0;
+ while ($ptr = $stw->fetchrow_hashref(NAME_lc)) {
+ if (($ptr->{accno} eq "") && ($ptr->{rate} == 0)) {
+ $i++;
+ $ptr->{accno} = $i;
}
- chop $ref->{taxaccounts};
- push @{ $form->{invoice_details} }, $ref;
- $stw->finish;
- }
- $sth->finish;
+ $ref->{taxaccounts} .= "$ptr->{accno} ";
+
+ if (!($form->{taxaccounts} =~ /$ptr->{accno}/)) {
+ $form->{"$ptr->{accno}_rate"} = $ptr->{rate};
+ $form->{"$ptr->{accno}_description"} = $ptr->{taxdescription};
+ $form->{"$ptr->{accno}_taxnumber"} = $ptr->{taxnumber};
+ $form->{taxaccounts} .= "$ptr->{accno} ";
+ }
- if ($form->{webdav}) {
- &webdav_folder($myconfig, $form);
}
+ chop $ref->{taxaccounts};
+ push @{ $form->{invoice_details} }, $ref;
+ $stw->finish();
}
+ $sth->finish();
- my $rc = $dbh->commit;
- $dbh->disconnect;
+ Common::webdav_folder($form) if ($main::webdav);
- $main::lxdebug->leave_sub();
+ $dbh->disconnect();
- return $rc;
+ $main::lxdebug->leave_sub();
}
sub get_vendor {
my $dateformat = $myconfig->{dateformat};
$dateformat .= "yy" if $myconfig->{dateformat} !~ /^y/;
+ my $vid = conv_i($form->{vendor_id});
+
my $duedate =
($form->{invdate})
- ? "to_date('$form->{invdate}', '$dateformat')"
+ ? "to_date(" . $dbh->quote($form->{invdate}) . ", '$dateformat')"
: "current_date";
- $form->{vendor_id} *= 1;
-
# get vendor
- my $query = qq|SELECT v.name AS vendor, v.creditlimit, v.terms,
- v.email, v.cc, v.bcc, v.language_id, v.payment_id,
- v.street, v.zipcode, v.city, v.country, v.taxzone_id,
- $duedate + v.terms AS duedate
- FROM vendor v
- WHERE v.id = $form->{vendor_id}|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- $ref = $sth->fetchrow_hashref(NAME_lc);
+ my $query =
+ qq|SELECT
+ v.name AS vendor, v.creditlimit, v.terms, v.notes AS intnotes,
+ v.email, v.cc, v.bcc, v.language_id, v.payment_id,
+ v.street, v.zipcode, v.city, v.country, v.taxzone_id,
+ $duedate + COALESCE(pt.terms_netto, 0) AS duedate,
+ b.description AS business
+ FROM vendor v
+ LEFT JOIN business b ON (b.id = v.business_id)
+ LEFT JOIN payment_terms pt ON (v.payment_id = pt.id)
+ WHERE v.id = ?|;
+ $ref = selectfirst_hashref_query($form, $dbh, $query, $vid);
map { $form->{$_} = $ref->{$_} } keys %$ref;
- $sth->finish;
$form->{creditremaining} = $form->{creditlimit};
- $query = qq|SELECT SUM(a.amount - a.paid)
- FROM ap a
- WHERE a.vendor_id = $form->{vendor_id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- ($form->{creditremaining}) -= $sth->fetchrow_array;
-
- $sth->finish;
+ $query = qq|SELECT SUM(amount - paid) FROM ap WHERE vendor_id = ?|;
+ my ($unpaid_invoices) = selectfirst_array_query($form, $dbh, $query, $vid);
+ $form->{creditremaining} -= $unpaid_invoices;
$query = qq|SELECT o.amount,
- (SELECT e.sell FROM exchangerate e
- WHERE e.curr = o.curr
- AND e.transdate = o.transdate)
- FROM oe o
- WHERE o.vendor_id = $form->{vendor_id}
- AND o.quotation = '0'
- AND o.closed = '0'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while (my ($amount, $exch) = $sth->fetchrow_array) {
+ (SELECT e.sell
+ FROM exchangerate e
+ WHERE (e.curr = o.curr)
+ AND (e.transdate = o.transdate)) AS exch
+ FROM oe o
+ WHERE (o.vendor_id = ?) AND (o.quotation = '0') AND (o.closed = '0')|;
+ my $sth = prepare_execute_query($form, $dbh, $query, $vid);
+ while (my ($amount, $exch) = $sth->fetchrow_array()) {
$exch = 1 unless $exch;
$form->{creditremaining} -= $amount * $exch;
}
- $sth->finish;
-
- $form->get_contacts($dbh, $form->{vendor_id});
-
- ($null, $form->{cp_id}) = split /--/, $form->{contact};
-
- # get contact if selected
- if ($form->{contact} ne "--" && $form->{contact} ne "") {
- $form->get_contact($dbh, $form->{cp_id});
- }
+ $sth->finish();
# get shipto if we do not convert an order or invoice
if (!$form->{shipto}) {
- map { delete $form->{$_} }
- qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax shiptoemail);
-
- $query = qq|SELECT s.* FROM shipto s
- WHERE s.trans_id = $form->{vendor_id} AND s.module= 'CT'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ delete @{$form}{qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax shiptoemail)};
- $ref = $sth->fetchrow_hashref(NAME_lc);
+ $query = qq|SELECT * FROM shipto WHERE (trans_id = ?) AND (module= 'CT')|;
+ $ref = selectfirst_hashref_query($form, $dbh, $query, $vid);
+ @{$form}{keys %$ref} = @{$ref}{keys %$ref};
map { $form->{$_} = $ref->{$_} } keys %$ref;
- $sth->finish;
}
- # get taxes for vendor
- $query = qq|SELECT c.accno
- FROM chart c
- JOIN vendortax v ON (v.chart_id = c.id)
- WHERE v.vendor_id = $form->{vendor_id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my $vendortax = ();
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- $vendortax{ $ref->{accno} } = 1;
- }
- $sth->finish;
-
if (!$form->{id} && $form->{type} !~ /_(order|quotation)/) {
-
# setup last accounts used
- $query = qq|SELECT c.accno, c.description, c.link, c.category
- FROM chart c
- JOIN acc_trans ac ON (ac.chart_id = c.id)
- JOIN ap a ON (a.id = ac.trans_id)
- WHERE a.vendor_id = $form->{vendor_id}
- AND NOT (c.link LIKE '%_tax%' OR c.link LIKE '%_paid%')
- AND a.id IN (SELECT max(a2.id) FROM ap a2
- WHERE a2.vendor_id = $form->{vendor_id})|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $query =
+ qq|SELECT c.id, c.accno, c.description, c.link, c.category
+ FROM chart c
+ JOIN acc_trans ac ON (ac.chart_id = c.id)
+ JOIN ap a ON (a.id = ac.trans_id)
+ WHERE (a.vendor_id = ?)
+ AND (NOT ((c.link LIKE '%_tax%') OR (c.link LIKE '%_paid%')))
+ AND (a.id IN (SELECT max(a2.id) FROM ap a2 WHERE a2.vendor_id = ?))|;
+ my $refs = selectall_hashref_query($form, $dbh, $query, $vid, $vid);
my $i = 0;
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
+ for $ref (@$refs) {
if ($ref->{category} eq 'E') {
$i++;
- $form->{"AP_amount_$i"} = "$ref->{accno}--$ref->{description}";
+
+ if ($form->{initial_transdate}) {
+ my $tax_query = qq|SELECT tk.tax_id, t.rate FROM taxkeys tk
+ LEFT JOIN tax t ON (tk.tax_id = t.id)
+ WHERE (tk.chart_id = ?) AND (startdate <= ?)
+ ORDER BY tk.startdate DESC
+ LIMIT 1|;
+ my ($tax_id, $rate) = selectrow_query($form, $dbh, $tax_query, $ref->{id}, $form->{initial_transdate});
+ $form->{"taxchart_$i"} = "${tax_id}--${rate}";
+ }
+
+ $form->{"AP_amount_$i"} = "$ref->{accno}--$tax_id";
}
+
if ($ref->{category} eq 'L') {
- $form->{APselected} = $form->{AP_1} =
- "$ref->{accno}--$ref->{description}";
+ $form->{APselected} = $form->{AP_1} = $ref->{accno};
}
}
- $sth->finish;
$form->{rowcount} = $i if ($i && !$form->{type});
}
- $dbh->disconnect;
+ $dbh->disconnect();
$main::lxdebug->leave_sub();
}
# don't include assemblies or obsolete parts
my $where = "NOT p.assembly = '1' AND NOT p.obsolete = '1'";
+ my @values;
- if ($form->{"partnumber_$i"}) {
- my $partnumber = $form->like(lc $form->{"partnumber_$i"});
- $where .= " AND lower(p.partnumber) LIKE '$partnumber'";
- }
-
- if ($form->{"description_$i"}) {
- my $description = $form->like(lc $form->{"description_$i"});
- $where .= " AND lower(p.description) LIKE '$description'";
- }
-
- if ($form->{"partsgroup_$i"}) {
- my $partsgroup = $form->like(lc $form->{"partsgroup_$i"});
- $where .= " AND lower(pg.partsgroup) LIKE '$partsgroup'";
+ foreach my $table_column (qw(p.partnumber p.description pg.partsgroup)) {
+ my $field = (split m{\.}, $table_column)[1];
+ next unless $form->{"${field}_${i}"};
+ $where .= " AND lower(${table_column}) LIKE lower(?)";
+ push @values, '%' . $form->{"${field}_${i}"} . '%';
}
if ($form->{"description_$i"}) {
my $transdate = "";
if ($form->{type} eq "invoice") {
- $transdate =
- $form->{invdate} ? $dbh->quote($form->{invdate}) : "current_date";
+ $transdate = $form->{invdate} ? $dbh->quote($form->{invdate}) : "current_date";
} else {
- $transdate =
- $form->{transdate} ? $dbh->quote($form->{transdate}) : "current_date";
+ $transdate = $form->{transdate} ? $dbh->quote($form->{transdate}) : "current_date";
}
- my $query = qq|SELECT p.id, p.partnumber, p.description, p.lastcost AS sellprice,
- p.listprice, p.inventory_accno_id,
- c1.accno AS inventory_accno, c1.new_chart_id AS inventory_new_chart, date($transdate) - c1.valid_from as inventory_valid,
- c2.accno AS income_accno, c2.new_chart_id AS income_new_chart, date($transdate) - c2.valid_from as income_valid,
- c3.accno AS expense_accno, c3.new_chart_id AS expense_new_chart, date($transdate) - c3.valid_from as expense_valid,
- p.unit, p.assembly, p.bin, p.onhand, p.notes AS partnotes, p.notes AS longdescription, p.not_discountable,
- pg.partsgroup, p.formel
- FROM parts p
- LEFT JOIN chart c1 ON ((select inventory_accno_id from buchungsgruppen where id=p.buchungsgruppen_id) = c1.id)
- LEFT JOIN chart c2 ON ((select income_accno_id_$form->{taxzone_id} from buchungsgruppen where id=p.buchungsgruppen_id) = c2.id)
- LEFT JOIN chart c3 ON ((select expense_accno_id_$form->{taxzone_id} from buchungsgruppen where id=p.buchungsgruppen_id) = c3.id)
- LEFT JOIN partsgroup pg ON (pg.id = p.partsgroup_id)
- WHERE $where|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $taxzone_id = $form->{taxzone_id} * 1;
+ $taxzone_id = 0 if ((3 < $taxzone_id) || (0 > $taxzone_id));
+ my $query =
+ qq|SELECT
+ p.id, p.partnumber, p.description, p.lastcost AS sellprice, p.listprice,
+ p.unit, p.assembly, p.bin, p.onhand, p.formel,
+ p.notes AS partnotes, p.notes AS longdescription, p.not_discountable,
+ p.inventory_accno_id,
+
+ c1.accno AS inventory_accno,
+ c1.new_chart_id AS inventory_new_chart,
+ date($transdate) - c1.valid_from AS inventory_valid,
+
+ c2.accno AS income_accno,
+ c2.new_chart_id AS income_new_chart,
+ date($transdate) - c2.valid_from AS income_valid,
+
+ c3.accno AS expense_accno,
+ c3.new_chart_id AS expense_new_chart,
+ date($transdate) - c3.valid_from AS expense_valid,
+
+ pg.partsgroup
+
+ FROM parts p
+ LEFT JOIN chart c1 ON
+ ((SELECT inventory_accno_id
+ FROM buchungsgruppen
+ WHERE id = p.buchungsgruppen_id) = c1.id)
+ LEFT JOIN chart c2 ON
+ ((SELECT income_accno_id_${taxzone_id}
+ FROM buchungsgruppen
+ WHERE id = p.buchungsgruppen_id) = c2.id)
+ LEFT JOIN chart c3 ON
+ ((SELECT expense_accno_id_${taxzone_id}
+ FROM buchungsgruppen
+ WHERE id = p.buchungsgruppen_id) = c3.id)
+ LEFT JOIN partsgroup pg ON (pg.id = p.partsgroup_id)
+ WHERE $where|;
+ my $sth = prepare_execute_query($form, $dbh, $query, @values);
+
+ $form->{item_list} = [];
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
# In der Buchungsgruppe ist immer ein Bestandskonto verknuepft, auch wenn
delete($ref->{inventory_accno_id});
# get tax rates and description
- $accno_id =
- ($form->{vc} eq "customer") ? $ref->{income_accno} : $ref->{expense_accno};
- $query = qq|SELECT c.accno, t.taxdescription, t.rate, t.taxnumber
- FROM tax t LEFT JOIN chart c on (c.id=t.chart_id)
- WHERE t.id in (SELECT tk.tax_id from taxkeys tk where tk.chart_id = (SELECT id from chart WHERE accno='$accno_id') AND startdate<=$transdate ORDER BY startdate desc LIMIT 1)
- ORDER BY c.accno|;
- $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
+ $accno_id = ($form->{vc} eq "customer") ? $ref->{income_accno} : $ref->{expense_accno};
+ $query =
+ qq|SELECT c.accno, t.taxdescription, t.rate, t.taxnumber
+ FROM tax t
+ LEFT JOIN chart c on (c.id = t.chart_id)
+ WHERE t.id IN
+ (SELECT tk.tax_id
+ FROM taxkeys tk
+ WHERE tk.chart_id =
+ (SELECT id
+ FROM chart
+ WHERE accno = ?)
+ AND (startdate <= $transdate)
+ ORDER BY startdate DESC
+ LIMIT 1)
+ ORDER BY c.accno|;
+ my $stw = prepare_execute_query($form, $dbh, $query, $accno_id);
$ref->{taxaccounts} = "";
my $i = 0;
$i++;
$ptr->{accno} = $i;
}
+
$ref->{taxaccounts} .= "$ptr->{accno} ";
+
if (!($form->{taxaccounts} =~ /$ptr->{accno}/)) {
- $form->{"$ptr->{accno}_rate"} = $ptr->{rate};
- $form->{"$ptr->{accno}_description"} = $ptr->{taxdescription};
- $form->{"$ptr->{accno}_taxnumber"} = $ptr->{taxnumber};
- $form->{taxaccounts} .= "$ptr->{accno} ";
+ $form->{"$ptr->{accno}_rate"} = $ptr->{rate};
+ $form->{"$ptr->{accno}_description"} = $ptr->{taxdescription};
+ $form->{"$ptr->{accno}_taxnumber"} = $ptr->{taxnumber};
+ $form->{taxaccounts} .= "$ptr->{accno} ";
}
}
- $stw->finish;
+ $stw->finish();
chop $ref->{taxaccounts};
push @{ $form->{item_list} }, $ref;
}
- $sth->finish;
- $dbh->disconnect;
+ $sth->finish();
+ $dbh->disconnect();
$main::lxdebug->leave_sub();
}
# connect to database
my $dbh = $form->dbconnect($myconfig);
- # get contact id, set it if nessessary
- ($null, $form->{cp_id}) = split /--/, $form->{contact};
+ my @values;
- $contact = "";
+ # get contact id, set it if nessessary
+ $form->{cp_id} = (split /--/, $form->{contact})[1];
+ my $contact = "";
if ($form->{cp_id}) {
- $contact = "and cp.cp_id = $form->{cp_id}";
+ $contact = "AND cp.cp_id = ?";
+ push @values, $form->{cp_id};
}
# get rest for the vendor
# fax and phone and email as vendor*
my $query =
qq|SELECT ct.*, cp.*, ct.notes as vendornotes, phone as vendorphone, fax as vendorfax, email as vendoremail
- FROM vendor ct
- LEFT JOIN contacts cp on ct.id = cp.cp_cv_id
- WHERE ct.id = $form->{vendor_id} $contact order by cp.cp_id limit 1|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- $ref = $sth->fetchrow_hashref(NAME_lc);
+ FROM vendor ct
+ LEFT JOIN contacts cp ON (ct.id = cp.cp_cv_id)
+ WHERE (ct.id = ?) $contact
+ ORDER BY cp.cp_id
+ LIMIT 1|;
+ my $ref = selectfirst_hashref_query($form, $dbh, $query, $form->{vendor_id}, @values);
# remove id and taxincluded before copy back
delete @$ref{qw(id taxincluded)};
map { $form->{$_} = $ref->{$_} } keys %$ref;
- $sth->finish;
- $dbh->disconnect;
+ $dbh->disconnect();
$main::lxdebug->leave_sub();
}
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT c.accno, c.description, c.link
- FROM chart c
- WHERE c.link LIKE '%IC%'
- ORDER BY c.accno|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $query =
+ qq|SELECT accno, description, link
+ FROM chart
+ WHERE link LIKE '%IC%'
+ ORDER BY accno|;
+ my $sth = prepare_execute_query($query, $dbh, $query);
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
foreach my $key (split(/:/, $ref->{link})) {
}
}
- $sth->finish;
+ $sth->finish();
+ $dbh->disconnect();
+
$main::lxdebug->leave_sub();
}
-sub webdav_folder {
+sub _delete_payments {
$main::lxdebug->enter_sub();
- my ($myconfig, $form) = @_;
+ my ($self, $form, $dbh) = @_;
-SWITCH: {
- $path = "webdav/rechnungen/" . $form->{invnumber}, last SWITCH
- if ($form->{vc} eq "customer");
- $path = "webdav/einkaufsrechnungen/" . $form->{invnumber}, last SWITCH
- if ($form->{vc} eq "vendor");
- }
+ my @delete_oids;
- if (!-d $path) {
- mkdir($path, 0770) or die "can't make directory $!\n";
- } else {
- if ($form->{id}) {
- @files = <$path/*>;
- foreach $file (@files) {
-
- $file =~ /\/([^\/]*)$/;
- $fname = $1;
- $ENV{'SCRIPT_NAME'} =~ /\/([^\/]*)\//;
- $lxerp = $1;
- $link = "http://" . $ENV{'SERVER_NAME'} . "/" . $lxerp . "/" . $file;
- $form->{WEBDAV}{$fname} = $link;
- }
- }
+ # Delete old payment entries from acc_trans.
+ my $query =
+ qq|SELECT oid
+ FROM acc_trans
+ WHERE (trans_id = ?) AND fx_transaction
+
+ UNION
+
+ SELECT at.oid
+ FROM acc_trans at
+ LEFT JOIN chart c ON (at.chart_id = c.id)
+ WHERE (trans_id = ?) AND (c.link LIKE '%AP_paid%')|;
+ push @delete_oids, selectall_array_query($form, $dbh, $query, conv_i($form->{id}), conv_i($form->{id}));
+
+ $query =
+ qq|SELECT at.oid
+ FROM acc_trans at
+ LEFT JOIN chart c ON (at.chart_id = c.id)
+ WHERE (trans_id = ?)
+ AND ((c.link = 'AP') OR (c.link LIKE '%:AP') OR (c.link LIKE 'AP:%'))
+ ORDER BY at.oid
+ OFFSET 1|;
+ push @delete_oids, selectall_array_query($form, $dbh, $query, conv_i($form->{id}));
+
+ if (@delete_oids) {
+ $query = qq|DELETE FROM acc_trans WHERE oid IN (| . join(", ", @delete_oids) . qq|)|;
+ do_query($form, $dbh, $query);
}
$main::lxdebug->leave_sub();
# connect to database, turn off autocommit
my $dbh = $form->dbconnect_noauto($myconfig);
- $form->{datepaid} = $form->{invdate};
+ my (%payments, $old_form, $row, $item, $query, %keep_vars);
- # total payments, don't move we need it here
- for my $i (1 .. $form->{paidaccounts}) {
- $form->{"paid_$i"} = $form->parse_amount($myconfig, $form->{"paid_$i"});
- $form->{paid} += $form->{"paid_$i"};
- $form->{datepaid} = $form->{"datepaid_$i"} if ($form->{"datepaid_$i"});
- }
+ $old_form = save_form();
- $form->{exchangerate} =
- $form->get_exchangerate($dbh, $form->{currency}, $form->{invdate},
- "buy");
+ # Delete all entries in acc_trans from prior payments.
+ $self->_delete_payments($form, $dbh);
- # record payments and offsetting AP
- for my $i (1 .. $form->{paidaccounts}) {
-
- if ($form->{"paid_$i"} != 0) {
- my ($accno) = split /--/, $form->{"AP_paid_$i"};
- $form->{"datepaid_$i"} = $form->{invdate}
- unless ($form->{"datepaid_$i"});
- $form->{datepaid} = $form->{"datepaid_$i"};
-
- $exchangerate = 0;
- if (($form->{currency} eq $form->{defaultcurrency}) || ($form->{defaultcurrency} eq "")) {
- $form->{"exchangerate_$i"} = 1;
- } else {
- $exchangerate =
- $form->check_exchangerate($myconfig, $form->{currency},
- $form->{"datepaid_$i"}, 'buy');
-
- $form->{"exchangerate_$i"} =
- ($exchangerate)
- ? $exchangerate
- : $form->parse_amount($myconfig, $form->{"exchangerate_$i"});
- }
-
- # record AP
- $amount =
- $form->round_amount($form->{"paid_$i"} * $form->{"exchangerate"},
- 2) * -1;
+ # Save the new payments the user made before cleaning up $form.
+ map { $payments{$_} = $form->{$_} } grep m/^datepaid_\d+$|^memo_\d+$|^source_\d+$|^exchangerate_\d+$|^paid_\d+$|^AP_paid_\d+$|^paidaccounts$/, keys %{ $form };
+ # Clean up $form so that old content won't tamper the results.
+ %keep_vars = map { $_, 1 } qw(login password id);
+ map { delete $form->{$_} unless $keep_vars{$_} } keys %{ $form };
- $query = qq|DELETE FROM acc_trans WHERE trans_id=$form->{id} AND chart_id=(SELECT c.id FROM chart c
- WHERE c.accno = '$form->{AP}') AND amount=$amount AND transdate='$form->{"datepaid_$i"}'|;
- $dbh->do($query) || $form->dberror($query);
+ # Retrieve the invoice from the database.
+ $self->retrieve_invoice($myconfig, $form);
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate)
- VALUES ($form->{id}, (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{AP}'),
- $amount, '$form->{"datepaid_$i"}')|;
- $dbh->do($query) || $form->dberror($query);
+ # Set up the content of $form in the way that IR::post_invoice() expects.
+ $form->{exchangerate} = $form->format_amount($myconfig, $form->{exchangerate});
+ for $row (1 .. scalar @{ $form->{invoice_details} }) {
+ $item = $form->{invoice_details}->[$row - 1];
+ map { $item->{$_} = $form->format_amount($myconfig, $item->{$_}) } qw(qty sellprice);
- $query = qq|DELETE FROM acc_trans WHERE trans_id=$form->{id} AND chart_id=(SELECT c.id FROM chart c
- WHERE c.accno = '$accno') AND amount=$form->{"paid_$i"} AND transdate='$form->{"datepaid_$i"}' AND source='$form->{"source_$i"}' AND memo='$form->{"memo_$i"}'|;
- $dbh->do($query) || $form->dberror($query);
-
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
- source, memo)
- VALUES ($form->{id}, (SELECT c.id FROM chart c
- WHERE c.accno = '$accno'),
- $form->{"paid_$i"}, '$form->{"datepaid_$i"}',
- '$form->{"source_$i"}', '$form->{"memo_$i"}')|;
- $dbh->do($query) || $form->dberror($query);
+ map { $form->{"${_}_${row}"} = $item->{$_} } keys %{ $item };
+ }
+ $form->{rowcount} = scalar @{ $form->{invoice_details} };
- # gain/loss
- $amount =
- $form->{"paid_$i"} * $form->{exchangerate} - $form->{"paid_$i"} *
- $form->{"exchangerate_$i"};
- if ($amount > 0) {
- $form->{fx}{ $form->{fxgain_accno} }{ $form->{"datepaid_$i"} } +=
- $amount;
- } else {
- $form->{fx}{ $form->{fxloss_accno} }{ $form->{"datepaid_$i"} } +=
- $amount;
- }
+ delete @{$form}{qw(invoice_details paidaccounts storno paid)};
- $diff = 0;
+ # Restore the payment options from the user input.
+ map { $form->{$_} = $payments{$_} } keys %payments;
- # update exchange rate
- if (($form->{currency} ne $form->{defaultcurrency}) && !$exchangerate) {
- $form->update_exchangerate($dbh, $form->{currency},
- $form->{"datepaid_$i"},
- $form->{"exchangerate_$i"}, 0);
- }
- }
- }
+ # Get the AP accno (which is normally done by Form::create_links()).
+ $query =
+ qq|SELECT c.accno
+ FROM acc_trans at
+ LEFT JOIN chart c ON (at.chart_id = c.id)
+ WHERE (trans_id = ?)
+ AND ((c.link = 'AP') OR (c.link LIKE '%:AP') OR (c.link LIKE 'AP:%'))
+ ORDER BY at.oid
+ LIMIT 1|;
- # record exchange rate differences and gains/losses
- foreach my $accno (keys %{ $form->{fx} }) {
- foreach my $transdate (keys %{ $form->{fx}{$accno} }) {
- if (
- ($form->{fx}{$accno}{$transdate} =
- $form->round_amount($form->{fx}{$accno}{$transdate}, 2)
- ) != 0
- ) {
- $query = qq|DELETE FROM acc_trans WHERE trans_id=$form->{id} AND chart_id=(SELECT c.id FROM chart c
- WHERE c.accno = '$accno') AND amount=$form->{fx}{$accno}{$transdate} AND transdate='$transdate' AND cleared='0' AND fx_transaction='1'|;
- $dbh->do($query) || $form->dberror($query);
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate, cleared, fx_transaction)
- VALUES ($form->{id},
- (SELECT c.id FROM chart c
- WHERE c.accno = '$accno'),
- $form->{fx}{$accno}{$transdate}, '$transdate', '0', '1')|;
- $dbh->do($query) || $form->dberror($query);
- }
- }
- }
- my $datepaid = ($form->{paid}) ? qq|'$form->{datepaid}'| : "NULL";
+ ($form->{AP}) = selectfirst_array_query($form, $dbh, $query, conv_i($form->{id}));
- # save AP record
- my $query = qq|UPDATE ap set
- paid = $form->{paid},
- datepaid = $datepaid
- WHERE id=$form->{id}|;
+ # Post the new payments.
+ $self->post_invoice($myconfig, $form, $dbh, 1);
- $dbh->do($query) || $form->dberror($query);
+ restore_form($old_form);
- my $rc = $dbh->commit;
- $dbh->disconnect;
+ my $rc = $dbh->commit();
+ $dbh->disconnect();
$main::lxdebug->leave_sub();
package IS;
-use Data::Dumper;
use SL::AM;
+use SL::Common;
+use SL::DBUtils;
+use SL::MoreCommon;
+use Data::Dumper;
sub invoice_details {
$main::lxdebug->enter_sub();
my ($self, $myconfig, $form, $locale) = @_;
- $form->{duedate} = $form->{invdate} unless ($form->{duedate});
+ $form->{duedate} ||= $form->{invdate};
# connect to database
my $dbh = $form->dbconnect($myconfig);
+ my $sth;
- my $query = qq|SELECT date '$form->{duedate}' - date '$form->{invdate}'
- AS terms
- FROM defaults|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $query = qq|SELECT date | . conv_dateq($form->{duedate}) . qq| - date | . conv_dateq($form->{invdate}) . qq| AS terms|;
+ ($form->{terms}) = selectrow_query($form, $dbh, $query);
- ($form->{terms}) = $sth->fetchrow_array;
- $sth->finish;
+ my (@project_ids, %projectnumbers);
+
+ push(@project_ids, $form->{"globalproject_id"}) if ($form->{"globalproject_id"});
+
+ # sort items by partsgroup
+ for $i (1 .. $form->{rowcount}) {
+ $partsgroup = "";
+ if ($form->{"partsgroup_$i"} && $form->{groupitems}) {
+ $partsgroup = $form->{"partsgroup_$i"};
+ }
+ push @partsgroup, [$i, $partsgroup];
+ push(@project_ids, $form->{"project_id_$i"}) if ($form->{"project_id_$i"});
+ }
+
+ if (@project_ids) {
+ $query = "SELECT id, projectnumber FROM project WHERE id IN (" .
+ join(", ", map({ "?" } @project_ids)) . ")";
+ $sth = $dbh->prepare($query);
+ $sth->execute(@project_ids) ||
+ $form->dberror($query . " (" . join(", ", @project_ids) . ")");
+ while (my $ref = $sth->fetchrow_hashref()) {
+ $projectnumbers{$ref->{id}} = $ref->{projectnumber};
+ }
+ $sth->finish();
+ }
+
+ $form->{"globalprojectnumber"} =
+ $projectnumbers{$form->{"globalproject_id"}};
my $tax = 0;
my $item;
my $subtotal_header = 0;
my $subposition = 0;
+ my @arrays =
+ qw(runningnumber number description longdescription qty ship unit bin
+ deliverydate_oe ordnumber_oe transdate_oe licensenumber validuntil
+ partnotes serialnumber reqdate sellprice listprice netprice
+ discount p_discount discount_sub nodiscount_sub
+ linetotal nodiscount_linetotal tax_rate projectnumber);
+
+ my @tax_arrays =
+ qw(taxbase tax taxdescription taxrate taxnumber);
foreach $item (sort { $a->[1] cmp $b->[1] } @partsgroup) {
$i = $item->[0];
push(@{ $form->{description} }, qq|$item->[1]|);
$sameitem = $item->[1];
- map { push(@{ $form->{$_} }, "") }
- qw(runningnumber number serialnumber bin partnotes qty unit deliverydate sellprice listprice netprice discount linetotal);
+ map({ push(@{ $form->{$_} }, "") } grep({ $_ ne "description" } @arrays));
}
$form->{"qty_$i"} = $form->parse_amount($myconfig, $form->{"qty_$i"});
- if ($form->{"qty_$i"} != 0) {
+ if ($form->{"id_$i"} != 0) {
# add number, description and qty to $form->{number},
if ($form->{"subtotal_$i"} && !$subtotal_header) {
if ($form->{lizenzen}) {
if ($form->{"licensenumber_$i"}) {
- $query =
- qq|SELECT l.licensenumber, l.validuntil FROM license l WHERE l.id = $form->{"licensenumber_$i"}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($licensenumber, $validuntil) = $sth->fetchrow_array;
+ $query = qq|SELECT licensenumber, validuntil FROM license WHERE id = ?|;
+ ($licensenumber, $validuntil) = selectrow_query($form, $dbh, $query, conv_i($form->{"licensenumber_$i"}));
push(@{ $form->{licensenumber} }, $licensenumber);
- push(@{ $form->{validuntil} },
- $locale->date($myconfig, $validuntil, 0));
- $sth->finish;
+ push(@{ $form->{validuntil} }, $locale->date($myconfig, $validuntil, 0));
+
} else {
push(@{ $form->{licensenumber} }, "");
push(@{ $form->{validuntil} }, "");
push(@{ $form->{nodiscount_linetotal} },
$form->format_amount($myconfig, $nodiscount_linetotal, 2));
+ push(@{ $form->{projectnumber} }, $projectnumbers{$form->{"project_id_$i"}});
-
- @taxaccounts = split / /, $form->{"taxaccounts_$i"};
+ @taxaccounts = split(/ /, $form->{"taxaccounts_$i"});
$taxrate = 0;
$taxdiff = 0;
$sortorder = qq|ORDER BY a.$oid{$myconfig->{dbdriver}}|;
}
- $query = qq|SELECT p.partnumber, p.description, p.unit, a.qty,
- pg.partsgroup
- FROM assembly a
- JOIN parts p ON (a.parts_id = p.id)
- LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
- WHERE a.bom = '1'
- AND a.id = '$form->{"id_$i"}'
- $sortorder|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $query =
+ qq|SELECT p.partnumber, p.description, p.unit, a.qty, pg.partsgroup
+ FROM assembly a
+ JOIN parts p ON (a.parts_id = p.id)
+ LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
+ WHERE (a.bom = '1') AND (a.id = ?) $sortorder|;
+ $sth = prepare_execute_query($form, $dbh, $query, conv_i($form->{"id_$i"}));
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
if ($form->{groupitems} && $ref->{partsgroup} ne $sameitem) {
- map { push(@{ $form->{$_} }, "") }
- qw(runningnumber number serialnumber unit qty bin sellprice listprice netprice discount linetotal nodiscount_linetotal);
+ map({ push(@{ $form->{$_} }, "") } grep({ $_ ne "description" } @arrays));
$sameitem = ($ref->{partsgroup}) ? $ref->{partsgroup} : "--";
push(@{ $form->{description} }, $sameitem);
}
$form->format_amount($myconfig, $ref->{qty} * $form->{"qty_$i"}
)
. qq| -- $form->{"a_partnumber"}, $form->{"a_description"}|);
- map { push(@{ $form->{$_} }, "") }
- qw(number unit qty runningnumber serialnumber bin sellprice listprice netprice discount linetotal nodiscount_linetotal);
+ map({ push(@{ $form->{$_} }, "") } grep({ $_ ne "description" } @arrays));
}
$sth->finish;
$tax += $taxamount = $form->round_amount($taxaccounts{$item}, 2);
push(@{ $form->{tax} }, $form->format_amount($myconfig, $taxamount, 2));
- push(@{ $form->{taxdescription} }, $form->{"${item}_description"});
+ push(@{ $form->{taxdescription} }, $form->{"${item}_description"} . q{ } . 100 * $form->{"${item}_rate"} . q{%});
push(@{ $form->{taxrate} },
$form->format_amount($myconfig, $form->{"${item}_rate"} * 100));
push(@{ $form->{taxnumber} }, $form->{"${item}_taxnumber"});
for my $i (1 .. $form->{paidaccounts}) {
if ($form->{"paid_$i"}) {
push(@{ $form->{payment} }, $form->{"paid_$i"});
- my ($accno, $description) = split /--/, $form->{"AR_paid_$i"};
+ my ($accno, $description) = split(/--/, $form->{"AR_paid_$i"});
push(@{ $form->{paymentaccount} }, $description);
push(@{ $form->{paymentdate} }, $form->{"datepaid_$i"});
push(@{ $form->{paymentsource} }, $form->{"source_$i"});
$form->{paid} += $form->parse_amount($myconfig, $form->{"paid_$i"});
}
}
-
- $form->{subtotal} = $form->format_amount($myconfig, $form->{total}, 2);
+ if($form->{taxincluded}) {
+ $form->{subtotal} = $form->format_amount($myconfig, $form->{total} - $tax, 2);
+ }
+ else {
+ $form->{subtotal} = $form->format_amount($myconfig, $form->{total}, 2);
+ }
$yesdiscount = $form->{nodiscount_total} - $nodiscount;
$form->{nodiscount_subtotal} = $form->format_amount($myconfig, $form->{nodiscount_total}, 2);
$form->{discount_total} = $form->format_amount($myconfig, $form->{discount_total}, 2);
($form->{taxincluded}) ? $form->{total} : $form->{total} + $tax;
$form->{total} =
$form->format_amount($myconfig, $form->{invtotal} - $form->{paid}, 2);
+
$form->{invtotal} = $form->format_amount($myconfig, $form->{invtotal}, 2);
- $form->set_payment_options($myconfig, $form->{invdate});
$form->{paid} = $form->format_amount($myconfig, $form->{paid}, 2);
+ $form->set_payment_options($myconfig, $form->{invdate});
$form->{username} = $myconfig->{name};
my ($self, $dbh, $id) = @_;
- my $query = qq|SELECT p.description
- FROM project p
- WHERE p.id = $id|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($_) = $sth->fetchrow_array;
-
- $sth->finish;
+ my $query = qq|SELECT description FROM project WHERE id = ?|;
+ my ($description) = selectrow_query($form, $dbh, $query, conv_i($id));
$main::lxdebug->leave_sub();
# get contact id, set it if nessessary
$form->{cp_id} *= 1;
- $contact = "";
+ my @values = (conv_i($form->{customer_id}));
+
+ my $where = "";
if ($form->{cp_id}) {
- $contact = "and cp.cp_id = $form->{cp_id}";
+ $where = qq| AND (cp.cp_id = ?) |;
+ push(@values, conv_i($form->{cp_id}));
}
# get rest for the customer
- my $query = qq|SELECT ct.*, cp.*, ct.notes as customernotes
- FROM customer ct
- LEFT JOIN contacts cp on ct.id = cp.cp_cv_id
- WHERE ct.id = $form->{customer_id} $contact order by cp.cp_id limit 1|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- $ref = $sth->fetchrow_hashref(NAME_lc);
+ my $query =
+ qq|SELECT ct.*, cp.*, ct.notes as customernotes,
+ ct.phone AS customerphone, ct.fax AS customerfax, ct.email AS customeremail
+ FROM customer ct
+ LEFT JOIN contacts cp on ct.id = cp.cp_cv_id
+ WHERE (ct.id = ?) $where
+ ORDER BY cp.cp_id
+ LIMIT 1|;
+ my $ref = selectfirst_hashref_query($form, $dbh, $query, @values);
# remove id and taxincluded before copy back
delete @$ref{qw(id taxincluded)};
}
map { $form->{$_} = $ref->{$_} } keys %$ref;
- $sth->finish;
if ($form->{delivery_customer_id}) {
- my $query = qq|SELECT ct.*, ct.notes as customernotes
- FROM customer ct
- WHERE ct.id = $form->{delivery_customer_id} limit 1|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- $ref = $sth->fetchrow_hashref(NAME_lc);
+ $query =
+ qq|SELECT *, notes as customernotes
+ FROM customer
+ WHERE id = ?
+ LIMIT 1|;
+ $ref = selectfirst_hashref_query($form, $dbh, $query, conv_i($form->{delivery_customer_id}));
- $sth->finish;
map { $form->{"dc_$_"} = $ref->{$_} } keys %$ref;
}
if ($form->{delivery_vendor_id}) {
- my $query = qq|SELECT ct.*, ct.notes as customernotes
- FROM customer ct
- WHERE ct.id = $form->{delivery_vendor_id} limit 1|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- $ref = $sth->fetchrow_hashref(NAME_lc);
+ $query =
+ qq|SELECT *, notes as customernotes
+ FROM customer
+ WHERE id = ?
+ LIMIT 1|;
+ $ref = selectfirst_hashref_query($form, $dbh, $query, conv_i($form->{delivery_vendor_id}));
- $sth->finish;
map { $form->{"dv_$_"} = $ref->{$_} } keys %$ref;
}
$dbh->disconnect;
sub post_invoice {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form) = @_;
+ my ($self, $myconfig, $form, $provided_dbh, $payments_only) = @_;
# connect to database, turn off autocommit
- my $dbh = $form->dbconnect_noauto($myconfig);
+ my $dbh = $provided_dbh ? $provided_dbh : $form->dbconnect_noauto($myconfig);
- my ($query, $sth, $null, $project_id, $deliverydate);
+ my ($query, $sth, $null, $project_id, @values);
my $exchangerate = 0;
- ($null, $form->{employee_id}) = split /--/, $form->{employee};
- unless ($form->{employee_id}) {
+ if (!$form->{employee_id}) {
$form->get_employee($dbh);
}
-
- $form->{contact_id} = $form->{cp_id};
- $form->{contact_id} *= 1;
- $form->{payment_id} *= 1;
- $form->{language_id} *= 1;
- $form->{taxzone_id} *= 1;
- $form->{delivery_customer_id} *= 1;
- $form->{delivery_vendor_id} *= 1;
- $form->{storno} *= 1;
- $form->{shipto_id} *= 1;
-
+
+ $form->{defaultcurrency} = $form->get_default_currency($myconfig);
($null, $form->{department_id}) = split(/--/, $form->{department});
- $form->{department_id} *= 1;
-
- my $service_units = AM->retrieve_units($myconfig,$form,"service");
- my $part_units = AM->retrieve_units($myconfig,$form,"dimension");
-
-
-
- if ($form->{id}) {
-
- &reverse_invoice($dbh, $form);
- } else {
- my $uid = rand() . time;
+ my $all_units = AM->retrieve_units($myconfig, $form);
- $uid .= $form->{login};
+ if (!$payments_only) {
+ if ($form->{id}) {
+ &reverse_invoice($dbh, $form);
- $uid = substr($uid, 2, 75);
+ } else {
+ $query = qq|SELECT nextval('glid')|;
+ ($form->{"id"}) = selectrow_query($form, $dbh, $query);
- $query = qq|INSERT INTO ar (invnumber, employee_id)
- VALUES ('$uid', $form->{employee_id})|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|INSERT INTO ar (id, invnumber) VALUES (?, ?)|;
+ do_query($form, $dbh, $query, $form->{"id"}, $form->{"id"});
- $query = qq|SELECT a.id FROM ar a
- WHERE a.invnumber = '$uid'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($form->{id}) = $sth->fetchrow_array;
- $sth->finish;
+ if (!$form->{invnumber}) {
+ $form->{invnumber} =
+ $form->update_defaults($myconfig, $form->{type} eq "credit_note" ?
+ "cnnumber" : "invnumber", $dbh);
+ }
+ }
}
- map { $form->{$_} =~ s/\'/\'\'/g }
- (qw(invnumber shippingpoint shipvia notes intnotes message));
-
my ($netamount, $invoicediff) = (0, 0);
my ($amount, $linetotal, $lastincomeaccno);
- if ($form->{currency} eq $form->{defaultcurrency}) {
+ my ($currencies) = selectfirst_array_query($form, $dbh, qq|SELECT curr FROM defaults|);
+ my $defaultcurrency = (split m/:/, $currencies)[0];
+
+ if ($form->{currency} eq $defaultcurrency) {
$form->{exchangerate} = 1;
} else {
$exchangerate =
$form->{expense_inventory} = "";
+ my %baseunits;
+
foreach my $i (1 .. $form->{rowcount}) {
if ($form->{type} eq "credit_note") {
$form->{"qty_$i"} = $form->parse_amount($myconfig, $form->{"qty_$i"}) * -1;
- $form->{shipped} = 1;
+ $form->{shipped} = 1;
} else {
$form->{"qty_$i"} = $form->parse_amount($myconfig, $form->{"qty_$i"});
}
my $basefactor;
my $basqty;
+ $form->{"marge_percent_$i"} = $form->parse_amount($myconfig, $form->{"marge_percent_$i"}) * 1;
+ $form->{"marge_absolut_$i"} = $form->parse_amount($myconfig, $form->{"marge_absolut_$i"}) * 1;
+ $form->{"lastcost_$i"} = $form->{"lastcost_$i"} * 1;
+
if ($form->{storno}) {
$form->{"qty_$i"} *= -1;
}
- if ($form->{"qty_$i"} != 0) {
-
- # get item baseunit
- $query = qq|SELECT p.unit
- FROM parts p
- WHERE p.id = $form->{"id_$i"}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my ($item_unit) = $sth->fetchrow_array();
- $sth->finish;
+ if ($form->{"id_$i"}) {
+ my $item_unit;
- if ($form->{"inventory_accno_$i"}) {
- if (defined($part_units->{$item_unit}->{factor}) && $part_units->{$item_unit}->{factor} ne '' && $part_units->{$item_unit}->{factor} ne '0') {
- $basefactor = $part_units->{$form->{"unit_$i"}}->{factor} / $part_units->{$item_unit}->{factor};
- } else {
- $basefactor = 1;
- }
- $baseqty = $form->{"qty_$i"} * $basefactor;
+ if (defined($baseunits{$form->{"id_$i"}})) {
+ $item_unit = $baseunits{$form->{"id_$i"}};
} else {
- if (defined($service_units->{$item_unit}->{factor}) && $service_units->{$item_unit}->{factor} ne '' && $service_units->{$item_unit}->{factor} ne '0') {
- $basefactor = $service_units->{$form->{"unit_$i"}}->{factor} / $service_units->{$item_unit}->{factor};
- } else {
- $basefactor = 1;
- }
- $baseqty = $form->{"qty_$i"} * $basefactor;
+ # get item baseunit
+ $query = qq|SELECT unit FROM parts WHERE id = ?|;
+ ($item_unit) = selectrow_query($form, $dbh, $query, conv_i($form->{"id_$i"}));
+ $baseunits{$form->{"id_$i"}} = $item_unit;
}
- map { $form->{"${_}_$i"} =~ s/\'/\'\'/g }
- (qw(partnumber description unit));
+ if (defined($all_units->{$item_unit}->{factor})
+ && ($all_units->{$item_unit}->{factor} ne '')
+ && ($all_units->{$item_unit}->{factor} != 0)) {
+ $basefactor = $all_units->{$form->{"unit_$i"}}->{factor} / $all_units->{$item_unit}->{factor};
+ } else {
+ $basefactor = 1;
+ }
+ $baseqty = $form->{"qty_$i"} * $basefactor;
# undo discount formatting
$form->{"discount_$i"} =
$form->{"sellprice_$i"} = $fxsellprice - $discount;
# add tax rates
- map { $taxrate += $form->{"${_}_rate"} } split / /,
- $form->{"taxaccounts_$i"};
+ map({ $taxrate += $form->{"${_}_rate"} } split(/ /,
+ $form->{"taxaccounts_$i"}));
# round linetotal to 2 decimal places
$linetotal =
map {
$form->{amount}{ $form->{id} }{$_} +=
$taxamount * $form->{"${_}_rate"} / $taxrate
- } split / /, $form->{"taxaccounts_$i"};
+ } split(/ /, $form->{"taxaccounts_$i"});
}
# add amount to income, $form->{amount}{trans_id}{accno}
$form->round_amount($form->{"sellprice_$i"} * $form->{exchangerate},
$decimalplaces);
+ next if $payments_only;
+
if ($form->{"inventory_accno_$i"} || $form->{"assembly_$i"}) {
# adjust parts onhand quantity
if ($form->{"assembly_$i"}) {
# do not update if assembly consists of all services
- $query = qq|SELECT sum(p.inventory_accno_id)
- FROM parts p
- JOIN assembly a ON (a.parts_id = p.id)
- WHERE a.id = $form->{"id_$i"}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $query =
+ qq|SELECT sum(p.inventory_accno_id)
+ FROM parts p
+ JOIN assembly a ON (a.parts_id = p.id)
+ WHERE a.id = ?|;
+ $sth = prepare_execute_query($form, $dbh, $query, conv_i($form->{"id_$i"}));
if ($sth->fetchrow_array) {
- $form->update_balance($dbh, "parts", "onhand",
- qq|id = $form->{"id_$i"}|,
- $baseqty * -1)
+ $form->update_balance($dbh, "parts", "onhand", qq|id = ?|,
+ $baseqty * -1, $form->{"id_$i"})
unless $form->{shipped};
}
$sth->finish;
# record assembly item as allocated
&process_assembly($dbh, $form, $form->{"id_$i"}, $baseqty);
} else {
- $form->update_balance($dbh, "parts", "onhand",
- qq|id = $form->{"id_$i"}|,
- $baseqty * -1)
+ $form->update_balance($dbh, "parts", "onhand", qq|id = ?|,
+ $baseqty * -1, $form->{"id_$i"})
unless $form->{shipped};
$allocated = &cogs($dbh, $form, $form->{"id_$i"}, $baseqty, $basefactor, $i);
}
}
- $project_id = 'NULL';
- if ($form->{"projectnumber_$i"}) {
- $project_id = $form->{"projectnumber_$i"};
- }
- $deliverydate =
- ($form->{"deliverydate_$i"})
- ? qq|'$form->{"deliverydate_$i"}'|
- : "NULL";
-
# get pricegroup_id and save it
- ($null, my $pricegroup_id) = split /--/, $form->{"sellprice_pg_$i"};
+ ($null, my $pricegroup_id) = split(/--/, $form->{"sellprice_pg_$i"});
$pricegroup_id *= 1;
my $subtotal = $form->{"subtotal_$i"} * 1;
# save detail record in invoice table
- $query = qq|INSERT INTO invoice (trans_id, parts_id, description,longdescription, qty,
- sellprice, fxsellprice, discount, allocated, assemblyitem,
- unit, deliverydate, project_id, serialnumber, pricegroup_id,
- ordnumber, transdate, cusordnumber, base_qty, subtotal)
- VALUES ($form->{id}, $form->{"id_$i"},
- '$form->{"description_$i"}', '$form->{"longdescription_$i"}', $form->{"qty_$i"},
- $form->{"sellprice_$i"}, $fxsellprice,
- $form->{"discount_$i"}, $allocated, 'f',
- '$form->{"unit_$i"}', $deliverydate, (SELECT id from project where projectnumber = '$project_id'),
- '$form->{"serialnumber_$i"}', '$pricegroup_id',
- '$form->{"ordnumber_$i"}', '$form->{"transdate_$i"}', '$form->{"cusordnumber_$i"}', $baseqty, '$subtotal')|;
- $dbh->do($query) || $form->dberror($query);
-
- if ($form->{lizenzen}) {
- if ($form->{"licensenumber_$i"}) {
- $query =
- qq|SELECT i.id FROM invoice i WHERE i.trans_id=$form->{id} ORDER BY i.oid DESC LIMIT 1|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($invoice_row_id) = $sth->fetchrow_array;
- $sth->finish;
-
- $query =
- qq|INSERT INTO licenseinvoice (trans_id, license_id) VALUES ($invoice_row_id, $form->{"licensenumber_$i"})|;
- $dbh->do($query) || $form->dberror($query);
- }
+ $query =
+ qq|INSERT INTO invoice (trans_id, parts_id, description, longdescription, qty,
+ sellprice, fxsellprice, discount, allocated, assemblyitem,
+ unit, deliverydate, project_id, serialnumber, pricegroup_id,
+ ordnumber, transdate, cusordnumber, base_qty, subtotal,
+ marge_percent, marge_total, lastcost)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
+
+ @values = (conv_i($form->{id}), conv_i($form->{"id_$i"}),
+ $form->{"description_$i"}, $form->{"longdescription_$i"}, $form->{"qty_$i"},
+ $form->{"sellprice_$i"}, $fxsellprice,
+ $form->{"discount_$i"}, $allocated, 'f',
+ $form->{"unit_$i"}, conv_date($form->{"deliverydate_$i"}), conv_i($form->{"project_id_$i"}),
+ $form->{"serialnumber_$i"}, conv_i($pricegroup_id),
+ $form->{"ordnumber_$i"}, conv_date($form->{"transdate_$i"}),
+ $form->{"cusordnumber_$i"}, $baseqty, $subtotal,
+ $form->{"marge_percent_$i"}, $form->{"marge_absolut_$i"},
+ $form->{"lastcost_$i"});
+ do_query($form, $dbh, $query, @values);
+
+ if ($form->{lizenzen} && $form->{"licensenumber_$i"}) {
+ $query =
+ qq|INSERT INTO licenseinvoice (trans_id, license_id)
+ VALUES ((SELECT id FROM invoice WHERE trans_id = ? ORDER BY oid DESC LIMIT 1), ?)|;
+ @values = (conv_i($form->{"id"}), conv_i($form->{"licensenumber_$i"}));
+ do_query($form, $dbh, $query, @values);
}
-
}
}
$diff += $amount - $netamount * $form->{exchangerate};
$netamount = $amount;
- foreach my $item (split / /, $form->{taxaccounts}) {
+ foreach my $item (split(/ /, $form->{taxaccounts})) {
$amount = $form->{amount}{ $form->{id} }{$item} * $form->{exchangerate};
$form->{amount}{ $form->{id} }{$item} = $form->round_amount($amount, 2);
$tax += $form->{amount}{ $form->{id} }{$item};
$amount = $form->round_amount($netamount * $form->{exchangerate}, 2);
$diff = $amount - $netamount * $form->{exchangerate};
$netamount = $amount;
- foreach my $item (split / /, $form->{taxaccounts}) {
+ foreach my $item (split(/ /, $form->{taxaccounts})) {
$form->{amount}{ $form->{id} }{$item} =
$form->round_amount($form->{amount}{ $form->{id} }{$item}, 2);
$amount =
$form->{amount}{ $form->{id} }{ $form->{AR} } *= -1;
# update exchangerate
- if (($form->{currency} ne $form->{defaultcurrency}) && !$exchangerate) {
+ if (($form->{currency} ne $defaultcurrency) && !$exchangerate) {
$form->update_exchangerate($dbh, $form->{currency}, $form->{invdate},
$form->{exchangerate}, 0);
}
+ $project_id = conv_i($form->{"globalproject_id"});
+
foreach my $trans_id (keys %{ $form->{amount} }) {
foreach my $accno (keys %{ $form->{amount}{$trans_id} }) {
next unless ($form->{expense_inventory} =~ /$accno/);
- if (
- ($form->{amount}{$trans_id}{$accno} =
- $form->round_amount($form->{amount}{$trans_id}{$accno}, 2)
- ) != 0
- ) {
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate, taxkey)
- VALUES ($trans_id, (SELECT c.id FROM chart c
- WHERE c.accno = '$accno'),
- $form->{amount}{$trans_id}{$accno}, '$form->{invdate}',
- (SELECT taxkey_id FROM chart WHERE accno = '$accno'))|;
- $dbh->do($query) || $form->dberror($query);
+
+ $form->{amount}{$trans_id}{$accno} = $form->round_amount($form->{amount}{$trans_id}{$accno}, 2);
+
+ if (!$payments_only && ($form->{amount}{$trans_id}{$accno} != 0)) {
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id)
+ VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?,
+ (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|;
+ @values = (conv_i($trans_id), $accno, $form->{amount}{$trans_id}{$accno}, conv_date($form->{invdate}), $accno, conv_i($project_id));
+ do_query($form, $dbh, $query, @values);
$form->{amount}{$trans_id}{$accno} = 0;
}
}
foreach my $accno (keys %{ $form->{amount}{$trans_id} }) {
- if (
- ($form->{amount}{$trans_id}{$accno} =
- $form->round_amount($form->{amount}{$trans_id}{$accno}, 2)
- ) != 0
- ) {
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate, taxkey)
- VALUES ($trans_id, (SELECT id FROM chart
- WHERE accno = '$accno'),
- $form->{amount}{$trans_id}{$accno}, '$form->{invdate}',
- (SELECT taxkey_id FROM chart WHERE accno = '$accno'))|;
- $dbh->do($query) || $form->dberror($query);
+ $form->{amount}{$trans_id}{$accno} = $form->round_amount($form->{amount}{$trans_id}{$accno}, 2);
+
+ if (!$payments_only && ($form->{amount}{$trans_id}{$accno} != 0)) {
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id)
+ VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?,
+ (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|;
+ @values = (conv_i($trans_id), $accno, $form->{amount}{$trans_id}{$accno}, conv_date($form->{invdate}), $accno, conv_i($project_id));
+ do_query($form, $dbh, $query, @values);
}
}
}
}
}
- # force AR entry if 0
- # $form->{amount}{$form->{id}}{$form->{AR}} = 1 if ($form->{amount}{$form->{id}}{$form->{AR}} == 0);
-
# record payments and offsetting AR
if (!$form->{storno}) {
for my $i (1 .. $form->{paidaccounts}) {
-
- if ($form->{"paid_$i"} != 0) {
- my ($accno) = split /--/, $form->{"AR_paid_$i"};
- $form->{"datepaid_$i"} = $form->{invdate}
- unless ($form->{"datepaid_$i"});
- $form->{datepaid} = $form->{"datepaid_$i"};
-
- $exchangerate = 0;
-
- if ($form->{currency} eq $form->{defaultcurrency}) {
- $form->{"exchangerate_$i"} = 1;
- } else {
- $exchangerate =
- $form->check_exchangerate($myconfig, $form->{currency},
- $form->{"datepaid_$i"}, 'buy');
-
- $form->{"exchangerate_$i"} =
- ($exchangerate)
- ? $exchangerate
+
+ next if ($form->{"paid_$i"} == 0);
+
+ my ($accno) = split(/--/, $form->{"AR_paid_$i"});
+ $form->{"datepaid_$i"} = $form->{invdate}
+ unless ($form->{"datepaid_$i"});
+ $form->{datepaid} = $form->{"datepaid_$i"};
+
+ $exchangerate = 0;
+
+ if ($form->{currency} eq $defaultcurrency) {
+ $form->{"exchangerate_$i"} = 1;
+ } else {
+ $exchangerate =
+ $form->check_exchangerate($myconfig, $form->{currency},
+ $form->{"datepaid_$i"}, 'buy');
+
+ $form->{"exchangerate_$i"} =
+ $exchangerate ? $exchangerate
: $form->parse_amount($myconfig, $form->{"exchangerate_$i"});
- }
-
- # record AR
- $amount =
- $form->round_amount($form->{"paid_$i"} * $form->{exchangerate} + $diff,
- 2);
-
- if ($form->{amount}{ $form->{id} }{ $form->{AR} } != 0) {
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate)
- VALUES ($form->{id}, (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{AR}'),
- $amount, '$form->{"datepaid_$i"}')|;
- $dbh->do($query) || $form->dberror($query);
- }
-
- # record payment
- $form->{"paid_$i"} *= -1;
-
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
- source, memo)
- VALUES ($form->{id}, (SELECT c.id FROM chart c
- WHERE c.accno = '$accno'),
- $form->{"paid_$i"}, '$form->{"datepaid_$i"}',
- '$form->{"source_$i"}', '$form->{"memo_$i"}')|;
- $dbh->do($query) || $form->dberror($query);
-
- # exchangerate difference
- $form->{fx}{$accno}{ $form->{"datepaid_$i"} } +=
- $form->{"paid_$i"} * ($form->{"exchangerate_$i"} - 1) + $diff;
-
- # gain/loss
- $amount =
- $form->{"paid_$i"} * $form->{exchangerate} - $form->{"paid_$i"} *
- $form->{"exchangerate_$i"};
- if ($amount > 0) {
- $form->{fx}{ $form->{fxgain_accno} }{ $form->{"datepaid_$i"} } +=
- $amount;
- } else {
- $form->{fx}{ $form->{fxloss_accno} }{ $form->{"datepaid_$i"} } +=
- $amount;
- }
-
- $diff = 0;
-
- # update exchange rate
- if (($form->{currency} ne $form->{defaultcurrency}) && !$exchangerate) {
- $form->update_exchangerate($dbh, $form->{currency},
- $form->{"datepaid_$i"},
- $form->{"exchangerate_$i"}, 0);
- }
+ }
+
+ # record AR
+ $amount = $form->round_amount($form->{"paid_$i"} * $form->{exchangerate} + $diff, 2);
+
+ if ($form->{amount}{ $form->{id} }{ $form->{AR} } != 0) {
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, project_id)
+ VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?,
+ (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|;
+ @values = (conv_i($form->{"id"}), $form->{AR}, $amount, $form->{"datepaid_$i"}, $form->{AR}, $project_id);
+ do_query($form, $dbh, $query, @values);
+ }
+
+ # record payment
+ $form->{"paid_$i"} *= -1;
+
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, source, memo, taxkey, project_id)
+ VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?,
+ (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|;
+ @values = (conv_i($form->{"id"}), $accno, $form->{"paid_$i"}, $form->{"datepaid_$i"},
+ $form->{"source_$i"}, $form->{"memo_$i"}, $accno, $project_id);
+ do_query($form, $dbh, $query, @values);
+
+ # exchangerate difference
+ $form->{fx}{$accno}{ $form->{"datepaid_$i"} } +=
+ $form->{"paid_$i"} * ($form->{"exchangerate_$i"} - 1) + $diff;
+
+ # gain/loss
+ $amount =
+ $form->{"paid_$i"} * $form->{exchangerate} - $form->{"paid_$i"} *
+ $form->{"exchangerate_$i"};
+ if ($amount > 0) {
+ $form->{fx}{ $form->{fxgain_accno} }{ $form->{"datepaid_$i"} } +=
+ $amount;
+ } else {
+ $form->{fx}{ $form->{fxloss_accno} }{ $form->{"datepaid_$i"} } +=
+ $amount;
+ }
+
+ $diff = 0;
+
+ # update exchange rate
+ if (($form->{currency} ne $defaultcurrency) && !$exchangerate) {
+ $form->update_exchangerate($dbh, $form->{currency},
+ $form->{"datepaid_$i"},
+ $form->{"exchangerate_$i"}, 0);
}
}
+
+ } else { # if (!$form->{storno})
+ $form->{marge_total} *= -1;
+ }
+
+ if ($payments_only) {
+ $query = qq|UPDATE ar SET paid = ?, datepaid = ? WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{paid}, $form->{paid} ? conv_date($form->{datepaid}) : undef, conv_i($form->{id}));
+
+ if (!$provided_dbh) {
+ $dbh->commit();
+ $dbh->disconnect();
+ }
+
+ $main::lxdebug->leave_sub();
+ return;
}
# record exchange rate differences and gains/losses
) != 0
) {
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate, cleared, fx_transaction)
- VALUES ($form->{id},
- (SELECT c.id FROM chart c
- WHERE c.accno = '$accno'),
- $form->{fx}{$accno}{$transdate}, '$transdate', '0', '1')|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, cleared, fx_transaction, taxkey, project_id)
+ VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, '0', '1',
+ (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|;
+ @values = (conv_i($form->{"id"}), $accno, $form->{fx}{$accno}{$transdate}, conv_date($transdate), $accno, $project_id);
+ do_query($form, $dbh, $query, @values);
}
}
}
$amount = $netamount + $tax;
- # set values which could be empty to 0
- $form->{terms} *= 1;
- $form->{taxincluded} *= 1;
- my $datepaid = ($form->{paid}) ? qq|'$form->{datepaid}'| : "NULL";
- my $duedate = ($form->{duedate}) ? qq|'$form->{duedate}'| : "NULL";
- my $deliverydate =
- ($form->{deliverydate}) ? qq|'$form->{deliverydate}'| : "NULL";
-
- # fill in subject if there is none
- $form->{subject} = qq|$form->{label} $form->{invnumber}|
- unless $form->{subject};
-
- # if there is a message stuff it into the intnotes
- my $cc = "Cc: $form->{cc}\\r\n" if $form->{cc};
- my $bcc = "Bcc: $form->{bcc}\\r\n" if $form->{bcc};
- my $now = scalar localtime;
- $form->{intnotes} .= qq|\r
-\r| if $form->{intnotes};
-
- $form->{intnotes} .= qq|[email]\r
-Date: $now
-To: $form->{email}\r
-$cc${bcc}Subject: $form->{subject}\r
-\r
-Message: $form->{message}\r| if $form->{message};
-
# save AR record
$query = qq|UPDATE ar set
- invnumber = '$form->{invnumber}',
- ordnumber = '$form->{ordnumber}',
- quonumber = '$form->{quonumber}',
- cusordnumber = '$form->{cusordnumber}',
- transdate = '$form->{invdate}',
- customer_id = $form->{customer_id},
- amount = $amount,
- netamount = $netamount,
- paid = $form->{paid},
- datepaid = $datepaid,
- duedate = $duedate,
- deliverydate = $deliverydate,
- invoice = '1',
- shippingpoint = '$form->{shippingpoint}',
- shipvia = '$form->{shipvia}',
- terms = $form->{terms},
- notes = '$form->{notes}',
- intnotes = '$form->{intnotes}',
- taxincluded = '$form->{taxincluded}',
- curr = '$form->{currency}',
- department_id = $form->{department_id},
- payment_id = $form->{payment_id},
- type = '$form->{type}',
- language_id = $form->{language_id},
- taxzone_id = $form->{taxzone_id},
- shipto_id = $form->{shipto_id},
- delivery_customer_id = $form->{delivery_customer_id},
- delivery_vendor_id = $form->{delivery_vendor_id},
- employee_id = $form->{employee_id},
- storno = '$form->{storno}',
- cp_id = $form->{contact_id}
- WHERE id = $form->{id}
- |;
- $dbh->do($query) || $form->dberror($query);
-
+ invnumber = ?,
+ ordnumber = ?,
+ quonumber = ?,
+ cusordnumber = ?,
+ transdate = ?,
+ orddate = ?,
+ quodate = ?,
+ customer_id = ?,
+ amount = ?,
+ netamount = ?,
+ paid = ?,
+ datepaid = ?,
+ duedate = ?,
+ deliverydate = ?,
+ invoice = '1',
+ shippingpoint = ?,
+ shipvia = ?,
+ terms = ?,
+ notes = ?,
+ intnotes = ?,
+ taxincluded = ?,
+ curr = ?,
+ department_id = ?,
+ payment_id = ?,
+ type = ?,
+ language_id = ?,
+ taxzone_id = ?,
+ shipto_id = ?,
+ delivery_customer_id = ?,
+ delivery_vendor_id = ?,
+ employee_id = ?,
+ salesman_id = ?,
+ storno = ?,
+ storno_id = ?,
+ globalproject_id = ?,
+ cp_id = ?,
+ transaction_description = ?,
+ marge_total = ?,
+ marge_percent = ?
+ WHERE id = ?|;
+ @values = ($form->{"invnumber"}, $form->{"ordnumber"}, $form->{"quonumber"}, $form->{"cusordnumber"},
+ conv_date($form->{"invdate"}), conv_date($form->{"orddate"}), conv_date($form->{"quodate"}),
+ conv_i($form->{"customer_id"}), $amount, $netamount, $form->{"paid"},
+ conv_date($form->{"datepaid"}), conv_date($form->{"duedate"}), conv_date($form->{"deliverydate"}),
+ $form->{"shippingpoint"}, $form->{"shipvia"}, conv_i($form->{"terms"}),
+ $form->{"notes"}, $form->{"intnotes"}, $form->{"taxincluded"} ? 't' : 'f',
+ $form->{"currency"}, conv_i($form->{"department_id"}), conv_i($form->{"payment_id"}),
+ $form->{"type"}, conv_i($form->{"language_id"}), conv_i($form->{"taxzone_id"}),
+ conv_i($form->{"shipto_id"}),
+ conv_i($form->{"delivery_customer_id"}), conv_i($form->{"delivery_vendor_id"}),
+ conv_i($form->{"employee_id"}), conv_i($form->{"salesman_id"}),
+ $form->{"storno"} ? 't' : 'f', conv_i($form->{storno_id}), conv_i($form->{"globalproject_id"}),
+ conv_i($form->{"cp_id"}), $form->{transaction_description},
+ $form->{marge_total} * 1, $form->{marge_percent} * 1,
+ conv_i($form->{"id"}));
+ do_query($form, $dbh, $query, @values);
+
+ if($form->{"formname"} eq "credit_note") {
+ for my $i (1 .. $form->{paidaccounts}) {
+ $query = qq|UPDATE parts SET onhand = onhand - ? WHERE id = ?|;
+ @values = (conv_i($form->{"qty_$i"}), conv_i($form->{"id_$i"}));
+ do_query($form, $dbh, $query, @values);
+ }
+ }
+
if ($form->{storno}) {
- $query = qq| update ar set paid=paid+amount where id=$form->{storno_id}|;
- $dbh->do($query) || $form->dberror($query);
- $query = qq| update ar set storno='$form->{storno}' where id=$form->{storno_id}|;
- $dbh->do($query) || $form->dberror($query);
- $query = qq§ update ar set intnotes='Rechnung storniert am $form->{invdate} ' || intnotes where id=$form->{storno_id}§;
- $dbh->do($query) || $form->dberror($query);
-
- $query = qq| update ar set paid=amount where id=$form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq!UPDATE ar SET
+ paid = paid + amount,
+ storno = 't',
+ intnotes = ? || intnotes
+ WHERE id = ?!;
+ do_query($form, $dbh, $query, "Rechnung storniert am $form->{invdate} ", conv_i($form->{"storno_id"}));
+ do_query($form, $dbh, qq|UPDATE ar SET paid = amount WHERE id = ?|, conv_i($form->{"id"}));
}
- $form->{pago_total} = $amount;
-
# add shipto
$form->{name} = $form->{customer};
$form->{name} =~ s/--$form->{customer_id}//;
# save printed, emailed and queued
$form->save_status($dbh);
- if ($form->{webdav}) {
- &webdav_folder($myconfig, $form);
- }
+ Common::webdav_folder($form) if ($main::webdav);
- my $rc = $dbh->commit;
- $dbh->disconnect;
+ my $rc = 1;
+ if (!$provided_dbh) {
+ $dbh->commit();
+ $dbh->disconnect();
+ }
$main::lxdebug->leave_sub();
return $rc;
}
+sub _delete_payments {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $form, $dbh) = @_;
+
+ my @delete_oids;
+
+ # Delete old payment entries from acc_trans.
+ my $query =
+ qq|SELECT oid
+ FROM acc_trans
+ WHERE (trans_id = ?) AND fx_transaction
+
+ UNION
+
+ SELECT at.oid
+ FROM acc_trans at
+ LEFT JOIN chart c ON (at.chart_id = c.id)
+ WHERE (trans_id = ?) AND (c.link LIKE '%AR_paid%')|;
+ push @delete_oids, selectall_array_query($form, $dbh, $query, conv_i($form->{id}), conv_i($form->{id}));
+
+ $query =
+ qq|SELECT at.oid
+ FROM acc_trans at
+ LEFT JOIN chart c ON (at.chart_id = c.id)
+ WHERE (trans_id = ?)
+ AND ((c.link = 'AR') OR (c.link LIKE '%:AR') OR (c.link LIKE 'AR:%'))
+ ORDER BY at.oid
+ OFFSET 1|;
+ push @delete_oids, selectall_array_query($form, $dbh, $query, conv_i($form->{id}));
+
+ if (@delete_oids) {
+ $query = qq|DELETE FROM acc_trans WHERE oid IN (| . join(", ", @delete_oids) . qq|)|;
+ do_query($form, $dbh, $query);
+ }
+
+ $main::lxdebug->leave_sub();
+}
+
sub post_payment {
$main::lxdebug->enter_sub();
# connect to database, turn off autocommit
my $dbh = $form->dbconnect_noauto($myconfig);
- $form->{datepaid} = $form->{invdate};
+ my (%payments, $old_form, $row, $item, $query, %keep_vars);
- # total payments, don't move we need it here
- for my $i (1 .. $form->{paidaccounts}) {
- if ($form->{type} eq "credit_note") {
- $form->{"paid_$i"} = $form->parse_amount($myconfig, $form->{"paid_$i"}) * -1;
- } else {
- $form->{"paid_$i"} = $form->parse_amount($myconfig, $form->{"paid_$i"});
- }
- $form->{paid} += $form->{"paid_$i"};
- $form->{datepaid} = $form->{"datepaid_$i"} if ($form->{"datepaid_$i"});
- }
+ $old_form = save_form();
- $form->{exchangerate} =
- $form->get_exchangerate($dbh, $form->{currency}, $form->{invdate},
- "buy");
+ # Delete all entries in acc_trans from prior payments.
+ $self->_delete_payments($form, $dbh);
- # record payments and offsetting AR
- for my $i (1 .. $form->{paidaccounts}) {
+ # Save the new payments the user made before cleaning up $form.
+ map { $payments{$_} = $form->{$_} } grep m/^datepaid_\d+$|^memo_\d+$|^source_\d+$|^exchangerate_\d+$|^paid_\d+$|^AR_paid_\d+$|^paidaccounts$/, keys %{ $form };
- if ($form->{"paid_$i"} != 0) {
- my ($accno) = split /--/, $form->{"AR_paid_$i"};
- $form->{"datepaid_$i"} = $form->{invdate}
- unless ($form->{"datepaid_$i"});
- $form->{datepaid} = $form->{"datepaid_$i"};
+ # Clean up $form so that old content won't tamper the results.
+ %keep_vars = map { $_, 1 } qw(login password id);
+ map { delete $form->{$_} unless $keep_vars{$_} } keys %{ $form };
- $exchangerate = 0;
- if (($form->{currency} eq $form->{defaultcurrency}) || ($form->{defaultcurrency} eq "")) {
- $form->{"exchangerate_$i"} = 1;
- } else {
- $exchangerate =
- $form->check_exchangerate($myconfig, $form->{currency},
- $form->{"datepaid_$i"}, 'buy');
+ # Retrieve the invoice from the database.
+ $self->retrieve_invoice($myconfig, $form);
- $form->{"exchangerate_$i"} =
- ($exchangerate)
- ? $exchangerate
- : $form->parse_amount($myconfig, $form->{"exchangerate_$i"});
- }
+ # Set up the content of $form in the way that IS::post_invoice() expects.
+ $form->{exchangerate} = $form->format_amount($myconfig, $form->{exchangerate});
- # record AR
- $amount =
- $form->round_amount($form->{"paid_$i"} * $form->{"exchangerate"},
- 2);
+ for $row (1 .. scalar @{ $form->{invoice_details} }) {
+ $item = $form->{invoice_details}->[$row - 1];
+ map { $item->{$_} = $form->format_amount($myconfig, $item->{$_}) } qw(qty sellprice discount);
- $query = qq|DELETE FROM acc_trans WHERE trans_id=$form->{id} AND chart_id=(SELECT c.id FROM chart c
- WHERE c.accno = '$form->{AR}') AND amount=$amount AND transdate='$form->{"datepaid_$i"}'|;
- $dbh->do($query) || $form->dberror($query);
+ map { $form->{"${_}_${row}"} = $item->{$_} } keys %{ $item };
+ }
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate)
- VALUES ($form->{id}, (SELECT c.id FROM chart c
- WHERE c.accno = '$form->{AR}'),
- $amount, '$form->{"datepaid_$i"}')|;
- $dbh->do($query) || $form->dberror($query);
+ $form->{rowcount} = scalar @{ $form->{invoice_details} };
+ delete @{$form}{qw(invoice_details paidaccounts storno paid)};
- # record payment
- $form->{"paid_$i"} *= -1;
+ # Restore the payment options from the user input.
+ map { $form->{$_} = $payments{$_} } keys %payments;
- $query = qq|DELETE FROM acc_trans WHERE trans_id=$form->{id} AND chart_id=(SELECT c.id FROM chart c
- WHERE c.accno = '$accno') AND amount=$form->{"paid_$i"} AND transdate='$form->{"datepaid_$i"}' AND source='$form->{"source_$i"}' AND memo='$form->{"memo_$i"}'|;
- $dbh->do($query) || $form->dberror($query);
+ # Get the AR accno (which is normally done by Form::create_links()).
+ $query =
+ qq|SELECT c.accno
+ FROM acc_trans at
+ LEFT JOIN chart c ON (at.chart_id = c.id)
+ WHERE (trans_id = ?)
+ AND ((c.link = 'AR') OR (c.link LIKE '%:AR') OR (c.link LIKE 'AR:%'))
+ ORDER BY at.oid
+ LIMIT 1|;
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
- source, memo)
- VALUES ($form->{id}, (SELECT c.id FROM chart c
- WHERE c.accno = '$accno'),
- $form->{"paid_$i"}, '$form->{"datepaid_$i"}',
- '$form->{"source_$i"}', '$form->{"memo_$i"}')|;
- $dbh->do($query) || $form->dberror($query);
+ ($form->{AR}) = selectfirst_array_query($form, $dbh, $query, conv_i($form->{id}));
+ # Post the new payments.
+ $self->post_invoice($myconfig, $form, $dbh, 1);
- # gain/loss
- $amount =
- $form->{"paid_$i"} * $form->{exchangerate} - $form->{"paid_$i"} *
- $form->{"exchangerate_$i"};
- if ($amount > 0) {
- $form->{fx}{ $form->{fxgain_accno} }{ $form->{"datepaid_$i"} } +=
- $amount;
- } else {
- $form->{fx}{ $form->{fxloss_accno} }{ $form->{"datepaid_$i"} } +=
- $amount;
- }
+ restore_form($old_form);
- $diff = 0;
-
- # update exchange rate
- if (($form->{currency} ne $form->{defaultcurrency}) && !$exchangerate) {
- $form->update_exchangerate($dbh, $form->{currency},
- $form->{"datepaid_$i"},
- $form->{"exchangerate_$i"}, 0);
- }
- }
- }
-
- # record exchange rate differences and gains/losses
- foreach my $accno (keys %{ $form->{fx} }) {
- foreach my $transdate (keys %{ $form->{fx}{$accno} }) {
- if (
- ($form->{fx}{$accno}{$transdate} =
- $form->round_amount($form->{fx}{$accno}{$transdate}, 2)
- ) != 0
- ) {
- $query = qq|DELETE FROM acc_trans WHERE trans_id=$form->{id} AND chart_id=(SELECT c.id FROM chart c
- WHERE c.accno = '$accno') AND amount=$form->{fx}{$accno}{$transdate} AND transdate='$transdate' AND cleared='0' AND fx_transaction='1'|;
- $dbh->do($query) || $form->dberror($query);
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
- transdate, cleared, fx_transaction)
- VALUES ($form->{id},
- (SELECT c.id FROM chart c
- WHERE c.accno = '$accno'),
- $form->{fx}{$accno}{$transdate}, '$transdate', '0', '1')|;
- $dbh->do($query) || $form->dberror($query);
- }
- }
- }
- my $datepaid = ($form->{paid}) ? qq|'$form->{datepaid}'| : "NULL";
-
- # save AR record
- my $query = qq|UPDATE ar set
- paid = $form->{paid},
- datepaid = $datepaid
- WHERE id=$form->{id}|;
-
- $dbh->do($query) || $form->dberror($query);
-
- my $rc = $dbh->commit;
- $dbh->disconnect;
+ my $rc = $dbh->commit();
+ $dbh->disconnect();
$main::lxdebug->leave_sub();
my ($dbh, $form, $id, $totalqty) = @_;
- my $query = qq|SELECT a.parts_id, a.qty, p.assembly,
- p.partnumber, p.description, p.unit,
- p.inventory_accno_id, p.income_accno_id,
- p.expense_accno_id
- FROM assembly a
- JOIN parts p ON (a.parts_id = p.id)
- WHERE a.id = $id|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $query =
+ qq|SELECT a.parts_id, a.qty, p.assembly, p.partnumber, p.description, p.unit,
+ p.inventory_accno_id, p.income_accno_id, p.expense_accno_id
+ FROM assembly a
+ JOIN parts p ON (a.parts_id = p.id)
+ WHERE (a.id = ?)|;
+ my $sth = prepare_execute_query($form, $dbh, $query, conv_i($id));
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
$ref->{inventory_accno_id} *= 1;
$ref->{expense_accno_id} *= 1;
- map { $ref->{$_} =~ s/\'/\'\'/g } (qw(partnumber description unit));
-
# multiply by number of assemblies
$ref->{qty} *= $totalqty;
}
# save detail record for individual assembly item in invoice table
- $query = qq|INSERT INTO invoice (trans_id, description, parts_id, qty,
- sellprice, fxsellprice, allocated, assemblyitem, unit)
- VALUES
- ($form->{id}, '$ref->{description}',
- $ref->{parts_id}, $ref->{qty}, 0, 0, $allocated, 't',
- '$ref->{unit}')|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|INSERT INTO invoice (trans_id, description, parts_id, qty, sellprice, fxsellprice, allocated, assemblyitem, unit)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)|;
+ @values = (conv_i($form->{id}), $ref->{description}, conv_i($ref->{parts_id}), $ref->{qty}, 0, 0, $allocated, 't', $ref->{unit});
+ do_query($form, $dbh, $query, @values);
}
my ($dbh, $form, $id, $totalqty, $basefactor, $row) = @_;
$form->{taxzone_id} *=1;
- my $transdate = ($form->{invdate}) ? "'$form->{invdate}'" : "current_date";
- my $query = qq|SELECT i.id, i.trans_id, i.base_qty, i.allocated, i.sellprice,
- c1.accno AS inventory_accno, c1.new_chart_id AS inventory_new_chart, date($transdate) - c1.valid_from as inventory_valid,
- c2.accno AS income_accno, c2.new_chart_id AS income_new_chart, date($transdate) - c2.valid_from as income_valid,
- c3.accno AS expense_accno, c3.new_chart_id AS expense_new_chart, date($transdate) - c3.valid_from as expense_valid
- FROM invoice i, parts p
- LEFT JOIN chart c1 ON ((select inventory_accno_id from buchungsgruppen where id=p.buchungsgruppen_id) = c1.id)
- LEFT JOIN chart c2 ON ((select income_accno_id_$form->{taxzone_id} from buchungsgruppen where id=p.buchungsgruppen_id) = c2.id)
- LEFT JOIN chart c3 ON ((select expense_accno_id_$form->{taxzone_id} from buchungsgruppen where id=p.buchungsgruppen_id) = c3.id)
- WHERE i.parts_id = p.id
- AND i.parts_id = $id
- AND (i.base_qty + i.allocated) < 0
- ORDER BY trans_id|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $transdate = $form->{invdate} ? $dbh->quote($form->{invdate}) : "current_date";
+ my $taxzone_id = $form->{"taxzone_id"} * 1;
+ my $query =
+ qq|SELECT i.id, i.trans_id, i.base_qty, i.allocated, i.sellprice,
+ c1.accno AS inventory_accno, c1.new_chart_id AS inventory_new_chart, date($transdate) - c1.valid_from AS inventory_valid,
+ c2.accno AS income_accno, c2.new_chart_id AS income_new_chart, date($transdate) - c2.valid_from AS income_valid,
+ c3.accno AS expense_accno, c3.new_chart_id AS expense_new_chart, date($transdate) - c3.valid_from AS expense_valid
+ FROM invoice i, parts p
+ LEFT JOIN chart c1 ON ((SELECT inventory_accno_id FROM buchungsgruppen WHERE id = p.buchungsgruppen_id) = c1.id)
+ LEFT JOIN chart c2 ON ((SELECT income_accno_id_${taxzone_id} FROM buchungsgruppen WHERE id = p.buchungsgruppen_id) = c2.id)
+ LEFT JOIN chart c3 ON ((select expense_accno_id_${taxzone_id} FROM buchungsgruppen WHERE id = p.buchungsgruppen_id) = c3.id)
+ WHERE (i.parts_id = p.id)
+ AND (i.parts_id = ?)
+ AND ((i.base_qty + i.allocated) < 0)
+ ORDER BY trans_id|;
+ my $sth = prepare_execute_query($form, $dbh, $query, conv_i($id));
my $allocated = 0;
my $qty;
$qty = $totalqty;
}
- $form->update_balance($dbh, "invoice", "allocated", qq|id = $ref->{id}|,
- $qty);
+ $form->update_balance($dbh, "invoice", "allocated", qq|id = $ref->{id}|, $qty);
# total expenses and inventory
# sellprice is the cost of the item
}
# add allocated
- $allocated += -$qty;
+ $allocated -= $qty;
last if (($totalqty -= $qty) <= 0);
}
my ($dbh, $form) = @_;
# reverse inventory items
- my $query = qq|SELECT i.id, i.parts_id, i.qty, i.assemblyitem, p.assembly,
- p.inventory_accno_id
- FROM invoice i
- JOIN parts p ON (i.parts_id = p.id)
- WHERE i.trans_id = $form->{id}|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $query =
+ qq|SELECT i.id, i.parts_id, i.qty, i.assemblyitem, p.assembly, p.inventory_accno_id
+ FROM invoice i
+ JOIN parts p ON (i.parts_id = p.id)
+ WHERE i.trans_id = ?|;
+ my $sth = prepare_execute_query($form, $dbh, $query, conv_i($form->{"id"}));
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
if (!$ref->{assemblyitem}) {
# adjust onhand in parts table
- $form->update_balance($dbh, "parts", "onhand",
- qq|id = $ref->{parts_id}|,
- $ref->{qty});
+ $form->update_balance($dbh, "parts", "onhand", qq|id = $ref->{parts_id}|, $ref->{qty});
}
# loop if it is an assembly
next if ($ref->{assembly});
# de-allocated purchases
- $query = qq|SELECT i.id, i.trans_id, i.allocated
- FROM invoice i
- WHERE i.parts_id = $ref->{parts_id}
- AND i.allocated > 0
- ORDER BY i.trans_id DESC|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while (my $inhref = $sth->fetchrow_hashref(NAME_lc)) {
+ $query =
+ qq|SELECT i.id, i.trans_id, i.allocated
+ FROM invoice i
+ WHERE (i.parts_id = ?) AND (i.allocated > 0)
+ ORDER BY i.trans_id DESC|;
+ my $sth2 = prepare_execute_query($form, $dbh, $query, conv_i($ref->{"parts_id"}));
+
+ while (my $inhref = $sth2->fetchrow_hashref(NAME_lc)) {
$qty = $ref->{qty};
if (($ref->{qty} - $inhref->{allocated}) > 0) {
$qty = $inhref->{allocated};
}
# update invoice
- $form->update_balance($dbh, "invoice", "allocated",
- qq|id = $inhref->{id}|,
- $qty * -1);
+ $form->update_balance($dbh, "invoice", "allocated", qq|id = $inhref->{id}|, $qty * -1);
last if (($ref->{qty} -= $qty) <= 0);
}
- $sth->finish;
+ $sth2->finish;
}
}
$sth->finish;
# delete acc_trans
- $query = qq|DELETE FROM acc_trans
- WHERE trans_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
-
- # delete invoice entries
- $query = qq|DELETE FROM invoice
- WHERE trans_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ @values = (conv_i($form->{id}));
+ do_query($form, $dbh, qq|DELETE FROM acc_trans WHERE trans_id = ?|, @values);
+ do_query($form, $dbh, qq|DELETE FROM invoice WHERE trans_id = ?|, @values);
if ($form->{lizenzen}) {
- $query = qq|DELETE FROM licenseinvoice
- WHERE trans_id in (SELECT id FROM invoice WHERE trans_id = $form->{id})|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|DELETE FROM licenseinvoice
+ WHERE trans_id in (SELECT id FROM invoice WHERE trans_id = ?)|;
+ do_query($form, $dbh, $query, @values);
}
- $query = qq|DELETE FROM shipto
- WHERE trans_id = $form->{id} AND module = 'AR'|;
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, qq|DELETE FROM shipto WHERE (trans_id = ?) AND (module = 'AR')|, @values);
$main::lxdebug->leave_sub();
}
&reverse_invoice($dbh, $form);
+ my @values = (conv_i($form->{id}));
+
# delete AR record
- my $query = qq|DELETE FROM ar
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, qq|DELETE FROM ar WHERE id = ?|, @values);
# delete spool files
- $query = qq|SELECT s.spoolfile FROM status s
- WHERE s.trans_id = $form->{id}|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
-
- my $spoolfile;
- my @spoolfiles = ();
-
- while (($spoolfile) = $sth->fetchrow_array) {
- push @spoolfiles, $spoolfile;
- }
- $sth->finish;
+ my @spoolfiles = selectall_array_query($form, $dbh, qq|SELECT spoolfile FROM status WHERE trans_id = ?|, @values);
# delete status entries
- $query = qq|DELETE FROM status
- WHERE trans_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, qq|DELETE FROM status WHERE trans_id = ?|, @values);
my $rc = $dbh->commit;
$dbh->disconnect;
if ($rc) {
- foreach $spoolfile (@spoolfiles) {
- unlink "$spool/$spoolfile" if $spoolfile;
- }
+ map { unlink "$spool/$_" if -f "$spool/$_"; } @{ $spoolfiles };
}
$main::lxdebug->leave_sub();
# connect to database
my $dbh = $form->dbconnect_noauto($myconfig);
- my $query;
+ my ($sth, $ref, $query);
- if ($form->{id}) {
+ my $query_transdate = ", current_date AS invdate" if !$form->{id};
- # get default accounts and last invoice number
- $query = qq|SELECT (SELECT c.accno FROM chart c
- WHERE d.inventory_accno_id = c.id) AS inventory_accno,
- (SELECT c.accno FROM chart c
- WHERE d.income_accno_id = c.id) AS income_accno,
- (SELECT c.accno FROM chart c
- WHERE d.expense_accno_id = c.id) AS expense_accno,
- (SELECT c.accno FROM chart c
- WHERE d.fxgain_accno_id = c.id) AS fxgain_accno,
- (SELECT c.accno FROM chart c
- WHERE d.fxloss_accno_id = c.id) AS fxloss_accno,
- d.curr AS currencies
- FROM defaults d|;
- } else {
- $query = qq|SELECT (SELECT c.accno FROM chart c
- WHERE d.inventory_accno_id = c.id) AS inventory_accno,
- (SELECT c.accno FROM chart c
- WHERE d.income_accno_id = c.id) AS income_accno,
- (SELECT c.accno FROM chart c
- WHERE d.expense_accno_id = c.id) AS expense_accno,
- (SELECT c.accno FROM chart c
- WHERE d.fxgain_accno_id = c.id) AS fxgain_accno,
- (SELECT c.accno FROM chart c
- WHERE d.fxloss_accno_id = c.id) AS fxloss_accno,
- d.curr AS currencies, current_date AS invdate
- FROM defaults d|;
- }
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $query =
+ qq|SELECT
+ (SELECT c.accno FROM chart c WHERE d.inventory_accno_id = c.id) AS inventory_accno,
+ (SELECT c.accno FROM chart c WHERE d.income_accno_id = c.id) AS income_accno,
+ (SELECT c.accno FROM chart c WHERE d.expense_accno_id = c.id) AS expense_accno,
+ (SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id) AS fxgain_accno,
+ (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno,
+ d.curr AS currencies
+ ${query_transdate}
+ FROM defaults d|;
- my $ref = $sth->fetchrow_hashref(NAME_lc);
- map { $form->{$_} = $ref->{$_} } keys %$ref;
- $sth->finish;
+ $ref = selectfirst_hashref_query($form, $dbh, $query);
+ map { $form->{$_} = $ref->{$_} } keys %{ $ref };
if ($form->{id}) {
+ my $id = conv_i($form->{id});
# retrieve invoice
- $query = qq|SELECT a.invnumber, a.ordnumber, a.quonumber, a.cusordnumber,
- a.transdate AS invdate, a.deliverydate, a.paid, a.storno, a.gldate,
- a.shippingpoint, a.shipvia, a.terms, a.notes, a.intnotes, a.taxzone_id,
- a.duedate, a.taxincluded, a.curr AS currency, a.shipto_id, a.cp_id,
- a.employee_id, e.name AS employee, a.payment_id, a.language_id, a.delivery_customer_id, a.delivery_vendor_id, a.type
- FROM ar a
- LEFT JOIN employee e ON (e.id = a.employee_id)
- WHERE a.id = $form->{id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $query =
+ qq|SELECT
+ a.invnumber, a.ordnumber, a.quonumber, a.cusordnumber,
+ a.orddate, a.quodate, a.globalproject_id,
+ a.transdate AS invdate, a.deliverydate, a.paid, a.storno, a.gldate,
+ a.shippingpoint, a.shipvia, a.terms, a.notes, a.intnotes, a.taxzone_id,
+ a.duedate, a.taxincluded, a.curr AS currency, a.shipto_id, a.cp_id,
+ a.employee_id, a.salesman_id, a.payment_id,
+ a.language_id, a.delivery_customer_id, a.delivery_vendor_id, a.type,
+ a.transaction_description,
+ a.marge_total, a.marge_percent,
+ e.name AS employee
+ FROM ar a
+ LEFT JOIN employee e ON (e.id = a.employee_id)
+ WHERE a.id = ?|;
+ $ref = selectfirst_hashref_query($form, $dbh, $query, $id);
+ map { $form->{$_} = $ref->{$_} } keys %{ $ref };
- $ref = $sth->fetchrow_hashref(NAME_lc);
- map { $form->{$_} = $ref->{$_} } keys %$ref;
- $sth->finish;
$form->{exchangerate} =
- $form->get_exchangerate($dbh, $form->{currency}, $form->{invdate},
- "buy");
- # get shipto
- $query = qq|SELECT s.* FROM shipto s
- WHERE s.trans_id = $form->{id} AND s.module = 'AR'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- $ref = $sth->fetchrow_hashref(NAME_lc);
- delete($ref->{id});
- map { $form->{$_} = $ref->{$_} } keys %$ref;
- $sth->finish;
-
- if ($form->{delivery_customer_id}) {
- $query = qq|SELECT name FROM customer WHERE id=$form->{delivery_customer_id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- ($form->{delivery_customer_string}) = $sth->fetchrow_array();
- $sth->finish;
- }
+ $form->get_exchangerate($dbh, $form->{currency}, $form->{invdate}, "buy");
- if ($form->{delivery_vendor_id}) {
- $query = qq|SELECT name FROM customer WHERE id=$form->{delivery_vendor_id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- ($form->{delivery_vendor_string}) = $sth->fetchrow_array();
- $sth->finish;
+ # get shipto
+ $query = qq|SELECT * FROM shipto WHERE (trans_id = ?) AND (module = 'AR')|;
+ $ref = selectfirst_hashref_query($form, $dbh, $query, $id);
+ delete $ref->{id};
+ map { $form->{$_} = $ref->{$_} } keys %{ $ref };
+
+ foreach my $vc (qw(customer vendor)) {
+ next if !$form->{"delivery_${vc}_id"};
+ ($form->{"delivery_${vc}_string"})
+ = selectrow_query($form, $dbh, qq|SELECT name FROM customer WHERE id = ?|, $id);
}
# get printed, emailed
- $query = qq|SELECT s.printed, s.emailed, s.spoolfile, s.formname
- FROM status s
- WHERE s.trans_id = $form->{id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $query =
+ qq|SELECT printed, emailed, spoolfile, formname
+ FROM status
+ WHERE trans_id = ?|;
+ $sth = prepare_execute_query($form, $dbh, $query, $id);
while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
$form->{printed} .= "$ref->{formname} " if $ref->{printed};
my $transdate =
$form->{deliverydate} ? $dbh->quote($form->{deliverydate}) :
- $form->{invdate} ? $dbh->quote($form->{invdate}) :
- "current_date";
+ $form->{invdate} ? $dbh->quote($form->{invdate}) :
+ "current_date";
+
+ my $taxzone_id = $form->{taxzone_id} *= 1;
+ $taxzone_id = 0 if (0 > $taxzone_id) || (3 < $taxzone_id);
- if (!$form->{taxzone_id}) {
- $form->{taxzone_id} = 0;
- }
# retrieve individual items
- $query = qq|SELECT
- c1.accno AS inventory_accno, c1.new_chart_id AS inventory_new_chart, date($transdate) - c1.valid_from as inventory_valid,
- c2.accno AS income_accno, c2.new_chart_id AS income_new_chart, date($transdate) - c2.valid_from as income_valid,
- c3.accno AS expense_accno, c3.new_chart_id AS expense_new_chart, date($transdate) - c3.valid_from as expense_valid,
- i.description, i.longdescription, i.qty, i.fxsellprice AS sellprice,
- i.discount, i.parts_id AS id, i.unit, i.deliverydate,
- i.project_id, pr.projectnumber, i.serialnumber,
- p.partnumber, p.assembly, p.bin, p.notes AS partnotes, p.inventory_accno_id AS part_inventory_accno_id, i.id AS invoice_pos,
- pg.partsgroup, i.pricegroup_id, (SELECT pricegroup FROM pricegroup WHERE id=i.pricegroup_id) as pricegroup,
- i.ordnumber, i.transdate, i.cusordnumber, p.formel, i.subtotal
- FROM invoice i
- JOIN parts p ON (i.parts_id = p.id)
- LEFT JOIN project pr ON (i.project_id = pr.id)
- LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
- LEFT JOIN chart c1 ON ((select inventory_accno_id from buchungsgruppen where id=p.buchungsgruppen_id) = c1.id)
- LEFT JOIN chart c2 ON ((select income_accno_id_$form->{taxzone_id} from buchungsgruppen where id=p.buchungsgruppen_id) = c2.id)
- LEFT JOIN chart c3 ON ((select expense_accno_id_$form->{taxzone_id} from buchungsgruppen where id=p.buchungsgruppen_id) = c3.id)
- WHERE i.trans_id = $form->{id}
- AND NOT i.assemblyitem = '1'
- ORDER BY i.id|;
- $sth = $dbh->prepare($query);
+ $query =
+ qq|SELECT
+ c1.accno AS inventory_accno,
+ c1.new_chart_id AS inventory_new_chart,
+ date($transdate) - c1.valid_from AS inventory_valid,
+
+ c2.accno AS income_accno,
+ c2.new_chart_id AS income_new_chart,
+ date($transdate) - c2.valid_from as income_valid,
+
+ c3.accno AS expense_accno,
+ c3.new_chart_id AS expense_new_chart,
+ date($transdate) - c3.valid_from AS expense_valid,
+
+ i.description, i.longdescription, i.qty, i.fxsellprice AS sellprice,
+ i.discount, i.parts_id AS id, i.unit, i.deliverydate,
+ i.project_id, i.serialnumber, i.id AS invoice_pos, i.pricegroup_id,
+ i.ordnumber, i.transdate, i.cusordnumber, i.subtotal, i.lastcost,
+
+ p.partnumber, p.assembly, p.bin, p.notes AS partnotes,
+ p.inventory_accno_id AS part_inventory_accno_id, p.formel,
+
+ pr.projectnumber,
+ pg.partsgroup,
+ prg.pricegroup
+
+ FROM invoice i
+ LEFT JOIN parts p ON (i.parts_id = p.id)
+ LEFT JOIN project pr ON (i.project_id = pr.id)
+ LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
+ LEFT JOIN pricegroup prg ON (i.pricegroup_id = prg.id)
+
+ LEFT JOIN chart c1 ON
+ ((SELECT inventory_accno_id
+ FROM buchungsgruppen
+ WHERE id = p.buchungsgruppen_id) = c1.id)
+ LEFT JOIN chart c2 ON
+ ((SELECT income_accno_id_${taxzone_id}
+ FROM buchungsgruppen
+ WHERE id=p.buchungsgruppen_id) = c2.id)
+ LEFT JOIN chart c3 ON
+ ((SELECT expense_accno_id_${taxzone_id}
+ FROM buchungsgruppen
+ WHERE id = p.buchungsgruppen_id) = c3.id)
+
+ WHERE (i.trans_id = ?)
+ AND NOT (i.assemblyitem = '1')
+ ORDER BY i.id|;
+
+ $sth = prepare_execute_query($form, $dbh, $query, $id);
- $sth->execute || $form->dberror($query);
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
if (!$ref->{"part_inventory_accno_id"}) {
map({ delete($ref->{$_}); } qw(inventory_accno inventory_new_chart inventory_valid));
}
delete($ref->{"part_inventory_accno_id"});
- while ($ref->{inventory_new_chart} && ($ref->{inventory_valid} >=0)) {
- my $query = qq| SELECT accno AS inventory_accno, new_chart_id AS inventory_new_chart, date($transdate) - valid_from AS inventory_valid FROM chart WHERE id = $ref->{inventory_new_chart}|;
- my $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
- ($ref->{inventory_accno}, $ref->{inventory_new_chart}, $ref->{inventory_valid}) = $stw->fetchrow_array;
- $stw->finish;
- }
-
- while ($ref->{income_new_chart} && ($ref->{income_valid} >=0)) {
- my $query = qq| SELECT accno AS income_accno, new_chart_id AS income_new_chart, date($transdate) - valid_from AS income_valid FROM chart WHERE id = $ref->{income_new_chart}|;
- my $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
- ($ref->{income_accno}, $ref->{income_new_chart}, $ref->{income_valid}) = $stw->fetchrow_array;
- $stw->finish;
- }
-
- while ($ref->{expense_new_chart} && ($ref->{expense_valid} >=0)) {
- my $query = qq| SELECT accno AS expense_accno, new_chart_id AS expense_new_chart, date($transdate) - valid_from AS expense_valid FROM chart WHERE id = $ref->{expense_new_chart}|;
- my $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
- ($ref->{expense_accno}, $ref->{expense_new_chart}, $ref->{expense_valid}) = $stw->fetchrow_array;
- $stw->finish;
- }
+ foreach my $type (qw(inventory income expense)) {
+ while ($ref->{"${type}_new_chart"} && ($ref->{"${type}_valid"} >=0)) {
+ my $query =
+ qq|SELECT accno, new_chart_id, date($transdate) - valid_from
+ FROM chart
+ WHERE id = ?|;
+ ($ref->{"${type}_accno"},
+ $ref->{"${type}_new_chart"},
+ $ref->{"${type}_valid"})
+ = selectrow_query($form, $dbh, $query, $ref->{"${type}_new_chart"});
+ }
+ }
# get tax rates and description
- $accno_id =
+ my $accno_id =
($form->{vc} eq "customer") ? $ref->{income_accno} : $ref->{expense_accno};
- $query = qq|SELECT c.accno, t.taxdescription, t.rate, t.taxnumber
- FROM tax t LEFT JOIN chart c on (c.id=t.chart_id)
- WHERE t.id in (SELECT tk.tax_id from taxkeys tk where tk.chart_id = (SELECT id from chart WHERE accno='$accno_id') AND startdate<=$transdate ORDER BY startdate desc LIMIT 1)
- ORDER BY c.accno|;
- $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
+ $query =
+ qq|SELECT c.accno, t.taxdescription, t.rate, t.taxnumber
+ FROM tax t
+ LEFT JOIN chart c ON (c.id = t.chart_id)
+ WHERE t.id IN
+ (SELECT tk.tax_id
+ FROM taxkeys tk
+ WHERE tk.chart_id = (SELECT id FROM chart WHERE accno = ?)
+ AND startdate <= date($transdate)
+ ORDER BY startdate DESC
+ LIMIT 1)
+ ORDER BY c.accno|;
+ my $stw = prepare_execute_query($form, $dbh, $query, $accno_id);
$ref->{taxaccounts} = "";
my $i=0;
while ($ptr = $stw->fetchrow_hashref(NAME_lc)) {
}
if ($form->{lizenzen}) {
- $query = qq|SELECT l.licensenumber, l.id AS licenseid
- FROM license l, licenseinvoice li
- WHERE l.id = li.license_id AND li.trans_id = $ref->{invoice_pos}|;
- $stg = $dbh->prepare($query);
- $stg->execute || $form->dberror($query);
- ($licensenumber, $licenseid) = $stg->fetchrow_array();
- $ref->{lizenzen} =
- "<option value=\"$licenseid\">$licensenumber</option>";
- $stg->finish();
- }
- if ($form->{type} eq "credit_note") {
- $ref->{qty} *= -1;
+ $query =
+ qq|SELECT l.licensenumber, l.id AS licenseid
+ FROM license l, licenseinvoice li
+ WHERE l.id = li.license_id AND li.trans_id = ?|;
+ my ($licensenumber, $licenseid)
+ = selectrow_query($form, $dbh, $query, conv_i($ref->{invoice_pos}));
+ $ref->{lizenzen} = "<option value=\"$licenseid\">$licensenumber</option>";
}
+ $ref->{qty} *= -1 if $form->{type} eq "credit_note";
+
chop $ref->{taxaccounts};
push @{ $form->{invoice_details} }, $ref;
$stw->finish;
}
$sth->finish;
- if ($form->{webdav}) {
- &webdav_folder($myconfig, $form);
- }
+ Common::webdav_folder($form) if ($main::webdav);
}
my $rc = $dbh->commit;
my $dateformat = $myconfig->{dateformat};
$dateformat .= "yy" if $myconfig->{dateformat} !~ /^y/;
- my $duedate =
- ($form->{invdate})
- ? "to_date('$form->{invdate}', '$dateformat')"
- : "current_date";
+ my (@values, $duedate, $ref, $query);
+
+ if ($form->{invdate}) {
+ $duedate = "to_date(?, '$dateformat')";
+ push @values, $form->{invdate};
+ } else {
+ $duedate = "current_date";
+ }
- $form->{customer_id} *= 1;
+ my $cid = conv_i($form->{customer_id});
# get customer
- my $query = qq|SELECT c.name AS customer, c.discount, c.creditlimit, c.terms,
- c.email, c.cc, c.bcc, c.language_id, c.payment_id AS customer_payment_id,
- c.street, c.zipcode, c.city, c.country,
- $duedate + c.terms AS duedate, c.notes AS intnotes,
- b.discount AS tradediscount, b.description AS business, c.klass as customer_klass, c.taxzone_id
- FROM customer c
- LEFT JOIN business b ON (b.id = c.business_id)
- WHERE c.id = $form->{customer_id}|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- $ref = $sth->fetchrow_hashref(NAME_lc);
-
+ $query =
+ qq|SELECT
+ c.name AS customer, c.discount, c.creditlimit, c.terms,
+ c.email, c.cc, c.bcc, c.language_id, c.payment_id AS customer_payment_id,
+ c.street, c.zipcode, c.city, c.country,
+ c.notes AS intnotes, c.klass as customer_klass, c.taxzone_id, c.salesman_id,
+ $duedate + COALESCE(pt.terms_netto, 0) AS duedate,
+ b.discount AS tradediscount, b.description AS business
+ FROM customer c
+ LEFT JOIN business b ON (b.id = c.business_id)
+ LEFT JOIN payment_terms pt ON (c.payment_id = pt.id)
+ WHERE c.id = ?|;
+ push @values, $cid;
+ $ref = selectfirst_hashref_query($form, $dbh, $query, @values);
map { $form->{$_} = $ref->{$_} } keys %$ref;
- $sth->finish;
-
- my $query = qq|SELECT sum(a.amount-a.paid) AS dunning_amount FROM ar a WHERE a.paid < a.amount AND a.customer_id=$form->{customer_id} AND a.dunning_id IS NOT NULL|;
- my $sth = $dbh->prepare($query);
-
- $sth->execute || $form->dberror($query);
-
- $ref = $sth->fetchrow_hashref(NAME_lc);
+ $query =
+ qq|SELECT sum(amount - paid) AS dunning_amount
+ FROM ar
+ WHERE (paid < amount)
+ AND (customer_id = ?)
+ AND (dunning_config_id IS NOT NULL)|;
+ $ref = selectfirst_hashref_query($form, $dbh, $query, $cid);
map { $form->{$_} = $ref->{$_} } keys %$ref;
- $sth->finish;
-
- #print(STDERR "DUNNING AMOUTN $form->{dunning_amount}\n");
-
- my $query = qq|SELECT dnn.dunning_description AS max_dunning_level FROM dunning_config dnn WHERE id in (select dunning_id from ar WHERE paid < amount AND customer_id=$form->{customer_id} AND dunning_id IS NOT NULL) ORDER BY dunning_level DESC LIMIT 1|;
- my $sth = $dbh->prepare($query);
-
- $sth->execute || $form->dberror($query);
-
- $ref = $sth->fetchrow_hashref(NAME_lc);
+ $query =
+ qq|SELECT dnn.dunning_description AS max_dunning_level
+ FROM dunning_config dnn
+ WHERE id IN (SELECT dunning_config_id
+ FROM ar
+ WHERE (paid < amount) AND (customer_id = ?) AND (dunning_config_id IS NOT NULL))
+ ORDER BY dunning_level DESC LIMIT 1|;
+ $ref = selectfirst_hashref_query($form, $dbh, $query, $cid);
map { $form->{$_} = $ref->{$_} } keys %$ref;
- $sth->finish;
- #print(STDERR "LEVEL $form->{max_dunning_level}\n");
-
#check whether payment_terms are better than old payment_terms
if (($form->{payment_id} ne "") && ($form->{customer_payment_id} ne "")) {
- my $query = qq|select (select ranking from payment_terms WHERE id = $form->{payment_id}), (select ranking from payment_terms WHERE id = $form->{customer_payment_id})|;
- my $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
- ($old_ranking, $new_ranking) = $stw->fetchrow_array;
- $stw->finish;
+ $query =
+ qq|SELECT
+ (SELECT ranking FROM payment_terms WHERE id = ?),
+ (SELECT ranking FROM payment_terms WHERE id = ?)|;
+ my ($old_ranking, $new_ranking)
+ = selectrow_query($form, $dbh, $query, conv_i($form->{payment_id}), conv_i($form->{customer_payment_id}));
if ($new_ranking > $old_ranking) {
- $form->{payment_id} =$form->{customer_payment_id};
+ $form->{payment_id} = $form->{customer_payment_id};
}
}
+
if ($form->{payment_id} eq "") {
- $form->{payment_id} =$form->{customer_payment_id};
+ $form->{payment_id} = $form->{customer_payment_id};
}
$form->{creditremaining} = $form->{creditlimit};
- $query = qq|SELECT SUM(a.amount - a.paid)
- FROM ar a
- WHERE a.customer_id = $form->{customer_id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($form->{creditremaining}) -= $sth->fetchrow_array;
-
- $sth->finish;
-
- $query = qq|SELECT o.amount,
- (SELECT e.buy FROM exchangerate e
- WHERE e.curr = o.curr
- AND e.transdate = o.transdate)
- FROM oe o
- WHERE o.customer_id = $form->{customer_id}
- AND o.quotation = '0'
- AND o.closed = '0'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $query = qq|SELECT SUM(amount - paid) FROM ar WHERE customer_id = ?|;
+ my ($value) = selectrow_query($form, $dbh, $query, $cid);
+ $form->{creditremaining} -= $value;
+
+ $query =
+ qq|SELECT o.amount,
+ (SELECT e.buy FROM exchangerate e
+ WHERE e.curr = o.curr
+ AND e.transdate = o.transdate)
+ FROM oe o
+ WHERE o.customer_id = ?
+ AND o.quotation = '0'
+ AND o.closed = '0'|;
+ $sth = prepare_execute_query($form, $dbh, $query, $cid);
while (my ($amount, $exch) = $sth->fetchrow_array) {
$exch = 1 unless $exch;
}
$sth->finish;
- $form->get_contacts($dbh, $form->{customer_id});
- $form->{cp_id} *= 1;
-
- # get contact if selected
- if ($form->{cp_id}) {
- $form->get_contact($dbh, $form->{cp_id});
- }
-
# get shipto if we did not converted an order or invoice
if (!$form->{shipto}) {
map { delete $form->{$_} }
- qw(shiptoname shiptodepartment_1 shiptodepartment_2 shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax shiptoemail);
+ qw(shiptoname shiptodepartment_1 shiptodepartment_2
+ shiptostreet shiptozipcode shiptocity shiptocountry
+ shiptocontact shiptophone shiptofax shiptoemail);
- $query = qq|SELECT s.* FROM shipto s
- WHERE s.trans_id = $form->{customer_id} AND s.module = 'CT'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- $ref = $sth->fetchrow_hashref(NAME_lc);
- undef($ref->{id});
+ $query = qq|SELECT * FROM shipto WHERE trans_id = ? AND module = 'CT'|;
+ $ref = selectfirst_hashref_query($form, $dbh, $query, $cid);
+ delete $ref->{id};
map { $form->{$_} = $ref->{$_} } keys %$ref;
- $sth->finish;
}
- # get taxes we charge for this customer
- $query = qq|SELECT c.accno
- FROM chart c
- JOIN customertax ct ON (ct.chart_id = c.id)
- WHERE ct.customer_id = $form->{customer_id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my $customertax = ();
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- $customertax{ $ref->{accno} } = 1;
- }
- $sth->finish;
-
- # get shipping addresses
- $query = qq|SELECT s.shipto_id,s.shiptoname,s.shiptodepartment_1
- FROM shipto s
- WHERE s.trans_id = $form->{customer_id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my $customertax = ();
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push(@{ $form->{SHIPTO} }, $ref);
- }
- $sth->finish;
-
# setup last accounts used for this customer
if (!$form->{id} && $form->{type} !~ /_(order|quotation)/) {
- $query = qq|SELECT c.accno, c.description, c.link, c.category
- FROM chart c
- JOIN acc_trans ac ON (ac.chart_id = c.id)
- JOIN ar a ON (a.id = ac.trans_id)
- WHERE a.customer_id = $form->{customer_id}
- AND NOT (c.link LIKE '%_tax%' OR c.link LIKE '%_paid%')
- AND a.id IN (SELECT max(a2.id) FROM ar a2
- WHERE a2.customer_id = $form->{customer_id})|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $query =
+ qq|SELECT c.id, c.accno, c.description, c.link, c.category
+ FROM chart c
+ JOIN acc_trans ac ON (ac.chart_id = c.id)
+ JOIN ar a ON (a.id = ac.trans_id)
+ WHERE a.customer_id = ?
+ AND NOT (c.link LIKE '%_tax%' OR c.link LIKE '%_paid%')
+ AND a.id IN (SELECT max(a2.id) FROM ar a2 WHERE a2.customer_id = ?)|;
+ $sth = prepare_execute_query($form, $dbh, $query, $cid, $cid);
my $i = 0;
while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
if ($ref->{category} eq 'I') {
$i++;
$form->{"AR_amount_$i"} = "$ref->{accno}--$ref->{description}";
+
+ if ($form->{initial_transdate}) {
+ my $tax_query =
+ qq|SELECT tk.tax_id, t.rate
+ FROM taxkeys tk
+ LEFT JOIN tax t ON tk.tax_id = t.id
+ WHERE (tk.chart_id = ?) AND (startdate <= date(?))
+ ORDER BY tk.startdate DESC
+ LIMIT 1|;
+ my ($tax_id, $rate) =
+ selectrow_query($form, $dbh, $tax_query, $ref->{id},
+ $form->{initial_transdate});
+ $form->{"taxchart_$i"} = "${tax_id}--${rate}";
+ }
}
if ($ref->{category} eq 'A') {
- $form->{ARselected} = $form->{AR_1} =
- "$ref->{accno}--$ref->{description}";
+ $form->{ARselected} = $form->{AR_1} = $ref->{accno};
}
}
$sth->finish;
my $i = $form->{rowcount};
- my $where = "NOT p.obsolete = '1'";
-
- if ($form->{"partnumber_$i"}) {
- my $partnumber = $form->like(lc $form->{"partnumber_$i"});
- $where .= " AND lower(p.partnumber) LIKE '$partnumber'";
- }
- if ($form->{"description_$i"}) {
- my $description = $form->like(lc $form->{"description_$i"});
- $where .= " AND lower(p.description) LIKE '$description'";
- }
+ my $where = qq|NOT p.obsolete = '1'|;
+ my @values;
- if ($form->{"partsgroup_$i"}) {
- my $partsgroup = $form->like(lc $form->{"partsgroup_$i"});
- $where .= " AND lower(pg.partsgroup) LIKE '$partsgroup'";
+ foreach my $column (qw(p.partnumber p.description pgpartsgroup)) {
+ my ($table, $field) = split m/\./, $column;
+ next if !$form->{"${field}_${i}"};
+ $where .= qq| AND lower(${column}) ILIKE ?|;
+ push @values, '%' . $form->{"${field}_${i}"} . '%';
}
if ($form->{"description_$i"}) {
- $where .= " ORDER BY p.description";
+ $where .= qq| ORDER BY p.description|;
} else {
- $where .= " ORDER BY p.partnumber";
+ $where .= qq| ORDER BY p.partnumber|;
}
my $transdate;
if ($form->{type} eq "invoice") {
$transdate =
$form->{deliverydate} ? $dbh->quote($form->{deliverydate}) :
- $form->{invdate} ? $dbh->quote($form->{invdate}) :
- "current_date";
+ $form->{invdate} ? $dbh->quote($form->{invdate}) :
+ "current_date";
} else {
$transdate =
- $form->{transdate} ? $dbh->quote($form->{transdate}) :
- "current_date";
+ $form->{transdate} ? $dbh->quote($form->{transdate}) :
+ "current_date";
}
- my $query = qq|SELECT p.id, p.partnumber, p.description, p.sellprice,
- p.listprice, p.inventory_accno_id,
- c1.accno AS inventory_accno, c1.new_chart_id AS inventory_new_chart, date($transdate) - c1.valid_from as inventory_valid,
- c2.accno AS income_accno, c2.new_chart_id AS income_new_chart, date($transdate) - c2.valid_from as income_valid,
- c3.accno AS expense_accno, c3.new_chart_id AS expense_new_chart, date($transdate) - c3.valid_from as expense_valid,
- p.unit, p.assembly, p.bin, p.onhand, p.notes AS partnotes, p.notes AS longdescription, p.not_discountable,
- pg.partsgroup, p.formel, p.payment_id AS part_payment_id
- FROM parts p
- LEFT JOIN chart c1 ON ((select inventory_accno_id from buchungsgruppen where id=p.buchungsgruppen_id) = c1.id)
- LEFT JOIN chart c2 ON ((select income_accno_id_$form->{taxzone_id} from buchungsgruppen where id=p.buchungsgruppen_id) = c2.id)
- LEFT JOIN chart c3 ON ((select expense_accno_id_$form->{taxzone_id} from buchungsgruppen where id=p.buchungsgruppen_id) = c3.id)
- LEFT JOIN partsgroup pg ON (pg.id = p.partsgroup_id)
- WHERE $where|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $taxzone_id = $form->{taxzone_id} * 1;
+ $taxzone_id = 0 if (0 > $taxzone_id) || (3 < $taxzone_id);
+
+ my $query =
+ qq|SELECT
+ p.id, p.partnumber, p.description, p.sellprice,
+ p.listprice, p.inventory_accno_id, p.lastcost,
+
+ c1.accno AS inventory_accno,
+ c1.new_chart_id AS inventory_new_chart,
+ date($transdate) - c1.valid_from AS inventory_valid,
+
+ c2.accno AS income_accno,
+ c2.new_chart_id AS income_new_chart,
+ date($transdate) - c2.valid_from AS income_valid,
+
+ c3.accno AS expense_accno,
+ c3.new_chart_id AS expense_new_chart,
+ date($transdate) - c3.valid_from AS expense_valid,
+
+ p.unit, p.assembly, p.bin, p.onhand,
+ p.notes AS partnotes, p.notes AS longdescription,
+ p.not_discountable, p.formel, p.payment_id AS part_payment_id,
+
+ pg.partsgroup
+
+ FROM parts p
+ LEFT JOIN chart c1 ON
+ ((SELECT inventory_accno_id
+ FROM buchungsgruppen
+ WHERE id = p.buchungsgruppen_id) = c1.id)
+ LEFT JOIN chart c2 ON
+ ((SELECT income_accno_id_${taxzone_id}
+ FROM buchungsgruppen
+ WHERE id = p.buchungsgruppen_id) = c2.id)
+ LEFT JOIN chart c3 ON
+ ((SELECT expense_accno_id_${taxzone_id}
+ FROM buchungsgruppen
+ WHERE id = p.buchungsgruppen_id) = c3.id)
+ LEFT JOIN partsgroup pg ON (pg.id = p.partsgroup_id)
+ WHERE $where|;
+ my $sth = prepare_execute_query($form, $dbh, $query, @values);
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
}
delete($ref->{inventory_accno_id});
- #set expense_accno=inventory_accno if they are different => bilanz
-
-
- while ($ref->{inventory_new_chart} && ($ref->{inventory_valid} >=0)) {
- my $query = qq| SELECT accno AS inventory_accno, new_chart_id AS inventory_new_chart, date($transdate) - valid_from AS inventory_valid FROM chart WHERE id = $ref->{inventory_new_chart}|;
- my $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
- ($ref->{inventory_accno}, $ref->{inventory_new_chart}, $ref->{inventory_valid}) = $stw->fetchrow_array;
- $stw->finish;
- }
-
- while ($ref->{income_new_chart} && ($ref->{income_valid} >=0)) {
- my $query = qq| SELECT accno AS income_accno, new_chart_id AS income_new_chart, date($transdate) - valid_from AS income_valid FROM chart WHERE id = $ref->{income_new_chart}|;
- my $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
- ($ref->{income_accno}, $ref->{income_new_chart}, $ref->{income_valid}) = $stw->fetchrow_array;
- $stw->finish;
- }
-
- while ($ref->{expense_new_chart} && ($ref->{expense_valid} >=0)) {
- my $query = qq| SELECT accno AS expense_accno, new_chart_id AS expense_new_chart, date($transdate) - valid_from AS expense_valid FROM chart WHERE id = $ref->{expense_new_chart}|;
- my $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
- ($ref->{expense_accno}, $ref->{expense_new_chart}, $ref->{expense_valid}) = $stw->fetchrow_array;
- $stw->finish;
+ foreach my $type (qw(inventory income expense)) {
+ while ($ref->{"${type}_new_chart"} && ($ref->{"${type}_valid"} >=0)) {
+ my $query =
+ qq|SELECT accno, new_chart_id, date($transdate) - valid_from
+ FROM chart
+ WHERE id = ?|;
+ ($ref->{"${type}_accno"},
+ $ref->{"${type}_new_chart"},
+ $ref->{"${type}_valid"})
+ = selectrow_query($form, $dbh, $query, $ref->{"${type}_new_chart"});
+ }
}
#check whether payment_terms are better than old payment_terms
- if (($form->{payment_id} ne "") && ($ref->{part_payment_id} ne "")) {
- my $query = qq|select (select ranking from payment_terms WHERE id = $form->{payment_id}), (select ranking from payment_terms WHERE id = $ref->{part_payment_id})|;
- my $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
- ($old_ranking, $new_ranking) = $stw->fetchrow_array;
- $stw->finish;
- if ($new_ranking <= $old_ranking) {
- $ref->{part_payment_id} = "";
+ if (($form->{payment_id} ne "") && ($form->{part_payment_id} ne "")) {
+ $query =
+ qq|SELECT
+ (SELECT ranking FROM payment_terms WHERE id = ?),
+ (SELECT ranking FROM payment_terms WHERE id = ?)|;
+ my ($old_ranking, $new_ranking)
+ = selectrow_query($form, $dbh, $query, conv_i($form->{payment_id}), conv_i($form->{part_payment_id}));
+ if ($new_ranking > $old_ranking) {
+ $form->{payment_id} = $form->{customer_payment_id};
}
}
+ if ($form->{payment_id} eq "") {
+ $form->{payment_id} = $form->{part_payment_id};
+ }
+
# get tax rates and description
- $accno_id =
- ($form->{vc} eq "customer") ? $ref->{income_accno} : $ref->{expense_accno};
- $query = qq|SELECT c.accno, t.taxdescription, t.rate, t.taxnumber
- FROM tax t LEFT JOIN chart c on (c.id=t.chart_id)
- WHERE t.id in (SELECT tk.tax_id from taxkeys tk where tk.chart_id = (SELECT id from chart WHERE accno='$accno_id') AND startdate<=$transdate ORDER BY startdate desc LIMIT 1)
- ORDER BY c.accno|;
+ $accno_id = ($form->{vc} eq "customer") ? $ref->{income_accno} : $ref->{expense_accno};
+ $query =
+ qq|SELECT c.accno, t.taxdescription, t.rate, t.taxnumber
+ FROM tax t
+ LEFT JOIN chart c ON (c.id = t.chart_id)
+ WHERE t.id in
+ (SELECT tk.tax_id
+ FROM taxkeys tk
+ WHERE tk.chart_id = (SELECT id from chart WHERE accno = ?)
+ AND startdate <= ?
+ ORDER BY startdate DESC
+ LIMIT 1)
+ ORDER BY c.accno|;
+ @values = ($accno_id, $transdate eq "current_date" ? "now" : $transdate);
$stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
+ $stw->execute(@values) || $form->dberror($query);
$ref->{taxaccounts} = "";
my $i = 0;
$stw->finish;
chop $ref->{taxaccounts};
if ($form->{language_id}) {
- $query = qq|SELECT tr.translation, tr.longdescription
- FROM translation tr
- WHERE tr.language_id=$form->{language_id} AND tr.parts_id=$ref->{id}|;
- $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
- my ($translation, $longdescription) = $stw->fetchrow_array();
+ $query =
+ qq|SELECT tr.translation, tr.longdescription
+ FROM translation tr
+ WHERE tr.language_id = ? AND tr.parts_id = ?|;
+ @values = (conv_i($form->{language_id}), conv_i($ref->{id}));
+ my ($translation, $longdescription) = selectrow_query($form, $dbh, $query, @values);
if ($translation ne "") {
$ref->{description} = $translation;
$ref->{longdescription} = $longdescription;
} else {
- $query = qq|SELECT tr.translation, tr.longdescription
- FROM translation tr
- WHERE tr.language_id in (select id from language where article_code=(select article_code from language where id = $form->{language_id})) AND tr.parts_id=$ref->{id} LIMIT 1|;
- $stg = $dbh->prepare($query);
- $stg->execute || $form->dberror($query);
- my ($translation) = $stg->fetchrow_array();
+ $query =
+ qq|SELECT tr.translation, tr.longdescription
+ FROM translation tr
+ WHERE tr.language_id IN
+ (SELECT id
+ FROM language
+ WHERE article_code = (SELECT article_code FROM language WHERE id = ?))
+ AND tr.parts_id = ?
+ LIMIT 1|;
+ @values = (conv_i($form->{language_id}), conv_i($ref->{id}));
+ my ($translation, $longdescription) = selectrow_query($form, $dbh, $query, @values);
if ($translation ne "") {
$ref->{description} = $translation;
$ref->{longdescription} = $longdescription;
}
- $stg->finish;
}
- $stw->finish;
}
push @{ $form->{item_list} }, $ref;
if ($form->{lizenzen}) {
if ($ref->{inventory_accno} > 0) {
$query =
- qq| SELECT l.* FROM license l WHERE l.parts_id = $ref->{id} AND NOT l.id IN (SELECT li.license_id FROM licenseinvoice li)|;
- $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
- while ($ptr = $stw->fetchrow_hashref(NAME_lc)) {
+ qq|SELECT l.*
+ FROM license l
+ WHERE l.parts_id = ? AND NOT l.id IN (SELECT li.license_id FROM licenseinvoice li)|;
+ my $stw = prepare_execute_query($form, $dbh, $query, conv_i($ref->{id}));
+ while (my $ptr = $stw->fetchrow_hashref(NAME_lc)) {
push @{ $form->{LIZENZEN}{ $ref->{id} } }, $ptr;
}
$stw->finish;
$id = $form->{"new_id_$i"};
}
- ($price, $selectedpricegroup_id) = split /--/,
- $form->{"sellprice_pg_$i"};
+ ($price, $selectedpricegroup_id) = split(/--/,
+ $form->{"sellprice_pg_$i"});
$pricegroup_old = $form->{"pricegroup_old_$i"};
$form->{"new_pricegroup_$i"} = $selectedpricegroup_id;
$form->{"old_pricegroup_$i"} = $pricegroup_old;
- $price_new = $form->{"price_new_$i"};
+ $price_new = $form->{"price_new_$i"};
$price_old = $form->{"price_old_$i"};
- $query =
- qq|SELECT pricegroup_id, (SELECT p.sellprice from parts p where p.id = $id) as default_sellprice,(SELECT pg.pricegroup FROM pricegroup pg WHERE id=pricegroup_id) AS pricegroup, price, '' AS selected FROM prices WHERE parts_id = $id UNION SELECT 0 as pricegroup_id,(SELECT sellprice FROM parts WHERE id=$id) as default_sellprice,'' as pricegroup, (SELECT DISTINCT sellprice from parts where id=$id) as price, 'selected' AS selected from prices ORDER BY pricegroup|;
- $pkq = $dbh->prepare($query);
- $pkq->execute || $form->dberror($query);
if (!$form->{"unit_old_$i"}) {
# Neue Ware aus der Datenbank. In diesem Fall ist unit_$i die
# Einheit, wie sie in den Stammdaten hinterlegt wurde.
# Es sollte also angenommen werden, dass diese ausgewaehlt war.
$form->{"unit_old_$i"} = $form->{"unit_$i"};
}
-
+
# Die zuletzt ausgewaehlte mit der aktuell ausgewaehlten Einheit
# vergleichen und bei Unterschied den Preis entsprechend umrechnen.
$form->{"selected_unit_$i"} = $form->{"unit_$i"} unless ($form->{"selected_unit_$i"});
# um eine Dienstleistung). Dann keinerlei Umrechnung vornehmen.
$form->{"unit_old_$i"} = $form->{"selected_unit_$i"} = $form->{"unit_$i"};
}
+
my $basefactor = 1;
-
+
if ($form->{"unit_old_$i"} ne $form->{"selected_unit_$i"}) {
if (defined($all_units->{$form->{"unit_old_$i"}}->{"factor"}) &&
$all_units->{$form->{"unit_old_$i"}}->{"factor"}) {
$all_units->{$form->{"unit_old_$i"}}->{"factor"};
}
}
+
if (!$form->{"basefactor_$i"}) {
$form->{"basefactor_$i"} = 1;
}
- while ($pkr = $pkq->fetchrow_hashref(NAME_lc)) {
- # push @{ $form->{PRICES}{$id} }, $pkr;
- #push @{ $form->{PRICES}{$i} }, $pkr;
+ $query =
+ qq|SELECT
+ pricegroup_id,
+ (SELECT p.sellprice FROM parts p WHERE p.id = ?) AS default_sellprice,
+ (SELECT pg.pricegroup FROM pricegroup pg WHERE id = pricegroup_id) AS pricegroup,
+ price,
+ '' AS selected
+ FROM prices
+ WHERE parts_id = ?
+
+ UNION
+
+ SELECT
+ 0 as pricegroup_id,
+ (SELECT sellprice FROM parts WHERE id = ?) AS default_sellprice,
+ '' AS pricegroup,
+ (SELECT DISTINCT sellprice FROM parts where id = ?) AS price,
+ 'selected' AS selected
+ FROM prices
+
+ ORDER BY pricegroup|;
+ @values = (conv_i($id), conv_i($id), conv_i($id), conv_i($id));
+ my $pkq = prepare_execute_query($form, $dbh, $query, @values);
+
+ while ($pkr = $pkq->fetchrow_hashref(NAME_lc)) {
$pkr->{id} = $id;
$pkr->{selected} = '';
}
$pkr->{price} *= $form->{"basefactor_$i"};
-
+
$pkr->{price} *= $basefactor;
-
+
$pkr->{price} = $form->format_amount($myconfig, $pkr->{price}, 5);
if ($selectedpricegroup_id eq undef) {
$form->{"sellprice_$i"} = $pkr->{price};
}
- } else {
- if ($pkr->{price} == $pkr->{default_sellprice}) {
-
- $pkr->{price} = $form->{"sellprice_$i"};
- $pkr->{selected} = ' selected';
- }
+ } elsif ($pkr->{price} == $pkr->{default_sellprice}) {
+ $pkr->{price} = $form->{"sellprice_$i"};
+ $pkr->{selected} = ' selected';
}
}
if ($pkr->{pricegroup_id} eq $selectedpricegroup_id) {
$pkr->{selected} = ' selected';
}
- } else {
- if (($price_new != $form->{"sellprice_$i"}) and ($price_new ne 0)) {
- if ($pkr->{pricegroup_id} == 0) {
- $pkr->{price} = $form->{"sellprice_$i"};
- $pkr->{selected} = ' selected';
- }
+ } elsif (($price_new != $form->{"sellprice_$i"}) and ($price_new ne 0)) {
+ if ($pkr->{pricegroup_id} == 0) {
+ $pkr->{price} = $form->{"sellprice_$i"};
+ $pkr->{selected} = ' selected';
+ }
+ } elsif ($pkr->{pricegroup_id} eq $selectedpricegroup_id) {
+ $pkr->{selected} = ' selected';
+ if ( ($pkr->{pricegroup_id} == 0)
+ and ($pkr->{price} == $form->{"sellprice_$i"})) {
+ # $pkr->{price} = $form->{"sellprice_$i"};
} else {
- if ($pkr->{pricegroup_id} eq $selectedpricegroup_id) {
- $pkr->{selected} = ' selected';
- if ( ($pkr->{pricegroup_id} == 0)
- and ($pkr->{price} == $form->{"sellprice_$i"})) {
-
- # $pkr->{price} = $form->{"sellprice_$i"};
- } else {
- $pkr->{price} = $form->{"sellprice_$i"};
- }
- }
+ $pkr->{price} = $form->{"sellprice_$i"};
}
}
}
$main::lxdebug->leave_sub();
}
-sub webdav_folder {
+sub has_storno {
$main::lxdebug->enter_sub();
- my ($myconfig, $form) = @_;
+ my ($self, $myconfig, $form, $table) = @_;
-SWITCH: {
- $path = "webdav/rechnungen/" . $form->{invnumber}, last SWITCH
- if ($form->{vc} eq "customer");
- $path = "webdav/einkaufsrechnungen/" . $form->{invnumber}, last SWITCH
- if ($form->{vc} eq "vendor");
- }
+ $main::lxdebug->leave_sub() and return 0 unless ($form->{id});
- if (!-d $path) {
- mkdir($path, 0770) or die "can't make directory $!\n";
- } else {
- if ($form->{id}) {
- @files = <$path/*>;
- foreach $file (@files) {
- $file =~ /\/([^\/]*)$/;
- $fname = $1;
- $ENV{'SCRIPT_NAME'} =~ /\/([^\/]*)\//;
- $lxerp = $1;
- $link = "http://" . $ENV{'SERVER_NAME'} . "/" . $lxerp . "/" . $file;
- $form->{WEBDAV}{$fname} = $link;
- }
- }
- }
+ # make sure there's no funny stuff in $table
+ # ToDO: die when this happens and throw an error
+ $main::lxdebug->leave_sub() and return 0 if ($table =~ /\W/);
+
+ my $dbh = $form->dbconnect($myconfig);
+
+ my $query = qq|SELECT storno FROM $table WHERE storno_id = ?|;
+ my ($result) = selectrow_query($form, $dbh, $query, $form->{id});
+
+ $dbh->disconnect();
$main::lxdebug->leave_sub();
+
+ return $result;
}
-1;
+sub is_storno {
+ $main::lxdebug->enter_sub();
+ my ($self, $myconfig, $form, $table, $id) = @_;
+
+ $main::lxdebug->leave_sub() and return 0 unless ($id);
+
+ # make sure there's no funny stuff in $table
+ # ToDO: die when this happens and throw an error
+ $main::lxdebug->leave_sub() and return 0 if ($table =~ /\W/);
+
+ my $dbh = $form->dbconnect($myconfig);
+
+ my $query = qq|SELECT storno FROM $table WHERE id = ?|;
+ my ($result) = selectrow_query($form, $dbh, $query, $id);
+
+ $dbh->disconnect();
+
+ $main::lxdebug->leave_sub();
+
+ return $result;
+}
+
+1;
--- /dev/null
+package SL::Iconv;
+
+use Text::Iconv;
+
+use SL::Common;
+
+use vars qw(%converters);
+
+sub get_converter {
+ my ($from_charset, $to_charset) = @_;
+
+ my $index = "${from_charset}::${to_charset}";
+ if (!$converters{$index}) {
+ $converters{$index} = Text::Iconv->new($from_charset, $to_charset) || die;
+ }
+
+ return $converters{$index};
+}
+
+sub convert {
+ my ($from_charset, $to_charset, $text) = @_;
+
+ $from_charset ||= Common::DEFAULT_CHARSET;
+ $to_charset ||= Common::DEFAULT_CHARSET;
+
+ my $converter = get_converter($from_charset, $to_charset);
+ return $converter->convert($text);
+}
+
+1;
+
package Inifile;
+use IO::File;
+
sub new {
$main::lxdebug->enter_sub();
- my ($type, $file, $level) = @_;
+ my ($type, $file) = @_;
my $id = "";
my $skip;
- $type = ref($self) || $self;
+ local *FH;
+
+ my $self = { "FILE" => $file };
open FH, "$file" or Form->error("$file : $!");
while (<FH>) {
- next if /^(#|;|\s)/;
- last if /^\./;
-
- chop;
+ chomp;
# strip comments
- s/\s*(#|;).*//g;
+ s/#.*//g;
# remove any trailing whitespace
- s/^\s*(.*?)\s*$/$1/;
+ s/^\s*//;
+ s/\s*$//;
- if (/^\[/) {
+ next unless $_;
+
+ if (m/^\[/) {
s/(\[|\])//g;
$id = $_;
- # if there is a level skip
- if ($skip = ($id !~ /^$level/)) {
- next;
- }
+ $self->{$id} ||= { };
push @{ $self->{ORDER} }, $_;
}
- if (!$skip) {
+ # add key=value to $id
+ my ($key, $value) = split m/=/, $_, 2;
- # add key=value to $id
- my ($key, $value) = split /=/, $_, 2;
-
- $self->{$id}{$key} = $value;
- }
+ $self->{$id}->{$key} = $value;
}
close FH;
$main::lxdebug->leave_sub();
- bless $self, $type;
+ return bless $self, $type;
+}
+
+sub write {
+ $main::lxdebug->enter_sub();
+
+ my ($self) = @_;
+
+ my $file = $self->{FILE};
+ my $fh = IO::File->new($file, "w") || Form->error("$file : $!");
+
+ foreach my $section_name (sort keys %{ $self }) {
+ next if $section_name =~ m/^[A-Z]+$/;
+
+ my $section = $self->{$section_name};
+ print $fh "[${section_name}]\n";
+ map { print $fh "${_}=$section->{$_}\n" } sort keys %{ $section };
+ print $fh "\n";
+ }
+
+ $fh->close();
+
+ $main::lxdebug->leave_sub();
}
1;
--- /dev/null
+package SL::InstallationCheck;
+
+use vars qw(@required_modules);
+
+@required_modules = (
+ { "name" => "Class::Accessor", "url" => "http://search.cpan.org/~kasei/" },
+ { "name" => "CGI", "url" => "http://search.cpan.org/~lds/" },
+ { "name" => "CGI::Ajax", "url" => "http://search.cpan.org/~bct/" },
+ { "name" => "DBI", "url" => "http://search.cpan.org/~timb/" },
+ { "name" => "DBD::Pg", "url" => "http://search.cpan.org/~dbdpg/" },
+ { "name" => "HTML::Template", "url" => "http://search.cpan.org/~samtregar/" },
+ { "name" => "Archive::Zip", "url" => "http://search.cpan.org/~adamk/" },
+ { "name" => "Text::Iconv", "url" => "http://search.cpan.org/~mpiotr/" },
+ { "name" => "Time::HiRes", "url" => "http://search.cpan.org/~jhi/" },
+ { "name" => "YAML", "url" => "http://search.cpan.org/~ingy/" },
+ { "name" => "IO::Wrap", "url" => "http://search.cpan.org/~dskoll/" },
+ { "name" => "Text::CSV_XS", "url" => "http://search.cpan.org/~hmbrand/" },
+ { "name" => "List::Util", "url" => "http://search.cpan.org/~gbarr/" },
+ { "name" => "Template", "url" => "http://search.cpan.org/~abw/" },
+ );
+
+sub module_available {
+ my ($module) = @_;
+
+ if (!defined(eval("require $module;"))) {
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
+sub test_all_modules {
+ return grep { !module_available($_->{name}) } @required_modules;
+}
+
+1;
$sth->finish();
if ($form->{own_product}) {
- $form->update_balance($dbh, "parts", "onhand", qq|id = $form->{parts_id}|,
- 1);
+ $form->update_balance($dbh, "parts", "onhand", qq|id = ?|,
+ 1, $form->{parts_id});
}
$dbh->disconnect();
package LXDebug;
-use constant NONE => 0;
-use constant INFO => 1;
-use constant DEBUG1 => 2;
-use constant DEBUG2 => 3;
-use constant QUERY => 4;
+use constant NONE => 0;
+use constant INFO => 1;
+use constant DEBUG1 => 1 << 1;
+use constant DEBUG2 => 1 << 2;
+use constant QUERY => 1 << 3;
+use constant TRACE => 1 << 4;
+use constant BACKTRACE_ON_ERROR => 1 << 5;
+use constant ALL => (1 << 6) - 1;
+use constant DEVEL => INFO | QUERY | TRACE | BACKTRACE_ON_ERROR;
use constant FILE_TARGET => 0;
use constant STDERR_TARGET => 1;
use POSIX qw(strftime);
+use YAML;
+
my $data_dumper_available;
+our $global_level;
+our $watch_form;
+
BEGIN {
eval("use Data::Dumper");
$data_dumper_available = $@ ? 0 : 1;
$global_level = NONE;
- $global_trace_subs = 0;
+ $watch_form = 0;
}
sub new {
$self->{"file"} = "/tmp/lx-office-debug.log";
$self->{"target"} = FILE_TARGET;
$self->{"level"} = 0;
- $self->{"trace_subs"} = 0;
while ($_[0]) {
$self->{ $_[0] } = $_[1];
sub enter_sub {
my ($self, $level) = @_;
+ $level *= 1;
- return 1 if $global_trace_subs < $level;
-
- if (!$self->{"trace_subs"} && !$global_trace_subs) {
- return 1;
- }
+ return 1 unless ($global_level & TRACE); # ignore if traces aren't active
+ return 1 if $level && !($global_level & $level); # ignore if level of trace isn't active
my ($package, $filename, $line, $subroutine) = caller(1);
my ($dummy1, $self_filename, $self_line) = caller(0);
- my $indent = " " x $self->{"calldepth"};
- $self->{"calldepth"} += 1;
+ my $indent = " " x $self->{"calldepth"}++;
if (!defined($package)) {
- $self->_write('sub', $indent . "\\ top-level?\n");
+ $self->_write('sub' . $level, $indent . "\\ top-level?\n");
} else {
- $self->_write('sub', $indent
+ $self->_write('sub' . $level, $indent
. "\\ ${subroutine} in "
. "${self_filename}:${self_line} called from "
. "${filename}:${line}\n");
sub leave_sub {
my ($self, $level) = @_;
+ $level *= 1;
- return 1 if $global_trace_subs < $level;
-
- if (!$self->{"trace_subs"} && !$global_trace_subs) {
- return 1;
- }
+ return 1 unless ($global_level & TRACE); # ignore if traces aren't active
+ return 1 if $level && !($global_level & $level); # ignore if level of trace isn't active
my ($package, $filename, $line, $subroutine) = caller(1);
my ($dummy1, $self_filename, $self_line) = caller(0);
- $self->{"calldepth"} -= 1;
- my $indent = " " x $self->{"calldepth"};
+ my $indent = " " x --$self->{"calldepth"};
if (!defined($package)) {
- $self->_write('sub', $indent . "/ top-level?\n");
+ $self->_write('sub' . $level, $indent . "/ top-level?\n");
} else {
- $self->_write('sub', $indent . "/ ${subroutine} in " . "${self_filename}:${self_line}\n");
+ $self->_write('sub' . $level, $indent . "/ ${subroutine} in " . "${self_filename}:${self_line}\n");
}
return 1;
}
-sub message {
- my ($self, $level, $message) = @_;
- my ($log_level) = $self->{"level"};
+sub show_backtrace {
+ my ($self) = @_;
- if ($global_level && ($global_level > $log_level)) {
- $log_level = $global_level;
- }
+ return 1 unless ($global_level & BACKTRACE_ON_ERROR);
- if ($log_level >= $level) {
- $self->_write(INFO == $level ? "info"
- : DEBUG1 == $level ? "debug1"
- : DEBUG2 == $level ? "debug2"
- : QUERY == $level ? "query":"",
- $message );
+ $self->message(BACKTRACE_ON_ERROR, "Starting full caller dump:");
+ my $level = 0;
+ while (my ($dummy, $filename, $line, $subroutine) = caller $level) {
+ $self->message(BACKTRACE_ON_ERROR, " ${subroutine} from ${filename}:${line}");
+ $level++;
}
+
+ return 1;
+}
+
+sub message {
+ my ($self, $level, $message) = @_;
+
+ $self->_write(level2string($level), $message) if (($self->{"level"} | $global_level) & $level || !$level);
}
sub dump {
my ($self, $level, $name, $variable) = @_;
if ($data_dumper_available) {
- $self->message($level, "dumping ${name}:\n" . Dumper($variable));
+ my $dumper = Data::Dumper->new([$variable]);
+ $dumper->Sortkeys(1);
+ $self->message($level, "dumping ${name}:\n" . $dumper->Dump());
} else {
$self->message($level,
"dumping ${name}: Data::Dumper not available; "
}
}
+sub dump_yaml {
+ my ($self, $level, $name, $variable) = @_;
+
+ $self->message($level, "dumping ${name}:\n" . YAML::Dump($variable));
+}
+
+sub dump_sql_result {
+ my ($self, $level, $prefix, $results) = @_;
+
+ if (!$results || !scalar @{ $results }) {
+ $self->message($level, "Empty result set");
+ return;
+ }
+
+ my %column_lengths = map { $_, length $_ } keys %{ $results->[0] };
+
+ foreach my $row (@{ $results }) {
+ map { $column_lengths{$_} = length $row->{$_} if (length $row->{$_} > $column_lengths{$_}) } keys %{ $row };
+ }
+
+ my @sorted_names = sort keys %column_lengths;
+ my $format = join '|', map { '%' . $column_lengths{$_} . 's' } @sorted_names;
+
+ $prefix .= ' ' if $prefix;
+
+ $self->message($level, $prefix . sprintf($format, @sorted_names));
+ $self->message($level, $prefix . join('+', map { '-' x $column_lengths{$_} } @sorted_names));
+
+ foreach my $row (@{ $results }) {
+ $self->message($level, $prefix . sprintf($format, map { $row->{$_} } @sorted_names));
+ }
+ $self->message($level, $prefix . sprintf('(%d row%s)', scalar @{ $results }, scalar @{ $results } > 1 ? 's' : ''));
+}
+
sub enable_sub_tracing {
my ($self) = @_;
- $self->{"trace_subs"} = 1;
+ $self->{level} | TRACE;
}
sub disable_sub_tracing {
my ($self) = @_;
- $self->{"trace_subs"} = 0;
+ $self->{level} & ~ TRACE;
}
sub _write {
print(FILE "${date}${message}\n");
close(FILE);
- } elsif (STDERR_TARGET == $self->{"target"}) {
+ } elsif (STDERR_TARGET == $self->{"target"}) {
print(STDERR "${date}${message}\n");
}
}
+sub level2string {
+ # use $_[0] as a bit mask and return levelstrings separated by /
+ join '/', qw(info debug1 debug2 query trace error_call_trace)[ grep { (reverse split //, sprintf "%05b", $_[0])[$_] } 0..5 ]
+}
+
1;
--- /dev/null
+#====================================================================
+# LX-Office ERP
+# Copyright (C) 2004
+# Based on SQL-Ledger Version 2.1.9
+# Web http://www.lx-office.org
+#
+#=====================================================================
+# SQL-Ledger Accounting
+# Copyright (C) 1998-2002
+#
+# Author: Dieter Simader
+# Email: dsimader@sql-ledger.org
+# Web: http://www.sql-ledger.org
+#
+# Contributors: Thomas Bayen <bayen@gmx.de>
+# Antti Kaihola <akaihola@siba.fi>
+# Moritz Bunkus (tex code)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#======================================================================
+#
+# Translations and number/date formatting
+#
+#======================================================================
+
+package Locale;
+
+use Text::Iconv;
+
+use SL::LXDebug;
+use SL::Common;
+
+sub new {
+ $main::lxdebug->enter_sub();
+
+ my ($type, $country, $NLS_file) = @_;
+ my $self = {};
+
+ $country =~ s|.*/||;
+ $country =~ s|\.||g;
+ $NLS_file =~ s|.*/||;
+
+ if ($country && -d "locale/$country") {
+ local *IN;
+ $self->{countrycode} = $country;
+ if (open(IN, "<", "locale/$country/$NLS_file")) {
+ my $code = join("", <IN>);
+ eval($code);
+ close(IN);
+ }
+
+ if (open IN, "<", "locale/$country/charset") {
+ $self->{charset} = <IN>;
+ close IN;
+
+ chomp $self->{charset};
+
+ } else {
+ $self->{charset} = Common::DEFAULT_CHARSET;
+ }
+
+ my $db_charset = $main::dbcharset;
+ $db_charset ||= Common::DEFAULT_CHARSET;
+ $self->{iconv} = Text::Iconv->new($self->{charset}, $db_charset);
+ $self->{iconv_english} = Text::Iconv->new("ASCII", $db_charset);
+ }
+
+ $self->{NLS_file} = $NLS_file;
+
+ push @{ $self->{LONG_MONTH} },
+ ("January", "February", "March", "April",
+ "May ", "June", "July", "August",
+ "September", "October", "November", "December");
+ push @{ $self->{SHORT_MONTH} },
+ (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec));
+
+ $main::lxdebug->leave_sub();
+
+ bless $self, $type;
+}
+
+sub text {
+ my ($self, $text) = @_;
+
+ if (exists $self->{texts}->{$text}) {
+ return $self->{iconv}->convert($self->{texts}->{$text});
+ }
+
+ return $self->{iconv_english}->convert($text);
+}
+
+sub findsub {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $text) = @_;
+
+ if (exists $self->{subs}{$text}) {
+ $text = $self->{subs}{$text};
+ } else {
+ if ($self->{countrycode} && $self->{NLS_file}) {
+ Form->error(
+ "$text not defined in locale/$self->{countrycode}/$self->{NLS_file}");
+ }
+ }
+
+ $main::lxdebug->leave_sub();
+
+ return $text;
+}
+
+sub date {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $date, $longformat) = @_;
+
+ my $longdate = "";
+ my $longmonth = ($longformat) ? 'LONG_MONTH' : 'SHORT_MONTH';
+
+ if ($date) {
+
+ # get separator
+ $spc = $myconfig->{dateformat};
+ $spc =~ s/\w//g;
+ $spc = substr($spc, 1, 1);
+
+ if ($date =~ /\D/) {
+ if ($myconfig->{dateformat} =~ /^yy/) {
+ ($yy, $mm, $dd) = split /\D/, $date;
+ }
+ if ($myconfig->{dateformat} =~ /^mm/) {
+ ($mm, $dd, $yy) = split /\D/, $date;
+ }
+ if ($myconfig->{dateformat} =~ /^dd/) {
+ ($dd, $mm, $yy) = split /\D/, $date;
+ }
+ } else {
+ $date = substr($date, 2);
+ ($yy, $mm, $dd) = ($date =~ /(..)(..)(..)/);
+ }
+
+ $dd *= 1;
+ $mm--;
+ $yy = ($yy < 70) ? $yy + 2000 : $yy;
+ $yy = ($yy >= 70 && $yy <= 99) ? $yy + 1900 : $yy;
+
+ if ($myconfig->{dateformat} =~ /^dd/) {
+ if (defined $longformat && $longformat == 0) {
+ $mm++;
+ $dd = "0$dd" if ($dd < 10);
+ $mm = "0$mm" if ($mm < 10);
+ $longdate = "$dd$spc$mm$spc$yy";
+ } else {
+ $longdate = "$dd";
+ $longdate .= ($spc eq '.') ? ". " : " ";
+ $longdate .= &text($self, $self->{$longmonth}[$mm]) . " $yy";
+ }
+ } elsif ($myconfig->{dateformat} eq "yyyy-mm-dd") {
+
+ # Use German syntax with the ISO date style "yyyy-mm-dd" because
+ # Lx-Office is mainly used in Germany or German speaking countries.
+ if (defined $longformat && $longformat == 0) {
+ $mm++;
+ $dd = "0$dd" if ($dd < 10);
+ $mm = "0$mm" if ($mm < 10);
+ $longdate = "$yy-$mm-$dd";
+ } else {
+ $longdate = "$dd. ";
+ $longdate .= &text($self, $self->{$longmonth}[$mm]) . " $yy";
+ }
+ } else {
+ if (defined $longformat && $longformat == 0) {
+ $mm++;
+ $dd = "0$dd" if ($dd < 10);
+ $mm = "0$mm" if ($mm < 10);
+ $longdate = "$mm$spc$dd$spc$yy";
+ } else {
+ $longdate = &text($self, $self->{$longmonth}[$mm]) . " $dd, $yy";
+ }
+ }
+
+ }
+
+ $main::lxdebug->leave_sub();
+
+ return $longdate;
+}
+
+sub parse_date {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $date, $longformat) = @_;
+
+ unless ($date) {
+ $main::lxdebug->leave_sub();
+ return ();
+ }
+
+ # get separator
+ $spc = $myconfig->{dateformat};
+ $spc =~ s/\w//g;
+ $spc = substr($spc, 1, 1);
+
+ if ($date =~ /\D/) {
+ if ($myconfig->{dateformat} =~ /^yy/) {
+ ($yy, $mm, $dd) = split /\D/, $date;
+ } elsif ($myconfig->{dateformat} =~ /^mm/) {
+ ($mm, $dd, $yy) = split /\D/, $date;
+ } elsif ($myconfig->{dateformat} =~ /^dd/) {
+ ($dd, $mm, $yy) = split /\D/, $date;
+ }
+ } else {
+ $date = substr($date, 2);
+ ($yy, $mm, $dd) = ($date =~ /(..)(..)(..)/);
+ }
+
+ $dd *= 1;
+ $mm *= 1;
+ $yy = ($yy < 70) ? $yy + 2000 : $yy;
+ $yy = ($yy >= 70 && $yy <= 99) ? $yy + 1900 : $yy;
+
+ $main::lxdebug->leave_sub();
+ return ($yy, $mm, $dd);
+}
+
+sub reformat_date {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $date, $output_format, $longformat) = @_;
+
+ $main::lxdebug->leave_sub() and return "" unless ($date);
+
+ my ($yy, $mm, $dd) = $self->parse_date($myconfig, $date);
+
+ $output_format =~ /d+/;
+ substr($output_format, $-[0], $+[0] - $-[0]) =
+ sprintf("%0" . (length($&)) . "d", $dd);
+
+ $output_format =~ /m+/;
+ substr($output_format, $-[0], $+[0] - $-[0]) =
+ sprintf("%0" . (length($&)) . "d", $mm);
+
+ $output_format =~ /y+/;
+ if (length($&) == 2) {
+ $yy -= $yy >= 2000 ? 2000 : 1900;
+ }
+ substr($output_format, $-[0], $+[0] - $-[0]) =
+ sprintf("%0" . (length($&)) . "d", $yy);
+
+ $main::lxdebug->leave_sub();
+
+ return $output_format;
+}
+
+1;
package Mailer;
+use SL::Common;
+
sub new {
$main::lxdebug->enter_sub();
sub send {
$main::lxdebug->enter_sub();
- my ($self, $out) = @_;
+ my ($self) = @_;
+
+ local (*IN, *OUT);
my $boundary = time;
$boundary = "LxOffice-$self->{version}-$boundary";
$domain =~ s/(.*?\@|>)//g;
my $msgid = "$boundary\@$domain";
- $self->{charset} = "ISO-8859-15" unless $self->{charset};
+ $self->{charset} = Common::DEFAULT_CHARSET unless $self->{charset};
- if ($out) {
- if (!open(OUT, $out)) {
- $main::lxdebug->leave_sub();
- return "$out : $!";
- }
- } else {
- if (!open(OUT, ">-")) {
- $main::lxdebug->leave_sub();
- return "STDOUT : $!";
- }
+ if (!open(OUT, $main::sendmail)) {
+ $main::lxdebug->leave_sub();
+ return "$main::sendmail : $!";
}
$self->{contenttype} = "text/plain" unless $self->{contenttype};
foreach my $attachment (@{ $self->{attachments} }) {
+ my $filename;
+
+ if (ref($attachment) eq "HASH") {
+ $filename = $attachment->{"name"};
+ $attachment = $attachment->{"filename"};
+ } else {
+ $filename = $attachment;
+ # strip path
+ $filename =~ s/(.*\/|$self->{fileid})//g;
+ }
+
my $application =
($attachment =~ /(^\w+$)|\.(html|text|txt|sql)$/)
? "text"
return "$attachment : $!";
}
- my $filename = $attachment;
-
- # strip path
- $filename =~ s/(.*\/|$self->{fileid})//g;
-
print OUT qq|--${boundary}
Content-Type: $application/$self->{format}; name="$filename"; charset="$self->{charset}"
Content-Transfer-Encoding: BASE64
package Menu;
+use SL::Inifile;
+
sub new {
$main::lxdebug->enter_sub();
- my ($type, $menufile, $level) = @_;
+ my ($type, $menufile) = @_;
+
+ my $self = {};
+ my $inifile = Inifile->new($menufile);
- use SL::Inifile;
- my $self = Inifile->new($menufile, $level);
+ map { $self->{$_} = $inifile->{$_} } keys %{ $inifile };
$main::lxdebug->leave_sub();
my $level = $form->escape($item);
my $str =
- qq|<a style="vertical-align:top" href=$module?path=$form->{path}&action=$action&level=$level&login=$form->{login}&password=$form->{password}|;
+ qq|<a style="vertical-align:top" href=$module?action=$action&level=$level&login=$form->{login}&password=$form->{password}|;
my @vars = qw(module action target href);
my $str = qq|<a href="$module?action=| . $form->escape($action) .
qq|&level=| . $form->escape($level);
- map({ $str .= "&${_}=" . $form->escape($form->{$_}); } qw(path login password));
+ map({ $str .= "&${_}=" . $form->escape($form->{$_}); } qw(login password));
my @vars = qw(module action target href);
my $level = $form->escape($item);
my $str =
- qq|$module?path=$form->{path}&action=$action&level=$level&login=$form->{login}&password=$form->{password}|;
+ qq|$module?action=$action&level=$level&login=$form->{login}&password=$form->{password}|;
my @vars = qw(module action target href);
if ($self->{$item}{href}) {
my $excl = ();
# remove --AR, --AP from array
- grep { ($a, $b) = split /--/; s/--$a$//; } @a;
+ grep { ($a, $b) = split(/--/); s/--$a$//; } @a;
map { $excl{$_} = 1 } @a;
--- /dev/null
+package SL::MoreCommon;
+
+require Exporter;
+@ISA = qw(Exporter);
+
+@EXPORT = qw(save_form restore_form);
+
+use YAML;
+
+sub save_form {
+ $main::lxdebug->enter_sub();
+
+ my $old_form = YAML::Dump($main::form);
+ $old_form =~ s|!|!:|g;
+ $old_form =~ s|\n|!n|g;
+ $old_form =~ s|\r|!r|g;
+
+ $main::lxdebug->leave_sub();
+
+ return $old_form;
+}
+
+sub restore_form {
+ $main::lxdebug->enter_sub();
+
+ my ($old_form, $no_delete) = @_;
+
+ my $form = $main::form;
+
+ map { delete $form->{$_}; } keys %{$form} unless ($no_delete);
+
+ $old_form =~ s|!r|\r|g;
+ $old_form =~ s|!n|\n|g;
+ $old_form =~ s|![!:]|!|g;
+
+ my $new_form = YAML::Load($old_form);
+ map { $form->{$_} = $new_form->{$_}; } keys %{$new_form};
+
+ $main::lxdebug->leave_sub();
+}
+
+1;
while (@num) {
@a = ();
- for (1 .. 3) {
- push @a, shift @num;
+ for (1..3) {
+ push(@a, shift(@num));
}
- push @numblock, join / /, reverse @a;
+ push(@numblock, join(" ", reverse @a));
}
while (@numblock) {
$i = $#numblock;
- @num = split //, $numblock[$i];
+ @num = split(//, $numblock[$i]);
if ($numblock[$i] == 0) {
pop @numblock;
if ($numblock[$i] > 99) {
# the one from hundreds
- push @textnumber, $self->{numbername}{ $num[0] };
+ push(@textnumber, $self->{numbername}{ $num[0] });
# add hundred designation
- push @textnumber, $self->{numbername}{ 10**2 };
+ push(@textnumber, $self->{numbername}{ 10**2 });
# reduce numblock
$numblock[$i] -= $num[0] * 100;
if ($numblock[$i] > 9) {
# tens
- push @textnumber, $self->format_ten($numblock[$i]);
+ push(@textnumber, $self->format_ten($numblock[$i]));
} elsif ($numblock[$i] > 0) {
# ones
- push @textnumber, $self->{numbername}{ $numblock[$i] };
+ push(@textnumber, $self->{numbername}{ $numblock[$i] });
}
# add thousand, million
if ($i) {
$num = 10**($i * 3);
- push @textnumber, $self->{numbername}{$num};
+ push(@textnumber, $self->{numbername}{$num});
}
- pop @numblock;
+ pop(@numblock);
}
- join ' ', @textnumber;
+ join(' ', @textnumber);
}
my ($self, $amount) = @_;
my $textnumber = "";
- my @num = split //, $amount;
+ my @num = split(//, $amount);
if ($amount > 20) {
$textnumber = $self->{numbername}{ $num[0] * 10 };
package OE;
use SL::AM;
+use SL::Common;
use SL::DBUtils;
sub transactions {
my $query;
my $ordnumber = 'ordnumber';
my $quotation = '0';
- my ($null, $department_id) = split /--/, $form->{department};
- my $department = " AND o.department_id = $department_id" if $department_id;
+ my @values;
+ my $where;
my $rate = ($form->{vc} eq 'customer') ? 'buy' : 'sell';
$ordnumber = 'quonumber';
}
- my $number = $form->like(lc $form->{$ordnumber});
- my $name = $form->like(lc $form->{ $form->{vc} });
-
- my $query = qq|SELECT 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)
- 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 = '$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)|;
-
- if ($warehouse_id && $form->{type} eq 'ship_order') {
- $query .= qq|
- JOIN inventory i ON (oi.parts_id = i.parts_id)
- |;
- }
+ my $vc = $form->{vc} eq "customer" ? "customer" : "vendor";
+
+ $query =
+ qq|SELECT o.id, o.ordnumber, o.transdate, o.reqdate, | .
+ qq| o.amount, ct.name, o.netamount, o.${vc}_id, o.globalproject_id, | .
+ qq| o.closed, o.delivered, o.quonumber, o.shippingpoint, o.shipvia, | .
+ qq| o.transaction_description, | .
+ qq| o.marge_total, o.marge_percent, | .
+ qq| ex.$rate AS exchangerate, | .
+ qq| pr.projectnumber AS globalprojectnumber, | .
+ qq| e.name AS employee | .
+ qq|FROM oe o | .
+ qq|JOIN $vc ct ON (o.${vc}_id = ct.id) | .
+ qq|LEFT JOIN employee e ON (o.employee_id = e.id) | .
+ qq|LEFT JOIN exchangerate ex ON (ex.curr = o.curr | .
+ qq| AND ex.transdate = o.transdate) | .
+ qq|LEFT JOIN project pr ON (o.globalproject_id = pr.id) | .
+ qq|WHERE (o.quotation = ?) |;
+ push(@values, $quotation);
- $query .= qq|
- 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)
- |;
- }
+ my ($null, $department_id) = split /--/, $form->{department};
+ if ($department_id) {
+ $query .= qq| AND o.department_id = ?|;
+ push(@values, $department_id);
+ }
+ if ($form->{"project_id"}) {
+ $query .=
+ qq|AND ((globalproject_id = ?) OR EXISTS | .
+ qq| (SELECT * FROM orderitems oi | .
+ qq| WHERE oi.project_id = ? AND oi.trans_id = o.id))|;
+ push(@values, $form->{"project_id"}, $form->{"project_id"});
}
- if ($form->{"$form->{vc}_id"}) {
- $query .= qq| AND o.$form->{vc}_id = $form->{"$form->{vc}_id"}|;
- } else {
- if ($form->{ $form->{vc} }) {
- $query .= " AND lower(ct.name) LIKE '$name'";
- }
+ if ($form->{"${vc}_id"}) {
+ $query .= " AND o.${vc}_id = ?";
+ push(@values, $form->{"${vc}_id"});
+
+ } elsif ($form->{$vc}) {
+ $query .= " AND ct.name ILIKE ?";
+ push(@values, '%' . $form->{$vc} . '%');
+ }
+
+ if ($form->{employee_id}) {
+ $query .= " AND o.employee_id = ?";
+ push @values, conv_i($form->{employee_id});
}
+
if (!$form->{open} && !$form->{closed}) {
$query .= " AND o.id = 0";
} elsif (!($form->{open} && $form->{closed})) {
$query .= ($form->{open}) ? " AND o.closed = '0'" : " AND o.closed = '1'";
}
- my $sortorder = join ', ',
- ("o.id", $form->sort_columns(transdate, $ordnumber, name));
- $sortorder = $form->{sort} if $form->{sort};
+ if (($form->{"notdelivered"} || $form->{"delivered"}) &&
+ ($form->{"notdelivered"} ne $form->{"delivered"})) {
+ $query .= $form->{"delivered"} ?
+ " AND o.delivered " : " AND NOT o.delivered";
+ }
- $query .= " AND lower($ordnumber) LIKE '$number'" if $form->{$ordnumber};
- $query .= " AND o.transdate >= '$form->{transdatefrom}'"
- if $form->{transdatefrom};
- $query .= " AND o.transdate <= '$form->{transdateto}'"
- if $form->{transdateto};
- $query .= " ORDER by $sortorder";
+ if ($form->{$ordnumber}) {
+ $query .= qq| AND o.$ordnumber ILIKE ?|;
+ push(@values, '%' . $form->{$ordnumber} . '%');
+ }
+
+ if($form->{transdatefrom}) {
+ $query .= qq| AND o.transdate >= ?|;
+ push(@values, conv_date($form->{transdatefrom}));
+ }
+
+ if($form->{transdateto}) {
+ $query .= qq| AND o.transdate <= ?|;
+ push(@values, conv_date($form->{transdateto}));
+ }
+
+ if ($form->{transaction_description}) {
+ $query .= qq| AND o.transaction_description ILIKE ?|;
+ push(@values, '%' . $form->{transaction_description} . '%');
+ }
+
+ my $sortorder = join(', ', ("o.id", $form->sort_columns("transdate", $ordnumber, "name")));
+ my %allowed_sort_columns =
+ ("transdate" => "o.transdate",
+ "reqdate" => "o.reqdate",
+ "id" => "o.id",
+ "ordnumber" => "o.ordnumber",
+ "quonumber" => "o.quonumber",
+ "name" => "ct.name",
+ "employee" => "e.name",
+ "shipvia" => "o.shipvia",
+ "transaction_description" => "o.transaction_description");
+ if ($form->{sort} && grep($form->{sort}, keys(%allowed_sort_columns))) {
+ $sortorder = $allowed_sort_columns{$form->{sort}};
+ }
+ $query .= qq| ORDER by | . $sortorder;
my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute(@values) ||
+ $form->dberror($query . " (" . join(", ", @values) . ")");
my %id = ();
+ $form->{OE} = [];
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
$ref->{exchangerate} = 1 unless $ref->{exchangerate};
push @{ $form->{OE} }, $ref if $ref->{id} != $id{ $ref->{id} };
# connect to database, turn off autocommit
my $dbh = $form->dbconnect_noauto($myconfig);
- my ($query, $sth, $null);
+ my ($query, @values, $sth, $null);
my $exchangerate = 0;
- my $service_units = AM->retrieve_units($myconfig,$form,"service");
- my $part_units = AM->retrieve_units($myconfig,$form,"dimension");
- $form->{service_units} =$service_units;
- $form->{part_units} =$part_units;
+ my $all_units = AM->retrieve_units($myconfig, $form);
+ $form->{all_units} = $all_units;
- ($null, $form->{employee_id}) = split /--/, $form->{employee};
+ $form->{employee_id} = (split /--/, $form->{employee})[1] if !$form->{employee_id};
unless ($form->{employee_id}) {
$form->get_employee($dbh);
}
- $form->{contact_id} = $form->{cp_id};
- $form->{contact_id} *= 1;
- $form->{payment_id} *= 1;
- $form->{language_id} *= 1;
- $form->{shipto_id} *= 1;
- $form->{delivery_customer_id} *= 1;
- $form->{delivery_vendor_id} *= 1;
-
my $ml = ($form->{type} eq 'sales_order') ? 1 : -1;
if ($form->{id}) {
&adj_onhand($dbh, $form, $ml) if $form->{type} =~ /_order$/;
- $query = qq|DELETE FROM orderitems
- WHERE trans_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|DELETE FROM orderitems WHERE trans_id = ?|;
+ do_query($form, $dbh, $query, $form->{id});
- $query = qq|DELETE FROM shipto
- WHERE trans_id = $form->{id} AND module = 'OE'|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|DELETE FROM shipto | .
+ qq|WHERE trans_id = ? AND module = 'OE'|;
+ do_query($form, $dbh, $query, $form->{id});
} else {
- my $uid = rand() . time;
-
- $uid .= $form->{login};
-
- $uid = substr($uid, 2, 75);
-
- $query = qq|INSERT INTO oe (ordnumber, employee_id)
- VALUES ('$uid', $form->{employee_id})|;
- $dbh->do($query) || $form->dberror($query);
-
- $query = qq|SELECT o.id FROM oe o
- WHERE o.ordnumber = '$uid'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $query = qq|SELECT nextval('id')|;
+ ($form->{id}) = selectrow_query($form, $dbh, $query);
- ($form->{id}) = $sth->fetchrow_array;
- $sth->finish;
+ $query = qq|INSERT INTO oe (id, ordnumber, employee_id) VALUES (?, '', ?)|;
+ do_query($form, $dbh, $query, $form->{id}, $form->{employee_id});
}
- map { $form->{$_} =~ s/\'/\'\'/g }
- qw(ordnumber quonumber shippingpoint shipvia notes intnotes message);
-
- my $amount;
- my $linetotal;
- my $discount;
+ my $amount = 0;
+ my $linetotal = 0;
+ my $discount = 0;
my $project_id;
my $reqdate;
my $taxrate;
- my $taxamount;
+ my $taxamount = 0;
my $fxsellprice;
my %taxbase;
my @taxaccounts;
for my $i (1 .. $form->{rowcount}) {
- map {
- $form->{"${_}_$i"} =
- $form->parse_amount($myconfig, $form->{"${_}_$i"})
- } qw(qty ship);
+ map({ $form->{"${_}_$i"} =
+ $form->parse_amount($myconfig, $form->{"${_}_$i"}) } qw(qty ship));
- if ($form->{"qty_$i"}) {
+ if ($form->{"id_$i"}) {
# get item baseunit
- $query = qq|SELECT p.unit
- FROM parts p
- WHERE p.id = $form->{"id_$i"}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my ($item_unit) = $sth->fetchrow_array();
- $sth->finish;
-
- if ($form->{"inventory_accno_$i"}) {
- if (defined($part_units->{$item_unit}->{factor}) && $part_units->{$item_unit}->{factor} ne '' && $part_units->{$item_unit}->{factor} ne '0') {
- $basefactor = $part_units->{$form->{"unit_$i"}}->{factor} / $part_units->{$item_unit}->{factor};
- } else {
- $basefactor = 1;
- }
- $baseqty = $form->{"qty_$i"} * $basefactor;
- } else {
- if (defined($service_units->{$item_unit}->{factor}) && $service_units->{$item_unit}->{factor} ne '' && $service_units->{$item_unit}->{factor} ne '0') {
- $basefactor = $service_units->{$form->{"unit_$i"}}->{factor} / $service_units->{$item_unit}->{factor};
- } else {
- $basefactor = 1;
- }
- $baseqty = $form->{"qty_$i"} * $basefactor;
+ $query = qq|SELECT unit FROM parts WHERE id = ?|;
+ my ($item_unit) = selectrow_query($form, $dbh, $query, $form->{"id_$i"});
+
+ my $basefactor = 1;
+ if (defined($all_units->{$item_unit}->{factor}) &&
+ (($all_units->{$item_unit}->{factor} * 1) != 0)) {
+ $basefactor = $all_units->{$form->{"unit_$i"}}->{factor} /
+ $all_units->{$item_unit}->{factor};
}
+ my $baseqty = $form->{"qty_$i"} * $basefactor;
- map { $form->{"${_}_$i"} =~ s/\'/\'\'/g }
- qw(partnumber description unit);
+ $form->{"marge_percent_$i"} = $form->parse_amount($myconfig, $form->{"marge_percent_$i"}) * 1;
+ $form->{"marge_absolut_$i"} = $form->parse_amount($myconfig, $form->{"marge_absolut_$i"}) * 1;
+ $form->{"lastcost_$i"} = $form->{"lastcost_$i"} * 1;
# set values to 0 if nothing entered
$form->{"discount_$i"} =
$fxsellprice = $form->{"sellprice_$i"};
my ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
- $dec = length $dec;
+ $dec = length($dec);
my $decimalplaces = ($dec > 2) ? $dec : 2;
$discount =
$linetotal =
$form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2);
- @taxaccounts = split / /, $form->{"taxaccounts_$i"};
+ @taxaccounts = split(/ /, $form->{"taxaccounts_$i"});
$taxrate = 0;
$taxdiff = 0;
$netamount += $form->{"sellprice_$i"} * $form->{"qty_$i"};
- $project_id = 'NULL';
- if ($form->{"projectnumber_$i"}) {
- $project_id = $form->{"projectnumber_$i"};
- }
$reqdate =
- ($form->{"reqdate_$i"}) ? qq|'$form->{"reqdate_$i"}'| : "NULL";
+ ($form->{"reqdate_$i"}) ? $form->{"reqdate_$i"} : undef;
# get pricegroup_id and save ist
- ($null, my $pricegroup_id) = split /--/, $form->{"sellprice_pg_$i"};
+ ($null, my $pricegroup_id) = split(/--/, $form->{"sellprice_pg_$i"});
$pricegroup_id *= 1;
- $subtotal = $form->{"subtotal_$i"} * 1;
# save detail record in orderitems table
+ @values = ();
$query = qq|INSERT INTO orderitems (|;
- $query .= "id, " if $form->{"orderitems_id_$i"};
- $query .= qq|trans_id, parts_id, description, longdescription, qty, base_qty, sellprice, discount,
- unit, reqdate, project_id, serialnumber, ship, pricegroup_id,
- ordnumber, transdate, cusordnumber, subtotal)
- VALUES (|;
- $query .= qq|$form->{"orderitems_id_$i"},|
- if $form->{"orderitems_id_$i"};
- $query .= qq|$form->{id}, $form->{"id_$i"},
- '$form->{"description_$i"}', '$form->{"longdescription_$i"}', $form->{"qty_$i"}, $baseqty,
- $fxsellprice, $form->{"discount_$i"},
- '$form->{"unit_$i"}', $reqdate, (SELECT id from project where projectnumber = '$project_id'),
- '$form->{"serialnumber_$i"}', $form->{"ship_$i"}, '$pricegroup_id',
- '$form->{"ordnumber_$i"}', '$form->{"transdate_$i"}', '$form->{"cusordnumber_$i"}', '$subtotal')|;
- $dbh->do($query) || $form->dberror($query);
+ if ($form->{"orderitems_id_$i"}) {
+ $query .= "id, ";
+ }
+ $query .= qq|trans_id, parts_id, description, longdescription, qty, base_qty, | .
+ qq|sellprice, discount, unit, reqdate, project_id, serialnumber, ship, | .
+ qq|pricegroup_id, ordnumber, transdate, cusordnumber, subtotal, | .
+ qq|marge_percent, marge_total, lastcost) | .
+ qq|VALUES (|;
+ if($form->{"orderitems_id_$i"}) {
+ $query .= qq|?,|;
+ push(@values, $form->{"orderitems_id_$i"});
+ }
+ $query .= qq|?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
+ push(@values,
+ conv_i($form->{id}), conv_i($form->{"id_$i"}),
+ $form->{"description_$i"}, $form->{"longdescription_$i"},
+ $form->{"qty_$i"}, $baseqty,
+ $fxsellprice, $form->{"discount_$i"},
+ $form->{"unit_$i"}, conv_date($reqdate), conv_i($form->{"project_id_$i"}),
+ $form->{"serialnumber_$i"}, $form->{"ship_$i"}, conv_i($pricegroup_id),
+ $form->{"ordnumber_$i"}, conv_date($form->{"transdate_$i"}),
+ $form->{"cusordnumber_$i"}, $form->{"subtotal_$i"} ? 't' : 'f',
+ $form->{"marge_percent_$i"}, $form->{"marge_absolut_$i"},
+ $form->{"lastcost_$i"});
+ do_query($form, $dbh, $query, @values);
$form->{"sellprice_$i"} = $fxsellprice;
$form->{"discount_$i"} *= 100;
}
}
- # set values which could be empty
- map { $form->{$_} *= 1 }
- qw(vendor_id customer_id taxincluded closed quotation);
-
- $reqdate = ($form->{reqdate}) ? qq|'$form->{reqdate}'| : "NULL";
+ $reqdate = ($form->{reqdate}) ? $form->{reqdate} : undef;
# add up the tax
my $tax = 0;
? $exchangerate
: $form->parse_amount($myconfig, $form->{exchangerate});
- my $quotation;
-
- # fill in subject if there is none
- if ($form->{type} =~ /_order$/) {
- $quotation = '0';
- $form->{subject} = qq|$form->{label} $form->{ordnumber}|
- unless $form->{subject};
- } else {
- $quotation = '1';
- $form->{subject} = qq|$form->{label} $form->{quonumber}|
- unless $form->{subject};
- }
-
- # if there is a message stuff it into the intnotes
- my $cc = "Cc: $form->{cc}\\r\n" if $form->{cc};
- my $bcc = "Bcc: $form->{bcc}\\r\n" if $form->{bcc};
- my $now = scalar localtime;
- $form->{intnotes} .= qq|\r
-\r| if $form->{intnotes};
-
- $form->{intnotes} .= qq|[email]\r
-Date: $now
-To: $form->{email}\r
-$cc${bcc}Subject: $form->{subject}\r
-\r
-Message: $form->{message}\r| if $form->{message};
+ my $quotation = $form->{type} =~ /_order$/ ? 'f' : 't';
($null, $form->{department_id}) = split(/--/, $form->{department});
- $form->{department_id} *= 1;
- $form->{payment_id} *= 1;
- $form->{language_id} *= 1;
- $form->{taxzone_id} *= 1;
- $form->{proforma} *= 1;
-
-
# save OE record
- $query = qq|UPDATE oe set
- ordnumber = '$form->{ordnumber}',
- quonumber = '$form->{quonumber}',
- cusordnumber = '$form->{cusordnumber}',
- transdate = '$form->{transdate}',
- vendor_id = $form->{vendor_id},
- customer_id = $form->{customer_id},
- amount = $amount,
- netamount = $netamount,
- reqdate = $reqdate,
- taxincluded = '$form->{taxincluded}',
- shippingpoint = '$form->{shippingpoint}',
- shipvia = '$form->{shipvia}',
- notes = '$form->{notes}',
- intnotes = '$form->{intnotes}',
- curr = '$form->{currency}',
- closed = '$form->{closed}',
- proforma = '$form->{proforma}',
- quotation = '$quotation',
- department_id = $form->{department_id},
- language_id = $form->{language_id},
- taxzone_id = $form->{taxzone_id},
- shipto_id = $form->{shipto_id},
- payment_id = $form->{payment_id},
- delivery_vendor_id = $form->{delivery_vendor_id},
- delivery_customer_id = $form->{delivery_customer_id},
- employee_id = $form->{employee_id},
- cp_id = $form->{contact_id}
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|UPDATE oe SET
+ ordnumber = ?, quonumber = ?, cusordnumber = ?, transdate = ?, vendor_id = ?,
+ customer_id = ?, amount = ?, netamount = ?, reqdate = ?, taxincluded = ?,
+ shippingpoint = ?, shipvia = ?, notes = ?, intnotes = ?, curr = ?, closed = ?,
+ delivered = ?, proforma = ?, quotation = ?, department_id = ?, language_id = ?,
+ taxzone_id = ?, shipto_id = ?, payment_id = ?, delivery_vendor_id = ?, delivery_customer_id = ?,
+ globalproject_id = ?, employee_id = ?, salesman_id = ?, cp_id = ?, transaction_description = ?, marge_total = ?, marge_percent = ?
+ WHERE id = ?|;
+
+ @values = ($form->{ordnumber}, $form->{quonumber},
+ $form->{cusordnumber}, conv_date($form->{transdate}),
+ conv_i($form->{vendor_id}), conv_i($form->{customer_id}),
+ $amount, $netamount, conv_date($reqdate),
+ $form->{taxincluded} ? 't' : 'f', $form->{shippingpoint},
+ $form->{shipvia}, $form->{notes}, $form->{intnotes},
+ substr($form->{currency}, 0, 3), $form->{closed} ? 't' : 'f',
+ $form->{delivered} ? "t" : "f", $form->{proforma} ? 't' : 'f',
+ $quotation, conv_i($form->{department_id}),
+ conv_i($form->{language_id}), conv_i($form->{taxzone_id}),
+ conv_i($form->{shipto_id}), conv_i($form->{payment_id}),
+ conv_i($form->{delivery_vendor_id}),
+ conv_i($form->{delivery_customer_id}),
+ conv_i($form->{globalproject_id}), conv_i($form->{employee_id}),
+ conv_i($form->{salesman_id}), conv_i($form->{cp_id}),
+ $form->{transaction_description},
+ $form->{marge_total} * 1, $form->{marge_percent} * 1,
+ conv_i($form->{id}));
+ do_query($form, $dbh, $query, @values);
$form->{ordtotal} = $amount;
- if ($form->{webdav}) {
- &webdav_folder($myconfig, $form);
- }
-
# add shipto
$form->{name} = $form->{ $form->{vc} };
$form->{name} =~ s/--$form->{"$form->{vc}_id"}//;
# adjust onhand
&adj_onhand($dbh, $form, $ml * -1);
- &adj_inventory($dbh, $myconfig, $form);
}
my $rc = $dbh->commit;
$dbh->disconnect;
+ $form->{saved_xyznumber} = $form->{$form->{type} =~ /_quotation$/ ?
+ "quonumber" : "ordnumber"};
+
+ Common::webdav_folder($form) if ($main::webdav);
+
$main::lxdebug->leave_sub();
return $rc;
my ($self, $myconfig, $form) = @_;
- for my $i (1 .. $form->{rowcount}) {
-
- map {
- $form->{"${_}_$i"} =
- $form->parse_amount($myconfig, $form->{"${_}_$i"})
- } qw(qty ship);
- if ($delete_oe_id) {
- $form->{"orderitems_id_$i"} = "";
- }
-
- if ($form->{"qty_$i"}) {
-
- # set values to 0 if nothing entered
- $form->{"discount_$i"} =
- $form->parse_amount($myconfig, $form->{"discount_$i"});
-
- $form->{"sellprice_$i"} =
- $form->parse_amount($myconfig, $form->{"sellprice_$i"});
- }
- }
-
# get ids from $form
map { push @ids, $form->{"ordnumber_$_"} if $form->{"ordnumber_$_"} }
(1 .. $form->{rowcount});
my $dbh = $form->dbconnect($myconfig);
- $query = qq|UPDATE oe SET
- closed = TRUE
- WHERE ordnumber IN (|
+ $query = qq|UPDATE oe SET | .
+ qq|closed = TRUE | .
+ qq|WHERE ordnumber IN (|
. join(', ', map { $dbh->quote($_) } @ids) . qq|)|;
$dbh->do($query) || $form->dberror($query);
$dbh->disconnect;
$main::lxdebug->leave_sub() unless ($form->{"id"});
my $dbh = $form->dbconnect($myconfig);
- do_query($form, $dbh, qq|UPDATE oe SET closed = TRUE where ordnumber = ?|,
+ do_query($form, $dbh, qq|UPDATE oe SET closed = TRUE where id = ?|,
$form->{"id"});
$dbh->disconnect;
my $dbh = $form->dbconnect_noauto($myconfig);
# delete spool files
- my $query = qq|SELECT s.spoolfile FROM status s
- WHERE s.trans_id = $form->{id}|;
+ my $query = qq|SELECT s.spoolfile FROM status s | .
+ qq|WHERE s.trans_id = ?|;
+ my @values = (conv_i($form->{id}));
$sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
+ $sth->execute(@values) || $self->dberror($query);
my $spoolfile;
my @spoolfiles = ();
}
$sth->finish;
- $query = qq|SELECT o.parts_id, o.ship FROM orderitems o
- WHERE o.trans_id = $form->{id}|;
+ $query = qq|SELECT o.parts_id, o.ship FROM orderitems o | .
+ qq|WHERE o.trans_id = ?|;
+ @values = (conv_i($form->{id}));
$sth = $dbh->prepare($query);
- $sth->execute || $self->dberror($query);
+ $sth->execute(@values) || $self->dberror($query);
while (my ($id, $ship) = $sth->fetchrow_array) {
$form->update_balance($dbh, "parts", "onhand", qq|id = $id|, $ship * -1);
}
$sth->finish;
+ # delete-values
+ @values = (conv_i($form->{id}));
+
# delete inventory
- $query = qq|DELETE FROM inventory
- WHERE oe_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|DELETE FROM inventory | .
+ qq|WHERE oe_id = ?|;
+ do_query($form, $dbh, $query, @values);
# delete status entries
- $query = qq|DELETE FROM status
- WHERE trans_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|DELETE FROM status | .
+ qq|WHERE trans_id = ?|;
+ do_query($form, $dbh, $query, @values);
# delete OE record
- $query = qq|DELETE FROM oe
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|DELETE FROM oe | .
+ qq|WHERE id = ?|;
+ do_query($form, $dbh, $query, @values);
# delete individual entries
- $query = qq|DELETE FROM orderitems
- WHERE trans_id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|DELETE FROM orderitems | .
+ qq|WHERE trans_id = ?|;
+ do_query($form, $dbh, $query, @values);
- $query = qq|DELETE FROM shipto
- WHERE trans_id = $form->{id} AND module = 'OE'|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|DELETE FROM shipto | .
+ qq|WHERE trans_id = ? AND module = 'OE'|;
+ do_query($form, $dbh, $query, @values);
my $rc = $dbh->commit;
$dbh->disconnect;
# connect to database
my $dbh = $form->dbconnect_noauto($myconfig);
- my $query, @ids;
+ my ($query, @values, @ids);
# translate the ids (given by id_# and trans_id_#) into one array of ids, so we can join them later
map {
push @ids, $form->{"trans_id_$_"}
- if ($form->{"id_$_"} and $form->{"trans_id_$_"})
+ if ($form->{"multi_id_$_"} and $form->{"trans_id_$_"})
} (1 .. $form->{"rowcount"});
# if called in multi id mode, and still only got one id, switch back to single id
if ($form->{id}) {
# get default accounts and last order number
- $query = qq|SELECT (SELECT c.accno FROM chart c
- WHERE d.inventory_accno_id = c.id) AS inventory_accno,
- (SELECT c.accno FROM chart c
- WHERE d.income_accno_id = c.id) AS income_accno,
- (SELECT c.accno FROM chart c
- WHERE d.expense_accno_id = c.id) AS expense_accno,
- (SELECT c.accno FROM chart c
- WHERE d.fxgain_accno_id = c.id) AS fxgain_accno,
- (SELECT c.accno FROM chart c
- WHERE d.fxloss_accno_id = c.id) AS fxloss_accno,
- d.curr AS currencies
- FROM defaults d|;
+ $query =
+ qq|SELECT (SELECT c.accno FROM chart c | .
+ qq| WHERE d.inventory_accno_id = c.id) AS inventory_accno, | .
+ qq| (SELECT c.accno FROM chart c | .
+ qq| WHERE d.income_accno_id = c.id) AS income_accno, | .
+ qq| (SELECT c.accno FROM chart c | .
+ qq| WHERE d.expense_accno_id = c.id) AS expense_accno, | .
+ qq| (SELECT c.accno FROM chart c | .
+ qq| WHERE d.fxgain_accno_id = c.id) AS fxgain_accno, | .
+ qq| (SELECT c.accno FROM chart c | .
+ qq| WHERE d.fxloss_accno_id = c.id) AS fxloss_accno, | .
+ qq|d.curr AS currencies | .
+ qq|FROM defaults d|;
} else {
- $query = qq|SELECT (SELECT c.accno FROM chart c
- WHERE d.inventory_accno_id = c.id) AS inventory_accno,
- (SELECT c.accno FROM chart c
- WHERE d.income_accno_id = c.id) AS income_accno,
- (SELECT c.accno FROM chart c
- WHERE d.expense_accno_id = c.id) AS expense_accno,
- (SELECT c.accno FROM chart c
- WHERE d.fxgain_accno_id = c.id) AS fxgain_accno,
- (SELECT c.accno FROM chart c
- WHERE d.fxloss_accno_id = c.id) AS fxloss_accno,
- d.curr AS currencies,
- current_date AS transdate, current_date AS reqdate
- FROM defaults d|;
+ $query =
+ qq|SELECT (SELECT c.accno FROM chart c | .
+ qq| WHERE d.inventory_accno_id = c.id) AS inventory_accno, | .
+ qq| (SELECT c.accno FROM chart c | .
+ qq| WHERE d.income_accno_id = c.id) AS income_accno, | .
+ qq| (SELECT c.accno FROM chart c | .
+ qq| WHERE d.expense_accno_id = c.id) AS expense_accno, | .
+ qq| (SELECT c.accno FROM chart c | .
+ qq| WHERE d.fxgain_accno_id = c.id) AS fxgain_accno, | .
+ qq| (SELECT c.accno FROM chart c | .
+ qq| WHERE d.fxloss_accno_id = c.id) AS fxloss_accno, | .
+ qq|d.curr AS currencies, | .
+ qq|current_date AS transdate, current_date AS reqdate | .
+ qq|FROM defaults d|;
}
my $sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
map { $form->{$_} = $ref->{$_} } keys %$ref;
$sth->finish;
- ($form->{currency}) = split /:/, $form->{currencies};
+ ($form->{currency}) = split(/:/, $form->{currencies});
# set reqdate if this is an invoice->order conversion. If someone knows a better check to ensure
# we come from invoices, feel free.
if ( $form->{deliverydate}
and $form->{callback} =~ /action=ar_transactions/);
+ my $vc = $form->{vc} eq "customer" ? "customer" : "vendor";
+
if ($form->{id} or @ids) {
# retrieve order for single id
# NOTE: this query is intended to fetch all information only ONCE.
# so if any of these infos is important (or even different) for any item,
# it will be killed out and then has to be fetched from the item scope query further down
- $query = qq|SELECT o.cp_id, o.ordnumber, o.transdate, o.reqdate,
- o.taxincluded, o.shippingpoint, o.shipvia, o.notes, o.intnotes,
- o.curr AS currency, e.name AS employee, o.employee_id,
- o.$form->{vc}_id, cv.name AS $form->{vc}, o.amount AS invtotal,
- o.closed, o.reqdate, o.quonumber, o.department_id, o.cusordnumber,
- d.description AS department, o.payment_id, o.language_id, o.taxzone_id, o.delivery_customer_id, o.delivery_vendor_id, o.proforma, o.shipto_id
- FROM oe o
- JOIN $form->{vc} cv ON (o.$form->{vc}_id = cv.id)
- LEFT JOIN employee e ON (o.employee_id = e.id)
- LEFT JOIN department d ON (o.department_id = d.id)
- |
- . ($form->{id}
- ? qq|WHERE o.id = $form->{id}|
- : qq|WHERE o.id IN (| . join(', ', @ids) . qq|)|);
-
- #$main::lxdebug->message(0, $query);
-
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $query =
+ qq|SELECT o.cp_id, o.ordnumber, o.transdate, o.reqdate, | .
+ qq| o.taxincluded, o.shippingpoint, o.shipvia, o.notes, o.intnotes, | .
+ qq| o.curr AS currency, e.name AS employee, o.employee_id, o.salesman_id, | .
+ qq| o.${vc}_id, cv.name AS ${vc}, o.amount AS invtotal, | .
+ qq| o.closed, o.reqdate, o.quonumber, o.department_id, o.cusordnumber, | .
+ qq| d.description AS department, o.payment_id, o.language_id, o.taxzone_id, | .
+ qq| o.delivery_customer_id, o.delivery_vendor_id, o.proforma, o.shipto_id, | .
+ qq| o.globalproject_id, o.delivered, o.transaction_description | .
+ qq|FROM oe o | .
+ qq|JOIN ${vc} cv ON (o.${vc}_id = cv.id) | .
+ qq|LEFT JOIN employee e ON (o.employee_id = e.id) | .
+ qq|LEFT JOIN department d ON (o.department_id = d.id) | .
+ ($form->{id} ? qq|WHERE o.id = ?| :
+ qq|WHERE o.id IN (| . join(', ', map("? ", @ids)) . qq|)|);
+ @values = $form->{id} ? ($form->{id}) : @ids;
+ $sth = prepare_execute_query($form, $dbh, $query, @values);
$ref = $sth->fetchrow_hashref(NAME_lc);
map { $form->{$_} = $ref->{$_} } keys %$ref;
-
+ $form->{saved_xyznumber} = $form->{$form->{type} =~ /_quotation$/ ?
+ "quonumber" : "ordnumber"};
# set all entries for multiple ids blank that yield different information
while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
$sth->finish;
if ($form->{delivery_customer_id}) {
- $query = qq|SELECT name FROM customer WHERE id=$form->{delivery_customer_id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- ($form->{delivery_customer_string}) = $sth->fetchrow_array();
- $sth->finish;
+ $query = qq|SELECT name FROM customer WHERE id = ?|;
+ ($form->{delivery_customer_string}) =
+ selectrow_query($form, $dbh, $query, $form->{delivery_customer_id});
}
if ($form->{delivery_vendor_id}) {
- $query = qq|SELECT name FROM customer WHERE id=$form->{delivery_vendor_id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- ($form->{delivery_vendor_string}) = $sth->fetchrow_array();
- $sth->finish;
+ $query = qq|SELECT name FROM customer WHERE id = ?|;
+ ($form->{delivery_vendor_string}) =
+ selectrow_query($form, $dbh, $query, $form->{delivery_vendor_id});
}
# shipto and pinted/mailed/queued status makes only sense for single id retrieve
if (!@ids) {
- $query = qq|SELECT s.* FROM shipto s
- WHERE s.trans_id = $form->{id} AND s.module = 'OE'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $query = qq|SELECT s.* FROM shipto s | .
+ qq|WHERE s.trans_id = ? AND s.module = 'OE'|;
+ $sth = prepare_execute_query($form, $dbh, $query, $form->{id});
$ref = $sth->fetchrow_hashref(NAME_lc);
delete($ref->{id});
$sth->finish;
# get printed, emailed and queued
- $query = qq|SELECT s.printed, s.emailed, s.spoolfile, s.formname
- FROM status s
- WHERE s.trans_id = $form->{id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $query = qq|SELECT s.printed, s.emailed, s.spoolfile, s.formname | .
+ qq|FROM status s | .
+ qq|WHERE s.trans_id = ?|;
+ $sth = prepare_execute_query($form, $dbh, $query, $form->{id});
while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
$form->{printed} .= "$ref->{formname} " if $ref->{printed};
my $transdate =
$form->{transdate} ? $dbh->quote($form->{transdate}) : "current_date";
- if(!$form->{taxzone_id}) {
- $form->{taxzone_id} = 0;
- }
+ $form->{taxzone_id} = 0 unless ($form->{taxzone_id});
+
# retrieve individual items
# this query looks up all information about the items
# stuff different from the whole will not be overwritten, but saved with a suffix.
- $query = qq|SELECT o.id AS orderitems_id,
- c1.accno AS inventory_accno, c1.new_chart_id AS inventory_new_chart, date($transdate) - c1.valid_from as inventory_valid,
- c2.accno AS income_accno, c2.new_chart_id AS income_new_chart, date($transdate) - c2.valid_from as income_valid,
- c3.accno AS expense_accno, c3.new_chart_id AS expense_new_chart, date($transdate) - c3.valid_from as expense_valid,
- oe.ordnumber AS ordnumber_oe, oe.transdate AS transdate_oe, oe.cusordnumber AS cusordnumber_oe,
- p.partnumber, p.assembly, o.description, o.qty,
- o.sellprice, o.parts_id AS id, o.unit, o.discount, p.bin, p.notes AS partnotes, p.inventory_accno_id AS part_inventory_accno_id,
- o.reqdate, o.project_id, o.serialnumber, o.ship,
- o.ordnumber, o.transdate, o.cusordnumber, o.subtotal, o.longdescription,
- pr.projectnumber, p.formel,
- pg.partsgroup, o.pricegroup_id, (SELECT pricegroup FROM pricegroup WHERE id=o.pricegroup_id) as pricegroup
- FROM orderitems o
- JOIN parts p ON (o.parts_id = p.id)
- JOIN oe ON (o.trans_id = oe.id)
- LEFT JOIN chart c1 ON ((select inventory_accno_id from buchungsgruppen where id=p.buchungsgruppen_id) = c1.id)
- LEFT JOIN chart c2 ON ((select income_accno_id_$form->{taxzone_id} from buchungsgruppen where id=p.buchungsgruppen_id) = c2.id)
- LEFT JOIN chart c3 ON ((select expense_accno_id_$form->{taxzone_id} from buchungsgruppen where id=p.buchungsgruppen_id) = c3.id)
- LEFT JOIN project pr ON (o.project_id = pr.id)
- LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
- |
- . ($form->{id}
- ? qq|WHERE o.trans_id = $form->{id}|
- : qq|WHERE o.trans_id IN (| . join(", ", @ids) . qq|)|)
- . qq|
- ORDER BY o.$oid{$myconfig->{dbdriver}}|;
-
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $query =
+ qq|SELECT o.id AS orderitems_id, | .
+ qq| c1.accno AS inventory_accno, c1.new_chart_id AS inventory_new_chart, date($transdate) - c1.valid_from as inventory_valid, | .
+ qq| c2.accno AS income_accno, c2.new_chart_id AS income_new_chart, date($transdate) - c2.valid_from as income_valid, | .
+ qq| c3.accno AS expense_accno, c3.new_chart_id AS expense_new_chart, date($transdate) - c3.valid_from as expense_valid, | .
+ qq| oe.ordnumber AS ordnumber_oe, oe.transdate AS transdate_oe, oe.cusordnumber AS cusordnumber_oe, | .
+ qq| p.partnumber, p.assembly, o.description, o.qty, | .
+ qq| o.sellprice, o.parts_id AS id, o.unit, o.discount, p.bin, p.notes AS partnotes, p.inventory_accno_id AS part_inventory_accno_id, | .
+ qq| o.reqdate, o.project_id, o.serialnumber, o.ship, o.lastcost, | .
+ qq| o.ordnumber, o.transdate, o.cusordnumber, o.subtotal, o.longdescription, | .
+ qq| pr.projectnumber, p.formel, | .
+ qq| pg.partsgroup, o.pricegroup_id, (SELECT pricegroup FROM pricegroup WHERE id=o.pricegroup_id) as pricegroup | .
+ qq|FROM orderitems o | .
+ qq|JOIN parts p ON (o.parts_id = p.id) | .
+ qq|JOIN oe ON (o.trans_id = oe.id) | .
+ qq|LEFT JOIN chart c1 ON ((SELECT inventory_accno_id FROM buchungsgruppen WHERE id=p.buchungsgruppen_id) = c1.id) | .
+ qq|LEFT JOIN chart c2 ON ((SELECT income_accno_id_$form->{taxzone_id} FROM buchungsgruppen WHERE id=p.buchungsgruppen_id) = c2.id) | .
+ qq|LEFT JOIN chart c3 ON ((SELECT expense_accno_id_$form->{taxzone_id} FROM buchungsgruppen WHERE id=p.buchungsgruppen_id) = c3.id) | .
+ qq|LEFT JOIN project pr ON (o.project_id = pr.id) | .
+ qq|LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id) | .
+ ($form->{id} ? qq|WHERE o.trans_id = ?| :
+ qq|WHERE o.trans_id IN (| . join(", ", map("?", @ids)) . qq|)|) .
+ qq|ORDER BY o.$oid{$myconfig->{dbdriver}}|;
+
+ @ids = $form->{id} ? ($form->{id}) : @ids;
+ $sth = prepare_execute_query($form, $dbh, $query, @values);
while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
if (!$ref->{"part_inventory_accno_id"}) {
- while ($ref->{inventory_new_chart} && ($ref->{inventory_valid} >=0)) {
- my $query = qq| SELECT accno AS inventory_accno, new_chart_id AS inventory_new_chart, date($transdate) - valid_from AS inventory_valid FROM chart WHERE id = $ref->{inventory_new_chart}|;
- my $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
- ($ref->{inventory_accno}, $ref->{inventory_new_chart}, $ref->{inventory_valid}) = $stw->fetchrow_array;
- $stw->finish;
- }
+ while ($ref->{inventory_new_chart} && ($ref->{inventory_valid} >= 0)) {
+ my $query =
+ qq|SELECT accno AS inventory_accno, | .
+ qq| new_chart_id AS inventory_new_chart, | .
+ qq| date($transdate) - valid_from AS inventory_valid | .
+ qq|FROM chart WHERE id = $ref->{inventory_new_chart}|;
+ ($ref->{inventory_accno}, $ref->{inventory_new_chart},
+ $ref->{inventory_valid}) = selectrow_query($form, $dbh, $query);
+ }
- while ($ref->{income_new_chart} && ($ref->{income_valid} >=0)) {
- my $query = qq| SELECT accno AS income_accno, new_chart_id AS income_new_chart, date($transdate) - valid_from AS income_valid FROM chart WHERE id = $ref->{income_new_chart}|;
- my $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
- ($ref->{income_accno}, $ref->{income_new_chart}, $ref->{income_valid}) = $stw->fetchrow_array;
- $stw->finish;
- }
+ while ($ref->{income_new_chart} && ($ref->{income_valid} >= 0)) {
+ my $query =
+ qq|SELECT accno AS income_accno, | .
+ qq| new_chart_id AS income_new_chart, | .
+ qq| date($transdate) - valid_from AS income_valid | .
+ qq|FROM chart WHERE id = $ref->{income_new_chart}|;
+ ($ref->{income_accno}, $ref->{income_new_chart},
+ $ref->{income_valid}) = selectrow_query($form, $dbh, $query);
+ }
- while ($ref->{expense_new_chart} && ($ref->{expense_valid} >=0)) {
- my $query = qq| SELECT accno AS expense_accno, new_chart_id AS expense_new_chart, date($transdate) - valid_from AS expense_valid FROM chart WHERE id = $ref->{expense_new_chart}|;
- my $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
- ($ref->{expense_accno}, $ref->{expense_new_chart}, $ref->{expense_valid}) = $stw->fetchrow_array;
- $stw->finish;
- }
+ while ($ref->{expense_new_chart} && ($ref->{expense_valid} >= 0)) {
+ my $query =
+ qq|SELECT accno AS expense_accno, | .
+ qq| new_chart_id AS expense_new_chart, | .
+ qq| date($transdate) - valid_from AS expense_valid | .
+ qq|FROM chart WHERE id = $ref->{expense_new_chart}|;
+ ($ref->{expense_accno}, $ref->{expense_new_chart},
+ $ref->{expense_valid}) = selectrow_query($form, $dbh, $query);
+ }
# delete orderitems_id in collective orders, so that they get cloned no matter what
delete $ref->{orderitems_id} if (@ids);
# get tax rates and description
$accno_id =
($form->{vc} eq "customer") ? $ref->{income_accno} : $ref->{expense_accno};
- $query = qq|SELECT c.accno, t.taxdescription, t.rate, t.taxnumber
- FROM tax t LEFT JOIN chart c on (c.id=t.chart_id)
- WHERE t.id in (SELECT tk.tax_id from taxkeys tk where tk.chart_id = (SELECT id from chart WHERE accno='$accno_id') AND startdate<=$transdate ORDER BY startdate desc LIMIT 1)
- ORDER BY c.accno|;
- $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
+ $query =
+ qq|SELECT c.accno, t.taxdescription, t.rate, t.taxnumber | .
+ qq|FROM tax t LEFT JOIN chart c on (c.id = t.chart_id) | .
+ qq|WHERE t.id IN (SELECT tk.tax_id FROM taxkeys tk | .
+ qq| WHERE tk.chart_id = (SELECT id FROM chart WHERE accno = ?) | .
+ qq| AND startdate <= $transdate ORDER BY startdate DESC LIMIT 1) | .
+ qq|ORDER BY c.accno|;
+ $stw = prepare_execute_query($form, $dbh, $query, $accno_id);
$ref->{taxaccounts} = "";
my $i = 0;
while ($ptr = $stw->fetchrow_hashref(NAME_lc)) {
-
- # if ($customertax{$ref->{accno}}) {
if (($ptr->{accno} eq "") && ($ptr->{rate} == 0)) {
$i++;
$ptr->{accno} = $i;
$form->get_exchangerate($dbh, $form->{currency}, $form->{transdate},
($form->{vc} eq 'customer') ? "buy" : "sell");
- if ($form->{webdav}) {
- &webdav_folder($myconfig, $form);
- }
-
- # get tax zones
- $query = qq|SELECT id, description
- FROM tax_zones|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
-
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{TAXZONE} }, $ref;
- }
- $sth->finish;
-
+ Common::webdav_folder($form) if ($main::webdav);
my $rc = $dbh->commit;
$dbh->disconnect;
# connect to database
my $dbh = $form->dbconnect($myconfig);
my $query;
+ my @values = ();
my $sth;
my $nodiscount;
my $yesdiscount;
my %oid = ('Pg' => 'oid',
'Oracle' => 'rowid');
+ my (@project_ids, %projectnumbers);
+
+ push(@project_ids, $form->{"globalproject_id"}) if ($form->{"globalproject_id"});
+
# sort items by partsgroup
for $i (1 .. $form->{rowcount}) {
$partsgroup = "";
$partsgroup = $form->{"partsgroup_$i"};
}
push @partsgroup, [$i, $partsgroup];
+ push(@project_ids, $form->{"project_id_$i"}) if ($form->{"project_id_$i"});
}
- # 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);
- }
+ if (@project_ids) {
+ $query = "SELECT id, projectnumber FROM project WHERE id IN (" .
+ join(", ", map("?", @project_ids)) . ")";
+ $sth = prepare_execute_query($form, $dbh, $query, @project_ids);
+ while (my $ref = $sth->fetchrow_hashref()) {
+ $projectnumbers{$ref->{id}} = $ref->{projectnumber};
}
+ $sth->finish();
}
+ $form->{"globalprojectnumber"} =
+ $projectnumbers{$form->{"globalproject_id"}};
+
+ my @arrays =
+ qw(runningnumber number description longdescription qty ship unit bin
+ partnotes serialnumber reqdate sellprice listprice netprice
+ discount p_discount discount_sub nodiscount_sub
+ linetotal nodiscount_linetotal tax_rate projectnumber);
+
my $sameitem = "";
foreach $item (sort { $a->[1] cmp $b->[1] } @partsgroup) {
$i = $item->[0];
push(@{ $form->{description} }, qq|$item->[1]|);
$sameitem = $item->[1];
- map { push(@{ $form->{$_} }, "") }
- qw(runningnumber number qty ship unit bin partnotes
- serialnumber reqdate sellprice listprice netprice
- discount p_discount linetotal);
+ map({ push(@{ $form->{$_} }, "") } grep({ $_ ne "description" } @arrays));
}
$form->{"qty_$i"} = $form->parse_amount($myconfig, $form->{"qty_$i"});
- if ($form->{"qty_$i"} != 0) {
+ if ($form->{"id_$i"} != 0) {
# add number, description and qty to $form->{number}, ....
push(@{ $form->{p_discount} }, $form->{"discount_$i"});
$form->{ordtotal} += $linetotal;
- $discount_subtotal += $linetotal;
+ $discount_subtotal += $linetotal;
$form->{nodiscount_total} += $nodiscount_linetotal;
$nodiscount_subtotal += $nodiscount_linetotal;
$form->{discount_total} += $form->parse_amount($myconfig, $discount);
push(@{ $form->{nodiscount_linetotal} },
$form->format_amount($myconfig, $nodiscount_linetotal, 2));
+ push(@{ $form->{projectnumber} }, $projectnumbers{$form->{"project_id_$i"}});
+
my ($taxamount, $taxbase);
my $taxrate = 0;
- map { $taxrate += $form->{"${_}_rate"} } split / /,
- $form->{"taxaccounts_$i"};
+ map { $taxrate += $form->{"${_}_rate"} } split(/ /, $form->{"taxaccounts_$i"});
if ($form->{taxincluded}) {
$sortorder = qq|ORDER BY a.$oid{$myconfig->{dbdriver}}|;
}
- $query = qq|SELECT p.partnumber, p.description, p.unit, a.qty,
- pg.partsgroup
- FROM assembly a
- JOIN parts p ON (a.parts_id = p.id)
- LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
- WHERE a.bom = '1'
- AND a.id = '$form->{"id_$i"}'
- $sortorder|;
+ $query = qq|SELECT p.partnumber, p.description, p.unit, a.qty, | .
+ qq|pg.partsgroup | .
+ qq|FROM assembly a | .
+ qq| JOIN parts p ON (a.parts_id = p.id) | .
+ qq| LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id) | .
+ qq| WHERE a.bom = '1' | .
+ qq| AND a.id = ? | . $sortorder;
+ @values = ($form->{"id_$i"});
$sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute(@values) || $form->dberror($query);
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
if ($form->{groupitems} && $ref->{partsgroup} ne $sameitem) {
- map { push(@{ $form->{$_} }, "") }
- qw(runningnumber ship bin serialnumber number unit bin qty
- reqdate sellprice listprice netprice discount p_discount
- linetotal nodiscount_linetotal);
+ map({ push(@{ $form->{$_} }, "") }
+ grep({ $_ ne "description" } @arrays));
$sameitem = ($ref->{partsgroup}) ? $ref->{partsgroup} : "--";
push(@{ $form->{description} }, $sameitem);
}
)
. qq|, $ref->{partnumber}, $ref->{description}|);
- map { push(@{ $form->{$_} }, "") }
- qw(number unit qty runningnumber ship bin serialnumber reqdate
- sellprice listprice netprice discount p_discount linetotal
- nodiscount_linetotal);
-
+ map({ push(@{ $form->{$_} }, "") }
+ grep({ $_ ne "description" } @arrays));
}
$sth->finish;
}
my $tax = 0;
foreach $item (sort keys %taxaccounts) {
- push(@{ $form->{taxbase} },
- $form->format_amount($myconfig, $taxbase{$item}, 2));
+ push(@{ $form->{taxbase} },
+ $form->format_amount($myconfig, $taxbase{$item}, 2));
- $tax += $taxamount = $form->round_amount($taxaccounts{$item}, 2);
+ $tax += $taxamount = $form->round_amount($taxaccounts{$item}, 2);
- push(@{ $form->{tax} }, $form->format_amount($myconfig, $taxamount, 2));
- push(@{ $form->{taxdescription} }, $form->{"${item}_description"});
- push(@{ $form->{taxrate} },
- $form->format_amount($myconfig, $form->{"${item}_rate"} * 100));
- push(@{ $form->{taxnumber} }, $form->{"${item}_taxnumber"});
+ push(@{ $form->{tax} }, $form->format_amount($myconfig, $taxamount, 2));
+ push(@{ $form->{taxdescription} }, $form->{"${item}_description"} . q{ } . 100 * $form->{"${item}_rate"} . q{%});
+ push(@{ $form->{taxrate} },
+ $form->format_amount($myconfig, $form->{"${item}_rate"} * 100));
+ push(@{ $form->{taxnumber} }, $form->{"${item}_taxnumber"});
}
- $form->{subtotal} = $form->format_amount($myconfig, $form->{total}, 2);
$yesdiscount = $form->{nodiscount_total} - $nodiscount;
$form->{nodiscount_subtotal} = $form->format_amount($myconfig, $form->{nodiscount_total}, 2);
$form->{discount_total} = $form->format_amount($myconfig, $form->{discount_total}, 2);
$form->{nodiscount} = $form->format_amount($myconfig, $nodiscount, 2);
$form->{yesdiscount} = $form->format_amount($myconfig, $yesdiscount, 2);
- $form->{subtotal} = $form->format_amount($myconfig, $form->{ordtotal}, 2);
+ if($form->{taxincluded}) {
+ $form->{subtotal} = $form->format_amount($myconfig, $form->{ordtotal} - $tax, 2);
+ }
+ else {
+ $form->{subtotal} = $form->format_amount($myconfig, $form->{ordtotal}, 2);
+ }
$form->{ordtotal} =
($form->{taxincluded}) ? $form->{ordtotal} : $form->{ordtotal} + $tax;
$form->set_payment_options($myconfig, $form->{orddate});
}
- # myconfig variables
- map { $form->{$_} = $myconfig->{$_} }
- (qw(company address tel fax signature businessnumber));
$form->{username} = $myconfig->{name};
$dbh->disconnect;
my ($self, $dbh, $id) = @_;
- my $query = qq|SELECT p.description
- FROM project p
- WHERE p.id = $id|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($_) = $sth->fetchrow_array;
-
- $sth->finish;
-
- $main::lxdebug->leave_sub();
-
- return $_;
-}
-
-sub get_warehouses {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- my $dbh = $form->dbconnect($myconfig);
-
- # setup warehouses
- my $query = qq|SELECT id, description
- FROM warehouse|;
-
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{all_warehouses} }, $ref;
- }
- $sth->finish;
-
- $dbh->disconnect;
+ my $query = qq|SELECT description FROM project WHERE id = ?|;
+ my ($value) = selectrow_query($form, $dbh, $query, $id);
$main::lxdebug->leave_sub();
-}
-
-sub save_inventory {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- my ($null, $warehouse_id) = split /--/, $form->{warehouse};
- $warehouse_id *= 1;
-
- my $employee_id;
- ($null, $employee_id) = split /--/, $form->{employee};
-
- my $ml = ($form->{type} eq 'ship_order') ? -1 : 1;
-
- my $dbh = $form->dbconnect_noauto($myconfig);
- my $sth;
- my $wth;
- my $serialnumber;
- my $ship;
-
- $query = qq|SELECT o.serialnumber, o.ship
- FROM orderitems o
- WHERE o.trans_id = ?
- AND o.id = ?
- FOR UPDATE|;
- $sth = $dbh->prepare($query) || $form->dberror($query);
-
- $query = qq|SELECT sum(i.qty)
- FROM inventory i
- WHERE i.parts_id = ?
- AND i.warehouse_id = ?|;
- $wth = $dbh->prepare($query) || $form->dberror($query);
-
- for my $i (1 .. $form->{rowcount} - 1) {
-
- $ship =
- (abs($form->{"ship_$i"}) > abs($form->{"qty_$i"}))
- ? $form->{"qty_$i"}
- : $form->{"ship_$i"};
-
- if ($warehouse_id && $form->{type} eq 'ship_order') {
-
- $wth->execute($form->{"id_$i"}, $warehouse_id) || $form->dberror;
- ($qty) = $wth->fetchrow_array;
- $wth->finish;
-
- if ($ship > $qty) {
- $ship = $qty;
- }
- }
-
- if ($ship != 0) {
-
- $ship *= $ml;
- $query = qq|INSERT INTO inventory (parts_id, warehouse_id,
- qty, oe_id, orderitems_id, shippingdate, employee_id)
- VALUES ($form->{"id_$i"}, $warehouse_id,
- $ship, $form->{"id"},
- $form->{"orderitems_id_$i"}, '$form->{shippingdate}',
- $employee_id)|;
- $dbh->do($query) || $form->dberror($query);
-
- # add serialnumber, ship to orderitems
- $sth->execute($form->{id}, $form->{"orderitems_id_$i"})
- || $form->dberror;
- ($serialnumber, $ship) = $sth->fetchrow_array;
- $sth->finish;
-
- $serialnumber .= " " if $serialnumber;
- $serialnumber .= qq|$form->{"serialnumber_$i"}|;
- $ship += $form->{"ship_$i"};
-
- $query = qq|UPDATE orderitems SET
- serialnumber = '$serialnumber',
- ship = $ship
- WHERE trans_id = $form->{id}
- AND id = $form->{"orderitems_id_$i"}|;
- $dbh->do($query) || $form->dberror($query);
-
- # update order with ship via
- $query = qq|UPDATE oe SET
- shippingpoint = '$form->{shippingpoint}',
- shipvia = '$form->{shipvia}'
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
-
- # update onhand for parts
- $form->update_balance($dbh, "parts", "onhand",
- qq|id = $form->{"id_$i"}|,
- $form->{"ship_$i"} * $ml);
-
- }
- }
-
- my $rc = $dbh->commit;
- $dbh->disconnect;
-
- $main::lxdebug->leave_sub();
-
- return $rc;
+ return $value;
}
sub adj_onhand {
my ($dbh, $form, $ml) = @_;
- my $service_units = $form->{service_units};
- my $part_units = $form->{part_units};
+ my $all_units = $form->{all_units};
- my $query = qq|SELECT oi.parts_id, oi.ship, oi.unit, p.inventory_accno_id, p.assembly
- FROM orderitems oi
- JOIN parts p ON (p.id = oi.parts_id)
- WHERE oi.trans_id = $form->{id}|;
+ my $query =
+ qq|SELECT oi.parts_id, oi.ship, oi.unit, p.inventory_accno_id, p.assembly | .
+ qq| FROM orderitems oi | .
+ qq| JOIN parts p ON (p.id = oi.parts_id) | .
+ qq| WHERE oi.trans_id = ?|;
+ my @values = ($form->{id});
my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute(@values) || $form->dberror($query);
- $query = qq|SELECT sum(p.inventory_accno_id)
- FROM parts p
- JOIN assembly a ON (a.parts_id = p.id)
- WHERE a.id = ?|;
+ $query =
+ qq|SELECT sum(p.inventory_accno_id) | .
+ qq|FROM parts p | .
+ qq|JOIN assembly a ON (a.parts_id = p.id) | .
+ qq|WHERE a.id = ?|;
my $ath = $dbh->prepare($query) || $form->dberror($query);
my $ispa;
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- #print(STDERR "Bin in Schleife $ref->{inventory_accno_id}\n");
-
if ($ref->{inventory_accno_id} || $ref->{assembly}) {
# do not update if assembly consists of all services
}
# get item baseunit
- $query = qq|SELECT p.unit
- FROM parts p
- WHERE p.id = $ref->{parts_id}|;
- my $stw = $dbh->prepare($query);
- $stw->execute || $form->dberror($query);
-
- my ($item_unit) = $stw->fetchrow_array();
- $stw->finish;
-
- if ($ref->{inventory_accno_id}) {
- if (defined($part_units->{$item_unit}->{factor}) && $part_units->{$item_unit}->{factor} ne '' && $part_units->{$item_unit}->{factor} ne '0') {
- $basefactor = $part_units->{$ref->{unit}}->{factor} / $part_units->{$item_unit}->{factor};
- } else {
- $basefactor = 1;
- }
- $baseqty = $ref->{ship} * $basefactor;
- } else {
- if (defined($service_units->{$item_unit}->{factor}) && $service_units->{$item_unit}->{factor} ne '' && $service_units->{$item_unit}->{factor} ne '0') {
- $basefactor = $service_units->{$ref->{unit}}->{factor} / $part_units->{$item_unit}->{factor};
- } else {
- $basefactor = 1;
- }
- $baseqty = $ref->{ship} * $basefactor;
- }
- #print(STDERR "$baseqty Basismenge\n");
+ $query = qq|SELECT unit FROM parts WHERE id = ?|;
+ my ($item_unit) = selectrow_query($form, $dbh, $query, $ref->{parts_id});
+
+ my $basefactor = 1;
+ if (defined($all_units->{$item_unit}->{factor}) &&
+ (($all_units->{$item_unit}->{factor} * 1) != 0)) {
+ $basefactor = $all_units->{$ref->{unit}}->{factor} /
+ $all_units->{$item_unit}->{factor};
+ }
+ my $baseqty = $ref->{ship} * $basefactor;
# adjust onhand in parts table
$form->update_balance($dbh, "parts", "onhand",
$main::lxdebug->leave_sub();
}
-sub adj_inventory {
- $main::lxdebug->enter_sub();
-
- my ($dbh, $myconfig, $form) = @_;
-
- my %oid = ('Pg' => 'oid',
- 'Oracle' => 'rowid');
-
- # increase/reduce qty in inventory table
- my $query = qq|SELECT oi.id, oi.parts_id, oi.ship
- FROM orderitems oi
- WHERE oi.trans_id = $form->{id}|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- $query = qq|SELECT $oid{$myconfig->{dbdriver}} AS oid, qty,
- (SELECT SUM(qty) FROM inventory
- WHERE oe_id = $form->{id}
- AND orderitems_id = ?) AS total
- FROM inventory
- WHERE oe_id = $form->{id}
- AND orderitems_id = ?|;
- my $ith = $dbh->prepare($query) || $form->dberror($query);
-
- my $qty;
- my $ml = ($form->{type} =~ /(ship|sales)_order/) ? -1 : 1;
-
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
-
- $ith->execute($ref->{id}, $ref->{id}) || $form->dberror($query);
-
- while (my $inv = $ith->fetchrow_hashref(NAME_lc)) {
-
- if (($qty = (($inv->{total} * $ml) - $ref->{ship})) >= 0) {
- $qty = $inv->{qty} if ($qty > ($inv->{qty} * $ml));
-
- $form->update_balance($dbh, "inventory", "qty",
- qq|$oid{$myconfig->{dbdriver}} = $inv->{oid}|,
- $qty * -1 * $ml);
- }
- }
- $ith->finish;
-
- }
- $sth->finish;
-
- # delete inventory entries if qty = 0
- $query = qq|DELETE FROM inventory
- WHERE oe_id = $form->{id}
- AND qty = 0|;
- $dbh->do($query) || $form->dberror($query);
-
- $main::lxdebug->leave_sub();
-}
-
-sub get_inventory {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- my ($null, $warehouse_id) = split /--/, $form->{warehouse};
- $warehouse_id *= 1;
-
- my $dbh = $form->dbconnect($myconfig);
-
- my $query = qq|SELECT p.id, p.partnumber, p.description, p.onhand,
- pg.partsgroup
- FROM parts p
- LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id)
- WHERE p.onhand > 0|;
-
- if ($form->{partnumber}) {
- $var = $form->like(lc $form->{partnumber});
- $query .= "
- AND lower(p.partnumber) LIKE '$var'";
- }
- if ($form->{description}) {
- $var = $form->like(lc $form->{description});
- $query .= "
- AND lower(p.description) LIKE '$var'";
- }
- if ($form->{partsgroup}) {
- $var = $form->like(lc $form->{partsgroup});
- $query .= "
- AND lower(pg.partsgroup) LIKE '$var'";
- }
-
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- $query = qq|SELECT sum(i.qty), w.description, w.id
- FROM inventory i
- LEFT JOIN warehouse w ON (w.id = i.warehouse_id)
- WHERE i.parts_id = ?
- AND NOT i.warehouse_id = $warehouse_id
- GROUP BY w.description, w.id|;
- $wth = $dbh->prepare($query) || $form->dberror($query);
-
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
-
- $wth->execute($ref->{id}) || $form->dberror;
-
- while (($qty, $warehouse, $warehouse_id) = $wth->fetchrow_array) {
- push @{ $form->{all_inventory} },
- { 'id' => $ref->{id},
- 'partnumber' => $ref->{partnumber},
- 'description' => $ref->{description},
- 'partsgroup' => $ref->{partsgroup},
- 'qty' => $qty,
- 'warehouse_id' => $warehouse_id,
- 'warehouse' => $warehouse }
- if $qty > 0;
- }
- $wth->finish;
- }
- $sth->finish;
-
- $dbh->disconnect;
-
- # sort inventory
- @{ $form->{all_inventory} } =
- sort { $a->{ $form->{sort} } cmp $b->{ $form->{sort} } }
- @{ $form->{all_inventory} };
-
- $main::lxdebug->leave_sub();
-
- return @{ $form->{all_inventory} };
-}
-
-sub transfer {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- my $dbh = $form->dbconnect_noauto($myconfig);
-
- my $query = qq|INSERT INTO inventory
- (warehouse_id, parts_id, qty, shippingdate, employee_id)
- VALUES (?, ?, ?, ?, ?)|;
- $sth = $dbh->prepare($query) || $form->dberror($query);
-
- $form->get_employee($dbh);
-
- my @a = localtime;
- $a[5] += 1900;
- $a[4]++;
- $shippingdate = "$a[5]-$a[4]-$a[3]";
-
- for my $i (1 .. $form->{rowcount}) {
- $qty = $form->parse_amount($myconfig, $form->{"transfer_$i"});
-
- $qty = $form->{"qty_$i"} if ($qty > $form->{"qty_$i"});
-
- if ($qty) {
-
- # to warehouse
- $sth->execute($form->{warehouse_id}, $form->{"id_$i"}, $qty,
- $shippingdate, $form->{employee_id})
- || $form->dberror;
-
- $sth->finish;
-
- # from warehouse
- $sth->execute($form->{"warehouse_id_$i"},
- $form->{"id_$i"}, $qty * -1, $shippingdate,
- $form->{employee_id})
- || $form->dberror;
-
- $sth->finish;
- }
- }
-
- my $rc = $dbh->commit;
- $dbh->disconnect;
-
- $main::lxdebug->leave_sub();
-
- return $rc;
-}
-
-sub webdav_folder {
- $main::lxdebug->enter_sub();
-
- my ($myconfig, $form) = @_;
-
-SWITCH: {
- $path = "webdav/angebote/" . $form->{quonumber}, last SWITCH
- if ($form->{type} eq "sales_quotation");
- $path = "webdav/bestellungen/" . $form->{ordnumber}, last SWITCH
- if ($form->{type} eq "sales_order");
- $path = "webdav/anfragen/" . $form->{quonumber}, last SWITCH
- if ($form->{type} eq "request_quotation");
- $path = "webdav/lieferantenbestellungen/" . $form->{ordnumber}, last SWITCH
- if ($form->{type} eq "purchase_order");
- }
-
- if (!-d $path) {
- mkdir($path, 0770) or die "can't make directory $!\n";
- } else {
- if ($form->{id}) {
- @files = <$path/*>;
- foreach $file (@files) {
- $file =~ /\/([^\/]*)$/;
- $fname = $1;
- $ENV{'SCRIPT_NAME'} =~ /\/([^\/]*)\//;
- $lxerp = $1;
- $link = "http://" . $ENV{'SERVER_NAME'} . "/" . $lxerp . "/" . $file;
- $form->{WEBDAV}{$fname} = $link;
- }
- }
- }
-
- $main::lxdebug->leave_sub();
-}
1;
-
package OP;
+use SL::DBUtils;
+
sub overpayment {
$main::lxdebug->enter_sub();
my ($self, $myconfig, $form, $dbh, $amount, $ml) = @_;
my $fxamount = $form->round_amount($amount * $form->{exchangerate}, 2);
- my ($paymentaccno) = split /--/, $form->{account};
+ my ($paymentaccno) = split(/--/, $form->{account});
- my $vc_id = "$form->{vc}_id";
+ my $vc_id = $form->{vc} eq "customer" ? "customer_id" : "vendor_id";
+ my $arap = $form->{arap} eq "ar" ? "ar" : "ap";
- my $uid = time;
- $uid .= $form->{login};
+ my $query = qq|SELECT nextval('glid')|;
+ my ($new_id) = selectrow_query($form, $dbh, $query);
# add AR/AP header transaction with a payment
- $query = qq|INSERT INTO $form->{arap} (invnumber, employee_id)
- VALUES ('$uid', (SELECT e.id FROM employee e
- WHERE e.login = '$form->{login}'))|;
- $dbh->do($query) || $form->dberror($query);
-
- $query = qq|SELECT a.id FROM $form->{arap} a
- WHERE a.invnumber = '$uid'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($uid) = $sth->fetchrow_array;
- $sth->finish;
-
- my $invnumber = ($form->{invnumber}) ? $form->{invnumber} : $uid;
- $query = qq|UPDATE $form->{arap} set
- invnumber = '$invnumber',
- $vc_id = $form->{"$form->{vc}_id"},
- transdate = '$form->{datepaid}',
- datepaid = '$form->{datepaid}',
- duedate = '$form->{datepaid}',
- netamount = 0,
- amount = 0,
- paid = $fxamount,
- curr = '$form->{currency}',
- department_id = $form->{department_id}
- WHERE id = $uid|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|INSERT INTO $arap (id, invnumber, employee_id) | .
+ qq|VALUES (?, ?, (SELECT id FROM employee WHERE login = ?))|;
+ my @values = ($new_id, $form->{login}, $form->{login});
+ do_query($form, $dbh, $query, @values);
+
+ my $invnumber = ($form->{invnumber}) ? $form->{invnumber} : $new_id;
+ $query =
+ qq|UPDATE $arap SET invnumber = ?, $vc_id = ?, transdate = ?, datepaid = ?, | .
+ qq|duedate = ?, netamount = ?, amount = ?, paid = ?, | .
+ qq|curr = ?, department_id = ? | .
+ qq|WHERE id = ?|;
+ @values = ($invnumber, $form->{$vc_id},
+ conv_date($form->{datepaid}), conv_date($form->{datepaid}),
+ conv_date($form->{datepaid}), 0, 0, $fxamount, $form->{currency},
+ $form->{department_id}, $new_id);
+ do_query($form, $dbh, $query, @values);
# add AR/AP
($accno) = split /--/, $form->{ $form->{ARAP} };
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount)
- VALUES ($uid, (SELECT c.id FROM chart c
- WHERE c.accno = '$accno'),
- '$form->{datepaid}', $fxamount * $ml)|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount) | .
+ qq|VALUES (?, (SELECT id FROM chart WHERE accno = ? ), ?, ?)|;
+ @values = ($new_id, $accno, conv_date($form->{datepaid}), $fxamount * $ml);
+ do_query($form, $dbh, $query, @values);
# add payment
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, transdate,
- amount, source, memo)
- VALUES ($uid, (SELECT c.id FROM chart c
- WHERE c.accno = '$paymentaccno'),
- '$form->{datepaid}', $amount * $ml * -1,
- '$form->{source}', '$form->{memo}')|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, source, memo) | .
+ qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?)|;
+ @values = ($new_id, $paymentaccno, conv_date($form->{datepaid}),
+ $amount * $ml * -1, $form->{source}, $form->{memo});
+ do_query($form, $dbh, $query, @values);
# add exchangerate difference
if ($fxamount != $amount) {
- $query = qq|INSERT INTO acc_trans (trans_id, chart_id, transdate,
- amount, cleared, fx_transaction)
- VALUES ($uid, (SELECT c.id FROM chart c
- WHERE c.accno = '$paymentaccno'),
- '$form->{datepaid}', ($fxamount - $amount) * $ml * -1,
- '1', '1')|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, cleared, fx_transaction) | .
+ qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?)|;
+ @values = ($new_id, $paymentaccno, conv_date($form->{datepaid}),
+ (($fxamount - $amount) * $ml * -1), 1, 1);
+ do_query($form, $dbh, $query, @values);
}
$main::lxdebug->leave_sub();
use Data::Dumper;
+use SL::DBUtils;
+
sub projects {
$main::lxdebug->enter_sub();
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $sortorder = ($form->{sort}) ? $form->{sort} : "projectnumber";
-
- my $query = qq|SELECT p.id, p.projectnumber, p.description
- FROM project p
- WHERE 1 = 1|;
+ my ($where, @values);
- if ($form->{projectnumber}) {
- my $projectnumber = $form->like(lc $form->{projectnumber});
- $query .= " AND lower(projectnumber) LIKE '$projectnumber'";
- }
- if ($form->{projectdescription}) {
- my $description = $form->like(lc $form->{projectdescription});
- $query .= " AND lower(description) LIKE '$description'";
+ foreach my $column (qw(projectnumber description)) {
+ if ($form->{$column}) {
+ $where .= qq|AND $column ILIKE ? |;
+ push(@values, '%' . $form->{$column} . '%');
+ }
}
+
if ($form->{status} eq 'orphaned') {
- $query .= " AND id NOT IN (SELECT p.id
- FROM project p, acc_trans a
- WHERE p.id = a.project_id)
- AND id NOT IN (SELECT p.id
- FROM project p, invoice i
- WHERE p.id = i.project_id)
- AND id NOT IN (SELECT p.id
- FROM project p, orderitems o
- WHERE p.id = o.project_id)";
+ my %col_prefix = ("ar" => "global", "ap" => "global", "oe" => "global");
+ my $first = 1;
+
+ $where .= qq|AND id NOT IN (|;
+ foreach my $table (qw(acc_trans invoice orderitems rmaitems ar ap oe)) {
+ $where .= "UNION " unless ($first);
+ $first = 0;
+ $where .=
+ qq|SELECT DISTINCT $col_prefix{$table}project_id FROM $table | .
+ qq|WHERE NOT $col_prefix{$table}project_id ISNULL |;
+ }
+ $where .= qq|) |;
}
- $query .= qq|
- ORDER BY $sortorder|;
+ if ($form->{active} eq "active") {
+ $where .= qq|AND active |;
+ } elsif ($form->{active} eq "inactive") {
+ $where .= qq|AND NOT active |;
+ }
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ substr($where, 0, 4) = "WHERE " if ($where);
- my $i = 0;
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{project_list} }, $ref;
- $i++;
- }
+ my $sortorder = $form->{sort} ? $form->{sort} : "projectnumber";
+ $sortorder =~ s/[^a-z_]//g;
+ my $query =
+ qq|SELECT id, projectnumber, description, active | .
+ qq|FROM project | .
+ $where .
+ qq|ORDER BY $sortorder|;
- $sth->finish;
+ $form->{project_list} =
+ selectall_hashref_query($form, $dbh, $query, @values);
$dbh->disconnect;
$main::lxdebug->leave_sub();
- return $i;
+ return scalar(@{ $form->{project_list} });
}
sub get_project {
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT p.*
- FROM project p
- WHERE p.id = $form->{id}|;
+ my $query =
+ qq|SELECT * FROM project | .
+ qq|WHERE id = ?|;
+ my @values = ($form->{id});
my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute(@values) || $form->dberror($query);
my $ref = $sth->fetchrow_hashref(NAME_lc);
$sth->finish;
# check if it is orphaned
- $query = qq|SELECT count(*)
- FROM acc_trans a
- WHERE a.project_id = $form->{id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my %col_prefix = ("ar" => "global", "ap" => "global", "oe" => "global");
+ @values = ();
+ $query = qq|SELECT |;
+ my $first = 1;
+ foreach my $table (qw(acc_trans invoice orderitems rmaitems ar ap oe)) {
+ $query .= " + " unless ($first);
+ $first = 0;
+ $query .=
+ qq|(SELECT COUNT(*) FROM $table | .
+ qq| WHERE $col_prefix{$table}project_id = ?) |;
+ push(@values, $form->{id});
+ }
- ($form->{orphaned}) = $sth->fetchrow_array;
+ ($form->{orphaned}) = selectrow_query($form, $dbh, $query, @values);
$form->{orphaned} = !$form->{orphaned};
- $sth->finish;
-
$dbh->disconnect;
$main::lxdebug->leave_sub();
# connect to database
my $dbh = $form->dbconnect($myconfig);
- map { $form->{$_} =~ s/\'/\'\'/g } qw(projectnumber description);
+ my @values = ($form->{projectnumber}, $form->{description});
if ($form->{id}) {
- $query = qq|UPDATE project SET
- projectnumber = '$form->{projectnumber}',
- description = '$form->{description}'
- WHERE id = $form->{id}|;
+ $query =
+ qq|UPDATE project SET projectnumber = ?, description = ?, active = ? | .
+ qq|WHERE id = ?|;
+ push(@values, ($form->{active} ? 't' : 'f'), $form->{id});
} else {
- $query = qq|INSERT INTO project
- (projectnumber, description)
- VALUES ('$form->{projectnumber}', '$form->{description}')|;
+ $query =
+ qq|INSERT INTO project (projectnumber, description, active) | .
+ qq|VALUES (?, ?, 't')|;
}
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, $query, @values);
$dbh->disconnect;
my ($self, $myconfig, $form) = @_;
- my $var;
-
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $sortorder = ($form->{sort}) ? $form->{sort} : "partsgroup";
-
- my $query = qq|SELECT g.*
- FROM partsgroup g|;
-
- my $where = "1 = 1";
+ my ($where, @values);
if ($form->{partsgroup}) {
- $var = $form->like(lc $form->{partsgroup});
- $where .= " AND lower(g.partsgroup) LIKE '$var'";
+ $where .= qq| AND partsgroup ILIKE ?|;
+ push(@values, '%' . $form->{partsgroup} . '%');
}
- $query .= qq|
- WHERE $where
- ORDER BY $sortorder|;
if ($form->{status} eq 'orphaned') {
- $query = qq|SELECT g.*
- FROM partsgroup g
- LEFT JOIN parts p ON (p.partsgroup_id = g.id)
- WHERE $where
- EXCEPT
- SELECT g.*
- FROM partsgroup g
- JOIN parts p ON (p.partsgroup_id = g.id)
- WHERE $where
- ORDER BY $sortorder|;
+ $where .=
+ qq| AND id NOT IN | .
+ qq| (SELECT DISTINCT partsgroup_id FROM parts | .
+ qq| WHERE NOT partsgroup_id ISNULL) |;
}
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ substr($where, 0, 4) = "WHERE " if ($where);
- my $i = 0;
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{item_list} }, $ref;
- $i++;
- }
+ my $sortorder = $form->{sort} ? $form->{sort} : "partsgroup";
+ $sortorder =~ s/[^a-z_]//g;
+
+ my $query =
+ qq|SELECT id, partsgroup FROM partsgroup | .
+ $where .
+ qq|ORDER BY $sortorder|;
+
+ $form->{item_list} = selectall_hashref_query($form, $dbh, $query, @values);
- $sth->finish;
$dbh->disconnect;
$main::lxdebug->leave_sub();
- return $i;
+ return scalar(@{ $form->{item_list} });
}
sub save_partsgroup {
# connect to database
my $dbh = $form->dbconnect($myconfig);
- map { $form->{$_} =~ s/\'/\'\'/g } qw(partsgroup);
$form->{discount} /= 100;
+ my @values = ($form->{partsgroup});
+
if ($form->{id}) {
- $query = qq|UPDATE partsgroup SET
- partsgroup = '$form->{partsgroup}'
- WHERE id = $form->{id}|;
+ $query = qq|UPDATE partsgroup SET partsgroup = ? WHERE id = ?|;
+ push(@values, $form->{id});
} else {
- $query = qq|INSERT INTO partsgroup
- (partsgroup)
- VALUES ('$form->{partsgroup}')|;
+ $query = qq|INSERT INTO partsgroup (partsgroup) VALUES (?)|;
}
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, $query, @values);
$dbh->disconnect;
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT p.*
- FROM partsgroup p
- WHERE p.id = $form->{id}|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
+ my $query =
+ qq|SELECT pg.*, | .
+ qq|(SELECT COUNT(*) FROM parts WHERE partsgroup_id = ?) = 0 AS orphaned | .
+ qq|FROM partsgroup pg | .
+ qq|WHERE pg.id = ?|;
+ my $sth = prepare_execute_query($form, $dbh, $query, $form->{id},
+ $form->{id});
my $ref = $sth->fetchrow_hashref(NAME_lc);
- map { $form->{$_} = $ref->{$_} } keys %$ref;
-
- $sth->finish;
-
- # check if it is orphaned
- $query = qq|SELECT count(*)
- FROM parts p
- WHERE p.partsgroup_id = $form->{id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($form->{orphaned}) = $sth->fetchrow_array;
- $form->{orphaned} = !$form->{orphaned};
-
+ map({ $form->{$_} = $ref->{$_} } keys(%{$ref}));
$sth->finish;
$dbh->disconnect;
# connect to database
my $dbh = $form->dbconnect($myconfig);
- $query = qq|DELETE FROM $form->{type}
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
+ my $table =
+ $form->{type} eq "project" ? "project" :
+ $form->{type} eq "pricegroup" ? "pricegroup" :
+ "partsgroup";
+
+ $query = qq|DELETE FROM $table WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{id});
$dbh->disconnect;
my ($self, $myconfig, $form) = @_;
- my $var;
-
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $sortorder = ($form->{sort}) ? $form->{sort} : "pricegroup";
-
- my $query = qq|SELECT g.id, g.pricegroup
- FROM pricegroup g|;
-
- my $where = "1 = 1";
+ my ($where, @values);
if ($form->{pricegroup}) {
- $var = $form->like(lc $form->{pricegroup});
- $where .= " AND lower(g.pricegroup) LIKE '$var'";
+ $where .= qq| AND pricegroup ILIKE ?|;
+ push(@values, '%' . $form->{pricegroup} . '%');
}
- $query .= qq|
- WHERE $where
- ORDER BY $sortorder|;
if ($form->{status} eq 'orphaned') {
- $query = qq|SELECT pg.*
- FROM pricegroup pg
- LEFT JOIN prices p ON (p.pricegroup_id = pg.id)
- WHERE $where
- EXCEPT
- SELECT pg.*
- FROM pricegroup pg
- JOIN prices p ON (p.pricegroup_id = pg.id)
- WHERE $where
- ORDER BY $sortorder|;
+ my $first = 1;
+
+ $where .= qq| AND id NOT IN (|;
+ foreach my $table (qw(invoice orderitems prices rmaitems)) {
+ $where .= "UNION " unless ($first);
+ $first = 0;
+ $where .=
+ qq|SELECT DISTINCT pricegroup_id FROM $table | .
+ qq|WHERE NOT pricegroup_id ISNULL |;
+ }
+ $where .= qq|) |;
}
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ substr($where, 0, 4) = "WHERE " if ($where);
- my $i = 0;
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{item_list} }, $ref;
- $i++;
- }
+ my $sortorder = $form->{sort} ? $form->{sort} : "pricegroup";
+ $sortorder =~ s/[^a-z_]//g;
+
+ my $query =
+ qq|SELECT id, pricegroup FROM pricegroup | .
+ $where .
+ qq|ORDER BY $sortorder|;
+
+ $form->{item_list} = selectall_hashref_query($form, $dbh, $query, @values);
- $sth->finish;
$dbh->disconnect;
$main::lxdebug->leave_sub();
- return $i;
+ return scalar(@{ $form->{item_list} });
}
+
########################
# save pricegruop to database
#
# connect to database
my $dbh = $form->dbconnect($myconfig);
-
- map { $form->{$_} =~ s/\'/\'\'/g } qw(pricegroup);
+ my $query;
$form->{discount} /= 100;
+ my @values = ($form->{pricegroup});
+
if ($form->{id}) {
- $query = qq|UPDATE pricegroup SET
- pricegroup = '$form->{pricegroup}'
- WHERE id = $form->{id}|;
+ $query = qq|UPDATE pricegroup SET pricegroup = ? WHERE id = ? |;
+ push(@values, $form->{id});
} else {
- $query = qq|INSERT INTO pricegroup
- (pricegroup)
- VALUES ('$form->{pricegroup}')|;
+ $query = qq|INSERT INTO pricegroup (pricegroup) VALUES (?)|;
}
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, $query, @values);
$dbh->disconnect;
$main::lxdebug->leave_sub();
}
+
############################
# get one pricegroup from database
#
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT p.id, p.pricegroup
- FROM pricegroup p
- WHERE p.id = $form->{id}|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
+ my $query = qq|SELECT id, pricegroup FROM pricegroup WHERE id = ?|;
+ my $sth = prepare_execute_query($form, $dbh, $query, $form->{id});
my $ref = $sth->fetchrow_hashref(NAME_lc);
- map { $form->{$_} = $ref->{$_} } keys %$ref;
+ map({ $form->{$_} = $ref->{$_} } keys(%{$ref}));
$sth->finish;
- # check if it is orphaned
- $query = qq|SELECT count(*)
- FROM prices p
- WHERE p.pricegroup_id = $form->{id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $first = 1;
- ($form->{orphaned}) = $sth->fetchrow_array;
- $form->{orphaned} = !$form->{orphaned};
+ my @values = ();
+ $query = qq|SELECT |;
+ foreach my $table (qw(invoice orderitems prices rmaitems)) {
+ $query .= " + " unless ($first);
+ $first = 0;
+ $query .= qq|(SELECT COUNT(*) FROM $table WHERE pricegroup_id = ?) |;
+ push(@values, $form->{id});
+ }
- $sth->finish;
+ ($form->{orphaned}) = selectrow_query($form, $dbh, $query, @values);
+ $form->{orphaned} = !$form->{orphaned};
$dbh->disconnect;
package RC;
+use SL::DBUtils;
+
sub paymentaccounts {
$main::lxdebug->enter_sub();
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT c.accno, c.description
- FROM chart c
- WHERE c.link LIKE '%_paid%'
- AND (c.category = 'A' OR c.category = 'L')
- ORDER BY c.accno|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $query =
+ qq|SELECT accno, description | .
+ qq|FROM chart | .
+ qq|WHERE link LIKE '%_paid%' AND category IN ('A', 'L') | .
+ qq|ORDER BY accno|;
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{PR} }, $ref;
- }
- $sth->finish;
+ $form->{PR} = selectall_hashref_query($form, $dbh, $query);
$dbh->disconnect;
$main::lxdebug->leave_sub();
# connect to database, turn AutoCommit off
my $dbh = $form->dbconnect_noauto($myconfig);
- my ($query, $sth);
+ my ($query, @values);
# get cleared balance
if ($form->{fromdate}) {
- $query = qq|SELECT sum(a.amount),
- (SELECT DISTINCT c2.category FROM chart c2
- WHERE c2.accno = '$form->{accno}') AS category
- FROM acc_trans a
- JOIN chart c ON (c.id = a.chart_id)
- WHERE a.transdate < date '$form->{fromdate}'
- AND a.cleared = '1'
- AND c.accno = '$form->{accno}'
- |;
+ $query =
+ qq|SELECT sum(a.amount), | .
+ qq| (SELECT DISTINCT c2.category FROM chart c2 | .
+ qq| WHERE c2.accno = ?) AS category | .
+ qq|FROM acc_trans a | .
+ qq|JOIN chart c ON (c.id = a.chart_id) | .
+ qq|WHERE a.transdate < date ? AND a.cleared = '1' AND c.accno = ?|;
+ @values = ($form->{accno}, conv_date($form->{fromdate}), $form->{accno});
+
} else {
- $query = qq|SELECT sum(a.amount),
- (SELECT DISTINCT c2.category FROM chart c2
- WHERE c2.accno = '$form->{accno}') AS category
- FROM acc_trans a
- JOIN chart c ON (c.id = a.chart_id)
- WHERE a.cleared = '1'
- AND c.accno = '$form->{accno}'
- |;
+ $query =
+ qq|SELECT sum(a.amount), | .
+ qq| (SELECT DISTINCT c2.category FROM chart c2 | .
+ qq| WHERE c2.accno = ?) AS category | .
+ qq|FROM acc_trans a | .
+ qq|JOIN chart c ON (c.id = a.chart_id) | .
+ qq|WHERE a.cleared = '1' AND c.accno = ?|;
+ @values = ($form->{accno}, $form->{accno});
}
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($form->{beginningbalance}, $form->{category}) = $sth->fetchrow_array;
-
- $sth->finish;
+ ($form->{beginningbalance}, $form->{category}) =
+ selectrow_query($form, $dbh, $query, @values);
my %oid = ('Pg' => 'ac.oid',
'Oracle' => 'ac.rowid');
+ @values = ();
+ $query =
+ qq|SELECT c.name, ac.source, ac.transdate, ac.cleared, | .
+ qq| ac.fx_transaction, ac.amount, a.id, | .
+ qq| $oid{$myconfig->{dbdriver}} AS oid | .
+ qq|FROM customer c, acc_trans ac, ar a, chart ch | .
+ qq|WHERE c.id = a.customer_id | .
+ qq| AND ac.cleared = '0' | .
+ qq| AND ac.trans_id = a.id | .
+ qq| AND ac.chart_id = ch.id | .
+ qq| AND ch.accno = ? |;
+ push(@values, $form->{accno});
+
+ if($form->{fromdate}) {
+ $query .= qq| AND ac.transdate >= ? |;
+ push(@values, conv_date($form->{fromdate}));
+ }
- $query = qq|SELECT c.name, ac.source, ac.transdate, ac.cleared,
- ac.fx_transaction, ac.amount, a.id,
- $oid{$myconfig->{dbdriver}} AS oid
- FROM customer c, acc_trans ac, ar a, chart ch
- WHERE c.id = a.customer_id
--- AND NOT ac.fx_transaction
- AND ac.cleared = '0'
- AND ac.trans_id = a.id
- AND ac.chart_id = ch.id
- AND ch.accno = '$form->{accno}'
- |;
-
- $query .= " AND ac.transdate >= '$form->{fromdate}'" if $form->{fromdate};
- $query .= " AND ac.transdate <= '$form->{todate}'" if $form->{todate};
-
- $query .= qq|
-
- UNION
- SELECT v.name, ac.source, ac.transdate, ac.cleared,
- ac.fx_transaction, ac.amount, a.id,
- $oid{$myconfig->{dbdriver}} AS oid
- FROM vendor v, acc_trans ac, ap a, chart ch
- WHERE v.id = a.vendor_id
--- AND NOT ac.fx_transaction
- AND ac.cleared = '0'
- AND ac.trans_id = a.id
- AND ac.chart_id = ch.id
- AND ch.accno = '$form->{accno}'
- |;
-
- $query .= " AND ac.transdate >= '$form->{fromdate}'" if $form->{fromdate};
- $query .= " AND ac.transdate <= '$form->{todate}'" if $form->{todate};
-
- $query .= qq|
-
- UNION
- SELECT g.description, ac.source, ac.transdate, ac.cleared,
- ac.fx_transaction, ac.amount, g.id,
- $oid{$myconfig->{dbdriver}} AS oid
- FROM gl g, acc_trans ac, chart ch
- WHERE g.id = ac.trans_id
--- AND NOT ac.fx_transaction
- AND ac.cleared = '0'
- AND ac.trans_id = g.id
- AND ac.chart_id = ch.id
- AND ch.accno = '$form->{accno}'
- |;
-
- $query .= " AND ac.transdate >= '$form->{fromdate}'" if $form->{fromdate};
- $query .= " AND ac.transdate <= '$form->{todate}'" if $form->{todate};
+ if($form->{todate}){
+ $query .= qq| AND ac.transdate <= ? |;
+ push(@values, conv_date($form->{todate}));
+ }
- $query .= " ORDER BY 3,7,8";
+ $query .=
+ qq|UNION | .
+
+ qq|SELECT v.name, ac.source, ac.transdate, ac.cleared, | .
+ qq| ac.fx_transaction, ac.amount, a.id, | .
+ qq| $oid{$myconfig->{dbdriver}} AS oid | .
+ qq|FROM vendor v, acc_trans ac, ap a, chart ch | .
+ qq|WHERE v.id = a.vendor_id | .
+ qq| AND ac.cleared = '0' | .
+ qq| AND ac.trans_id = a.id | .
+ qq| AND ac.chart_id = ch.id | .
+ qq| AND ch.accno = ? |;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ push(@values, $form->{accno});
+
+ if($form->{fromdate}) {
+ $query .= qq| AND ac.transdate >= ? |;
+ push(@values, conv_date($form->{fromdate}));
+ }
- while (my $pr = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{PR} }, $pr;
+ if($form->{todate}){
+ $query .= qq| AND ac.transdate <= ? |;
+ push(@values, conv_date($form->{todate}));
}
- $sth->finish;
+
+ $query .=
+ qq|UNION | .
+
+ qq|SELECT g.description, ac.source, ac.transdate, ac.cleared, | .
+ qq| ac.fx_transaction, ac.amount, g.id, | .
+ qq| $oid{$myconfig->{dbdriver}} AS oid | .
+ qq|FROM gl g, acc_trans ac, chart ch | .
+ qq|WHERE g.id = ac.trans_id | .
+ qq| AND ac.cleared = '0' | .
+ qq| AND ac.trans_id = g.id | .
+ qq| AND ac.chart_id = ch.id | .
+ qq| AND ch.accno = ? |;
+
+ push(@values, $form->{accno});
+
+ if($form->{fromdate}) {
+ $query .= qq| AND ac.transdate >= ? |;
+ push(@values, conv_date($form->{fromdate}));
+ }
+
+ if($form->{todate}){
+ $query .= qq| AND ac.transdate <= ? |;
+ push(@values, conv_date($form->{todate}));
+ }
+
+ $query .= " ORDER BY 3,7,8";
+
+ $form->{PR} = selectall_hashref_query($form, $dbh, $query, @values);
$dbh->disconnect;
# clear flags
for $i (1 .. $form->{rowcount}) {
if ($form->{"cleared_$i"}) {
- $query = qq|UPDATE acc_trans SET cleared = '1'
- WHERE $oid{$myconfig->{dbdriver}} = $form->{"oid_$i"}|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|UPDATE acc_trans SET cleared = '1' | .
+ qq|WHERE $oid{$myconfig->{dbdriver}} = ?|;
+ do_query($form, $dbh, $query, $form->{"oid_$i"});
# clear fx_transaction
if ($form->{"fxoid_$i"}) {
- $query = qq|UPDATE acc_trans SET cleared = '1'
- WHERE $oid{$myconfig->{dbdriver}} = $form->{"fxoid_$i"}|;
- $dbh->do($query) || $form->dberror($query);
+ $query =
+ qq|UPDATE acc_trans SET cleared = '1' | .
+ qq|WHERE $oid{$myconfig->{dbdriver}} = ?|;
+ do_query($form, $dbh, $query, $form->{"fxoid_$i"});
}
}
}
-#=====================================================================
+###=====================================================================
# LX-Office ERP
# Copyright (C) 2004
# Based on SQL-Ledger Version 2.1.9
package RP;
+use SL::DBUtils;
+use Data::Dumper;
+
sub balance_sheet {
$main::lxdebug->enter_sub();
# if there are any dates construct a where
if ($form->{asofdate}) {
-
- $form->{this_period} = "$form->{asofdate}";
- $form->{period} = "$form->{asofdate}";
-
+ $form->{period} = $form->{this_period} = conv_dateq($form->{asofdate});
}
$form->{decimalplaces} *= 1;
&get_accounts($dbh, $last_period, "", $form->{compareasofdate},
$form, \@categories);
- $form->{last_period} = "$form->{compareasofdate}";
+ $form->{last_period} = conv_dateq($form->{compareasofdate});
}
'ml' => 1
});
- foreach $category (grep { !/C/ } @categories) {
+ foreach my $category (grep { !/C/ } @categories) {
foreach $key (sort keys %{ $form->{$category} }) {
my $glwhere = "";
my $subwhere = "";
my $item;
+ my $sth;
- my $category = "AND (";
- foreach $item (@{$categories}) {
- $category .= qq|c.category = '$item' OR |;
- }
- $category =~ s/OR $/\)/;
+ my $category = qq| AND (| . join(" OR ", map({ "(c.category = " . $dbh->quote($_) . ")" } @{$categories})) . qq|) |;
# get headings
- $query = qq|SELECT c.accno, c.description, c.category
- FROM chart c
- WHERE c.charttype = 'H'
- $category
- ORDER by c.accno|;
-
- if ($form->{accounttype} eq 'gifi') {
- $query = qq|SELECT g.accno, g.description, c.category
- FROM gifi g
- JOIN chart c ON (c.gifi_accno = g.accno)
- WHERE c.charttype = 'H'
- $category
- ORDER BY g.accno|;
- }
+ $query =
+ qq|SELECT c.accno, c.description, c.category
+ FROM chart c
+ WHERE (c.charttype = 'H')
+ $category
+ ORDER by c.accno|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth = prepare_execute_query($form, $dbh, $query);
my @headingaccounts = ();
while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
$sth->finish;
if ($fromdate) {
+ $fromdate = conv_dateq($fromdate);
if ($form->{method} eq 'cash') {
- $subwhere .= " AND transdate >= '$fromdate'";
- $glwhere = " AND ac.transdate >= '$fromdate'";
+ $subwhere .= " AND (transdate >= $fromdate)";
+ $glwhere = " AND (ac.transdate >= $fromdate)";
} else {
- $where .= " AND ac.transdate >= '$fromdate'";
+ $where .= " AND (ac.transdate >= $fromdate)";
}
}
if ($todate) {
- $where .= " AND ac.transdate <= '$todate'";
- $subwhere .= " AND transdate <= '$todate'";
+ $todate = conv_dateq($todate);
+ $where .= " AND (ac.transdate <= $todate)";
+ $subwhere .= " AND (transdate <= $todate)";
}
if ($department_id) {
- $dpt_join = qq|
- JOIN department t ON (a.department_id = t.id)
- |;
- $dpt_where = qq|
- AND t.id = $department_id
- |;
+ $dpt_join = qq| JOIN department t ON (a.department_id = t.id) |;
+ $dpt_where = qq| AND (t.id = | . conv_i($department_id, 'NULL') . qq|)|;
}
if ($form->{project_id}) {
- $project = qq|
- AND ac.project_id = $form->{project_id}
- |;
+ $project = qq| AND (ac.project_id = | . conv_i($form->{project_id}, 'NULL') . qq|) |;
}
- if ($form->{accounttype} eq 'gifi') {
-
- if ($form->{method} eq 'cash') {
-
- $query = qq|
-
- SELECT g.accno, sum(ac.amount) AS amount,
- g.description, c.category
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- JOIN ar a ON (a.id = ac.trans_id)
- JOIN gifi g ON (g.accno = c.gifi_accno)
- $dpt_join
- WHERE $where
- $dpt_where
- $category
- AND ac.trans_id IN
- (
- SELECT trans_id
- FROM acc_trans
- JOIN chart ON (chart_id = id)
- WHERE link LIKE '%AR_paid%'
- $subwhere
- )
- $project
- GROUP BY g.accno, g.description, c.category
-
- UNION ALL
-
- SELECT '' AS accno, SUM(ac.amount) AS amount,
- '' AS description, c.category
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- JOIN ar a ON (a.id = ac.trans_id)
- $dpt_join
- WHERE $where
- $dpt_where
- $category
- AND c.gifi_accno = ''
- AND ac.trans_id IN
- (
- SELECT trans_id
- FROM acc_trans
- JOIN chart ON (chart_id = id)
- WHERE link LIKE '%AR_paid%'
- $subwhere
- )
- $project
- GROUP BY c.category
-
- UNION ALL
-
- SELECT g.accno, sum(ac.amount) AS amount,
- g.description, c.category
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- JOIN ap a ON (a.id = ac.trans_id)
- JOIN gifi g ON (g.accno = c.gifi_accno)
- $dpt_join
- WHERE $where
- $dpt_where
- $category
- AND ac.trans_id IN
- (
- SELECT trans_id
- FROM acc_trans
- JOIN chart ON (chart_id = id)
- WHERE link LIKE '%AP_paid%'
- $subwhere
- )
- $project
- GROUP BY g.accno, g.description, c.category
-
- UNION ALL
-
- SELECT '' AS accno, SUM(ac.amount) AS amount,
- '' AS description, c.category
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- JOIN ap a ON (a.id = ac.trans_id)
- $dpt_join
- WHERE $where
- $dpt_where
- $category
- AND c.gifi_accno = ''
- AND ac.trans_id IN
- (
- SELECT trans_id
- FROM acc_trans
- JOIN chart ON (chart_id = id)
- WHERE link LIKE '%AP_paid%'
- $subwhere
- )
- $project
- GROUP BY c.category
-
- UNION ALL
-
--- add gl
-
- SELECT g.accno, sum(ac.amount) AS amount,
- g.description, c.category
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- JOIN gifi g ON (g.accno = c.gifi_accno)
- JOIN gl a ON (a.id = ac.trans_id)
- $dpt_join
- WHERE $where
- $glwhere
- $dpt_where
- $category
- AND NOT (c.link = 'AR' OR c.link = 'AP')
- $project
- GROUP BY g.accno, g.description, c.category
-
- UNION ALL
-
- SELECT '' AS accno, SUM(ac.amount) AS amount,
- '' AS description, c.category
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- JOIN gl a ON (a.id = ac.trans_id)
- $dpt_join
- WHERE $where
- $glwhere
- $dpt_where
- $category
- AND c.gifi_accno = ''
- AND NOT (c.link = 'AR' OR c.link = 'AP')
- $project
- GROUP BY c.category
- |;
-
- if ($form->{project_id}) {
-
- $query .= qq|
-
- UNION ALL
-
- SELECT g.accno AS accno, SUM(ac.sellprice * ac.qty) AS amount,
- g.description AS description, c.category
- FROM invoice ac
- JOIN ar a ON (a.id = ac.trans_id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN chart c on (p.income_accno_id = c.id)
- JOIN gifi g ON (g.accno = c.gifi_accno)
- $dpt_join
- -- use transdate from subwhere
- WHERE 1 = 1 $subwhere
- AND c.category = 'I'
- $dpt_where
- AND ac.trans_id IN
- (
- SELECT trans_id
- FROM acc_trans
- JOIN chart ON (chart_id = id)
- WHERE link LIKE '%AR_paid%'
- $subwhere
- )
- $project
- GROUP BY g.accno, g.description, c.category
-
- UNION ALL
-
- SELECT g.accno AS accno, SUM(ac.sellprice * ac.qty) * -1 AS amount,
- g.description AS description, c.category
- FROM invoice ac
- JOIN ap a ON (a.id = ac.trans_id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN chart c on (p.expense_accno_id = c.id)
- JOIN gifi g ON (g.accno = c.gifi_accno)
- $dpt_join
- WHERE 1 = 1 $subwhere
- AND c.category = 'E'
- $dpt_where
- AND ac.trans_id IN
- (
- SELECT trans_id
- FROM acc_trans
- JOIN chart ON (chart_id = id)
- WHERE link LIKE '%AP_paid%'
- $subwhere
- )
- $project
- GROUP BY g.accno, g.description, c.category
- |;
- }
-
- } else {
-
- if ($department_id) {
- $dpt_join = qq|
- JOIN dpt_trans t ON (t.trans_id = ac.trans_id)
- |;
- $dpt_where = qq|
- AND t.department_id = $department_id
- |;
-
- }
-
- $query = qq|
-
- SELECT g.accno, SUM(ac.amount) AS amount,
- g.description, c.category
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- JOIN gifi g ON (c.gifi_accno = g.accno)
- $dpt_join
- WHERE $where
- $dpt_from
- $category
- $project
- GROUP BY g.accno, g.description, c.category
-
- UNION ALL
-
- SELECT '' AS accno, SUM(ac.amount) AS amount,
- '' AS description, c.category
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- $dpt_join
- WHERE $where
- $dpt_from
- $category
- AND c.gifi_accno = ''
- $project
- GROUP BY c.category
- |;
-
- if ($form->{project_id}) {
-
- $query .= qq|
-
- UNION ALL
-
- SELECT g.accno AS accno, SUM(ac.sellprice * ac.qty) AS amount,
- g.description AS description, c.category
- FROM invoice ac
- JOIN ar a ON (a.id = ac.trans_id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN chart c on (p.income_accno_id = c.id)
- JOIN gifi g ON (c.gifi_accno = g.accno)
- $dpt_join
- -- use transdate from subwhere
- WHERE 1 = 1 $subwhere
- AND c.category = 'I'
- $dpt_where
- $project
- GROUP BY g.accno, g.description, c.category
-
- UNION ALL
-
- SELECT g.accno AS accno, SUM(ac.sellprice * ac.qty) * -1 AS amount,
- g.description AS description, c.category
- FROM invoice ac
- JOIN ap a ON (a.id = ac.trans_id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN chart c on (p.expense_accno_id = c.id)
- JOIN gifi g ON (c.gifi_accno = g.accno)
- $dpt_join
- WHERE 1 = 1 $subwhere
- AND c.category = 'E'
- $dpt_where
- $project
- GROUP BY g.accno, g.description, c.category
- |;
- }
+ if ($form->{method} eq 'cash') {
+ $query =
+ qq|SELECT c.accno, sum(ac.amount) AS amount, c.description, c.category
+ FROM acc_trans ac
+ JOIN chart c ON (c.id = ac.chart_id)
+ JOIN ar a ON (a.id = ac.trans_id)
+ $dpt_join
+ WHERE $where
+ $dpt_where
+ $category
+ AND ac.trans_id IN
+ (
+ SELECT trans_id
+ FROM acc_trans
+ JOIN chart ON (chart_id = id)
+ WHERE (link LIKE '%AR_paid%')
+ $subwhere
+ )
+ $project
+ GROUP BY c.accno, c.description, c.category
+
+ UNION ALL
+
+ SELECT c.accno, sum(ac.amount) AS amount, c.description, c.category
+ FROM acc_trans ac
+ JOIN chart c ON (c.id = ac.chart_id)
+ JOIN ap a ON (a.id = ac.trans_id)
+ $dpt_join
+ WHERE $where
+ $dpt_where
+ $category
+ AND ac.trans_id IN
+ (
+ SELECT trans_id
+ FROM acc_trans
+ JOIN chart ON (chart_id = id)
+ WHERE (link LIKE '%AP_paid%')
+ $subwhere
+ )
+ $project
+ GROUP BY c.accno, c.description, c.category
+
+ UNION ALL
+
+ SELECT c.accno, sum(ac.amount) AS amount, c.description, c.category
+ FROM acc_trans ac
+ JOIN chart c ON (c.id = ac.chart_id)
+ JOIN gl a ON (a.id = ac.trans_id)
+ $dpt_join
+ WHERE $where
+ $glwhere
+ $dpt_where
+ $category
+ AND NOT ((c.link = 'AR') OR (c.link = 'AP'))
+ $project
+ GROUP BY c.accno, c.description, c.category |;
+ if ($form->{project_id}) {
+ $query .=
+ qq|
+ UNION ALL
+
+ SELECT c.accno AS accno, SUM(ac.sellprice * ac.qty) AS amount, c.description AS description, c.category
+ FROM invoice ac
+ JOIN ar a ON (a.id = ac.trans_id)
+ JOIN parts p ON (ac.parts_id = p.id)
+ JOIN chart c on (p.income_accno_id = c.id)
+ $dpt_join
+ -- use transdate from subwhere
+ WHERE (c.category = 'I')
+ $subwhere
+ $dpt_where
+ AND ac.trans_id IN
+ (
+ SELECT trans_id
+ FROM acc_trans
+ JOIN chart ON (chart_id = id)
+ WHERE (link LIKE '%AR_paid%')
+ $subwhere
+ )
+ $project
+ GROUP BY c.accno, c.description, c.category
+
+ UNION ALL
+
+ SELECT c.accno AS accno, SUM(ac.sellprice) AS amount, c.description AS description, c.category
+ FROM invoice ac
+ JOIN ap a ON (a.id = ac.trans_id)
+ JOIN parts p ON (ac.parts_id = p.id)
+ JOIN chart c on (p.expense_accno_id = c.id)
+ $dpt_join
+ WHERE (c.category = 'E')
+ $subwhere
+ $dpt_where
+ AND ac.trans_id IN
+ (
+ SELECT trans_id
+ FROM acc_trans
+ JOIN chart ON (chart_id = id)
+ WHERE link LIKE '%AP_paid%'
+ $subwhere
+ )
+ $project
+ GROUP BY c.accno, c.description, c.category |;
}
- } else { # standard account
-
- if ($form->{method} eq 'cash') {
-
- $query = qq|
-
- SELECT c.accno, sum(ac.amount) AS amount,
- c.description, c.category
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- JOIN ar a ON (a.id = ac.trans_id)
- $dpt_join
- WHERE $where
- $dpt_where
- $category
- AND ac.trans_id IN
- (
- SELECT trans_id
- FROM acc_trans
- JOIN chart ON (chart_id = id)
- WHERE link LIKE '%AR_paid%'
- $subwhere
- )
-
- $project
- GROUP BY c.accno, c.description, c.category
-
- UNION ALL
-
- SELECT c.accno, sum(ac.amount) AS amount,
- c.description, c.category
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- JOIN ap a ON (a.id = ac.trans_id)
- $dpt_join
- WHERE $where
- $dpt_where
- $category
- AND ac.trans_id IN
- (
- SELECT trans_id
- FROM acc_trans
- JOIN chart ON (chart_id = id)
- WHERE link LIKE '%AP_paid%'
- $subwhere
- )
-
- $project
- GROUP BY c.accno, c.description, c.category
-
- UNION ALL
-
- SELECT c.accno, sum(ac.amount) AS amount,
- c.description, c.category
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- JOIN gl a ON (a.id = ac.trans_id)
- $dpt_join
- WHERE $where
- $glwhere
- $dpt_from
- $category
- AND NOT (c.link = 'AR' OR c.link = 'AP')
- $project
- GROUP BY c.accno, c.description, c.category
- |;
-
- if ($form->{project_id}) {
-
- $query .= qq|
-
- UNION ALL
-
- SELECT c.accno AS accno, SUM(ac.sellprice * ac.qty) AS amount,
- c.description AS description, c.category
- FROM invoice ac
- JOIN ar a ON (a.id = ac.trans_id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN chart c on (p.income_accno_id = c.id)
- $dpt_join
- -- use transdate from subwhere
- WHERE 1 = 1 $subwhere
- AND c.category = 'I'
- $dpt_where
- AND ac.trans_id IN
- (
- SELECT trans_id
- FROM acc_trans
- JOIN chart ON (chart_id = id)
- WHERE link LIKE '%AR_paid%'
- $subwhere
- )
-
- $project
- GROUP BY c.accno, c.description, c.category
-
- UNION ALL
-
- SELECT c.accno AS accno, SUM(ac.sellprice) AS amount,
- c.description AS description, c.category
- FROM invoice ac
- JOIN ap a ON (a.id = ac.trans_id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN chart c on (p.expense_accno_id = c.id)
- $dpt_join
- WHERE 1 = 1 $subwhere
- AND c.category = 'E'
- $dpt_where
- AND ac.trans_id IN
- (
- SELECT trans_id
- FROM acc_trans
- JOIN chart ON (chart_id = id)
- WHERE link LIKE '%AP_paid%'
- $subwhere
- )
-
- $project
- GROUP BY c.accno, c.description, c.category
- |;
- }
-
- } else {
-
- if ($department_id) {
- $dpt_join = qq|
- JOIN dpt_trans t ON (t.trans_id = ac.trans_id)
- |;
- $dpt_where = qq|
- AND t.department_id = $department_id
- |;
- }
-
- $query = qq|
-
- SELECT c.accno, sum(ac.amount) AS amount,
- c.description, c.category
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- $dpt_join
- WHERE $where
- $dpt_where
- $category
- $project
- GROUP BY c.accno, c.description, c.category
- |;
-
- if ($form->{project_id}) {
+ } else { # if ($form->{method} eq 'cash')
+ if ($department_id) {
+ $dpt_join = qq| JOIN dpt_trans t ON (t.trans_id = ac.trans_id) |;
+ $dpt_where = qq| AND t.department_id = $department_id |;
+ }
- $query .= qq|
-
- UNION ALL
-
- SELECT c.accno AS accno, SUM(ac.sellprice * ac.qty) AS amount,
- c.description AS description, c.category
- FROM invoice ac
- JOIN ar a ON (a.id = ac.trans_id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN chart c on (p.income_accno_id = c.id)
- $dpt_join
- -- use transdate from subwhere
- WHERE 1 = 1 $subwhere
- AND c.category = 'I'
- $dpt_where
- $project
- GROUP BY c.accno, c.description, c.category
-
- UNION ALL
-
- SELECT c.accno AS accno, SUM(ac.sellprice * ac.qty) * -1 AS amount,
- c.description AS description, c.category
- FROM invoice ac
- JOIN ap a ON (a.id = ac.trans_id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN chart c on (p.expense_accno_id = c.id)
- $dpt_join
- WHERE 1 = 1 $subwhere
- AND c.category = 'E'
- $dpt_where
- $project
- GROUP BY c.accno, c.description, c.category
- |;
+ $query = qq|
+ SELECT c.accno, sum(ac.amount) AS amount, c.description, c.category
+ FROM acc_trans ac
+ JOIN chart c ON (c.id = ac.chart_id)
+ $dpt_join
+ WHERE $where
+ $dpt_where
+ $category
+ $project
+ GROUP BY c.accno, c.description, c.category |;
- }
+ if ($form->{project_id}) {
+ $query .= qq|
+ UNION ALL
+
+ SELECT c.accno AS accno, SUM(ac.sellprice * ac.qty) AS amount, c.description AS description, c.category
+ FROM invoice ac
+ JOIN ar a ON (a.id = ac.trans_id)
+ JOIN parts p ON (ac.parts_id = p.id)
+ JOIN chart c on (p.income_accno_id = c.id)
+ $dpt_join
+ -- use transdate from subwhere
+ WHERE (c.category = 'I')
+ $subwhere
+ $dpt_where
+ $project
+ GROUP BY c.accno, c.description, c.category
+
+ UNION ALL
+
+ SELECT c.accno AS accno, SUM(ac.sellprice * ac.qty) * -1 AS amount, c.description AS description, c.category
+ FROM invoice ac
+ JOIN ap a ON (a.id = ac.trans_id)
+ JOIN parts p ON (ac.parts_id = p.id)
+ JOIN chart c on (p.expense_accno_id = c.id)
+ $dpt_join
+ WHERE (c.category = 'E')
+ $subwhere
+ $dpt_where
+ $project
+ GROUP BY c.accno, c.description, c.category |;
}
}
my $accno;
my $ref;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $sth = prepare_execute_query($form, $dbh, $query);
while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
my $project;
my $where = "1 = 1";
my $glwhere = "";
+ my $prwhere = "";
my $subwhere = "";
my $item;
if ($fromdate) {
+ $fromdate = conv_dateq($fromdate);
if ($form->{method} eq 'cash') {
- $subwhere .= " AND transdate >= '$fromdate'";
- $glwhere = " AND ac.transdate >= '$fromdate'";
+ $subwhere .= " AND (transdate >= $fromdate)";
+ $glwhere = " AND (ac.transdate >= $fromdate)";
+ $prwhere = " AND (ar.transdate >= $fromdate)";
} else {
- $where .= " AND ac.transdate >= '$fromdate'";
+ $where .= " AND (ac.transdate >= $fromdate)";
}
}
if ($todate) {
- $where .= " AND ac.transdate <= '$todate'";
- $subwhere .= " AND transdate <= '$todate'";
+ $todate = conv_dateq($todate);
+ $subwhere .= " AND (transdate <= $todate)";
+ $where .= " AND (ac.transdate <= $todate)";
+ $prwhere .= " AND (ar.transdate <= $todate)";
}
if ($department_id) {
- $dpt_join = qq|
- JOIN department t ON (a.department_id = t.id)
- |;
- $dpt_where = qq|
- AND t.id = $department_id
- |;
+ $dpt_join = qq| JOIN department t ON (a.department_id = t.id) |;
+ $dpt_where = qq| AND (t.id = | . conv_i($department_id, 'NULL') . qq|) |;
}
if ($form->{project_id}) {
- $project = qq|
- AND ac.project_id = $form->{project_id}
- |;
+ $project = qq| AND (ac.project_id = | . conv_i($form->{project_id}) . qq|) |;
}
if ($form->{method} eq 'cash') {
-
- $query = qq|
-
- SELECT sum(ac.amount) AS amount,
- c.$category
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- JOIN ar a ON (a.id = ac.trans_id)
- $dpt_join
- WHERE $where
- $dpt_where
- AND ac.trans_id IN
- (
- SELECT trans_id
- FROM acc_trans
- JOIN chart ON (chart_id = id)
- WHERE link LIKE '%AR_paid%'
- $subwhere
- )
-
- $project
- GROUP BY c.$category
-
- UNION
-
- SELECT sum(ac.amount) AS amount,
- c.$category
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- JOIN ap a ON (a.id = ac.trans_id)
- $dpt_join
- WHERE $where
- $dpt_where
- AND ac.trans_id IN
- (
- SELECT trans_id
- FROM acc_trans
- JOIN chart ON (chart_id = id)
- WHERE link LIKE '%AP_paid%'
- $subwhere
- )
-
- $project
- GROUP BY c.$category
-
- UNION
-
- SELECT sum(ac.amount) AS amount,
- c.$category
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- JOIN gl a ON (a.id = ac.trans_id)
- $dpt_join
- WHERE $where
- $glwhere
- $dpt_from
- AND NOT (c.link = 'AR' OR c.link = 'AP')
- $project
- GROUP BY c.$category
- |;
+ $query =
+ qq|
+ SELECT SUM(ac.amount * chart_category_to_sgn(c.category)) AS amount, c.$category
+ FROM acc_trans ac
+ JOIN chart c ON (c.id = ac.chart_id)
+ JOIN ar a ON (a.id = ac.trans_id)
+ $dpt_join
+ WHERE $where $dpt_where
+ AND ac.trans_id IN ( SELECT trans_id FROM acc_trans JOIN chart ON (chart_id = id) WHERE (link LIKE '%AR_paid%') $subwhere)
+ $project
+ GROUP BY c.$category
+
+ UNION
+
+ SELECT SUM(ac.amount * chart_category_to_sgn(c.category)) AS amount, c.$category
+ FROM acc_trans ac
+ JOIN chart c ON (c.id = ac.chart_id)
+ JOIN ap a ON (a.id = ac.trans_id)
+ $dpt_join
+ WHERE $where $dpt_where
+ AND ac.trans_id IN ( SELECT trans_id FROM acc_trans JOIN chart ON (chart_id = id) WHERE (link LIKE '%AP_paid%') $subwhere)
+ $project
+ GROUP BY c.$category
+
+ UNION
+
+ SELECT SUM(ac.amount * chart_category_to_sgn(c.category)) AS amount, c.$category
+ FROM acc_trans ac
+ JOIN chart c ON (c.id = ac.chart_id)
+ JOIN gl a ON (a.id = ac.trans_id)
+ $dpt_join
+ WHERE $where $dpt_where $glwhere
+ AND NOT ((c.link = 'AR') OR (c.link = 'AP'))
+ $project
+
+ $project_union
+ GROUP BY c.$category
+ |;
if ($form->{project_id}) {
-
- $query .= qq|
-
- UNION
-
- SELECT SUM(ac.sellprice * ac.qty) AS amount,
- c.$category
- FROM invoice ac
- JOIN ar a ON (a.id = ac.trans_id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN chart c on (p.income_accno_id = c.id)
- $dpt_join
- -- use transdate from subwhere
- WHERE 1 = 1 $subwhere
- AND c.category = 'I'
- $dpt_where
- AND ac.trans_id IN
- (
- SELECT trans_id
- FROM acc_trans
- JOIN chart ON (chart_id = id)
- WHERE link LIKE '%AR_paid%'
- $subwhere
- )
-
- $project
- GROUP BY c.$category
-
- UNION
-
- SELECT SUM(ac.sellprice) AS amount,
- c.$category
- FROM invoice ac
- JOIN ap a ON (a.id = ac.trans_id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN chart c on (p.expense_accno_id = c.id)
- $dpt_join
- WHERE 1 = 1 $subwhere
- AND c.category = 'E'
- $dpt_where
- AND ac.trans_id IN
- (
- SELECT trans_id
- FROM acc_trans
- JOIN chart ON (chart_id = id)
- WHERE link LIKE '%AP_paid%'
- $subwhere
- )
-
- $project
- GROUP BY c.$category
- |;
+ $project_union = qq|
+ UNION
+
+ SELECT SUM(ac.sellprice * ac.qty * chart_category_to_sgn(c.category)) AS amount, c.$category
+ FROM invoice ac
+ JOIN ar a ON (a.id = ac.trans_id)
+ JOIN parts p ON (ac.parts_id = p.id)
+ JOIN chart c on (p.income_accno_id = c.id)
+ $dpt_join
+ WHERE (c.category = 'I') $prwhere $dpt_where
+ AND ac.trans_id IN ( SELECT trans_id FROM acc_trans JOIN chart ON (chart_id = id) WHERE (link LIKE '%AR_paid%') $subwhere)
+ $project
+ GROUP BY c.$category
+
+ UNION
+
+ SELECT SUM(ac.sellprice * chart_category_to_sgn(c.category)) AS amount, c.$category
+ FROM invoice ac
+ JOIN ap a ON (a.id = ac.trans_id)
+ JOIN parts p ON (ac.parts_id = p.id)
+ JOIN chart c on (p.expense_accno_id = c.id)
+ $dpt_join
+ WHERE (c.category = 'E') $prwhere $dpt_where
+ AND ac.trans_id IN ( SELECT trans_id FROM acc_trans JOIN chart ON (chart_id = id) WHERE (link LIKE '%AP_paid%') $subwhere)
+ $project
+ GROUP BY c.$category
+ |;
}
- } else {
-
+ } else { # if ($form->{method} eq 'cash')
if ($department_id) {
- $dpt_join = qq|
- JOIN dpt_trans t ON (t.trans_id = ac.trans_id)
- |;
- $dpt_where = qq|
- AND t.department_id = $department_id
- |;
+ $dpt_join = qq| JOIN dpt_trans t ON (t.trans_id = ac.trans_id) |;
+ $dpt_where = qq| AND (t.department_id = | . conv_i($department_id, 'NULL') . qq|) |;
}
$query = qq|
-
- SELECT sum(ac.amount) AS amount,
- c.$category
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- $dpt_join
- WHERE $where
- $dpt_where
- $project
- GROUP BY c.$category
- |;
+ SELECT sum(ac.amount * chart_category_to_sgn(c.category)) AS amount, c.$category
+ FROM acc_trans ac
+ JOIN chart c ON (c.id = ac.chart_id)
+ $dpt_join
+ WHERE $where
+ $dpt_where
+ $project
+ GROUP BY c.$category |;
if ($form->{project_id}) {
-
$query .= qq|
+ UNION
- UNION
-
- SELECT SUM(ac.sellprice * ac.qty) AS amount,
- c.$category
- FROM invoice ac
- JOIN ar a ON (a.id = ac.trans_id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN chart c on (p.income_accno_id = c.id)
- $dpt_join
- -- use transdate from subwhere
- WHERE 1 = 1 $subwhere
- AND c.category = 'I'
- $dpt_where
- $project
- GROUP BY c.$category
-
- UNION
-
- SELECT SUM(ac.sellprice * ac.qty) * -1 AS amount,
- c.$category
- FROM invoice ac
- JOIN ap a ON (a.id = ac.trans_id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN chart c on (p.expense_accno_id = c.id)
- $dpt_join
- WHERE 1 = 1 $subwhere
- AND c.category = 'E'
- $dpt_where
- $project
- GROUP BY c.$category
- |;
+ SELECT SUM(ac.sellprice * ac.qty * chart_category_to_sgn(c.category)) AS amount, c.$category
+ FROM invoice ac
+ JOIN ar a ON (a.id = ac.trans_id)
+ JOIN parts p ON (ac.parts_id = p.id)
+ JOIN chart c on (p.income_accno_id = c.id)
+ $dpt_join
+ WHERE (c.category = 'I')
+ $prwhere
+ $dpt_where
+ $project
+ GROUP BY c.$category
+ UNION
+
+ SELECT SUM(ac.sellprice * ac.qty * chart_category_to_sgn(c.category)) AS amount, c.$category
+ FROM invoice ac
+ JOIN ap a ON (a.id = ac.trans_id)
+ JOIN parts p ON (ac.parts_id = p.id)
+ JOIN chart c on (p.expense_accno_id = c.id)
+ $dpt_join
+ WHERE (c.category = 'E')
+ $prwhere
+ $dpt_where
+ $project
+ GROUP BY c.$category |;
}
}
my $accno;
my $ref;
- #print $query;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ my $sth = prepare_execute_query($form, $dbh, $query);
while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- if ($ref->{amount} < 0) {
- $ref->{amount} *= -1;
- }
if ($category eq "pos_bwa") {
if ($last_period) {
$form->{ $ref->{$category} }{kumm} += $ref->{amount};
my $invwhere = $where;
if ($department_id) {
- $dpt_join = qq|
- JOIN dpt_trans t ON (ac.trans_id = t.trans_id)
- |;
- $dpt_where = qq|
- AND t.department_id = $department_id
- |;
+ $dpt_join = qq| JOIN dpt_trans t ON (ac.trans_id = t.trans_id) |;
+ $dpt_where = qq| AND (t.department_id = | . conv_i($department_id, 'NULL') . qq|) |;
}
# project_id only applies to getting transactions
# but we use the same function to collect information
if ($form->{project_id}) {
- $project = qq|
- AND ac.project_id = $form->{project_id}
- |;
+ $project = qq| AND ac.project_id = | . conv_i($form->{project_id}, 'NULL') . qq|) |;
}
# get beginning balances
if ($form->{fromdate}) {
-
- if ($form->{accounttype} eq 'gifi') {
-
- $query = qq|SELECT g.accno, c.category, SUM(ac.amount) AS amount,
- g.description
- FROM acc_trans ac
- JOIN chart c ON (ac.chart_id = c.id)
- JOIN gifi g ON (c.gifi_accno = g.accno)
- $dpt_join
- WHERE ac.transdate < '$form->{fromdate}'
- $dpt_where
- $project
- GROUP BY g.accno, c.category, g.description
- |;
-
- } else {
-
- $query = qq|SELECT c.accno, c.category, SUM(ac.amount) AS amount,
- c.description
- FROM acc_trans ac
- JOIN chart c ON (ac.chart_id = c.id)
- $dpt_join
- WHERE ac.transdate < '$form->{fromdate}'
- $dpt_where
- $project
- GROUP BY c.accno, c.category, c.description
- |;
-
- }
-
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $query =
+ qq|SELECT c.accno, c.category, SUM(ac.amount) AS amount, c.description
+ FROM acc_trans ac
+ JOIN chart c ON (ac.chart_id = c.id)
+ $dpt_join
+ WHERE (ac.transdate < ?)
+ $dpt_where
+ $project
+ GROUP BY c.accno, c.category, c.description |;
+
+ $sth = prepare_execute_query($form, $dbh, $query, $form->{fromdate});
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
$balance{ $ref->{accno} } = $ref->{amount};
}
# get headings
- $query = qq|SELECT c.accno, c.description, c.category
- FROM chart c
- WHERE c.charttype = 'H'
- ORDER by c.accno|;
-
- if ($form->{accounttype} eq 'gifi') {
- $query = qq|SELECT g.accno, g.description, c.category
- FROM gifi g
- JOIN chart c ON (c.gifi_accno = g.accno)
- WHERE c.charttype = 'H'
- ORDER BY g.accno|;
- }
+ $query =
+ qq|SELECT c.accno, c.description, c.category
+ FROM chart c
+ WHERE c.charttype = 'H'
+ ORDER by c.accno|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth = prepare_execute_query($form, $dbh, $query);
while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
$trb{ $ref->{accno} }{description} = $ref->{description};
$sth->finish;
$where = " 1 = 1 ";
+ my $tofrom;
if ($form->{fromdate} || $form->{todate}) {
if ($form->{fromdate}) {
- $tofrom .= " AND ac.transdate >= '$form->{fromdate}'";
- $subwhere .= " AND transdate >= '$form->{fromdate}'";
- $invwhere .= " AND a.transdate >= '$form->{fromdate}'";
- $glwhere = " AND ac.transdate >= '$form->{fromdate}'";
+ my $fromdate = conv_dateq($form->{fromdate});
+ $tofrom .= " AND (ac.transdate >= $fromdate)";
+ $subwhere .= " AND (transdate >= $fromdate)";
+ $invwhere .= " AND (a.transdate >= $fromdate)";
+ $glwhere = " AND (ac.transdate >= $fromdate)";
}
if ($form->{todate}) {
- $tofrom .= " AND ac.transdate <= '$form->{todate}'";
- $invwhere .= " AND a.transdate <= '$form->{todate}'";
- $subwhere .= " AND transdate <= '$form->{todate}'";
- $glwhere .= " AND ac.transdate <= '$form->{todate}'";
+ my $todate = conv_dateq($form->{todate});
+ $tofrom .= " AND (ac.transdate <= $todate)";
+ $invwhere .= " AND (a.transdate <= $todate)";
+ $subwhere .= " AND (transdate <= $todate)";
+ $glwhere .= " AND (ac.transdate <= $todate)";
}
}
+
if ($form->{eur}) {
- $where .= qq| AND ((ac.trans_id in (SELECT id from ar)
- AND ac.trans_id IN
- (
- SELECT trans_id
- FROM acc_trans
- JOIN chart ON (chart_id = id)
- WHERE link LIKE '%AR_paid%'
- $subwhere
- )) OR (ac.trans_id in (SELECT id from ap)
- AND ac.trans_id IN
- (
- SELECT trans_id
- FROM acc_trans
- JOIN chart ON (chart_id = id)
- WHERE link LIKE '%AP_paid%'
- $subwhere
- )) OR (ac.trans_id in (SELECT id from gl)
- $glwhere))|;
+ $where .=
+ qq| AND ((ac.trans_id IN (SELECT id from ar) AND
+ ac.trans_id IN
+ (
+ SELECT trans_id
+ FROM acc_trans
+ JOIN chart ON (chart_id = id)
+ WHERE (link LIKE '%AR_paid%')
+ $subwhere
+ )
+ )
+ OR
+ (ac.trans_id in (SELECT id from ap) AND
+ ac.trans_id IN
+ (
+ SELECT trans_id
+ FROM acc_trans
+ JOIN chart ON (chart_id = id)
+ WHERE (link LIKE '%AP_paid%')
+ $subwhere
+ )
+ )
+ OR
+ (ac.trans_id in (SELECT id from gl)
+ $glwhere)
+ )|;
} else {
$where .= $tofrom;
}
- if ($form->{accounttype} eq 'gifi') {
-
- $query = qq|SELECT g.accno, g.description, c.category,
- SUM(ac.amount) AS amount
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- JOIN gifi g ON (c.gifi_accno = g.accno)
- $dpt_join
- WHERE $where
- $dpt_where
- $project
- GROUP BY g.accno, g.description, c.category
- |;
-
- if ($form->{project_id}) {
-
- $query .= qq|
-
- -- add project transactions from invoice
-
- UNION ALL
-
- SELECT g.accno, g.description, c.category,
- SUM(ac.sellprice * ac.qty) AS amount
- FROM invoice ac
- JOIN ar a ON (ac.trans_id = a.id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN chart c ON (p.income_accno_id = c.id)
- JOIN gifi g ON (c.gifi_accno = g.accno)
- $dpt_join
- WHERE $invwhere
- $dpt_where
- $project
- GROUP BY g.accno, g.description, c.category
-
- UNION ALL
-
- SELECT g.accno, g.description, c.category,
- SUM(ac.sellprice * ac.qty) * -1 AS amount
- FROM invoice ac
- JOIN ap a ON (ac.trans_id = a.id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN chart c ON (p.expense_accno_id = c.id)
- JOIN gifi g ON (c.gifi_accno = g.accno)
- $dpt_join
- WHERE $invwhere
- $dpt_where
- $project
- GROUP BY g.accno, g.description, c.category
- |;
- }
+ $query = qq|
+ SELECT c.accno, c.description, c.category, SUM(ac.amount) AS amount
+ FROM acc_trans ac
+ JOIN chart c ON (c.id = ac.chart_id)
+ $dpt_join
+ WHERE $where
+ $dpt_where
+ $project
+ GROUP BY c.accno, c.description, c.category |;
+ if ($form->{project_id}) {
$query .= qq|
- ORDER BY accno|;
-
- } else {
-
- $query = qq|SELECT c.accno, c.description, c.category,
- SUM(ac.amount) AS amount
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- $dpt_join
- WHERE $where
- $dpt_where
- $project
- GROUP BY c.accno, c.description, c.category
- |;
-
- if ($form->{project_id}) {
-
- $query .= qq|
-
- -- add project transactions from invoice
-
- UNION ALL
-
- SELECT c.accno, c.description, c.category,
- SUM(ac.sellprice * ac.qty) AS amount
- FROM invoice ac
- JOIN ar a ON (ac.trans_id = a.id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN chart c ON (p.income_accno_id = c.id)
- $dpt_join
- WHERE $invwhere
- $dpt_where
- $project
- GROUP BY c.accno, c.description, c.category
-
- UNION ALL
-
- SELECT c.accno, c.description, c.category,
- SUM(ac.sellprice * ac.qty) * -1 AS amount
- FROM invoice ac
- JOIN ap a ON (ac.trans_id = a.id)
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN chart c ON (p.expense_accno_id = c.id)
- $dpt_join
- WHERE $invwhere
- $dpt_where
- $project
- GROUP BY c.accno, c.description, c.category
- |;
+ -- add project transactions from invoice
+
+ UNION ALL
+
+ SELECT c.accno, c.description, c.category, SUM(ac.sellprice * ac.qty) AS amount
+ FROM invoice ac
+ JOIN ar a ON (ac.trans_id = a.id)
+ JOIN parts p ON (ac.parts_id = p.id)
+ JOIN chart c ON (p.income_accno_id = c.id)
+ $dpt_join
+ WHERE $invwhere
+ $dpt_where
+ $project
+ GROUP BY c.accno, c.description, c.category
+
+ UNION ALL
+
+ SELECT c.accno, c.description, c.category, SUM(ac.sellprice * ac.qty) * -1 AS amount
+ FROM invoice ac
+ JOIN ap a ON (ac.trans_id = a.id)
+ JOIN parts p ON (ac.parts_id = p.id)
+ JOIN chart c ON (p.expense_accno_id = c.id)
+ $dpt_join
+ WHERE $invwhere
+ $dpt_where
+ $project
+ GROUP BY c.accno, c.description, c.category
+ |;
}
- $query .= qq|
- ORDER BY accno|;
-
- }
-
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- # prepare query for each account
- $query = qq|SELECT (SELECT SUM(ac.amount) * -1
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- $dpt_join
- WHERE $where
- $dpt_where
- $project
- AND ac.amount < 0
- AND c.accno = ?) AS debit,
-
- (SELECT SUM(ac.amount)
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- $dpt_join
- WHERE $where
- $dpt_where
- $project
- AND ac.amount > 0
- AND c.accno = ?) AS credit
- |;
-
- if ($form->{accounttype} eq 'gifi') {
-
- $query = qq|SELECT (SELECT SUM(ac.amount) * -1
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- $dpt_join
- WHERE $where
- $dpt_where
- $project
- AND ac.amount < 0
- AND c.gifi_accno = ?) AS debit,
-
- (SELECT SUM(ac.amount)
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- $dpt_join
- WHERE $where
- $dpt_where
- $project
- AND ac.amount > 0
- AND c.gifi_accno = ?) AS credit|;
-
- }
-
- $drcr = $dbh->prepare($query);
-
- if ($form->{project_id}) {
-
- # prepare query for each account
- $query = qq|SELECT (SELECT SUM(ac.sellprice * ac.qty) * -1
- FROM invoice ac
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN ap a ON (ac.trans_id = a.id)
- JOIN chart c ON (p.expense_accno_id = c.id)
- $dpt_join
- WHERE $invwhere
- $dpt_where
- $project
- AND c.accno = ?) AS debit,
-
- (SELECT SUM(ac.sellprice * ac.qty)
- FROM invoice ac
- JOIN parts p ON (ac.parts_id = p.id)
- JOIN ar a ON (ac.trans_id = a.id)
- JOIN chart c ON (p.income_accno_id = c.id)
- $dpt_join
- WHERE $invwhere
- $dpt_where
- $project
- AND c.accno = ?) AS credit
- |;
-
- $project_drcr = $dbh->prepare($query);
+ $query .= qq| ORDER BY accno|;
- }
+ $sth = prepare_execute_query($form, $dbh, $query);
# calculate the debit and credit in the period
while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
}
$sth->finish;
+ # prepare query for each account
+ my ($q_drcr, $drcr, $q_project_drcr, $project_drcr);
+
+ $q_drcr =
+ qq|SELECT
+ (SELECT SUM(ac.amount) * -1
+ FROM acc_trans ac
+ JOIN chart c ON (c.id = ac.chart_id)
+ $dpt_join
+ WHERE $where
+ $dpt_where
+ $project
+ AND (ac.amount < 0)
+ AND (c.accno = ?)) AS debit,
+
+ (SELECT SUM(ac.amount)
+ FROM acc_trans ac
+ JOIN chart c ON (c.id = ac.chart_id)
+ $dpt_join
+ WHERE $where
+ $dpt_where
+ $project
+ AND ac.amount > 0
+ AND c.accno = ?) AS credit |;
+
+ $drcr = prepare_query($form, $dbh, $q_drcr);
+
+ if ($form->{project_id}) {
+ # prepare query for each account
+ $q_project_drcr =
+ qq|SELECT
+ (SELECT SUM(ac.sellprice * ac.qty) * -1
+ FROM invoice ac
+ JOIN parts p ON (ac.parts_id = p.id)
+ JOIN ap a ON (ac.trans_id = a.id)
+ JOIN chart c ON (p.expense_accno_id = c.id)
+ $dpt_join
+ WHERE $invwhere
+ $dpt_where
+ $project
+ AND c.accno = ?) AS debit,
+
+ (SELECT SUM(ac.sellprice * ac.qty)
+ FROM invoice ac
+ JOIN parts p ON (ac.parts_id = p.id)
+ JOIN ar a ON (ac.trans_id = a.id)
+ JOIN chart c ON (p.income_accno_id = c.id)
+ $dpt_join
+ WHERE $invwhere
+ $dpt_where
+ $project
+ AND c.accno = ?) AS credit |;
+
+ $project_drcr = prepare_query($form, $dbh, $q_project_drcr);
+ }
+
my ($debit, $credit);
foreach my $accno (sort keys %trb) {
- $ref = ();
+ $ref = {};
$ref->{accno} = $accno;
map { $ref->{$_} = $trb{$accno}{$_} }
if ($trb{$accno}{charttype} eq 'A') {
# get DR/CR
- $drcr->execute($ref->{accno}, $ref->{accno}) || $form->dberror($query);
+ do_statement($form, $drcr, $q_drcr, $ref->{accno}, $ref->{accno});
($debit, $credit) = (0, 0);
while (($debit, $credit) = $drcr->fetchrow_array) {
if ($form->{project_id}) {
# get DR/CR
- $project_drcr->execute($ref->{accno}, $ref->{accno})
- || $form->dberror($query);
+ do_statement($form, $project_drcr, $q_project_drcr, $ref->{accno}, $ref->{accno});
($debit, $credit) = (0, 0);
while (($debit, $credit) = $project_drcr->fetchrow_array) {
$main::lxdebug->leave_sub();
}
+sub get_storno {
+ $main::lxdebug->enter_sub();
+ my ($self, $dbh, $form) = @_;
+ my $arap = $form->{arap} eq "ar" ? "ar" : "ap";
+ my $query = qq|SELECT invnumber FROM $arap WHERE invnumber LIKE "Storno zu "|;
+ my $sth = $dbh->prepare($query);
+ while(my $ref = $sth->fetchrow_hashref()) {
+ $ref->{invnumer} =~ s/Storno zu //g;
+ $form->{storno}{$ref->{invnumber}} = 1;
+ }
+ $main::lxdebug->leave_sub();
+}
+
sub aging {
$main::lxdebug->enter_sub();
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $invoice = ($form->{arap} eq 'ar') ? 'is' : 'ir';
+
+ my ($invoice, $arap, $buysell, $ct, $ct_id);
+
+ if ($form->{ct} eq "customer") {
+ $invoice = "is";
+ $arap = "ar";
+ $buysell = "buy";
+ $ct = "customer";
+ } else {
+ $invoice = "ir";
+ $arap = "ap";
+ $buysell = "sell";
+ $ct = "vendor";
+ }
+ $ct_id = "${ct}_id";
$form->{todate} = $form->current_date($myconfig) unless ($form->{todate});
+ my $todate = conv_dateq($form->{todate});
- my $where = "1 = 1";
+ my $where = " 1 = 1 ";
my ($name, $null);
- if ($form->{"$form->{ct}_id"}) {
- $where .= qq| AND ct.id = $form->{"$form->{ct}_id"}|;
- } else {
- if ($form->{ $form->{ct} }) {
- $name = $form->like(lc $form->{ $form->{ct} });
- $where .= qq| AND lower(ct.name) LIKE '$name'| if $form->{ $form->{ct} };
- }
+ if ($form->{$ct_id}) {
+ $where .= qq| AND (ct.id = | . conv_i($form->{$ct_id}) . qq|)|;
+ } elsif ($form->{ $form->{ct} }) {
+ $where .= qq| AND (ct.name ILIKE | . $dbh->quote('%' . $form->{$ct} . '%') . qq|)|;
}
my $dpt_join;
if ($form->{department}) {
($null, $department_id) = split /--/, $form->{department};
- $dpt_join = qq|
- JOIN department d ON (a.department_id = d.id)
- |;
-
- $where .= qq| AND a.department_id = $department_id|;
- }
+ $dpt_join = qq| JOIN department d ON (a.department_id = d.id) |;
+ $where .= qq| AND (a.department_id = | . conv_i($department_id, 'NULL') . qq|)|;
+ }
+
+ my $q_details = qq|
+ -- between 0-30 days
+
+ SELECT ${ct}.id AS ctid, ${ct}.name,
+ street, zipcode, city, country, contact, email,
+ phone as customerphone, fax as customerfax, ${ct}number,
+ "invnumber", "transdate",
+ (amount - paid) as "c0", 0.00 as "c30", 0.00 as "c60", 0.00 as "c90",
+ "duedate", invoice, ${arap}.id,
+ (SELECT $buysell
+ FROM exchangerate
+ WHERE (${arap}.curr = exchangerate.curr)
+ AND (exchangerate.transdate = ${arap}.transdate)) AS exchangerate
+ FROM ${arap}, ${ct}
+ WHERE (paid != amount)
+ AND (${arap}.storno IS FALSE)
+ AND (${arap}.${ct}_id = ${ct}.id)
+ AND (${ct}.id = ?)
+ AND (transdate <= (date $todate - interval '0 days'))
+ AND (transdate >= (date $todate - interval '30 days'))
+
+ UNION
+
+ -- between 31-60 days
+
+ SELECT ${ct}.id AS ctid, ${ct}.name,
+ street, zipcode, city, country, contact, email,
+ phone as customerphone, fax as customerfax, ${ct}number,
+ "invnumber", "transdate",
+ 0.00 as "c0", (amount - paid) as "c30", 0.00 as "c60", 0.00 as "c90",
+ "duedate", invoice, ${arap}.id,
+ (SELECT $buysell
+ FROM exchangerate
+ WHERE (${arap}.curr = exchangerate.curr)
+ AND (exchangerate.transdate = ${arap}.transdate)) AS exchangerate
+ FROM ${arap}, ${ct}
+ WHERE (paid != amount)
+ AND (${arap}.storno IS FALSE)
+ AND (${arap}.${ct}_id = ${ct}.id)
+ AND (${ct}.id = ?)
+ AND (transdate < (date $todate - interval '30 days'))
+ AND (transdate >= (date $todate - interval '60 days'))
+
+ UNION
+
+ -- between 61-90 days
+
+ SELECT ${ct}.id AS ctid, ${ct}.name,
+ street, zipcode, city, country, contact, email,
+ phone as customerphone, fax as customerfax, ${ct}number,
+ "invnumber", "transdate",
+ 0.00 as "c0", 0.00 as "c30", (amount - paid) as "c60", 0.00 as "c90",
+ "duedate", invoice, ${arap}.id,
+ (SELECT $buysell
+ FROM exchangerate
+ WHERE (${arap}.curr = exchangerate.curr)
+ AND (exchangerate.transdate = ${arap}.transdate)) AS exchangerate
+ FROM ${arap}, ${ct}
+ WHERE (paid != amount)
+ AND (${arap}.storno IS FALSE)
+ AND (${arap}.${ct}_id = ${ct}.id)
+ AND (${ct}.id = ?)
+ AND (transdate < (date $todate - interval '60 days'))
+ AND (transdate >= (date $todate - interval '90 days'))
+
+ UNION
+
+ -- over 90 days
+
+ SELECT ${ct}.id AS ctid, ${ct}.name,
+ street, zipcode, city, country, contact, email,
+ phone as customerphone, fax as customerfax, ${ct}number,
+ "invnumber", "transdate",
+ 0.00 as "c0", 0.00 as "c30", 0.00 as "c60", (amount - paid) as "c90",
+ "duedate", invoice, ${arap}.id,
+ (SELECT $buysell
+ FROM exchangerate
+ WHERE (${arap}.curr = exchangerate.curr)
+ AND (exchangerate.transdate = ${arap}.transdate)) AS exchangerate
+ FROM ${arap}, ${ct}
+ WHERE (paid != amount)
+ AND (${arap}.storno IS FALSE)
+ AND (${arap}.${ct}_id = ${ct}.id)
+ AND (${ct}.id = ?)
+ AND (transdate < (date $todate - interval '90 days'))
+
+ ORDER BY ctid, transdate, invnumber |;
+
+ my $sth_details = prepare_query($form, $dbh, $q_details);
# select outstanding vendors or customers, depends on $ct
- my $query = qq|SELECT DISTINCT ct.id, ct.name
- FROM $form->{ct} ct, $form->{arap} a
- $dpt_join
- WHERE $where
- AND a.$form->{ct}_id = ct.id
- AND a.paid != a.amount
- AND (a.transdate <= '$form->{todate}')
- ORDER BY ct.name|;
-
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror;
-
- my $buysell = ($form->{arap} eq 'ar') ? 'buy' : 'sell';
-
+ my $query =
+ qq|SELECT DISTINCT ct.id, ct.name
+ FROM $ct ct, $arap a
+ $dpt_join
+ WHERE $where
+ AND (a.${ct_id} = ct.id)
+ AND (a.paid != a.amount)
+ AND (a.transdate <= $todate)
+ ORDER BY ct.name|;
+
+ my $sth = prepare_execute_query($form, $dbh, $query);
+
+ $form->{AG} = [];
# for each company that has some stuff outstanding
while (my ($id) = $sth->fetchrow_array) {
+ do_statement($form, $sth_details, $q_details, $id, $id, $id, $id);
- $query = qq|
-
--- between 0-30 days
-
- SELECT $form->{ct}.id AS ctid, $form->{ct}.name,
- street, zipcode, city, country, contact, email,
- phone as customerphone, fax as customerfax, $form->{ct}number,
- "invnumber", "transdate",
- (amount - paid) as "c0", 0.00 as "c30", 0.00 as "c60", 0.00 as "c90",
- "duedate", invoice, $form->{arap}.id,
- (SELECT $buysell FROM exchangerate
- WHERE $form->{arap}.curr = exchangerate.curr
- AND exchangerate.transdate = $form->{arap}.transdate) AS exchangerate
- FROM $form->{arap}, $form->{ct}
- WHERE paid != amount
- AND $form->{arap}.$form->{ct}_id = $form->{ct}.id
- AND $form->{ct}.id = $id
- AND (
- transdate <= (date '$form->{todate}' - interval '0 days')
- AND transdate >= (date '$form->{todate}' - interval '30 days')
- )
-
- UNION
-
--- between 31-60 days
-
- SELECT $form->{ct}.id AS ctid, $form->{ct}.name,
- street, zipcode, city, country, contact, email,
- phone as customerphone, fax as customerfax, $form->{ct}number,
- "invnumber", "transdate",
- 0.00 as "c0", (amount - paid) as "c30", 0.00 as "c60", 0.00 as "c90",
- "duedate", invoice, $form->{arap}.id,
- (SELECT $buysell FROM exchangerate
- WHERE $form->{arap}.curr = exchangerate.curr
- AND exchangerate.transdate = $form->{arap}.transdate) AS exchangerate
- FROM $form->{arap}, $form->{ct}
- WHERE paid != amount
- AND $form->{arap}.$form->{ct}_id = $form->{ct}.id
- AND $form->{ct}.id = $id
- AND (
- transdate < (date '$form->{todate}' - interval '30 days')
- AND transdate >= (date '$form->{todate}' - interval '60 days')
- )
-
- UNION
-
--- between 61-90 days
-
- SELECT $form->{ct}.id AS ctid, $form->{ct}.name,
- street, zipcode, city, country, contact, email,
- phone as customerphone, fax as customerfax, $form->{ct}number,
- "invnumber", "transdate",
- 0.00 as "c0", 0.00 as "c30", (amount - paid) as "c60", 0.00 as "c90",
- "duedate", invoice, $form->{arap}.id,
- (SELECT $buysell FROM exchangerate
- WHERE $form->{arap}.curr = exchangerate.curr
- AND exchangerate.transdate = $form->{arap}.transdate) AS exchangerate
- FROM $form->{arap}, $form->{ct}
- WHERE paid != amount
- AND $form->{arap}.$form->{ct}_id = $form->{ct}.id
- AND $form->{ct}.id = $id
- AND (
- transdate < (date '$form->{todate}' - interval '60 days')
- AND transdate >= (date '$form->{todate}' - interval '90 days')
- )
-
- UNION
-
--- over 90 days
-
- SELECT $form->{ct}.id AS ctid, $form->{ct}.name,
- street, zipcode, city, country, contact, email,
- phone as customerphone, fax as customerfax, $form->{ct}number,
- "invnumber", "transdate",
- 0.00 as "c0", 0.00 as "c30", 0.00 as "c60", (amount - paid) as "c90",
- "duedate", invoice, $form->{arap}.id,
- (SELECT $buysell FROM exchangerate
- WHERE $form->{arap}.curr = exchangerate.curr
- AND exchangerate.transdate = $form->{arap}.transdate) AS exchangerate
- FROM $form->{arap}, $form->{ct}
- WHERE paid != amount
- AND $form->{arap}.$form->{ct}_id = $form->{ct}.id
- AND $form->{ct}.id = $id
- AND transdate < (date '$form->{todate}' - interval '90 days')
-
- ORDER BY
-
- ctid, transdate, invnumber
-
- |;
-
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror;
-
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- $ref->{module} = ($ref->{invoice}) ? $invoice : $form->{arap};
+ while (my $ref = $sth_details->fetchrow_hashref(NAME_lc)) {
+ $ref->{module} = ($ref->{invoice}) ? $invoice : $arap;
$ref->{exchangerate} = 1 unless $ref->{exchangerate};
push @{ $form->{AG} }, $ref;
}
- $sth->finish;
+ $sth_details->finish;
}
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT ct.name, ct.email, ct.cc, ct.bcc
- FROM $form->{ct} ct
- WHERE ct.id = $form->{"$form->{ct}_id"}|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror;
+ my $ct = $form->{ct} eq "customer" ? "customer" : "vendor";
+ my $query =
+ qq|SELECT ct.name, ct.email, ct.cc, ct.bcc
+ FROM $ct ct
+ WHERE ct.id = ?|;
($form->{ $form->{ct} }, $form->{email}, $form->{cc}, $form->{bcc}) =
- $sth->fetchrow_array;
- $sth->finish;
+ selectrow_query($form, $dbh, $query, $form->{"${ct}_id"});
$dbh->disconnect;
$main::lxdebug->leave_sub();
my $dbh = $form->dbconnect($myconfig);
# get tax accounts
- my $query = qq|SELECT c.accno, c.description, t.rate
- FROM chart c, tax t
- WHERE c.link LIKE '%CT_tax%'
- AND c.id = t.chart_id
- ORDER BY c.accno|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror;
-
- my $ref = ();
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{taxaccounts} }, $ref;
- }
- $sth->finish;
-
- # get gifi tax accounts
- $query = qq|SELECT DISTINCT ON (g.accno) g.accno, g.description,
- sum(t.rate) AS rate
- FROM gifi g, chart c, tax t
- WHERE g.accno = c.gifi_accno
- AND c.id = t.chart_id
- AND c.link LIKE '%CT_tax%'
- GROUP BY g.accno, g.description
- ORDER BY accno|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror;
-
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{gifi_taxaccounts} }, $ref;
- }
- $sth->finish;
+ my $query =
+ qq|SELECT c.accno, c.description, t.rate
+ FROM chart c, tax t
+ WHERE (c.link LIKE '%CT_tax%') AND (c.id = t.chart_id)
+ ORDER BY c.accno|;
+ $form->{taxaccounts} = selectall_hashref_quert($form, $dbh, $query);
$dbh->disconnect;
my $where = "1 = 1";
if ($department_id) {
- $where .= qq|
- AND a.department_id = $department_id
- |;
+ $where .= qq| AND (a.department_id = | . conv_i($department_id, 'NULL') . qq|) |;
}
my ($accno, $rate);
if ($form->{accno}) {
- if ($form->{accno} =~ /^gifi_/) {
- ($null, $accno) = split /_/, $form->{accno};
- $rate = $form->{"$form->{accno}_rate"};
- $accno = qq| AND ch.gifi_accno = '$accno'|;
- } else {
- $accno = $form->{accno};
- $rate = $form->{"$form->{accno}_rate"};
- $accno = qq| AND ch.accno = '$accno'|;
- }
+ $accno = $form->{accno};
+ $rate = $form->{"$form->{accno}_rate"};
+ $accno = qq| AND (ch.accno = | . $dbh->quote($accno) . qq|)|;
}
$rate *= 1;
if ($form->{db} eq 'ar') {
$table = "customer";
$ARAP = "AR";
- }
- if ($form->{db} eq 'ap') {
+ } else {
$table = "vendor";
$ARAP = "AP";
}
+ my $arap = lc($ARAP);
+
my $transdate = "a.transdate";
if ($form->{method} eq 'cash') {
$transdate = "a.datepaid";
- my $todate =
- ($form->{todate}) ? $form->{todate} : $form->current_date($myconfig);
+ my $todate = conv_dateq($form->{todate} ? $form->{todate} : $form->current_date($myconfig));
$where .= qq|
- AND ac.trans_id IN
- (
- SELECT trans_id
- FROM acc_trans
- JOIN chart ON (chart_id = id)
- WHERE link LIKE '%${ARAP}_paid%'
- AND transdate <= '$todate'
- )
- |;
+ AND ac.trans_id IN
+ (
+ SELECT trans_id
+ FROM acc_trans
+ JOIN chart ON (chart_id = id)
+ WHERE (link LIKE '%${ARAP}_paid%')
+ AND (transdate <= $todate)
+ )
+ |;
}
# if there are any dates construct a where
- if ($form->{fromdate} || $form->{todate}) {
- if ($form->{fromdate}) {
- $where .= " AND $transdate >= '$form->{fromdate}'";
- }
- if ($form->{todate}) {
- $where .= " AND $transdate <= '$form->{todate}'";
- }
- }
+ $where .= " AND ($transdate >= " . conv_dateq($form->{fromdate}) . ") " if ($form->{fromdate});
+ $where .= " AND ($transdate <= " . conv_dateq($form->{todate}) . ") " if ($form->{todate});
my $ml = ($form->{db} eq 'ar') ? 1 : -1;
my $sortorder = join ', ', $form->sort_columns(qw(transdate invnumber name));
- $sortorder = $form->{sort} if $form->{sort};
-
- $query = qq|SELECT a.id, '0' AS invoice, $transdate AS transdate,
- a.invnumber, n.name, a.netamount,
- ac.amount * $ml AS tax
- FROM acc_trans ac
- JOIN $form->{db} a ON (a.id = ac.trans_id)
- JOIN chart ch ON (ch.id = ac.chart_id)
- JOIN $table n ON (n.id = a.${table}_id)
- WHERE $where
- $accno
- AND a.invoice = '0'
- UNION
- SELECT a.id, '1' AS invoice, $transdate AS transdate,
- a.invnumber, n.name, i.sellprice * i.qty AS netamount,
- i.sellprice * i.qty * $rate * $ml AS tax
- FROM acc_trans ac
- JOIN $form->{db} a ON (a.id = ac.trans_id)
- JOIN chart ch ON (ch.id = ac.chart_id)
- JOIN $table n ON (n.id = a.${table}_id)
- JOIN ${table}tax t ON (t.${table}_id = n.id)
- JOIN invoice i ON (i.trans_id = a.id)
- JOIN partstax p ON (p.parts_id = i.parts_id)
- WHERE $where
- $accno
- AND a.invoice = '1'
- ORDER by $sortorder|;
-
- if ($form->{report} =~ /nontaxable/) {
-
+ $sortorder = $form->{sort} if ($form->{sort} && grep({ $_ eq $form->{sort} } qw(id transdate invnumber name netamount tax)));
+
+ if ($form->{report} !~ /nontaxable/) {
+ $query =
+ qq|SELECT a.id, '0' AS invoice, $transdate AS transdate, a.invnumber, n.name, a.netamount,
+ ac.amount * $ml AS tax
+ FROM acc_trans ac
+ JOIN ${arap} a ON (a.id = ac.trans_id)
+ JOIN chart ch ON (ch.id = ac.chart_id)
+ JOIN $table n ON (n.id = a.${table}_id)
+ WHERE
+ $where
+ $accno
+ AND (a.invoice = '0')
+
+ UNION
+
+ SELECT a.id, '1' AS invoice, $transdate AS transdate, a.invnumber, n.name, i.sellprice * i.qty AS netamount,
+ i.sellprice * i.qty * $rate * $ml AS tax
+ FROM acc_trans ac
+ JOIN ${arap} a ON (a.id = ac.trans_id)
+ JOIN chart ch ON (ch.id = ac.chart_id)
+ JOIN $table n ON (n.id = a.${table}_id)
+ JOIN ${table}tax t ON (t.${table}_id = n.id)
+ JOIN invoice i ON (i.trans_id = a.id)
+ JOIN partstax p ON (p.parts_id = i.parts_id)
+ WHERE
+ $where
+ $accno
+ AND (a.invoice = '1')
+ ORDER BY $sortorder|;
+ } else {
# only gather up non-taxable transactions
- $query = qq|SELECT a.id, '0' AS invoice, $transdate AS transdate,
- a.invnumber, n.name, a.netamount
- FROM acc_trans ac
- JOIN $form->{db} a ON (a.id = ac.trans_id)
- JOIN $table n ON (n.id = a.${table}_id)
- WHERE $where
- AND a.invoice = '0'
- AND a.netamount = a.amount
- UNION
- SELECT a.id, '1' AS invoice, $transdate AS transdate,
- a.invnumber, n.name, i.sellprice * i.qty AS netamount
- FROM acc_trans ac
- JOIN $form->{db} a ON (a.id = ac.trans_id)
- JOIN $table n ON (n.id = a.${table}_id)
- JOIN invoice i ON (i.trans_id = a.id)
- WHERE $where
- AND a.invoice = '1'
- AND (
- a.${table}_id NOT IN (
- SELECT ${table}_id FROM ${table}tax t (${table}_id)
- ) OR
- i.parts_id NOT IN (
- SELECT parts_id FROM partstax p (parts_id)
- )
- )
- GROUP BY a.id, a.invnumber, $transdate, n.name, i.sellprice, i.qty
- ORDER by $sortorder|;
- }
-
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{TR} }, $ref;
- }
+ $query =
+ qq|SELECT a.id, '0' AS invoice, $transdate AS transdate, a.invnumber, n.name, a.netamount
+ FROM acc_trans ac
+ JOIN ${arap} a ON (a.id = ac.trans_id)
+ JOIN $table n ON (n.id = a.${table}_id)
+ WHERE
+ $where
+ AND (a.invoice = '0')
+ AND (a.netamount = a.amount)
+
+ UNION
+
+ SELECT a.id, '1' AS invoice, $transdate AS transdate, a.invnumber, n.name, i.sellprice * i.qty AS netamount
+ FROM acc_trans ac
+ JOIN ${arap} a ON (a.id = ac.trans_id)
+ JOIN $table n ON (n.id = a.${table}_id)
+ JOIN invoice i ON (i.trans_id = a.id)
+ WHERE
+ $where
+ AND (a.invoice = '1')
+ AND (
+ a.${table}_id NOT IN (SELECT ${table}_id FROM ${table}tax t (${table}_id))
+ OR
+ i.parts_id NOT IN (SELECT parts_id FROM partstax p (parts_id))
+ )
+ GROUP BY a.id, a.invnumber, $transdate, n.name, i.sellprice, i.qty
+ ORDER by $sortorder|;
+ }
+
+ $form->{TR} = selectall_hashref_query($form, $dbh, $query);
- $sth->finish;
$dbh->disconnect;
$main::lxdebug->leave_sub();
# connect to database, turn AutoCommit off
my $dbh = $form->dbconnect_noauto($myconfig);
- my $ARAP = uc $form->{db};
+ my $ARAP = $form->{db} eq "ar" ? "AR" : "AP";
# get A(R|P)_paid accounts
- my $query = qq|SELECT c.accno, c.description
- FROM chart c
- WHERE c.link LIKE '%${ARAP}_paid%'|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{PR} }, $ref;
- }
+ my $query =
+ qq|SELECT accno, description
+ FROM chart
+ WHERE link LIKE '%${ARAP}_paid%'|;
+ $form->{PR} = selectall_hashref_query($form, $dbh, $query);
- $sth->finish;
$dbh->disconnect;
$main::lxdebug->leave_sub();
my $dbh = $form->dbconnect_noauto($myconfig);
my $ml = 1;
+ my $arap;
if ($form->{db} eq 'ar') {
$table = 'customer';
- $ml = -1;
- }
- if ($form->{db} eq 'ap') {
+ $ml = -1;
+ $arap = 'ar';
+ } else {
$table = 'vendor';
+ $arap = 'ap';
}
my ($query, $sth);
my $where;
if ($form->{department_id}) {
- $dpt_join = qq|
- JOIN dpt_trans t ON (t.trans_id = ac.trans_id)
- |;
-
- $where = qq|
- AND t.department_id = $form->{department_id}
- |;
+ $dpt_join = qq| JOIN dpt_trans t ON (t.trans_id = ac.trans_id) |;
+ $where = qq| AND (t.department_id = | . conv_i($form->{department_id}, 'NULL') . qq|) |;
}
if ($form->{fromdate}) {
- $where .= " AND ac.transdate >= '$form->{fromdate}'";
+ $where .= " AND (ac.transdate >= " . $dbh->quote($form->{fromdate}) . ") ";
}
if ($form->{todate}) {
- $where .= " AND ac.transdate <= '$form->{todate}'";
+ $where .= " AND (ac.transdate <= " . $dbh->quote($form->{todate}) . ") ";
}
if (!$form->{fx_transaction}) {
$where .= " AND ac.fx_transaction = '0'";
my $invnumber;
my $reference;
if ($form->{reference}) {
- $reference = $form->like(lc $form->{reference});
- $invnumber = " AND lower(a.invnumber) LIKE '$reference'";
- $reference = " AND lower(g.reference) LIKE '$reference'";
+ $reference = $dbh->quote('%' . $form->{reference} . '%');
+ $invnumber = " AND (a.invnumber LIKE $reference)";
+ $reference = " AND (g.reference LIKE $reference)";
}
if ($form->{source}) {
- my $source = $form->like(lc $form->{source});
- $where .= " AND lower(ac.source) LIKE '$source'";
+ $where .= " AND (ac.source ILIKE " . $dbh->quote('%' . $form->{source} . '%') . ") ";
}
if ($form->{memo}) {
- my $memo = $form->like(lc $form->{memo});
- $where .= " AND lower(ac.memo) LIKE '$memo'";
+ $where .= " AND (ac.memo ILIKE " . $dbh->quote('%' . $form->{memo} . '%') . ") ";
}
- my $sortorder = join ', ',
- $form->sort_columns(qw(name invnumber ordnumber transdate source));
- $sortorder = $form->{sort} if $form->{sort};
+ my $sortorder = join(', ', qw(name invnumber ordnumber transdate source));
+ $sortorder = $form->{sort} if ($form->{sort} && grep({ $_ eq $form->{sort} } qw(transdate invnumber name source memo)));
+
+ $query = qq|SELECT id, accno, description FROM chart WHERE accno = ?|;
+ my $sth = prepare_query($form, $dbh, $query);
+
+ my $q_details =
+ qq|SELECT c.name, a.invnumber, a.ordnumber,
+ ac.transdate, ac.amount * $ml AS paid, ac.source,
+ a.invoice, a.id, ac.memo, '${arap}' AS module
+ FROM acc_trans ac
+ JOIN $arap a ON (ac.trans_id = a.id)
+ JOIN $table c ON (c.id = a.${table}_id)
+ $dpt_join
+ WHERE (ac.chart_id = ?)
+ $where
+ $invnumber
+
+ UNION
+
+ SELECT g.description, g.reference, NULL AS ordnumber,
+ ac.transdate, ac.amount * $ml AS paid, ac.source,
+ '0' as invoice, g.id, ac.memo, 'gl' AS module
+ FROM acc_trans ac
+ JOIN gl g ON (g.id = ac.trans_id)
+ $dpt_join
+ WHERE (ac.chart_id = ?)
+ $where
+ $reference
+ AND (ac.amount * $ml) > 0
+
+ ORDER BY $sortorder|;
+ my $sth_details = prepare_query($form, $dbh, $q_details);
+
+ $form->{PR} = [];
# cycle through each id
foreach my $accno (split(/ /, $form->{paymentaccounts})) {
+ do_statement($form, $sth, $query, $accno);
+ my $ref = $sth->fetchrow_hashref();
+ push(@{ $form->{PR} }, $ref);
+ $sth->finish();
- $query = qq|SELECT c.id, c.accno, c.description
- FROM chart c
- WHERE c.accno = '$accno'|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $form->{ $ref->{id} } = [] unless ($form->{ $ref->{id} });
- my $ref = $sth->fetchrow_hashref(NAME_lc);
- push @{ $form->{PR} }, $ref;
- $sth->finish;
-
- $query = qq|SELECT c.name, a.invnumber, a.ordnumber,
- ac.transdate, ac.amount * $ml AS paid, ac.source,
- a.invoice, a.id, ac.memo, '$form->{db}' AS module
- FROM acc_trans ac
- JOIN $form->{db} a ON (ac.trans_id = a.id)
- JOIN $table c ON (c.id = a.${table}_id)
- $dpt_join
- WHERE ac.chart_id = $ref->{id}
- $where
- $invnumber
-
- UNION
- SELECT g.description, g.reference, NULL AS ordnumber,
- ac.transdate, ac.amount * $ml AS paid, ac.source,
- '0' as invoice, g.id, ac.memo, 'gl' AS module
- FROM acc_trans ac
- JOIN gl g ON (g.id = ac.trans_id)
- $dpt_join
- WHERE ac.chart_id = $ref->{id}
- $where
- $reference
- AND (ac.amount * $ml) > 0
- ORDER BY $sortorder|;
-
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while (my $pr = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{ $ref->{id} } }, $pr;
+ do_statement($form, $sth_details, $q_details, $ref->{id}, $ref->{id});
+ while (my $pr = $sth_details->fetchrow_hashref()) {
+ push(@{ $form->{ $ref->{id} } }, $pr);
}
- $sth->finish;
-
+ $sth_details->finish();
}
$dbh->disconnect;
my $dbh = $form->dbconnect($myconfig);
my $last_period = 0;
- my $category = "pos_bwa";
+ my $category;
my @categories =
qw(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40);
$form->{decimalplaces} *= 1;
- &get_accounts_g($dbh, $last_period, $form->{fromdate}, $form->{todate},
- $form, $category);
+ &get_accounts_g($dbh, $last_period, $form->{fromdate}, $form->{todate}, $form, "pos_bwa");
# if there are any compare dates
if ($form->{fromdate} || $form->{todate}) {
}
$kummfromdate = $form->{comparefromdate};
$kummtodate = $form->{comparetodate};
- &get_accounts_g($dbh, $last_period, $kummfromdate, $kummtodate, $form,
- $category);
+ &get_accounts_g($dbh, $last_period, $kummfromdate, $kummtodate, $form, "pos_bwa");
}
@periods = qw(jetzt kumm);
my $dbh = $form->dbconnect($myconfig);
my $last_period = 0;
- my $category = "pos_ustva";
my @categories_cent = qw(51r 511 86r 861 97r 971 93r 931
96 66 43 45 53 62 65 67);
my @categories_euro = qw(48 51 86 91 97 93 94);
$form->{"$item"} = 0;
}
- &get_accounts_g($dbh, $last_period, $form->{fromdate}, $form->{todate},
- $form, $category);
+ &get_accounts_g($dbh, $last_period, $form->{fromdate}, $form->{todate}, $form, "pos_ustva");
# foreach $item (@categories_cent) {
# if ($form->{$item}{"jetzt"} > 0) {
my $dbh = $form->dbconnect($myconfig);
my $last_period = 0;
- my $category = "pos_eur";
my @categories_einnahmen = qw(1 2 3 4 5 6 7);
my @categories_ausgaben =
qw(8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31);
}
&get_accounts_g($dbh, $last_period, $form->{fromdate}, $form->{todate},
- $form, $category);
+ $form, "pos_eur");
foreach $item (@categories_einnahmen) {
$form->{"eur${item}"} =
--- /dev/null
+package SL::ReportGenerator;
+
+use IO::Wrap;
+use List::Util qw(max);
+use Text::CSV_XS;
+
+use SL::Form;
+
+sub new {
+ my $type = shift;
+
+ my $self = { };
+
+ $self->{myconfig} = shift;
+ $self->{form} = shift;
+
+ $self->{data} = [];
+ $self->{options} = {
+ 'std_column_visibility' => 0,
+ 'output_format' => 'HTML',
+ 'allow_pdf_export' => 1,
+ 'allow_csv_export' => 1,
+ 'pdf_export' => {
+ 'paper_size' => 'A4',
+ 'orientation' => 'landscape',
+ 'font_size' => '10',
+ 'margin_top' => 1.5,
+ 'margin_left' => 1.5,
+ 'margin_bottom' => 1.5,
+ 'margin_right' => 1.5,
+ 'number' => 1,
+ 'print' => 0,
+ 'printer_id' => 0,
+ 'copies' => 1,
+ },
+ 'csv_export' => {
+ 'quote_char' => '"',
+ 'sep_char' => ';',
+ 'escape_char' => '"',
+ 'eol_style' => 'Unix',
+ 'headers' => 1,
+ },
+ };
+ $self->{export} = {
+ 'nextsub' => '',
+ 'variable_list' => '',
+ };
+
+ $self->{data_present} = 0;
+
+ $self->set_options(@_) if (@_);
+
+ return bless $self, $type;
+}
+
+sub set_columns {
+ my $self = shift;
+ my %columns = @_;
+
+ $self->{columns} = \%columns;
+
+ foreach my $column (values %{ $self->{columns} }) {
+ $column->{visible} = $self->{options}->{std_column_visibility} unless defined $column->{visible};
+ }
+
+ $self->set_column_order(sort keys %{ $self->{columns} });
+}
+
+sub set_column_order {
+ my $self = shift;
+
+ my $order = 0;
+ my %columns = map { $order++; ($_, $order) } @_;
+
+ foreach my $column (sort keys %{ $self->{columns} }) {
+ next if $columns{$column};
+
+ $order++;
+ $columns{$column} = $order;
+ }
+
+ $self->{column_order} = [ sort { $columns{$a} <=> $columns{$b} } keys %columns ];
+}
+
+sub set_sort_indicator {
+ my $self = shift;
+
+ $self->{options}->{sort_indicator_column} = shift;
+ $self->{options}->{sort_indicator_direction} = shift;
+}
+
+sub add_data {
+ my $self = shift;
+
+ my $last_row_set;
+
+ while (my $arg = shift) {
+ my $row_set;
+
+ if ('ARRAY' eq ref $arg) {
+ $row_set = $arg;
+
+ } elsif ('HASH' eq ref $arg) {
+ $row_set = [ $arg ];
+
+ } else {
+ $self->{form}->error('Incorrect usage -- expecting hash or array ref');
+ }
+
+ my @columns_with_default_alignment = grep { defined $self->{columns}->{$_}->{align} } keys %{ $self->{columns} };
+
+ foreach my $row (@{ $row_set }) {
+ foreach my $column (@columns_with_default_alignment) {
+ $row->{$column} ||= { };
+ $row->{$column}->{align} = $self->{columns}->{$column}->{align} unless (defined $row->{$column}->{align});
+ }
+
+ foreach my $field (qw(data link)) {
+ map { $row->{$_}->{$field} = [ $row->{$_}->{$field} ] if (ref $row->{$_}->{$field} ne 'ARRAY') } keys %{ $row };
+ }
+ }
+
+ push @{ $self->{data} }, $row_set;
+ $last_row_set = $row_set;
+
+ $self->{data_present} = 1;
+ }
+
+ return $last_row_set;
+}
+
+sub add_separator {
+ my $self = shift;
+
+ push @{ $self->{data} }, { 'type' => 'separator' };
+}
+
+sub add_control {
+ my $self = shift;
+ my $data = shift;
+
+ push @{ $self->{data} }, $data;
+}
+
+sub clear_data {
+ my $self = shift;
+
+ $self->{data} = [];
+ $self->{data_present} = 0;
+}
+
+sub set_options {
+ my $self = shift;
+ my %options = @_;
+
+ map { $self->{options}->{$_} = $options{$_} } keys %options;
+}
+
+sub set_options_from_form {
+ my $self = shift;
+
+ my $form = $self->{form};
+ my $myconfig = $self->{myconfig};
+
+ foreach my $key (qw(output_format)) {
+ my $full_key = "report_generator_${key}";
+ $self->{options}->{$key} = $form->{$full_key} if (defined $form->{$full_key});
+ }
+
+ foreach my $format (qw(pdf csv)) {
+ my $opts = $self->{options}->{"${format}_export"};
+ foreach my $key (keys %{ $opts }) {
+ my $full_key = "report_generator_${format}_options_${key}";
+ $opts->{$key} = $key =~ /^margin/ ? $form->parse_amount($myconfig, $form->{$full_key}) : $form->{$full_key};
+ }
+ }
+}
+
+sub set_export_options {
+ my $self = shift;
+
+ $self->{export} = {
+ 'nextsub' => shift,
+ 'variable_list' => join(" ", @_),
+ };
+}
+
+sub get_attachment_basename {
+ my $self = shift;
+ my $filename = $self->{options}->{attachment_basename} || 'report';
+ $filename =~ s|.*\\||;
+ $filename =~ s|.*/||;
+
+ return $filename;
+}
+
+sub generate_with_headers {
+ my $self = shift;
+ my $format = lc $self->{options}->{output_format};
+ my $form = $self->{form};
+
+ if (!$self->{columns}) {
+ $form->error('Incorrect usage -- no columns specified');
+ }
+
+ if ($format eq 'html') {
+ my $title = $form->{title};
+ $form->{title} = $self->{title} if ($self->{title});
+ $form->header();
+ $form->{title} = $title;
+
+ print $self->generate_html_content();
+
+ } elsif ($format eq 'csv') {
+ my $filename = $self->get_attachment_basename();
+ print qq|content-type: text/csv\n|;
+ print qq|content-disposition: attachment; filename=${filename}.csv\n\n|;
+ $self->generate_csv_content();
+
+ } elsif ($format eq 'pdf') {
+ $self->generate_pdf_content();
+
+ } else {
+ $form->error('Incorrect usage -- unknown format (supported are HTML, CSV, PDF)');
+ }
+}
+
+sub get_visible_columns {
+ my $self = shift;
+ my $format = shift;
+
+ return grep { my $c = $self->{columns}->{$_}; $c && $c->{visible} && (($c->{visible} == 1) || ($c->{visible} =~ /${format}/i)) } @{ $self->{column_order} };
+}
+
+sub html_format {
+ my $self = shift;
+ my $value = shift;
+
+ $value = $self->{form}->quote_html($value);
+ $value =~ s/\r//g;
+ $value =~ s/\n/<br>/g;
+
+ return $value;
+}
+
+sub prepare_html_content {
+ my $self = shift;
+
+ my ($column, $name, @column_headers);
+
+ my $opts = $self->{options};
+ my @visible_columns = $self->get_visible_columns('HTML');
+
+ foreach $name (@visible_columns) {
+ $column = $self->{columns}->{$name};
+
+ my $header = {
+ 'name' => $name,
+ 'link' => $column->{link},
+ 'text' => $column->{text},
+ 'show_sort_indicator' => $name eq $opts->{sort_indicator_column},
+ 'sort_indicator_direction' => $opts->{sort_indicator_direction},
+ };
+
+ push @column_headers, $header;
+ }
+
+ my ($outer_idx, $inner_idx) = (0, 0);
+ my @rows;
+
+ foreach my $row_set (@{ $self->{data} }) {
+ if ('HASH' eq ref $row_set) {
+ my $row_data = {
+ 'IS_CONTROL' => 1,
+ 'IS_SEPARATOR' => $row_set->{type} eq 'separator',
+ 'IS_COLSPAN_DATA' => $row_set->{type} eq 'colspan_data',
+ 'NUM_COLUMNS' => scalar @visible_columns,
+ 'data' => $row_set->{data},
+ };
+
+ push @rows, $row_data;
+
+ next;
+ }
+
+ $outer_idx++;
+
+ foreach my $row (@{ $row_set }) {
+ $inner_idx++;
+
+ foreach my $col_name (@visible_columns) {
+ my $col = $row->{$col_name};
+ $col->{CELL_ROWS} = [ ];
+ foreach my $i (0 .. scalar(@{ $col->{data} }) - 1) {
+ push @{ $col->{CELL_ROWS} }, {
+ 'data' => $self->html_format($col->{data}->[$i]),
+ 'link' => $col->{link}->[$i],
+ };
+ };
+ }
+
+ my $row_data = {
+ 'COLUMNS' => [ map { $row->{$_} } @visible_columns ],
+ 'outer_idx' => $outer_idx,
+ 'outer_idx_odd' => $outer_idx % 2,
+ 'inner_idx' => $inner_idx,
+ };
+
+ push @rows, $row_data;
+ }
+ }
+
+ my @export_variables;
+ foreach my $key (split m/ +/, $self->{export}->{variable_list}) {
+ push @export_variables, { 'key' => $key, 'value' => $self->{form}->{$key} };
+ }
+
+ my $allow_pdf_export = $opts->{allow_pdf_export} && (-x $main::html2ps_bin) && (-x $main::ghostscript_bin);
+
+ my $variables = {
+ 'TITLE' => $opts->{title},
+ 'TOP_INFO_TEXT' => $self->html_format($opts->{top_info_text}),
+ 'RAW_TOP_INFO_TEXT' => $opts->{raw_top_info_text},
+ 'BOTTOM_INFO_TEXT' => $self->html_format($opts->{bottom_info_text}),
+ 'RAW_BOTTOM_INFO_TEXT' => $opts->{raw_bottom_info_text},
+ 'ALLOW_PDF_EXPORT' => $allow_pdf_export,
+ 'ALLOW_CSV_EXPORT' => $opts->{allow_csv_export},
+ 'SHOW_EXPORT_BUTTONS' => ($allow_pdf_export || $opts->{allow_csv_export}) && $self->{data_present},
+ 'COLUMN_HEADERS' => \@column_headers,
+ 'NUM_COLUMNS' => scalar @column_headers,
+ 'ROWS' => \@rows,
+ 'EXPORT_VARIABLES' => \@export_variables,
+ 'EXPORT_VARIABLE_LIST' => $self->{export}->{variable_list},
+ 'EXPORT_NEXTSUB' => $self->{export}->{nextsub},
+ 'DATA_PRESENT' => $self->{data_present},
+ };
+
+ return $variables;
+}
+
+sub generate_html_content {
+ my $self = shift;
+ my $variables = $self->prepare_html_content();
+
+ return $self->{form}->parse_html_template2('report_generator/html_report', $variables);
+}
+
+sub verify_paper_size {
+ my $self = shift;
+ my $requested_paper_size = lc shift;
+ my $default_paper_size = shift;
+
+ my %allowed_paper_sizes = map { $_ => 1 } qw(a3 a4 letter legal);
+
+ return $allowed_paper_sizes{$requested_paper_size} ? $requested_paper_size : $default_paper_size;
+}
+
+sub generate_pdf_content {
+ my $self = shift;
+ my $variables = $self->prepare_html_content();
+ my $form = $self->{form};
+ my $myconfig = $self->{myconfig};
+ my $opt = $self->{options}->{pdf_export};
+
+ my $opt_number = $opt->{number} ? 'number : 1' : '';
+ my $opt_landscape = $opt->{orientation} eq 'landscape' ? 'landscape : 1' : '';
+
+ my $opt_paper_size = $self->verify_paper_size($opt->{paper_size}, 'a4');
+
+ my $html2ps_config = <<"END"
+\@html2ps {
+ option {
+ titlepage: 0;
+ hyphenate: 0;
+ colour: 1;
+ ${opt_landscape};
+ ${opt_number};
+ }
+ paper {
+ type: ${opt_paper_size};
+ }
+ break-table: 1;
+}
+
+\@page {
+ margin-top: $opt->{margin_top}cm;
+ margin-left: $opt->{margin_left}cm;
+ margin-bottom: $opt->{margin_bottom}cm;
+ margin-right: $opt->{margin_right}cm;
+}
+
+BODY {
+ font-family: Helvetica;
+ font-size: $opt->{font_size}pt;
+}
+
+END
+ ;
+
+ my $printer_command;
+ if ($opt->{print} && $opt->{printer_id}) {
+ $form->{printer_id} = $opt->{printer_id};
+ $form->get_printer_code($myconfig);
+ $printer_command = $form->{printer_command};
+ }
+
+ my $cfg_file_name = Common::tmpname() . '-html2ps-config';
+ my $cfg_file = IO::File->new($cfg_file_name, 'w') || $form->error($locale->text('Could not write the html2ps config file.'));
+
+ $cfg_file->print($html2ps_config);
+ $cfg_file->close();
+
+ my $html_file_name = Common::tmpname() . '.html';
+ my $html_file = IO::File->new($html_file_name, 'w');
+
+ if (!$html_file) {
+ unlink $cfg_file_name;
+ $form->error($locale->text('Could not write the temporary HTML file.'));
+ }
+
+ $html_file->print($form->parse_html_template('report_generator/pdf_report', $variables));
+ $html_file->close();
+
+ my $cmdline =
+ "\"${main::html2ps_bin}\" -f \"${cfg_file_name}\" \"${html_file_name}\" | " .
+ "\"${main::ghostscript_bin}\" -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sPAPERSIZE=${opt_paper_size} -sOutputFile=- -c .setpdfwrite -";
+
+ my $gs = IO::File->new("${cmdline} |");
+ if ($gs) {
+ my $content;
+
+ if (!$printer_command) {
+ my $filename = $self->get_attachment_basename();
+ print qq|content-type: application/pdf\n|;
+ print qq|content-disposition: attachment; filename=${filename}.pdf\n\n|;
+
+ while (my $line = <$gs>) {
+ print $line;
+ }
+
+ } else {
+ while (my $line = <$gs>) {
+ $content .= $line;
+ }
+ }
+
+ $gs->close();
+ unlink $cfg_file_name, $html_file_name;
+
+ if ($printer_command && $content) {
+ foreach my $i (1 .. max $opt->{copies}, 1) {
+ my $printer = IO::File->new("| ${printer_command}");
+ if (!$printer) {
+ $form->error($locale->text('Could not spawn the printer command.'));
+ }
+ $printer->print($content);
+ $printer->close();
+ }
+
+ $form->{report_generator_printed} = 1;
+ }
+
+ } else {
+ unlink $cfg_file_name, $html_file_name;
+ $form->error($locale->text('Could not spawn html2ps or GhostScript.'));
+ }
+}
+
+sub generate_csv_content {
+ my $self = shift;
+
+ my %valid_sep_chars = (';' => ';', ',' => ',', ':' => ':', 'TAB' => "\t");
+ my %valid_escape_chars = ('"' => 1, "'" => 1);
+ my %valid_quote_chars = ('"' => 1, "'" => 1);
+
+ my $opts = $self->{options}->{csv_export};
+ my $eol = $opts->{eol_style} eq 'DOS' ? "\r\n" : "\n";
+ my $sep_char = $valid_sep_chars{$opts->{sep_char}} ? $valid_sep_chars{$opts->{sep_char}} : ';';
+ my $escape_char = $valid_escape_chars{$opts->{escape_char}} ? $opts->{escape_char} : '"';
+ my $quote_char = $valid_quote_chars{$opts->{quote_char}} ? $opts->{quote_char} : '"';
+
+ $escape_char = $quote_char if ($opts->{escape_char} eq 'QUOTE_CHAR');
+
+ my $csv = Text::CSV_XS->new({ 'binary' => 1,
+ 'sep_char' => $sep_char,
+ 'escape_char' => $escape_char,
+ 'quote_char' => $quote_char,
+ 'eol' => $eol, });
+
+ my $stdout = wraphandle(\*STDOUT);
+ my @visible_columns = $self->get_visible_columns('CSV');
+
+ if ($opts->{headers}) {
+ $csv->print($stdout, [ map { $self->{columns}->{$_}->{text} } @visible_columns ]);
+ }
+
+ foreach my $row_set (@{ $self->{data} }) {
+ next if ('ARRAY' ne ref $row_set);
+ foreach my $row (@{ $row_set }) {
+ my @data;
+ foreach my $col (@visible_columns) {
+ push @data, join($eol, map { s/\r?\n/$eol/g; $_ } @{ $row->{$col}->{data} });
+ }
+ $csv->print($stdout, \@data);
+ }
+ }
+}
+
+1;
'<pagebreak>',
'&', quotemeta("\n"),
'"', '\$', '%', '_', '#', quotemeta('^'),
- '{', '}', '<', '>', '£', "\r"
+ '{', '}', '<', '>', '£', "\r", '±', '\xe1',
],
quotemeta("\\") => '\\textbackslash ',
'<pagebreak>' => '',
'>' => '$>$',
'£' => '\pounds ',
"\r" => "",
+ '±' => '$\pm$',
+ '\xe1' => '$\bullet$',
quotemeta('^') => '\^\\',
quotemeta("\n") => '\newline '
);
$variable =~ s/\$\<\$${key}\$\>\$(.*?)\$<\$\/${key}\$>\$/\\${new}\{$1\}/gi;
}
+ $variable =~ s/[\x00-\x1f]//g;
+
return $variable;
}
}
+####
+#### PlainTextTemplate
+####
+
+package PlainTextTemplate;
+
+use vars qw(@ISA);
+
+@ISA = qw(LaTeXTemplate);
+
+sub new {
+ my $type = shift;
+
+ return $type->SUPER::new(@_);
+}
+
+sub format_string {
+ my ($self, $variable) = @_;
+
+ return $variable;
+}
+
+sub get_mime_type {
+ return "text/plain";
+}
+
+sub parse {
+}
+
+1;
+
####
#### OpenDocumentTemplate
####
package USTVA;
+sub report_variables {
+ # Get all positions for taxreport out of the database
+ # Needs Databaseupdate Pg-upgrade2/USTVA_abstraction.pl
+
+ return unless defined wantarray;
+
+ my ( $self,
+ $arg_ref) = @_;
+
+ my $myconfig = $arg_ref->{myconfig};
+ my $form = $arg_ref->{form};
+ my $type = $arg_ref->{type}; # 'paied' || 'received' || ''
+ my $attribute = $arg_ref->{attribute}; #
+ my $dec_places = (defined $arg_ref->{dec_places}) ? $arg_ref->{dec_places}:undef;
+
+ my $where_type = "AND tax.report_headings.type = '$type'" if ( $type );
+ my $where_dcp = "AND tax.report_variables.dec_places = '$dec_places'" if ( defined $dec_places );
+
+ my $query = qq|
+ SELECT $attribute
+ FROM tax.report_variables
+ LEFT JOIN tax.report_headings
+ ON (tax.report_variables.heading_id = tax.report_headings.id)
+ WHERE 1=1
+ $where_type
+ $where_dcp
+ |;
+
+ $main::lxdebug->message(LXDebug::QUERY, "\$query= \n $query\n");
+
+ my $dbh = $form->dbconnect($myconfig);
+ my $sth = $dbh->prepare($query);
+
+ $sth->execute() || $form->dberror($query);
+
+ my @positions;
+
+ while ( my $row_ref = $sth->fetchrow_arrayref() ) {
+ push @positions, @$row_ref; # Copy the array contents
+ }
+
+ $sth->finish;
+
+ $dbh->disconnect;
+
+ return @positions;
+
+}
+
sub create_steuernummer {
$main::lxdebug->enter_sub();
my $h = 0;
my $i = 0;
- $steuernummer_new = $part;
- $elstersteuernummer_new = $elster_FFFF;
+ $steuernummer_new = $part;
+ $elstersteuernummer_new = $elster_FFFF;
$elstersteuernummer_new .= '0';
for ($h = 1; $h < $patterncount; $h++) {
sub steuernummer_input {
$main::lxdebug->enter_sub();
- ($elsterland, $elsterFFFF, $steuernummer) = @_;
+ my ($self, $elsterland, $elsterFFFF, $steuernummer) = @_;
+ my $steuernummer_input = '';
+
$elster_land = $elsterland;
$elster_FFFF = $elsterFFFF;
$steuernummer = '0000000000' if ($steuernummer eq '');
# $steuernummer formatieren (nur Zahlen) -> $stnr
- $stnr = $steuernummer;
+ my $stnr = $steuernummer;
$stnr =~ s/\D+//g;
#Pattern description Elstersteuernummer
my %elster_STNRformat = (
- 'Mecklenburg Vorpommern' => 'FFF/BBB/UUUUP', # '/' 3
- 'Hessen' => '0FF BBB UUUUP', # ' ' 3
- 'Nordrhein Westfalen' => 'FFF/BBBB/UUUP', # '/' 3
- 'Schleswig Holstein' => 'FF BBB UUUUP', # ' ' 2
- 'Berlin' => 'FF/BBB/UUUUP', # '/' 3
- 'Thüringen' => 'FFF/BBB/UUUUP', # '/' 3
- 'Sachsen' => 'FFF/BBB/UUUUP', # '/' 3
- 'Hamburg' => 'FF/BBB/UUUUP', # '/' 3
- 'Baden Würtemberg' => 'FF/BBB/UUUUP', # '/' 2
- 'Sachsen Anhalt' => 'FFF/BBB/UUUUP', # '/' 3
- 'Saarland' => 'FFF/BBB/UUUUP', # '/' 3
- 'Bremen' => 'FF BBB UUUUP', # ' ' 3
- 'Bayern' => 'FFF/BBB/UUUUP', # '/' 3
- 'Rheinland Pfalz' => 'FF/BBB/UUUU/P', # '/' 4
- 'Niedersachsen' => 'FF/BBB/UUUUP', # '/' 3
- 'Brandenburg' => 'FFF/BBB/UUUUP', # '/' 3
+ 'Mecklenburg Vorpommern' => 'FFF/BBB/UUUUP', # '/' 3
+ 'Hessen' => '0FF BBB UUUUP', # ' ' 3
+ 'Nordrhein Westfalen' => 'FFF/BBBB/UUUP', # '/' 3
+ 'Schleswig Holstein' => 'FF BBB UUUUP', # ' ' 2
+ 'Berlin' => 'FF/BBB/UUUUP', # '/' 3
+ 'Thüringen' => 'FFF/BBB/UUUUP', # '/' 3
+ 'Sachsen' => 'FFF/BBB/UUUUP', # '/' 3
+ 'Hamburg' => 'FF/BBB/UUUUP', # '/' 3
+ 'Baden Würtemberg' => 'FF/BBB/UUUUP', # '/' 2
+ 'Sachsen Anhalt' => 'FFF/BBB/UUUUP', # '/' 3
+ 'Saarland' => 'FFF/BBB/UUUUP', # '/' 3
+ 'Bremen' => 'FF BBB UUUUP', # ' ' 3
+ 'Bayern' => 'FFF/BBB/UUUUP', # '/' 3
+ 'Rheinland Pfalz' => 'FF/BBB/UUUU/P', # '/' 4
+ 'Niedersachsen' => 'FF/BBB/UUUUP', # '/' 3
+ 'Brandenburg' => 'FFF/BBB/UUUUP', # '/' 3
);
#split the pattern
- $elster_pattern = $elster_STNRformat{$elster_land};
+ my $elster_pattern = $elster_STNRformat{$elster_land};
my @elster_pattern = split(' ', $elster_pattern);
my $delimiter = ' ';
my $patterncount = @elster_pattern;
# no we have an array of patternparts and a delimiter
# create the first automated and fixed part and delimiter
- print qq|<b><font size="+1">|;
- $part = '';
+ $steuernummer_input .= qq|<b><font size="+1">|;
+ my $part = '';
SWITCH: {
$elster_pattern[0] eq 'FFF' && do {
$part = substr($elster_FFFF, 1, 4);
- print qq|$part|;
+ $steuernummer_input .= qq|$part|;
last SWITCH;
};
$elster_pattern[0] eq '0FF' && do {
$part = '0' . substr($elster_FFFF, 2, 4);
- print qq|$part|;
+ $steuernummer_input .= qq|$part|;
last SWITCH;
};
$elster_pattern[0] eq 'FF' && do {
$part = substr($elster_FFFF, 2, 4);
- print qq|$part|;
+ $steuernummer_input .= qq|$part|;
last SWITCH;
};
1 == 1 && do {
- print qq|Fehler!|;
+ $steuernummer_input .= qq|Fehler!|;
last SWITCH;
};
}
#now the rest of the Steuernummer ...
- print qq|</b></font>|;
- print qq|\n
+ $steuernummer_input .= qq|</b></font>|;
+ $steuernummer_input .= qq|\n
<input type=hidden name="elster_pattern" value="$elster_pattern">
<input type=hidden name="patterncount" value="$patterncount">
<input type=hidden name="patternlength" value="$patterncount">
<input type=hidden name="delimiter" value="$delimiter">
<input type=hidden name="part" value="$part">
|;
- my $h = 0;
- my $i = 0;
- my $j = 0;
- $k = 0;
- for ($h = 1; $h < $patterncount; $h++) {
- print qq| $delimiter \n|;
- for ($i = 1; $i <= length($elster_pattern[$h]); $i++) {
- print qq|<select name="part_$h\_$i">\n|;
+ my $k = 0;
+
+ for (my $h = 1; $h < $patterncount; $h++) {
+ $steuernummer_input .= qq| $delimiter \n|;
+ for (my $i = 1; $i <= length($elster_pattern[$h]); $i++) {
+ $steuernummer_input .= qq|<select name="part_$h\_$i">\n|;
- for ($j = 0; $j <= 9; $j++) {
- print qq| <option value="$j"|;
+ for (my $j = 0; $j <= 9; $j++) {
+ $steuernummer_input .= qq| <option value="$j"|;
if ($steuernummer ne '') {
if ($j eq substr($stnr, length($part) + $k, 1)) {
- print qq| selected|;
+ $steuernummer_input .= qq| selected|;
}
}
- print qq|>$j</option>\n|;
+ $steuernummer_input .= qq|>$j</option>\n|;
}
$k++;
- print qq|</select>\n|;
+ $steuernummer_input .= qq|</select>\n|;
}
}
+
$main::lxdebug->leave_sub();
+
+ return $steuernummer_input;
}
sub fa_auswahl {
$main::lxdebug->enter_sub();
- use SL::Form;
+# use SL::Form;
# Referenz wird übergeben, hash of hash wird nicht
# in neues Hash kopiert, sondern direkt über die Referenz verändert
# Prototyp für diese Konstruktion
- my ($land, $elsterFFFF, $elster_init) =
- @_; #Referenz auf Hash von Hash übergeben
+ my ($self, $land, $elsterFFFF, $elster_init) = @_;
+
my $terminal = '';
my $FFFF = $elsterFFFF;
my $ffff = '';
#}
#if ( $terminal eq 'mozilla' or $terminal eq 'js' ) {
- print qq|
- <br>
+ my $fa_auswahl = qq|
<script language="Javascript">
function update_auswahl()
{
|;
foreach $elster_land (sort keys %$elster_init) {
- print qq|
+ $fa_auswahl .= qq|
if (elsterBLAuswahl.options[elsterBLAuswahl.selectedIndex].
value == "$elster_land")
{
foreach $ffff (sort { $elster_land_fa{$a} cmp $elster_land_fa{$b} }
keys(%elster_land_fa)
) {
- print qq|
+ $fa_auswahl .= qq|
elsterFAAuswahl.options[$j] = new Option("$elster_land_fa{$ffff} ($ffff)","$ffff");|;
$j++;
}
- print qq|
+ $fa_auswahl .= qq|
}|;
}
- print qq|
+ $fa_auswahl .= qq|
}
</script>
<td>
<select size="1" name="elsterland_new" onchange="update_auswahl()">|;
if ($land eq '') {
- print qq|<option value="Auswahl" $checked>hier auswählen...</option>\n|;
+ $fa_auswahl .= qq|<option value="Auswahl" $checked>hier auswählen...</option>\n|;
}
foreach $elster_land (sort keys %$elster_init) {
- print qq|
+ $fa_auswahl .= qq|
<option value="$elster_land"|;
if ($elster_land eq $land and $checked eq '') {
- print qq| selected|;
+ $fa_auswahl .= qq| selected|;
}
- print qq|>$elster_land</option>
+ $fa_auswahl .= qq|>$elster_land</option>
|;
}
- print qq|
+ $fa_auswahl .= qq|
</td>
</tr>
|;
$elster_land_fa{$FFFF} = $elster_init->{$elster_land}->{$FFFF}->[0];
}
- print qq|
+ $fa_auswahl .= qq|
<tr>
<td>Finanzamt
</td>
<td>
<select size="1" name="elsterFFFF_new">|;
if ($elsterFFFF eq '') {
- print qq|<option value="Auswahl" $checked>hier auswählen...</option>|;
+ $fa_auswahl .= qq|<option value="Auswahl" $checked>hier auswählen...</option>|;
} else {
foreach $ffff (sort { $elster_land_fa{$a} cmp $elster_land_fa{$b} }
keys(%elster_land_fa)
) {
- print qq|
+ $fa_auswahl .= qq|
<option value="$ffff"|;
if ($ffff eq $elsterFFFF and $checked eq '') {
- print qq| selected|;
+ $fa_auswahl .= qq| selected|;
}
- print qq|>$elster_land_fa{$ffff} ($ffff)</option>|;
+ $fa_auswahl .= qq|>$elster_land_fa{$ffff} ($ffff)</option>|;
}
}
- print qq|
+ $fa_auswahl .= qq|
</td>
</tr>
</table>
</select>|;
$main::lxdebug->leave_sub();
+ return $fa_auswahl;
}
sub info {
sub query_finanzamt {
$main::lxdebug->enter_sub();
- my ($myconfig, $form) = @_;
+ my ($self, $myconfig, $form) = @_;
+
my $dbh = $form->dbconnect($myconfig) or $self->error(DBI->errstr);
#Test, if table finanzamt exist
# return unless (-f $filename);
- open(FH, "$filename") or $form->error("$filename : $!\n");
+ open my $FH, "<", "$filename" or $form->error("$filename : $!\n");
my $query = "";
my $sth;
my @quote_chars;
- while (<FH>) {
+ while (<$FH>) {
# Remove DOS and Unix style line endings.
s/[\r\n]//g;
}
}
- close FH;
+ close $FH;
$main::lxdebug->leave_sub();
}
my $last_period = 0;
my $category = "pos_ustva";
- my @category_cent = qw(511 861 36 80 971 931 98 96 53 74
- 85 65 66 61 62 67 63 64 59 69 39 83
- Z43 Z45 Z53 Z62 Z65 Z67);
- my @category_euro = qw(41 44 49 43 48 51 86 35 77 76 91 97 93
- 95 94 42 60 45 52 73 84);
+ my @category_cent = USTVA->report_variables({
+ myconfig => $myconfig,
+ form => $form,
+ type => '',
+ attribute => 'position',
+ dec_places => '2',
+ });
+
+ push @category_cent, qw(83 Z43 Z45 Z53 Z62 Z65 Z67);
+
+ my @category_euro = USTVA->report_variables({
+ myconfig => $myconfig,
+ form => $form,
+ type => '',
+ attribute => 'position',
+ dec_places => '0',
+ });
+
+ push @category_euro, USTVA->report_variables({
+ myconfig => $myconfig,
+ form => $form,
+ type => '',
+ attribute => 'position',
+ dec_places => '0',
+ });
$form->{decimalplaces} *= 1;
foreach $item (@category_euro) {
$form->{"$item"} = 0;
}
+ my $coa_name = coa_get($dbh);
+ $form->{coa} = $coa_name;
+
+ # Controlvariable for templates
+ $form->{"$coa_name"} = '1';
+
+ $main::lxdebug->message(LXDebug::DEBUG2, "COA: '$form->{coa}', \$form->{$coa_name} = 1");
&get_accounts_ustva($dbh, $last_period, $form->{fromdate}, $form->{todate},
$form, $category);
+ ###########################################
#
- # Berechnung der USTVA Formularfelder
+ # Nationspecific Modfications
+ #
+ ###########################################
+
+ # Germany
+
+ if ( $form->{coa} eq 'Germany-DATEV-SKR03EU' or $form->{coa} eq 'Germany-DATEV-SKR04EU'){
+
+ # 16%/19% Umstellung
+ # Umordnen der Kennziffern
+ if ( $form->{year} < 2007) {
+ $form->{35} += $form->{81};
+ $form->{36} += $form->{811};
+ $form->{95} += $form->{89};
+ $form->{98} += $form->{891};
+ map { delete $form->{$_} } qw(81 811 89 891);
+ } else {
+ $form->{35} += $form->{51};
+ $form->{36} += $form->{511};
+ $form->{95} += $form->{97};
+ $form->{98} += $form->{971};
+ map { delete $form->{$_} } qw(51 511 97 971);
+ }
+
+ }
+
+
+ # Fixme: Wird auch noch für Oesterreich gebraucht,
+ # weil kein eigenes Ausgabeformular
+ # sotte aber aus der allgeméinen Steuerberechnung verschwinden
+ #
+ # Berechnung der USTVA Formularfelder laut Bogen 207
#
$form->{"51r"} = $form->{"511"};
$form->{"86r"} = $form->{"861"};
$form->{"97r"} = $form->{"971"};
$form->{"93r"} = $form->{"931"};
- $form->{"Z43"} =
- $form->{"511"} + $form->{"861"} + $form->{"36"} + $form->{"80"} +
- $form->{"971"} + $form->{"931"} + $form->{"96"} + $form->{"98"};
+
+ $form->{"Z43"} = $form->{"511"} + $form->{"811"} + $form->{"861"}
+ + $form->{"36"} + $form->{"80"} + $form->{"971"}
+ + $form->{"891"} + $form->{"931"} + $form->{"96"}
+ + $form->{"98"};
+
$form->{"Z45"} = $form->{"Z43"};
- $form->{"Z53"} = $form->{"Z43"};
- $form->{"Z62"} =
- $form->{"Z43"} - $form->{"66"} - $form->{"61"} - $form->{"62"} -
- $form->{"63"} - $form->{"64"} - $form->{"59"};
- $form->{"Z65"} = $form->{"Z62"} - $form->{"69"};
- $form->{"83"} = $form->{"Z65"} - $form->{"39"};
- # Hier fehlen moeglicherweise noch einige Berechnungen!
+
+ $form->{"Z53"} = $form->{"Z45"} + $form->{"53"} + $form->{"74"}
+ + $form->{"85"} + $form->{"65"};
+
+ $form->{"Z62"} = $form->{"Z43"} - $form->{"66"} - $form->{"61"}
+ - $form->{"62"} - $form->{"67"} - $form->{"63"}
+ - $form->{"64"} - $form->{"59"};
+
+ $form->{"Z65"} = $form->{"Z62"} - $form->{"69"};
+ $form->{"83"} = $form->{"Z65"} - $form->{"39"};
$dbh->disconnect;
$main::lxdebug->leave_sub();
}
+sub coa_get {
+
+ my ($dbh) = @_;
+
+ my $query= qq|SELECT coa FROM defaults|;
+
+ my $sth = $dbh->prepare($query);
+
+ $sth->execute || $form->dberror($query);
+
+ ($ref) = $sth->fetchrow_array;
+
+ return $ref;
+
+};
+
sub get_accounts_ustva {
$main::lxdebug->enter_sub();
my ($dbh, $last_period, $fromdate, $todate, $form, $category) = @_;
- my ($null, $department_id) = split /--/, $form->{department};
-
my $query;
- my $dpt_where;
- my $dpt_join;
- my $project;
- my $where = "1 = 1";
+ my $where = "";
my $glwhere = "";
my $subwhere = "";
my $ARwhere = "";
my $arwhere = "";
my $item;
+ my $gltaxkey_where = "(tk.pos_ustva>=59 AND tk.pos_ustva<=66)";
+
if ($fromdate) {
if ($form->{method} eq 'cash') {
$subwhere .= " AND transdate >= '$fromdate'";
$glwhere = " AND ac.transdate >= '$fromdate'";
- $ARwhere .= " AND acc.transdate >= '$fromdate'";
- $APwhere .= " AND AP.transdate >= '$fromdate'";
+ $ARwhere .= " AND acc.transdate >= '$fromdate'";
}
+ $APwhere .= " AND AP.transdate >= '$fromdate'";
$where .= " AND ac.transdate >= '$fromdate'";
}
if ($todate) {
$where .= " AND ac.transdate <= '$todate'";
$ARwhere .= " AND acc.transdate <= '$todate'";
- $subwhere .= " AND transdate <= '$todate'";
- $APwhere .= " AND AP.transdate <= '$todate'";
- }
-
- if ($department_id) {
- $dpt_join = qq|
- JOIN department t ON (a.department_id = t.id)
- |;
- $dpt_where = qq|
- AND t.id = $department_id
- |;
}
- if ($form->{project_id}) {
- $project = qq|
- AND ac.project_id = $form->{project_id}
- |;
- }
-#########################################
-# Method eq 'cash' = IST Versteuerung
-#########################################
+ ############################################
+ # Method eq 'cash' = IST Versteuerung
+ ############################################
+ # Betrifft nur die eingenommene Umsatzsteuer
+ #
+ ############################################
if ($form->{method} eq 'cash') {
$query = qq|
- SELECT
- -- Alle tatsaechlichen Zahlungseingaenge
- -- im Voranmeldezeitraum erfassen
- -- (Teilzahlungen werden prozentual auf verschiedene Steuern aufgeteilt)
- SUM( ac.amount *
- -- Bezahlt / Rechnungssumme
- (
- SELECT SUM(acc.amount)
- FROM acc_trans acc
- INNER JOIN chart c ON (acc.chart_id = c.id AND c.link like '%AR_paid%')
- WHERE
- 1=1
- $ARwhere
- AND acc.trans_id = ac.trans_id
- )
- /
- (
- select amount from ar where id = ac.trans_id
- )
- ) AS amount,
- c.pos_ustva
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- --JOIN ar ON (ar.id = ac.trans_id)
- where
- 1=1
- -- Here no where, please. All Transactions ever should be
- -- testet if they are paied in the USTVA report period.
- GROUP BY c.pos_ustva
-
- UNION -- alle Ausgaben AP erfassen
-
- SELECT
- sum(ac.amount) AS amount, pos_ustva
- FROM acc_trans ac
- JOIN AP ON (AP.id = ac.trans_id )
- JOIN chart c ON (c.id = ac.chart_id AND pos_ustva NOT LIKE '')
- WHERE
- 1=1
- $APwhere
- $dpt_where
- $project
- GROUP BY pos_ustva
-
- UNION -- alle Ausgaben und Einnahmen direkter gl Buchungen erfassen
-
- SELECT sum
- (
- CASE WHEN c.link LIKE '%AR%' THEN ac.amount * -1
- WHEN c.link LIKE '%AP%' THEN ac.amount * 1
- END
- ) AS amount, c.$category
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- JOIN gl a ON (a.id = ac.trans_id)
- $dpt_join
- WHERE $where
- $dpt_from
- AND NOT (c.link = 'AR' OR c.link = 'AP')
- $project
- GROUP BY c.$category
- |;
-
- } else {
-#########################################
-# Method eq 'accrual' = Soll Versteuerung
-#########################################
-
- if ($department_id) {
- $dpt_join = qq|
- JOIN dpt_trans t ON (t.trans_id = ac.trans_id)
- |;
- $dpt_where = qq|
- AND t.department_id = $department_id
- |;
- }
+ SELECT
+ -- USTVA IST-Versteuerung
+ --
+ -- Alle tatsaechlichen _Zahlungseingaenge_
+ -- im Voranmeldezeitraum erfassen
+ -- (Teilzahlungen werden prozentual auf verschiedene Steuern aufgeteilt)
+ SUM( ac.amount *
+ -- Bezahlt / Rechnungssumme
+ (
+ SELECT SUM(acc.amount)
+ FROM acc_trans acc
+ INNER JOIN chart c ON (acc.chart_id = c.id
+ AND c.link like '%AR_paid%')
+ WHERE
+ 1=1
+ $ARwhere
+ AND acc.trans_id = ac.trans_id
+ )
+ /
+ (
+ SELECT amount FROM ar WHERE id = ac.trans_id
+ )
+ ) AS amount,
+ tk.pos_ustva
+ FROM acc_trans ac
+ LEFT JOIN chart c ON (c.id = ac.chart_id)
+ LEFT JOIN ar ON (ar.id = ac.trans_id)
+ LEFT JOIN taxkeys tk ON (
+ tk.id = (
+ SELECT id FROM taxkeys
+ WHERE chart_id = ac.chart_id
+ -- AND taxkey_id = ac.taxkey
+ AND startdate <= COALESCE(ar.deliverydate,ar.transdate)
+ ORDER BY startdate DESC LIMIT 1
+ )
+ )
+ WHERE
+ 1=1
+ -- Here no where, please. All Transactions ever should be
+ -- testet if they are paied in the USTVA report period.
+ GROUP BY tk.pos_ustva
+ |;
+
+ } elsif ($form->{method} eq 'accrual') {
+ #########################################
+ # Method eq 'accrual' = Soll Versteuerung
+ #########################################
$query = qq|
- SELECT sum
- (
- CASE WHEN c.link LIKE '%AR%' THEN ac.amount * -1
- WHEN c.link LIKE '%AP%' THEN ac.amount * 1
- END
- ) AS amount, c.$category
- FROM acc_trans ac
- JOIN chart c ON (c.id = ac.chart_id)
- $dpt_join
- WHERE $where
- $dpt_where
- $project
- GROUP BY c.$category
- |;
+ -- Alle Einnahmen AR und pos_ustva erfassen
+ SELECT
+ - sum(ac.amount) AS amount,
+ tk.pos_ustva
+ FROM acc_trans ac
+ JOIN chart c ON (c.id = ac.chart_id)
+ JOIN ar ON (ar.id = ac.trans_id)
+ JOIN taxkeys tk ON (
+ tk.id = (
+ SELECT id FROM taxkeys
+ WHERE chart_id = ac.chart_id
+ AND startdate <= COALESCE(ar.deliverydate,ar.transdate)
+ ORDER BY startdate DESC LIMIT 1
+ )
+ )
+ $dpt_join
+ WHERE 1 = 1
+ $where
+ GROUP BY tk.pos_ustva
+ |;
+
+ } else {
+
+ $self->error("Unknown tax method: $form->{method}")
+
}
+
+ #########################################
+ # Ausgaben und Gl Buchungen sind gleich
+ # für Ist- und Soll-Versteuerung
+ #########################################
+ $query .= qq|
+ UNION -- alle Ausgaben AP erfassen
+
+ SELECT
+ sum(ac.amount) AS amount,
+ tk.pos_ustva
+ FROM acc_trans ac
+ JOIN ap ON (ap.id = ac.trans_id )
+ JOIN chart c ON (c.id = ac.chart_id)
+ LEFT JOIN taxkeys tk ON (
+ tk.id = (
+ SELECT id FROM taxkeys
+ WHERE 1=1
+ AND chart_id=ac.chart_id
+ --AND taxkey_id = ac.taxkey
+ AND startdate <= COALESCE(AP.transdate)
+ ORDER BY startdate DESC LIMIT 1
+ )
+ )
+ WHERE
+ 1=1
+ $where
+ GROUP BY tk.pos_ustva
+
+ UNION -- Einnahmen direkter gl Buchungen erfassen
+
+ SELECT sum
+ ( - ac.amount) AS amount,
+ tk.pos_ustva
+ FROM acc_trans ac
+ JOIN chart c ON (c.id = ac.chart_id)
+ JOIN gl a ON (a.id = ac.trans_id)
+ LEFT JOIN taxkeys tk ON (
+ tk.id = (
+ SELECT id FROM taxkeys
+ WHERE chart_id=ac.chart_id
+ AND NOT $gltaxkey_where
+ AND startdate <= COALESCE(ac.transdate)
+ ORDER BY startdate DESC LIMIT 1
+ )
+ )
+
+ $dpt_join
+ WHERE 1 = 1
+ $where
+ GROUP BY tk.pos_ustva
+
+
+ UNION -- Ausgaben direkter gl Buchungen erfassen
+
+ SELECT sum
+ (ac.amount) AS amount,
+ tk.pos_ustva
+ FROM acc_trans ac
+ JOIN chart c ON (c.id = ac.chart_id)
+ JOIN gl a ON (a.id = ac.trans_id)
+ LEFT JOIN taxkeys tk ON (
+ tk.id = (
+ SELECT id FROM taxkeys
+ WHERE chart_id=ac.chart_id
+ AND $gltaxkey_where
+ AND startdate <= COALESCE(ac.transdate)
+ ORDER BY startdate DESC LIMIT 1
+ )
+ )
+
+ $dpt_join
+ WHERE 1 = 1
+ $where
+ GROUP BY tk.pos_ustva
+
+ |;
my @accno;
my $accno;
$main::lxdebug->message(LXDebug::QUERY, "$callingdetails \$query=\n $query");
my $sth = $dbh->prepare($query);
+
$sth->execute || $form->dberror($query);
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
-# Bug 365 solved?!
- $ref->{amount} *= -1;
- if ($category eq "pos_bwa") {
- if ($last_period) {
- $form->{ $ref->{$category} }{kumm} += $ref->{amount};
- } else {
- $form->{ $ref->{$category} }{jetzt} += $ref->{amount};
- }
- } else {
- $form->{ $ref->{$category} } += $ref->{amount};
- }
+ while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
+ # Bug 365 solved?!
+ $ref->{amount} *= -1;
+ $form->{ $ref->{$category} } += $ref->{amount};
}
+
$sth->finish;
+ $main::lxdebug->leave_sub();
+
+}
+
+sub get_config {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $userspath, $filename) = @_;
+
+ $form->error("Missing Parameter: @_") if !$userspath || !$filename;
+
+ my $form = $main::form;
+
+ $filename = "$form->{login}_$filename";
+ $filename =~ s|.*/||;
+ $filename = "$userspath/$filename";
+ open my $FACONF, "<", $filename or sub {# Annon Sub
+ # catch open error
+ # create file if file does not exist
+ open my $FANEW, ">", $filename or $form->error("CREATE: $filename : $!");
+ close $FANEW or $form->error("CLOSE: $filename : $!");
+
+ #try again open file
+ open my $FACONF, "<", $filename or $form->error("OPEN: $filename : $!");
+ };
+
+ while (<$FACONF>) {
+ last if (/^\[/);
+ next if (/^(\#|\s)/);
+
+ # remove comments
+ s/\s#.*//g;
+
+ # remove any trailing whitespace
+ s/^\s*(.*?)\s*$/$1/;
+ my ($key, $value) = split(/=/, $_, 2);
+
+ $form->{$key} = "$value";
+
+ }
+
+ close $FACONF;
+
$main::lxdebug->leave_sub();
}
+
1;
package User;
+use IO::File;
+use Fcntl qw(:seek);
+
use SL::DBUpgrade2;
+use SL::DBUtils;
+use SL::Iconv;
+use SL::Inifile;
sub new {
$main::lxdebug->enter_sub();
my $self = {};
if ($login ne "") {
+ local *MEMBER;
+
+ $login =~ s|.*/||;
+
&error("", "$memfile locked!") if (-f "${memfile}.LCK");
open(MEMBER, "$memfile") or &error("", "$memfile : $!");
while (<MEMBER>) {
if (/^\[$login\]/) {
while (<MEMBER>) {
- last if /^\[/;
- next if /^(#|\s)/;
+ last if m/^\[/;
+ next if m/^(#|\s)/;
# remove comments
s/\s#.*//g;
sub country_codes {
$main::lxdebug->enter_sub();
+ local *DIR;
+
my %cc = ();
my @language = ();
# scan the locale directory and read in the LANGUAGE files
- opendir DIR, "locale";
+ opendir(DIR, "locale");
- my @dir = grep !/(^\.\.?$|\..*)/, readdir DIR;
+ my @dir = grep(!/(^\.\.?$|\..*)/, readdir(DIR));
foreach my $dir (@dir) {
next unless open(FH, "locale/$dir/LANGUAGE");
my ($self, $form, $userspath) = @_;
+ local *FH;
+
my $rc = -3;
if ($self->{login}) {
}
unless (-e "$userspath/$self->{login}.conf") {
- $self->create_config("$userspath/$self->{login}.conf");
+ $self->create_config();
}
do "$userspath/$self->{login}.conf";
- $myconfig{dbpasswd} = unpack 'u', $myconfig{dbpasswd};
+ $myconfig{dbpasswd} = unpack('u', $myconfig{dbpasswd});
# check if database is down
my $dbh =
# add login to employee table if it does not exist
# no error check for employee table, ignore if it does not exist
- $query = qq|SELECT e.id FROM employee e WHERE e.login = '$self->{login}'|;
- $sth = $dbh->prepare($query);
- $sth->execute;
-
- my ($login) = $sth->fetchrow_array;
- $sth->finish;
+ $query = qq|SELECT id FROM employee WHERE login = ?|;
+ my ($login) = selectrow_query($form, $dbh, $query, $self->{login});
if (!$login) {
- $query = qq|INSERT INTO employee (login, name, workphone, role)
- VALUES ('$self->{login}', '$myconfig{name}',
- '$myconfig{tel}', 'user')|;
- $dbh->do($query);
+ $query = qq|INSERT INTO employee (login, name, workphone, role)| .
+ qq|VALUES (?, ?, ?, ?)|;
+ my @values = ($self->{login}, $myconfig{name}, $myconfig{tel}, "user");
+ do_query($form, $dbh, $query, @values);
}
$self->create_schema_info_table($form, $dbh);
$self->dbupdate($form);
$self->dbupdate2($form, $controls);
+ close(FH);
+
# remove lock file
unlink("$userspath/nologin");
or $form->dberror;
if ($form->{dbdriver} eq 'Pg') {
-
- $query = qq|SELECT datname FROM pg_database WHERE NOT ((datname = 'template0') OR (datname = 'template1'))|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $query =
+ qq|SELECT datname FROM pg_database | .
+ qq|WHERE NOT datname IN ('template0', 'template1')|;
+ $sth = $dbh->prepare($query);
+ $sth->execute() || $form->dberror($query);
while (my ($db) = $sth->fetchrow_array) {
DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
or $form->dberror;
- $query = qq|SELECT p.tablename FROM pg_tables p
- WHERE p.tablename = 'defaults'
- AND p.tableowner = '$form->{dbuser}'|;
+ $query =
+ qq|SELECT tablename FROM pg_tables | .
+ qq|WHERE (tablename = 'defaults') AND (tableowner = ?)|;
my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ $sth->execute($form->{dbuser}) ||
+ $form->dberror($query . " ($form->{dbuser})");
if ($sth->fetchrow_array) {
- push @dbsources, $db;
+ push(@dbsources, $db);
}
$sth->finish;
$dbh->disconnect;
next;
}
- push @dbsources, $db;
+ push(@dbsources, $db);
}
}
if ($form->{dbdriver} eq 'Oracle') {
if ($form->{only_acc_db}) {
- $query = qq|SELECT o.owner FROM dba_objects o
- WHERE o.object_name = 'DEFAULTS'
- AND o.object_type = 'TABLE'|;
+ $query =
+ qq|SELECT owner FROM dba_objects | .
+ qq|WHERE object_name = 'DEFAULTS' AND object_type = 'TABLE'|;
} else {
$query = qq|SELECT username FROM dba_users|;
}
$sth->execute || $form->dberror($query);
while (my ($db) = $sth->fetchrow_array) {
- push @dbsources, $db;
+ push(@dbsources, $db);
}
}
my $dbh =
DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
or $form->dberror;
-
+ $form->{db} =~ s/\"//g;
my %dbcreate = (
'Pg' => qq|CREATE DATABASE "$form->{db}"|,
'Oracle' =>
- qq|CREATE USER "$form->{db}" DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP IDENTIFIED BY "$form->{db}"|
+ qq|CREATE USER "$form->{db}" DEFAULT TABLESPACE USERS | .
+ qq|TEMPORARY TABLESPACE TEMP IDENTIFIED BY "$form->{db}"|
);
my %dboptions = (
push(@{$dboptions{"Pg"}}, "TEMPLATE = $dbdefault");
}
- my $query = qq|$dbcreate{$form->{dbdriver}}|;
+ my $query = $dbcreate{$form->{dbdriver}};
$query .= " WITH " . join(" ", @{$dboptions{"Pg"}}) if (@{$dboptions{"Pg"}});
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, $query);
if ($form->{dbdriver} eq 'Oracle') {
- $query = qq|GRANT CONNECT,RESOURCE TO "$form->{db}"|;
- $dbh->do($query) || $form->dberror($query);
+ $query = qq|GRANT CONNECT, RESOURCE TO "$form->{db}"|;
+ do_query($form, $dbh, $query);
}
$dbh->disconnect;
$dbh = DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
or $form->dberror;
- # create the tables
- my $filename = qq|sql/lx-office.sql|;
- $self->process_query($form, $dbh, $filename);
+ my $db_charset = $Common::db_encoding_to_charset{$form->{encoding}};
+ $db_charset ||= Common::DEFAULT_CHARSET;
- # load gifi
- ($filename) = split /_/, $form->{chart};
- $filename =~ s/_//;
- $self->process_query($form, $dbh, "sql/${filename}-gifi.sql");
+ # create the tables
+ $self->process_query($form, $dbh, "sql/lx-office.sql", undef, $db_charset);
# load chart of accounts
- $filename = qq|sql/$form->{chart}-chart.sql|;
- $self->process_query($form, $dbh, $filename);
+ $self->process_query($form, $dbh, "sql/$form->{chart}-chart.sql", undef, $db_charset);
- $query = "UPDATE defaults SET coa = " . $dbh->quote($form->{"chart"});
- $dbh->do($query) || $form->dberror($query);
+ $query = "UPDATE defaults SET coa = ?";
+ do_query($form, $dbh, $query, $form->{chart});
$dbh->disconnect;
sub process_perl_script {
$main::lxdebug->enter_sub();
- my ($self, $form, $dbh, $filename, $version) = @_;
+ my ($self, $form, $dbh, $filename, $version_or_control, $db_charset) = @_;
- open(FH, "$filename") or $form->error("$filename : $!\n");
- my $contents = join("", <FH>);
- close(FH);
+ my $fh = IO::File->new($filename, "r") or $form->error("$filename : $!\n");
+
+ my $file_charset = Common::DEFAULT_CHARSET;
+
+ if (ref($version_or_control) eq "HASH") {
+ $file_charset = $version_or_control->{charset};
+
+ } else {
+ while (<$fh>) {
+ last if !/^--/;
+ next if !/^--\s*\@charset:\s*(.+)/;
+ $file_charset = $1;
+ last;
+ }
+ $fh->seek(0, SEEK_SET);
+ }
+
+ my $contents = join "", <$fh>;
+ $fh->close();
+
+ $db_charset ||= Common::DEFAULT_CHARSET;
+
+ my $iconv = SL::Iconv::get_converter($file_charset, $db_charset);
$dbh->begin_work();
exit(0);
}
- if ($version) {
- $dbh->do("UPDATE defaults SET version = " . $dbh->quote($version));
+ if (ref($version_or_control) eq "HASH") {
+ $dbh->do("INSERT INTO schema_info (tag, login) VALUES (" .
+ $dbh->quote($version_or_control->{"tag"}) . ", " .
+ $dbh->quote($form->{"login"}) . ")");
+ } elsif ($version_or_control) {
+ $dbh->do("UPDATE defaults SET version = " .
+ $dbh->quote($version_or_control));
}
$dbh->commit();
sub process_query {
$main::lxdebug->enter_sub();
- my ($self, $form, $dbh, $filename, $version_or_control) = @_;
+ my ($self, $form, $dbh, $filename, $version_or_control, $db_charset) = @_;
- # return unless (-f $filename);
-
- open(FH, "$filename") or $form->error("$filename : $!\n");
+ my $fh = IO::File->new($filename, "r") or $form->error("$filename : $!\n");
my $query = "";
my $sth;
my @quote_chars;
+ my $file_charset = Common::DEFAULT_CHARSET;
+ while (<$fh>) {
+ last if !/^--/;
+ next if !/^--\s*\@charset:\s*(.+)/;
+ $file_charset = $1;
+ last;
+ }
+ $fh->seek(0, SEEK_SET);
+
+ $db_charset ||= Common::DEFAULT_CHARSET;
+
$dbh->begin_work();
- while (<FH>) {
+ while (<$fh>) {
+ $_ = SL::Iconv::convert($file_charset, $db_charset, $_);
# Remove DOS and Unix style line endings.
chomp;
my $errstr = $dbh->errstr;
$sth->finish();
$dbh->rollback();
- $form->dberror("The database update/creation did not succeed. The file ${filename} containing the following query failed:<br>${query}<br>" .
+ $form->dberror("The database update/creation did not succeed. " .
+ "The file ${filename} containing the following " .
+ "query failed:<br>${query}<br>" .
"The error message was: ${errstr}<br>" .
"All changes in that file have been reverted.");
}
}
$dbh->commit();
- close FH;
+ $fh->close();
$main::lxdebug->leave_sub();
}
$main::lxdebug->enter_sub();
my ($self, $form) = @_;
-
+ $form->{db} =~ s/\"//g;
my %dbdelete = ('Pg' => qq|DROP DATABASE "$form->{db}"|,
- 'Oracle' => qq|DROP USER $form->{db} CASCADE|);
+ 'Oracle' => qq|DROP USER "$form->{db}" CASCADE|);
$form->{sid} = $form->{dbdefault};
&dbconnect_vars($form, $form->{dbdefault});
my $dbh =
DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
or $form->dberror;
- my $query = qq|$dbdelete{$form->{dbdriver}}|;
- $dbh->do($query) || $form->dberror($query);
+ my $query = $dbdelete{$form->{dbdriver}};
+ do_query($form, $dbh, $query);
$dbh->disconnect;
my ($self, $form, $memfile) = @_;
+ local *FH;
+
my @dbexcl = ();
my @dbsources = ();
my ($self, $form) = @_;
- my %dbsources = ();
- my $query;
+ my $members = Inifile->new($main::memberfile);
+ my $controls = parse_dbupdate_controls($form, $form->{dbdriver});
- $form->{sid} = $form->{dbdefault};
- &dbconnect_vars($form, $form->{dbdefault});
+ my ($query, $sth, %dbs_needing_updates);
- my $dbh =
- DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
- or $form->dberror;
+ foreach my $login (grep /[a-z]/, keys %{ $members }) {
+ my $member = $members->{$login};
- if ($form->{dbdriver} eq 'Pg') {
+ map { $form->{$_} = $member->{$_} } qw(dbname dbuser dbpasswd dbhost dbport);
+ dbconnect_vars($form, $form->{dbname});
+ $main::lxdebug->dump(0, "form", $form);
+ my $dbh = DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd});
- $query = qq|SELECT d.datname FROM pg_database d, pg_user u
- WHERE d.datdba = u.usesysid
- AND u.usename = '$form->{dbuser}'|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
+ next unless $dbh;
- while (my ($db) = $sth->fetchrow_array) {
-
- next if ($db =~ /^template/);
-
- &dbconnect_vars($form, $db);
-
- my $dbh =
- DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
- or $form->dberror;
-
- $query = qq|SELECT t.tablename FROM pg_tables t
- WHERE t.tablename = 'defaults'|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- if ($sth->fetchrow_array) {
- $query = qq|SELECT version FROM defaults|;
- my $sth = $dbh->prepare($query);
- $sth->execute;
+ my $version;
- if (my ($version) = $sth->fetchrow_array) {
- $dbsources{$db} = $version;
- }
- $sth->finish;
- }
- $sth->finish;
- $dbh->disconnect;
+ $query = qq|SELECT version FROM defaults|;
+ $sth = prepare_query($form, $dbh, $query);
+ if ($sth->execute()) {
+ ($version) = $sth->fetchrow_array();
}
- $sth->finish;
- }
-
- if ($form->{dbdriver} eq 'Oracle') {
- $query = qq|SELECT o.owner FROM dba_objects o
- WHERE o.object_name = 'DEFAULTS'
- AND o.object_type = 'TABLE'|;
-
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while (my ($db) = $sth->fetchrow_array) {
-
- $form->{dbuser} = $db;
- &dbconnect_vars($form, $db);
-
- my $dbh =
- DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
- or $form->dberror;
+ $sth->finish();
+ $dbh->disconnect();
- $query = qq|SELECT version FROM defaults|;
- my $sth = $dbh->prepare($query);
- $sth->execute;
+ next unless $version;
- if (my ($version) = $sth->fetchrow_array) {
- $dbsources{$db} = $version;
- }
- $sth->finish;
- $dbh->disconnect;
+ if (update_available($form->{dbdriver}, $version) || update2_available($form, $controls)) {
+ my $dbinfo = {};
+ map { $dbinfo->{$_} = $member->{$_} } grep /^db/, keys %{ $member };
+ $dbs_needing_updates{$member->{dbhost} . "::" . $member->{dbname}} = $dbinfo;
}
- $sth->finish;
}
- $dbh->disconnect;
-
$main::lxdebug->leave_sub();
- return %dbsources;
+ return values %dbs_needing_updates;
}
-## LINET
sub calc_version {
$main::lxdebug->enter_sub(2);
return $res_a <=> $res_b;
}
-## /LINET
sub update_available {
my ($dbdriver, $cur_version) = @_;
- opendir SQLDIR, "sql/${dbdriver}-upgrade" or &error("", "sql/${dbdriver}-upgrade: $!");
- my @upgradescripts =
- grep(/$form->{dbdriver}-upgrade-\Q$cur_version\E.*\.(sql|pl)$/, readdir(SQLDIR));
+ local *SQLDIR;
+
+ opendir SQLDIR, "sql/${dbdriver}-upgrade" || error("", "sql/${dbdriver}-upgrade: $!");
+ my @upgradescripts = grep /${dbdriver}-upgrade-\Q$cur_version\E.*\.(sql|pl)$/, readdir SQLDIR;
closedir SQLDIR;
return ($#upgradescripts > -1);
my $query = "SELECT tag FROM schema_info LIMIT 1";
if (!$dbh->do($query)) {
+ $dbh->rollback();
$query =
- "CREATE TABLE schema_info (" .
- " tag text, " .
- " login text, " .
- " itime timestamp DEFAULT now(), " .
- " PRIMARY KEY (tag))";
+ qq|CREATE TABLE schema_info (| .
+ qq| tag text, | .
+ qq| login text, | .
+ qq| itime timestamp DEFAULT now(), | .
+ qq| PRIMARY KEY (tag))|;
$dbh->do($query) || $form->dberror($query);
}
my ($self, $form) = @_;
+ local *SQLDIR;
+
$form->{sid} = $form->{dbdefault};
my @upgradescripts = ();
if ($form->{dbupdate}) {
# read update scripts into memory
- opendir SQLDIR, "sql/" . $form->{dbdriver} . "-upgrade" or &error("", "sql/" . $form->{dbdriver} . "-upgrade : $!");
- ## LINET
+ opendir(SQLDIR, "sql/" . $form->{dbdriver} . "-upgrade")
+ or &error("", "sql/" . $form->{dbdriver} . "-upgrade : $!");
@upgradescripts =
sort(cmp_script_version
- grep(/$form->{dbdriver}-upgrade-.*?\.(sql|pl)$/, readdir(SQLDIR)));
- ## /LINET
- closedir SQLDIR;
+ grep(/$form->{dbdriver}-upgrade-.*?\.(sql|pl)$/,
+ readdir(SQLDIR)));
+ closedir(SQLDIR);
}
- foreach my $db (split / /, $form->{dbupdate}) {
+ my $db_charset = $main::dbcharset;
+ $db_charset ||= Common::DEFAULT_CHARSET;
+
+ foreach my $db (split(/ /, $form->{dbupdate})) {
next unless $form->{$db};
# check version
$query = qq|SELECT version FROM defaults|;
- my $sth = $dbh->prepare($query);
-
- # no error check, let it fall through
- $sth->execute;
-
- my $version = $sth->fetchrow_array;
- $sth->finish;
+ my ($version) = selectrow_query($form, $dbh, $query);
next unless $version;
- ## LINET
$version = calc_version($version);
- ## /LINET
foreach my $upgradescript (@upgradescripts) {
my $a = $upgradescript;
my ($mindb, $maxdb) = split /-/, $a;
my $str_maxdb = $maxdb;
- ## LINET
$mindb = calc_version($mindb);
$maxdb = calc_version($maxdb);
- ## /LINET
next if ($version >= $maxdb);
# apply upgrade
$main::lxdebug->message(DEBUG2, "Applying Update $upgradescript");
if ($file_type eq "sql") {
- $self->process_query($form, $dbh, "sql/" . $form->{"dbdriver"} . "-upgrade/$upgradescript", $str_maxdb);
+ $self->process_query($form, $dbh, "sql/" . $form->{"dbdriver"} .
+ "-upgrade/$upgradescript", $str_maxdb, $db_charset);
} else {
- $self->process_perl_script($form, $dbh, "sql/" . $form->{"dbdriver"} . "-upgrade/$upgradescript", $str_maxdb);
+ $self->process_perl_script($form, $dbh, "sql/" . $form->{"dbdriver"} .
+ "-upgrade/$upgradescript", $str_maxdb, $db_charset);
}
$version = $maxdb;
@upgradescripts = sort_dbupdate_controls($controls);
+ my $db_charset = $main::dbcharset;
+ $db_charset ||= Common::DEFAULT_CHARSET;
+
foreach my $db (split / /, $form->{dbupdate}) {
next unless $form->{$db};
map({ $_->{"applied"} = 0; } @upgradescripts);
- $query = "SELECT tag FROM schema_info";
+ $self->create_schema_info_table($form, $dbh);
+
+ $query = qq|SELECT tag FROM schema_info|;
$sth = $dbh->prepare($query);
$sth->execute() || $form->dberror($query);
while (($tag) = $sth->fetchrow_array()) {
foreach my $control (@upgradescripts) {
next if ($control->{"applied"});
+ $control->{description} = SL::Iconv::convert($control->{charset}, $db_charset, $control->{description});
+
$control->{"file"} =~ /\.(sql|pl)$/;
my $file_type = $1;
if ($file_type eq "sql") {
$self->process_query($form, $dbh, "sql/" . $form->{"dbdriver"} .
- "-upgrade2/$control->{file}", $control);
+ "-upgrade2/$control->{file}", $control, $db_charset);
} else {
$self->process_perl_script($form, $dbh, "sql/" . $form->{"dbdriver"} .
- "-upgrade2/$control->{file}", $control);
+ "-upgrade2/$control->{file}", $control, $db_charset);
}
}
my ($query, $tag, $sth);
- $query = "SELECT tag FROM schema_info";
+ $query = qq|SELECT tag FROM schema_info|;
$sth = $dbh->prepare($query);
- $sth->execute() || $form->dberror($query);
- while (($tag) = $sth->fetchrow_array()) {
- $controls->{$tag}->{"applied"} = 1 if (defined($controls->{$tag}));
+ if ($sth->execute()) {
+ while (($tag) = $sth->fetchrow_array()) {
+ $controls->{$tag}->{"applied"} = 1 if (defined($controls->{$tag}));
+ }
}
$sth->finish();
$dbh->disconnect();
sub create_config {
$main::lxdebug->enter_sub();
- my ($self, $filename) = @_;
+ my ($self) = @_;
+
+ local *CONF;
+
+ @config = config_vars();
- @config = &config_vars;
+ my $userspath = $main::userspath;
- open(CONF, ">$filename") or $self->error("$filename : $!");
+ open(CONF, ">", "$userspath/$self->{login}.conf") || $self->error("$userspath/$self->{login}.conf : $!");
# create the config file
print CONF qq|# configuration file for $self->{login}
\%myconfig = (
|;
- foreach $key (sort @config) {
+ foreach my $key (sort @config) {
$self->{$key} =~ s/\'/\\\'/g;
print CONF qq| $key => '$self->{$key}',\n|;
}
my ($self, $memberfile, $userspath) = @_;
+ local (*FH, *CONF);
+
my $newmember = 1;
# format dbconnect and dboptions string
unlink "${memberfile}.LCK";
# create conf file
- $self->create_config("$userspath/$self->{login}.conf")
- unless $self->{'root login'};
+ $self->create_config() unless $self->{'root login'};
$main::lxdebug->leave_sub();
}
sub config_vars {
$main::lxdebug->enter_sub();
- my @conf = qw(acs address admin businessnumber charset company countrycode
+ my @conf = qw(acs address admin businessnumber company countrycode
currency dateformat dbconnect dbdriver dbhost dbport dboptions
- dbname dbuser dbpasswd email fax name numberformat in_numberformat password
- printer role sid signature stylesheet tel templates vclimit angebote bestellungen rechnungen
- anfragen lieferantenbestellungen einkaufsrechnungen taxnumber co_ustid duns menustyle
- template_format copies show_form_details);
+ dbname dbuser dbpasswd email fax name numberformat password
+ printer role sid signature stylesheet tel templates vclimit angebote
+ bestellungen rechnungen anfragen lieferantenbestellungen einkaufsrechnungen
+ taxnumber co_ustid duns menustyle template_format default_media
+ default_printer_id copies show_form_details);
$main::lxdebug->leave_sub();
my ($self, $msg) = @_;
+ $main::lxdebug->show_backtrace();
+
if ($ENV{HTTP_USER_AGENT}) {
print qq|Content-Type: text/html
--- /dev/null
+package SL::Watchdog;
+
+use Data::Dumper;
+
+require Tie::Hash;
+
+@ISA = (Tie::StdHash);
+
+my %watched_variables;
+
+sub STORE {
+ my ($this, $key, $value) = @_;
+
+ if (substr($key, 0, 10) eq "Watchdog::") {
+ substr $key, 0, 10, "";
+ foreach $key (split m/[ ,]/, $key) {
+ $watched_variables{$key} = $value;
+ if ($value) {
+ $main::lxdebug->_write("WATCH", "Starting to watch '$key' with current value '$this->{$key}'");
+ } else {
+ $main::lxdebug->_write("WATCH", "Stopping to watch '$key'");
+ }
+ }
+
+ return;
+ }
+
+ if ($watched_variables{$key}
+ && ($this->{$key} ne $value)) {
+ my $subroutine = (caller 1)[3];
+ my ($self_filename, $self_line) = (caller)[1, 2];
+ $main::lxdebug->_write("WATCH",
+ "Value of '$key' changed from '$this->{$key}' to '$value' "
+ . "in ${subroutine} at ${self_filename}:${self_line}");
+ if ($watched_variables{$key} > 1) {
+ my $level = 1;
+ my ($dummy, $filename, $line);
+
+ while (($dummy, $filename, $line, $subroutine) = caller $level) {
+ $main::lxdebug->_write("WATCH", " ${subroutine} from ${filename}:${line}");
+ $level++;
+ }
+ }
+ }
+
+ $this->{$key} = $value;
+}
+
+sub DELETE {
+ my ($this, $key) = @_;
+
+ if ($watched_variables{$key} && ($this->{$key} ne "")) {
+ my $subroutine = (caller 1)[3];
+ my ($self_filename, $self_line) = (caller)[1, 2];
+ $main::lxdebug->_write("WATCH",
+ "Value of '$key' changed from '$this->{$key}' to '' "
+ . "in ${subroutine} at ${self_filename}:${self_line}");
+ if ($watched_variables{$key} > 1) {
+ my $level = 1;
+ my ($dummy, $filename, $line);
+
+ while (($dummy, $filename, $line, $subroutine) = caller $level) {
+ $main::lxdebug->_write("WATCH", " ${subroutine} from ${filename}:${line}");
+ $level++;
+ }
+ }
+ }
+
+ delete $this->{$key};
+}
+
+1;
+++ /dev/null
-#=====================================================================
-# LX-Office ERP
-# Copyright (C) 2004
-# Based on SQL-Ledger Version 2.1.9
-# Web http://www.lx-office.org
-#
-#
-# XIII form retrieval
-#
-#======================================================================
-
-package XIII;
-
-sub retrieve_form {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT f.line
- FROM xiii_forms f
- WHERE f.file = '$form->{file}'
- AND f.dbname = '$myconfig->{dbname}'
- ORDER BY f.oid|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my $ref;
-
- while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{body} }, $ref->{line};
- }
-
- $sth->finish;
-
- $dbh->disconnect;
-
- $main::lxdebug->leave_sub();
-}
-
-sub delete_form {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- # connect to database, turn AutoCommit off
- my $dbh = $form->dbconnect_noauto($myconfig);
-
- my $query = qq|DELETE FROM xiii_forms
- WHERE file = '$form->{file}'
- AND dbname = '$myconfig->{dbname}'|;
- $dbh->do($query) || $form->dberror($query);
-
- # commit and redirect
- $rc = $dbh->commit;
- $dbh->disconnect;
-
- $main::lxdebug->leave_sub();
-
- return $rc;
-}
-
-sub save_form {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- # connect to database, turn AutoCommit off
- my $dbh = $form->dbconnect_noauto($myconfig);
-
- my $query = qq|DELETE FROM xiii_forms
- WHERE file = '$form->{file}'
- AND dbname = '$myconfig->{dbname}'|;
- $dbh->do($query) || $form->dberror($query);
-
- $query = qq|INSERT INTO xiii_forms (line, file, dbname)
- VALUES (?, '$form->{file}', '$myconfig->{dbname}')|;
-
- $sth = $dbh->prepare($query);
-
- foreach $line (split /\r/, $form->{body}) {
- $sth->execute($line) || $form->dberror($query);
- $sth->finish;
- }
-
- $rc = $dbh->commit;
- $dbh->disconnect;
-
- $main::lxdebug->leave_sub();
-
- return $rc;
-}
-
-1;
-
--- /dev/null
+login.pl
\ No newline at end of file
#
#######################################################################
+BEGIN {
+ unshift @INC, "modules/YAML"; # Use our own version of YAML.
+ push @INC, "modules"; # Only use our own versions of modules if there's no system version.
+}
+
# setup defaults, DO NOT CHANGE
$userspath = "users";
$templates = "templates";
use SL::LXDebug;
$lxdebug = LXDebug->new();
+use CGI;
use SL::Form;
+use SL::Locale;
eval { require "lx-erp.conf"; };
+eval { require "lx-erp-local.conf"; } if -f "lx-erp-local.conf";
+
+require "bin/mozilla/common.pl";
if (defined($latex) && !defined($latex_templates)) {
$latex_templates = $latex;
}
$form = new Form;
+$cgi = new CGI('');
# name of this script
$0 =~ tr/\\/\//;
# pull in DBI
use DBI;
+$form->{login} =~ s|.*/||;
+
# check for user config file, could be missing or ???
eval { require("$userspath/$form->{login}.conf"); };
if ($@) {
$form->error($locale->text('Incorrect Password!'))
if ($form->{password} ne $myconfig{password});
-$form->{path} =~ s/\.\.\///g;
-if ($form->{path} !~ /^bin\//) {
- $form->error($locale->text('Invalid path!') . "\n");
-}
-
# did sysadmin lock us out
if (-e "$userspath/nologin") {
$form->error($locale->text('System currently down for maintenance!'));
}
# pull in the main code
-require "$form->{path}/$form->{script}";
+require "bin/mozilla/$form->{script}";
# customized scripts
-if (-f "$form->{path}/custom_$form->{script}") {
- eval { require "$form->{path}/custom_$form->{script}"; };
+if (-f "bin/mozilla/custom_$form->{script}") {
+ eval { require "bin/mozilla/custom_$form->{script}"; };
$form->error($@) if ($@);
}
# customized scripts for login
-if (-f "$form->{path}/$form->{login}_$form->{script}") {
- eval { require "$form->{path}/$form->{login}_$form->{script}"; };
+if (-f "bin/mozilla/$form->{login}_$form->{script}") {
+ eval { require "bin/mozilla/$form->{login}_$form->{script}"; };
$form->error($@) if ($@);
}
. $locale->text('Version')
. " $form->{version} - $myconfig{name} - $myconfig{dbname}";
- &{ $locale->findsub($form->{action}) };
+ call_sub($locale->findsub($form->{action}));
} else {
$form->error($locale->text('action= not defined!'));
}
--- /dev/null
+am.pl
\ No newline at end of file
--- /dev/null
+am.pl
\ No newline at end of file
--- /dev/null
+am.pl
\ No newline at end of file
--- /dev/null
+Order Allow,Deny
+Deny from all
$menufile = "menu.ini";
+use DBI;
+use CGI;
+use POSIX qw(strftime);
+use IO::File;
+use Fcntl;
+use English qw(-no_match_vars);
+use Sys::Hostname;
+
use SL::Form;
+use SL::Mailer;
use SL::User;
+use SL::Common;
+use SL::Inifile;
+use SL::DBUpgrade2;
+use SL::DBUtils;
+
+require "bin/mozilla/common.pl";
+
+our $cgi = new CGI('');
$form = new Form;
$form->{"root"} = "root login";
$locale = new Locale $language, "admin";
-eval { require DBI; };
-$form->error($locale->text('DBI not installed!')) if ($@);
-
# customization
-if (-f "$form->{path}/custom_$form->{script}") {
- eval { require "$form->{path}/custom_$form->{script}"; };
+if (-f "bin/mozilla/custom_$form->{script}") {
+ eval { require "bin/mozilla/custom_$form->{script}"; };
$form->error($@) if ($@);
}
}
}
- &check_password;
+ check_password();
- &$subroutine;
+ call_sub($subroutine);
} else {
# create memberfile
if (!-f $memberfile) {
- open(FH, ">$memberfile") or $form->error("$memberfile : $!");
+ open(FH, ">$memberfile") or $form->error("$memberfile : $ERRNO");
print FH qq|# SQL-Ledger Accounting members
[root login]
close FH;
}
- &adminlogin;
+ adminlogin();
}
$form->{title} =
qq|Lx-Office ERP $form->{version} | . $locale->text('Administration');
- $form->header;
-
- print qq|
-<body class=admin>
-
+ $form->header();
+ print $form->parse_html_template2('admin/adminlogin');
+}
-<div align=center>
+sub login {
+ list_users();
+}
-<a href="http://www.lx-office.org"><img src="image/lx-office-erp.png" border=0></a>
-<h1 class=login>|
- . $locale->text('Version')
- . qq| $form->{version}<p>|
- . $locale->text('Administration')
- . qq|</h1>
+sub list_users {
-<form method=post action="$form->{script}">
+ $form->error($locale->text('File locked!')) if (-f "${memberfile}.LCK");
-<table>
- <tr>
- <th>| . $locale->text('Password') . qq|</th>
- <td><input type=password name=rpw></td>
- <td><input type=submit class=submit name=action value="|
- . $locale->text('Login') . qq|"></td>
- </tr>
-<input type=hidden name=action value=login>
-<input type=hidden name=path value=$form->{path}>
-</table>
+ open(FH, "$memberfile") or $form->error("$memberfile : $ERRNO");
+ my %members;
-</form>
+ while (<FH>) {
+ chomp;
-<a href=http://www.lx-office.org>Lx-Office |
- . $locale->text('website') . qq|</a>
+ if (/^\[.*\]/) {
+ $login = $_;
+ $login =~ s/(\[|\])//g;
-</div>
+ $members{$login} = { "login" => $login };
+ }
-</body>
-</html>
-|;
+ if (/^([a-z]+)=(.*)/) {
+ $members{$login}->{$1} = $2;
+ }
+ }
-}
+ close(FH);
-sub login {
+ delete $members{"root login"};
+ map { $_->{templates} =~ s|.*/||; } values %members;
- &list_users;
+ $form->{title} = "Lx-Office ERP " . $locale->text('Administration');
+ $form->{LOCKED} = -e "$userspath/nologin";
+ $form->{MEMBERS} = [ @members{sort { lc $a cmp lc $b } keys %members} ];
+ $form->header();
+ print $form->parse_html_template2("admin/list_users");
}
sub add_user {
. $locale->text('Administration') . " / "
. $locale->text('Add User');
- $form->{Oracle_sid} = $sid;
- $form->{Oracle_dbport} = '1521';
- $form->{Oracle_dbhost} = `hostname`;
-
- if (-f "css/lx-office-erp.css") {
- $myconfig->{stylesheet} = "lx-office-erp.css";
- }
- $myconfig->{vclimit} = 200;
-
- $myconfig->{"countrycode"} = "de";
- $myconfig->{"numberformat"} = "1000,00";
- $myconfig->{"dateformat"} = "dd.mm.yy";
-
- &form_header;
- &form_footer;
+ my $myconfig = {
+ "vclimit" => 200,
+ "countrycode" => "de",
+ "numberformat" => "1000,00",
+ "dateformat" => "dd.mm.yy",
+ "stylesheet" => "lx-office-erp.css",
+ "menustyle" => "v3",
+ };
+ edit_user_form($myconfig);
}
sub edit {
. $locale->text('Edit User');
$form->{edit} = 1;
- &form_header;
- &form_footer;
-
-}
-
-sub form_footer {
-
- if ($form->{edit}) {
- $delete =
- qq|<input type=submit class=submit name=action value="|
- . $locale->text('Delete') . qq|">
-<input type=hidden name=edit value=1>|;
- }
-
- print qq|
-
-<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&rpw=$form->{rpw}">
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=rpw value=$form->{rpw}>
-
-<input type=submit class=submit name=action value="|
- . $locale->text('Save') . qq|">
-$delete
-
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-sub list_users {
-
- $form->error($locale->text('File locked!')) if (-f "${memberfile}.LCK");
-
- open(FH, "$memberfile") or $form->error("$memberfile : $!");
+ $form->isblank("login", $locale->text("The login is missing."));
- $nologin = qq|
-<input type=submit class=submit name=action value="|
- . $locale->text('Lock System') . qq|">|;
+ # get user
+ my $myconfig = new User "$memberfile", "$form->{login}";
- if (-e "$userspath/nologin") {
- $nologin = qq|
-<input type=submit class=submit name=action value="|
- . $locale->text('Unlock System') . qq|">|;
- }
-
- while (<FH>) {
- chop;
-
- if (/^\[.*\]/) {
- $login = $_;
- $login =~ s/(\[|\])//g;
- }
-
- if (/^(name=|company=|templates=|dbuser=|dbdriver=|dbname=|dbhost=)/) {
- chop($var = $&);
- ($null, $member{$login}{$var}) = split(/=/, $_, 2);
- }
- }
-
- close(FH);
-
- # type=submit $locale->text('Pg Database Administration')
- # type=submit $locale->text('Oracle Database Administration')
-
- foreach $item (User->dbdrivers) {
- $dbdrivers .=
- qq|<input name=action type=submit class=submit value="|
- . $locale->text("$item Database Administration") . qq|">|;
- }
-
- $column_header{login} = qq|<th>| . $locale->text('Login') . qq|</th>|;
- $column_header{name} = qq|<th>| . $locale->text('Name') . qq|</th>|;
- $column_header{company} = qq|<th>| . $locale->text('Company') . qq|</th>|;
- $column_header{dbdriver} = qq|<th>| . $locale->text('Driver') . qq|</th>|;
- $column_header{dbhost} = qq|<th>| . $locale->text('Host') . qq|</th>|;
- $column_header{dataset} = qq|<th>| . $locale->text('Dataset') . qq|</th>|;
- $column_header{templates} =
- qq|<th>| . $locale->text('Templates') . qq|</th>|;
-
- @column_index = qw(login name company dbdriver dbhost dataset templates);
-
- $form->{title} = "Lx-Office ERP " . $locale->text('Administration');
-
- $form->header;
-
- print qq|
-<body class=admin>
-
-<form method=post action=$form->{script}>
-
-<table width=100%>
- <tr>
- <tr class=listheading>
- <th>$form->{title}</th>
- </tr>
- <tr size=5></tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>|;
+ $myconfig->{signature} =~ s/\\n/\r\n/g;
+ $myconfig->{address} =~ s/\\n/\r\n/g;
- map { print "$column_header{$_}\n" } @column_index;
-
- print qq|
- </tr>
-|;
-
- foreach $key (sort keys %member) {
- $href =
- "$script?action=edit&login=$key&path=$form->{path}&rpw=$form->{rpw}";
- $href =~ s/ /%20/g;
-
- $member{$key}{templates} =~ s/^$templates\///;
- $member{$key}{dbhost} = $locale->text('localhost')
- unless $member{$key}{dbhost};
- $member{$key}{dbname} = $member{$key}{dbuser}
- if ($member{$key}{dbdriver} eq 'Oracle');
-
- $column_data{login} = qq|<td><a id="$key" href="$href">$key</a></td>|;
- $column_data{name} = qq|<td>$member{$key}{name}</td>|;
- $column_data{company} = qq|<td>$member{$key}{company}</td>|;
- $column_data{dbdriver} = qq|<td>$member{$key}{dbdriver}</td>|;
- $column_data{dbhost} = qq|<td>$member{$key}{dbhost}</td>|;
- $column_data{dataset} = qq|<td>$member{$key}{dbname}</td>|;
- $column_data{templates} = qq|<td>$member{$key}{templates}</td>|;
-
- $i++;
- $i %= 2;
- print qq|
- <tr class="listrow$i">|;
-
- map { print "$column_data{$_}\n" } @column_index;
-
- print qq|
- </tr>|;
- }
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=rpw value=$form->{rpw}>
-
-<br><input type=submit class=submit name=action value="|
- . $locale->text('Add User') . qq|">
-<input type=submit class=submit name=action value="|
- . $locale->text('Change Admin Password') . qq|">
-
-$dbdrivers
-$nologin
-
-</form>
-
-| . $locale->text('Click on login name to edit!') . qq|
-<br>
-|
- . $locale->text(
- 'To add a user to a group edit a name, change the login name and save. A new user with the same variables will then be saved under the new login name.'
- )
- . qq|
-
-<p>
-
-<form method=post action=login.pl>
-
-<table border=0 width=100%>
- <tr class=listheading>
- <th>Lx-Office ERP | . $locale->text('Login') . qq|</th>
- </tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align=right>| . $locale->text('Name') . qq|</th>
- <td><input class=login name=login></td>
- <td> </td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Password') . qq|</th>
- <td><input class=login type=password name=password></td>
- <td><input type=submit name=action value="|
- . $locale->text('Login') . qq|"></td>
- </tr>
-<input type=hidden name=path value=$form->{path}>
- </table>
- </td>
- </tr>
-</table>
-
-</form>
-
-<hr size=3 noshade>
-
-</body>
-</html>
-|;
+ # strip basedir from templates directory
+ $myconfig->{templates} =~ s|.*/||;
+ edit_user_form($myconfig);
}
-sub form_header {
+sub edit_user_form {
+ my ($myconfig) = @_;
- # if there is a login, get user
- if ($form->{login}) {
+ my @valid_dateformats = qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd);
+ $form->{ALL_DATEFORMATS} = [ map { { "format" => $_, "selected" => $_ eq $myconfig->{dateformat} } } @valid_dateformats ];
- # get user
- $myconfig = new User "$memberfile", "$form->{login}";
-
- $myconfig->{signature} =~ s/\\n/\r\n/g;
- $myconfig->{address} =~ s/\\n/\r\n/g;
-
- # strip basedir from templates directory
- $myconfig->{templates} =~ s/^$templates\///;
-
- # $myconfig->{dbpasswd} = unpack 'u', $myconfig->{dbpasswd};
- }
-
- foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
- $dateformat .=
- ($item eq $myconfig->{dateformat})
- ? "<option selected>$item\n"
- : "<option>$item\n";
- }
-
- foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
- $numberformat .=
- ($item eq $myconfig->{numberformat})
- ? "<option selected>$item\n"
- : "<option>$item\n";
- }
+ my @valid_numberformats = qw(1,000.00 1000.00 1.000,00 1000,00);
+ $form->{ALL_NUMBERFORMATS} = [ map { { "format" => $_, "selected" => $_ eq $myconfig->{numberformat} } } @valid_numberformats ];
%countrycodes = User->country_codes;
- $countrycodes = "";
- foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
- keys %countrycodes
- ) {
- $countrycodes .=
- ($myconfig->{countrycode} eq $key)
- ? "<option selected value=$key>$countrycodes{$key}"
- : "<option value=$key>$countrycodes{$key}";
+ $form->{ALL_COUNTRYCODES} = [];
+ foreach $countrycode (sort { $countrycodes{$a} cmp $countrycodes{$b} } keys %countrycodes) {
+ push @{ $form->{ALL_COUNTRYCODES} }, { "value" => $countrycode,
+ "name" => $countrycodes{$countrycode},
+ "selected" => $countrycode eq $myconfig->{countrycode} };
}
- $countrycodes = qq|<option value="">American English\n$countrycodes|;
# is there a templates basedir
if (!-d "$templates") {
- $form->error( $locale->text('Directory')
- . ": $templates "
- . $locale->text('does not exist'));
+ $form->error(sprintf($locale->text("The directory %s does not exist."), $templates));
}
- opendir TEMPLATEDIR, "$templates/." or $form->error("$templates : $!");
- my @all = readdir(TEMPLATEDIR);
- my @alldir = sort(grep({ -d "$templates/$_" && !/^\.\.?$/ } @all));
- my @allhtml = sort(grep({ -f "$templates/$_" && /\.html$/ } @all));
+ opendir TEMPLATEDIR, "$templates/." or $form->error("$templates : $ERRNO");
+ my @all = readdir(TEMPLATEDIR);
+ my @alldir = sort grep { -d "$templates/$_" && !/^\.\.?$/ } @all;
+ my @allhtml = sort grep { -f "$templates/$_" && /\.html$/ } @all;
closedir TEMPLATEDIR;
@alldir = grep !/\.(html|tex|sty|odt|xml|txb)$/, @alldir;
push @allhtml, 'Default';
@allhtml = reverse @allhtml;
- foreach $item (@alldir) {
- if ($item eq $myconfig->{templates}) {
- $usetemplates .= qq|<option selected>$item\n|;
- } else {
- $usetemplates .= qq|<option>$item\n|;
- }
- }
+ $form->{ALL_TEMPLATES} = [ map { { "name", => $_, "selected" => $_ eq $myconfig->{templates} } } @alldir ];
$lastitem = $allhtml[0];
$lastitem =~ s/-.*//g;
- $mastertemplates = qq|<option>$lastitem\n|;
+ $form->{ALL_MASTER_TEMPLATES} = [ { "name" => $lastitem, "selected" => $lastitem eq "German" } ];
foreach $item (@allhtml) {
$item =~ s/-.*//g;
+ next if ($item eq $lastitem);
- if ($item ne $lastitem) {
- my $selected = $item eq "German" ? " selected" : "";
- $mastertemplates .= qq|<option$selected>$item\n|;
- $lastitem = $item;
- }
+ push @{ $form->{ALL_MASTER_TEMPLATES} }, { "name" => $item, "selected" => $item eq "German" };
+ $lastitem = $item;
}
- opendir CSS, "css/.";
- @all = sort(grep({ /\.css$/ && ($_ ne "tabcontent.css") } readdir(CSS)));
- closedir CSS;
+ # css dir has styles that are not intended as general layouts.
+ # reverting to hardcoded list
+ $form->{ALL_STYLESHEETS} = [ map { { "name" => $_, "selected" => $_ eq $myconfig->{stylesheet} } } qw(lx-office-erp.css Win2000.css) ];
- foreach $item (@all) {
- if ($item eq $myconfig->{stylesheet}) {
- $selectstylesheet .= qq|<option selected>$item\n|;
- } else {
- $selectstylesheet .= qq|<option>$item\n|;
- }
- }
+ $form->{"menustyle_" . $myconfig->{menustyle} } = 1;
- $form->header;
-
- if ($myconfig->{menustyle} eq "v3") {
- $menustyle_v3 = "checked";
- } elsif ($myconfig->{menustyle} eq "neu") {
- $menustyle_neu = "checked";
- } else {
- $menustyle_old = "checked";
- }
-
- print qq|
-<body class=admin>
-
-<form method=post action=$form->{script}>
-
-<table width=100%>
- <tr class=listheading><th colspan=2>$form->{title}</th></tr>
- <tr size=5></tr>
- <tr valign=top>
- <td>
- <table>
- <tr>
- <th align=right>| . $locale->text('Login') . qq|</th>
- <td><input name=login value="$myconfig->{login}"></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Password') . qq|</th>
- <td><input type=password name=password size=8 value=$myconfig->{password}></td>
- <input type=hidden name=old_password value=$myconfig->{password}>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Name') . qq|</th>
- <td><input name=name size=15 value="$myconfig->{name}"></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('E-mail') . qq|</th>
- <td><input name=email size=30 value="$myconfig->{email}"></td>
- </tr>
- <tr valign=top>
- <th align=right>| . $locale->text('Signature') . qq|</th>
- <td><textarea name=signature rows=3 cols=35>$myconfig->{signature}</textarea></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Phone') . qq|</th>
- <td><input name=tel size=14 value="$myconfig->{tel}"></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Fax') . qq|</th>
- <td><input name=fax size=14 value="$myconfig->{fax}"></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Company') . qq|</th>
- <td><input name=company size=35 value="$myconfig->{company}"></td>
- </tr>
- <tr valign=top>
- <th align=right>| . $locale->text('Address') . qq|</th>
- <td><textarea name=address rows=4 cols=35>$myconfig->{address}</textarea></td>
- </tr>
- <tr valign=top>
- <th align=right>| . $locale->text('Tax number') . qq|</th>
- <td><input name=taxnumber size=14 value="$myconfig->{taxnumber}"></td>
- </tr>
- <tr valign=top>
- <th align=right>| . $locale->text('Ust-IDNr') . qq|</th>
- <td><input name=co_ustid size=14 value="$myconfig->{co_ustid}"></td>
- </tr>
- <tr valign=top>
- <th align=right>| . $locale->text('DUNS-Nr') . qq|</th>
- <td><input name=duns size=14 value="$myconfig->{duns}"></td>
- </tr>
- </table>
- </td>
- <td>
- <table>
- <tr>
- <th align=right>| . $locale->text('Date Format') . qq|</th>
- <td><select name=dateformat>$dateformat</select></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Number Format') . qq|</th>
- <td><select name=numberformat>$numberformat</select></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
- <td><input name=vclimit value="$myconfig->{vclimit}"></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Language') . qq|</th>
- <td><select name=countrycode>$countrycodes</select></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Character Set') . qq|</th>
- <td><input name=charset value="$myconfig->{charset}"></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Stylesheet') . qq|</th>
- <td><select name=userstylesheet>$selectstylesheet</select></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Printer') . qq|</th>
- <td><input name=printer size=20 value="$myconfig->{printer}"></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Use Templates') . qq|</th>
- <td><select name=usetemplates>$usetemplates</select></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('New Templates') . qq|</th>
- <td><input name=newtemplates></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Setup Templates') . qq|</th>
- <td><select name=mastertemplates>$mastertemplates</select></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Setup Menu') . qq|</th>
- <td><input name=menustyle type=radio class=radio value=v3 $menustyle_v3> | .
- $locale->text("Top (CSS)") . qq|
- <input name=menustyle type=radio class=radio value=neu $menustyle_neu> | .
- $locale->text("Top (Javascript)") . qq|
- <input name=menustyle type=radio class=radio value=old $menustyle_old> | .
- $locale->text("Old (on the side)") . qq|
- </td>
- </tr>
- <input type=hidden name=templates value=$myconfig->{templates}>
- </table>
- </td>
- </tr>
- <tr class=listheading>
- <th colspan=2>| . $locale->text('Database') . qq|</th>
- </tr>|;
-
- # list section for database drivers
- foreach $item (User->dbdrivers) {
-
- print qq|
- <tr>
- <td colspan=2>
- <table>
- <tr>|;
-
- $checked = "";
- if ($myconfig->{dbdriver} eq $item) {
- map { $form->{"${item}_$_"} = $myconfig->{$_} }
- qw(dbhost dbport dbuser dbpasswd dbname sid);
- $checked = "checked";
- }
-
- print qq|
- <th align=right>| . $locale->text('Driver') . qq|</th>
- <td><input name=dbdriver type=radio class=radio value=$item $checked> $item</td>
- <th align=right>| . $locale->text('Host') . qq|</th>
- <td><input name="${item}_dbhost" size=30 value=$form->{"${item}_dbhost"}></td>
- </tr>
- <tr>|;
-
- if ($item eq 'Pg') {
- print qq|
- <th align=right>| . $locale->text('Dataset') . qq|</th>
- <td><input name=Pg_dbname size=15 value=$form->{Pg_dbname}></td>
- <th align=right>| . $locale->text('Port') . qq|</th>
- <td><input name=Pg_dbport size=4 value=$form->{Pg_dbport}></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('User') . qq|</th>
- <td><input name="${item}_dbuser" size=15 value=$form->{"${item}_dbuser"}></td>
- <th align=right>| . $locale->text('Password') . qq|</th>
- <td><input name="${item}_dbpasswd" type=password size=10 value=$form->{"${item}_dbpasswd"}></td>
- </tr>|;
-
- }
-
- if ($item eq 'Oracle') {
- print qq|
- <th align=right>SID</th>
- <td><input name=Oracle_sid value=$form->{Oracle_sid}></td>
- <th align=right>| . $locale->text('Port') . qq|</th>
- <td><input name=Oracle_dbport size=4 value=$form->{Oracle_dbport}></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Dataset') . qq|</th>
- <td><input name="${item}_dbuser" size=15 value=$form->{"${item}_dbuser"}></td>
- <th align=right>| . $locale->text('Password') . qq|</th>
- <td><input name="${item}_dbpasswd" type=password size=10 value=$form->{"${item}_dbpasswd"}></td>
-
- </tr>|;
- }
-
- print qq|
- <input type=hidden name=old_dbpasswd value=$myconfig->{dbpasswd}>
- </table>
- </td>
- </tr>
- <tr>
- <td colspan=2><hr size=2 noshade></td>
- </tr>
-|;
-
- }
+ map { $form->{"myc_${_}"} = $myconfig->{$_} } keys %{ $myconfig };
# access control
- open(FH, $menufile) or $form->error("$menufile : $!");
+ my @acsorder = ();
+ my %acs = ();
+ my %excl = ();
+ open(FH, $menufile) or $form->error("$menufile : $ERRNO");
- # scan for first menu level
- @a = <FH>;
- close(FH);
-
- if (open(FH, "custom_$menufile")) {
- push @a, <FH>;
- }
- close(FH);
-
- foreach $item (@a) {
+ while ($item = <FH>) {
next unless $item =~ /\[/;
next if $item =~ /\#/;
$item =~ s/(\[|\])//g;
- chop $item;
+ chomp $item;
+
+ my ($level, $menuitem);
if ($item =~ /--/) {
($level, $menuitem) = split /--/, $item, 2;
push @acsorder, $item;
}
+ $acs{$level} ||= [];
push @{ $acs{$level} }, $menuitem;
}
- %role = ('admin' => $locale->text('Administrator'),
- 'user' => $locale->text('User'),
- 'manager' => $locale->text('Manager'),
- 'supervisor' => $locale->text('Supervisor'));
-
- $selectrole = "";
- foreach $item (qw(user supervisor manager admin)) {
- $selectrole .=
- ($myconfig->{role} eq $item)
- ? "<option selected value=$item>$role{$item}\n"
- : "<option value=$item>$role{$item}\n";
- }
-
- print qq|
- <tr class=listheading>
- <th colspan=2>| . $locale->text('Access Control') . qq|</th>
- </tr>
- <tr>
- <td><select name=role>$selectrole</select></td>
- </tr>
-|;
-
foreach $item (split(/;/, $myconfig->{acs})) {
($key, $value) = split /--/, $item, 2;
$excl{$key}{$value} = 1;
}
- foreach $key (@acsorder) {
-
- $checked = "checked";
- if ($form->{login}) {
- $checked = ($excl{$key}{$key}) ? "" : "checked";
- }
-
- # can't have variable names with spaces
- # the 1 is for apache 2
- $item = $form->escape("${key}--$key", 1);
+ $form->{ACLS} = [];
+ $form->{all_acs} = "";
- $acsheading = $key;
- $acsheading =~ s/ / /g;
-
- $acsheading = qq|
- <th align=left><input name="$item" class=checkbox type=checkbox value=1 $checked> $acsheading</th>\n|;
- $menuitems .= "$item;";
- $acsdata = "
- <td>";
+ foreach $key (@acsorder) {
+ my $acl = { "checked" => $form->{login} ? !$excl{$key}->{$key} : 1,
+ "name" => "${key}--${key}",
+ "title" => $key,
+ "SUBACLS" => [], };
+ $form->{all_acs} .= "${key}--${key};";
foreach $item (@{ $acs{$key} }) {
next if ($key eq $item);
- $checked = "checked";
- if ($form->{login}) {
- $checked = ($excl{$key}{$item}) ? "" : "checked";
- }
-
- $acsitem = $form->escape("${key}--$item", 1);
-
- $acsdata .= qq|
- <br><input name="$acsitem" class=checkbox type=checkbox value=1 $checked> $item|;
- $menuitems .= "$acsitem;";
+ my $subacl = { "checked" => $form->{login} ? !$excl{$key}->{$item} : 1,
+ "name" => "${key}--${item}",
+ "title" => $item };
+ push @{ $acl->{SUBACLS} }, $subacl;
+ $form->{all_acs} .= "${key}--${item};";
}
-
- $acsdata .= "
- </td>";
-
- print qq|
- <tr valign=top>$acsheading $acsdata
- </tr>
-|;
+ push @{ $form->{ACLS} }, $acl;
}
- print qq|<input type=hidden name=acs value="$menuitems">
-|;
- if ($webdav) {
- @webdavdirs =
- qw(angebote bestellungen rechnungen anfragen lieferantenbestellungen einkaufsrechnungen);
- foreach $directory (@webdavdirs) {
- if ($myconfig->{$directory}) {
- $webdav{"${directory}c"} = "checked";
- } else {
- $webdav{"${directory}c"} = "";
- }
- }
- print qq|
- <tr>
- <td colspan=2><hr size=3 noshade></td>
- </tr>
- <tr class=listheading>
- <th colspan=2>| . $locale->text('WEBDAV-Zugriff') . qq|</th>
- </tr>
- <table width=100%>
- <tr>
- <td><input name=angebote class=checkbox type=checkbox value=1 $webdav{angebotec}> Angebot</td>
- <td><input name=bestellungen class=checkbox type=checkbox value=1 $webdav{bestellungenc}> Bestellung</td>
- <td><input name=rechnungen class=checkbox type=checkbox value=1 $webdav{rechnungenc}> Rechnung</td>
- </tr>
- <tr>
- <td><input name=anfragen class=checkbox type=checkbox value=1 $webdav{anfragenc}> Angebot</td>
- <td><input name=lieferantenbestellungen class=checkbox type=checkbox value=1 $webdav{lieferantenbestellungenc}> Lieferantenbestellung</td>
- <td><input name=einkaufsrechnungen class=checkbox type=checkbox value=1 $webdav{einkaufsrechnungenc}> Einkaufsrechnung</td>
- </tr>
- </table>
- <tr>
- <td colspan=2><hr size=3 noshade></td>
- </tr>
-|;
- }
- print qq|
-</table>
-</div>
-|;
+ chop $form->{all_acs};
+ $form->header();
+ print $form->parse_html_template2("admin/edit_user");
}
sub save {
- # no driver checked
- $form->error($locale->text('Database Driver not checked!'))
- unless $form->{dbdriver};
+ $form->{dbdriver} = 'Pg';
# no spaces allowed in login name
($form->{login}) = split / /, $form->{login};
# is there a basedir
if (!-d "$templates") {
- $form->error( $locale->text('Directory')
- . ": $templates "
- . $locale->text('does not exist'));
+ $form->error(sprintf($locale->text("The directory %s does not exist."), $templates));
}
# add base directory to $form->{templates}
- $form->{templates} = "$templates/$form->{templates}";
+ $form->{templates} =~ s|.*/||;
+ $form->{templates} = "$templates/$form->{templates}";
$myconfig = new User "$memberfile", "$form->{login}";
# redo acs variable and delete all the acs codes
- @acs = split(/;/, $form->{acs});
-
- $form->{acs} = "";
- foreach $item (@acs) {
- $item = $form->escape($item, 1);
-
- if (!$form->{$item}) {
- $form->{acs} .= $form->unescape($form->unescape($item)) . ";";
- }
- delete $form->{$item};
+ my @acs;
+ foreach $item (split m|;|, $form->{all_acs}) {
+ my $name = "ACS_${item}";
+ $name =~ s| |+|g;
+ push @acs, $item if !$form->{$name};
+ delete $form->{$name};
}
+ $form->{acs} = join ";", @acs;
- # check which database was filled in
- if ($form->{dbdriver} eq 'Oracle') {
- $form->{sid} = $form->{Oracle_sid},;
- $form->{dbhost} = $form->{Oracle_dbhost},;
- $form->{dbport} = $form->{Oracle_dbport};
- $form->{dbpasswd} = $form->{Oracle_dbpasswd};
- $form->{dbuser} = $form->{Oracle_dbuser};
- $form->{dbname} = $form->{Oracle_dbuser};
-
- $form->isblank("dbhost", $locale->text('Hostname missing!'));
- $form->isblank("dbport", $locale->text('Port missing!'));
- $form->isblank("dbuser", $locale->text('Dataset missing!'));
- }
- if ($form->{dbdriver} eq 'Pg') {
- $form->{dbhost} = $form->{Pg_dbhost};
- $form->{dbport} = $form->{Pg_dbport};
- $form->{dbpasswd} = $form->{Pg_dbpasswd};
- $form->{dbuser} = $form->{Pg_dbuser};
- $form->{dbname} = $form->{Pg_dbname};
-
- $form->isblank("dbname", $locale->text('Dataset missing!'));
- $form->isblank("dbuser", $locale->text('Database User missing!'));
- }
-
- if ($webdav) {
- @webdavdirs =
- qw(angebote bestellungen rechnungen anfragen lieferantenbestellungen einkaufsrechnungen);
- foreach $directory (@webdavdirs) {
- if ($form->{$directory}) {
- $form->{$directory} = $form->{$directory};
- } else {
- $form->{$directory} = 0;
- }
- }
- }
+ $form->isblank("dbname", $locale->text('Dataset missing!'));
+ $form->isblank("dbuser", $locale->text('Database User missing!'));
foreach $item (keys %{$form}) {
$myconfig->{$item} = $form->{$item};
}
close(HTACCESS);
}
- open(HTACCESS, "> $file") or die "cannot open $file $!\n";
+ open(HTACCESS, "> $file") or die "cannot open $file $ERRNO\n";
$newfile .= $myconfig->{login} . ":" . $myconfig->{password} . "\n";
print(HTACCESS $newfile);
close(HTACCESS);
}
close(HTACCESS);
}
- open(HTACCESS, "> $file") or die "cannot open $file $!\n";
+ open(HTACCESS, "> $file") or die "cannot open $file $ERRNO\n";
print(HTACCESS $newfile);
close(HTACCESS);
}
}
}
+ $form->{templates} =~ s|.*/||;
+ $form->{templates} = "${templates}/$form->{templates}";
+ $form->{mastertemplates} =~ s|.*/||;
+
# create user template directory and copy master files
if (!-d "$form->{templates}") {
umask(002);
umask(007);
# copy templates to the directory
- opendir TEMPLATEDIR, "$templates/." or $form - error("$templates : $!");
+ opendir TEMPLATEDIR, "$templates/." or $form - error("$templates : $ERRNO");
@templates = grep /$form->{mastertemplates}.*?\.(html|tex|sty|xml|txb)$/,
readdir TEMPLATEDIR;
closedir TEMPLATEDIR;
foreach $file (@templates) {
open(TEMP, "$templates/$file")
- or $form->error("$templates/$file : $!");
+ or $form->error("$templates/$file : $ERRNO");
$file =~ s/$form->{mastertemplates}-//;
open(NEW, ">$form->{templates}/$file")
- or $form->error("$form->{templates}/$file : $!");
+ or $form->error("$form->{templates}/$file : $ERRNO");
while ($line = <TEMP>) {
print NEW $line;
close(NEW);
}
} else {
- $form->error("$!: $form->{templates}");
+ $form->error("$ERRNO: $form->{templates}");
}
}
}
sub delete {
-
- $form->{templates} =
- ($form->{templates})
- ? "$templates/$form->{templates}"
- : "$templates/$form->{login}";
-
$form->error($locale->text('File locked!')) if (-f ${memberfile} . LCK);
- open(FH, ">${memberfile}.LCK") or $form->error("${memberfile}.LCK : $!");
+ open(FH, ">${memberfile}.LCK") or $form->error("${memberfile}.LCK : $ERRNO");
close(FH);
- open(CONF, "+<$memberfile") or $form->error("$memberfile : $!");
-
- @config = <CONF>;
-
- seek(CONF, 0, 0);
- truncate(CONF, 0);
-
- while ($line = shift @config) {
-
- if ($line =~ /^\[/) {
- last if ($line =~ /\[$form->{login}\]/);
- $login = &login_name($line);
- }
-
- if ($line =~ /^templates=/) {
- $user{$login} = &get_value($line);
- }
-
- print CONF $line;
- }
-
- # remove everything up to next login or EOF
- # and save template variable
- while ($line = shift @config) {
- if ($line =~ /^templates=/) {
- $templatedir = &get_value($line);
- }
- last if ($line =~ /^\[/);
- }
-
- # this one is either the next login or EOF
- print CONF $line;
-
- $login = &login_name($line);
-
- while ($line = shift @config) {
- if ($line =~ /^\[/) {
- $login = &login_name($line);
- }
-
- if ($line =~ /^templates=/) {
- $user{$login} = &get_value($line);
- }
-
- print CONF $line;
- }
-
- close(CONF);
+ my $members = Inifile->new($memberfile);
+ my $templates = $members->{$form->{login}}->{templates};
+ delete $members->{$form->{login}};
+ $members->write();
unlink "${memberfile}.LCK";
- # scan %user for $templatedir
- foreach $login (keys %user) {
- last if ($found = ($templatedir eq $user{$login}));
- }
-
- # if found keep directory otherwise delete
- if (!$found) {
+ if ($templates) {
+ my $templates_in_use = 0;
+ foreach $login (keys %{ $members }) {
+ next if $login =~ m/^[A-Z]+$/;
+ next if $members->{$login}->{templates} ne $templates;
+ $templates_in_use = 1;
+ last;
+ }
- # delete it if there is a template directory
- $dir = "$form->{templates}";
- if (-d "$dir") {
- unlink <$dir/*.html>;
- unlink <$dir/*.tex>;
- unlink <$dir/*.sty>;
- rmdir "$dir";
+ if (!$templates_in_use && -d $templates) {
+ unlink <$templates/*>;
+ rmdir $templates;
}
}
. $locale->text('Administration') . " / "
. $locale->text('Change Admin Password');
- $form->header;
-
- print qq|
-<body class=admin>
-
-
-<h2>| . $locale->text('Change Admin Password') . qq|</h2>
-
-<form method=post action=$form->{script}>
-
-<table>
- <tr>
- <td><b>| . $locale->text('Password') . qq|</b></td>
- <td><input type=password name=password size=8></td>
- </tr>
- <tr>
- <td><b>| . $locale->text('Repeat the password') . qq|</b></td>
- <td><input type=password name=password_again size=8></b></td>
- </tr>
-</table>
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=rpw value=$form->{rpw}>
-
-<p>
-<input type=submit class=submit name=action value="|
- . $locale->text('Change Password') . qq|">
-
-</form>
-
-</body>
-</html>
-|;
-
+ $form->header();
+ print $form->parse_html_template2("admin/change_admin_password");
}
sub change_password {
. $locale->text('Administration') . " / "
. $locale->text('Change Admin Password');
- $form->header;
-
- print qq|
-<body class=admin>
-
-
-<h2>| . $locale->text('Change Admin Password') . qq|</h2>
-
-<p>| . $locale->text("The passwords do not match.") . qq|<br>
-<input type="button" onclick="history.back()" value="| . $locale->text("Back") . qq|">|;
- return;
+ $form->header();
+ $form->error($locale->text("The passwords do not match."));
}
$root->{password} = $form->{password};
$root->save_member($memberfile);
$form->{callback} =
- "$form->{script}?action=list_users&path=$form->{path}&rpw=$root->{password}";
+ "$form->{script}?action=list_users&rpw=$root->{password}";
$form->redirect($locale->text('Password changed!'));
-
}
sub check_password {
sub pg_database_administration {
$form->{dbdriver} = 'Pg';
- &dbselect_source;
-
-}
-
-sub oracle_database_administration {
-
- $form->{dbdriver} = 'Oracle';
- &dbselect_source;
-
-}
-
-sub dbdriver_defaults {
-
- # load some defaults for the selected driver
- %driverdefaults = (
- 'Pg' => { dbport => '5432',
- dbuser => 'postgres',
- dbdefault => 'template1',
- dbhost => 'localhost',
- connectstring => $locale->text('Connect to')
- },
- 'Oracle' => { dbport => '1521',
- dbuser => 'oralin',
- dbdefault => $sid,
- dbhost => `hostname`,
- connectstring => 'SID'
- });
-
- map { $form->{$_} = $driverdefaults{ $form->{dbdriver} }{$_} }
- keys %{ $driverdefaults{Pg} };
+ dbselect_source();
}
sub dbselect_source {
+ $form->{dbport} = '5432';
+ $form->{dbuser} = 'postgres';
+ $form->{dbdefault} = 'template1';
+ $form->{dbhost} = 'localhost';
- &dbdriver_defaults;
-
- $msg{Pg} =
- $locale->text(
- 'Leave host and port field empty unless you want to make a remote connection.'
- );
- $msg{Oracle} =
- $locale->text(
- 'You must enter a host and port for local and remote connections!');
-
- $form->{title} =
- "Lx-Office ERP / " . $locale->text('Database Administration');
-
- $form->header;
-
- print qq|
-<body class=admin>
-
-
-<center>
-<h2>$form->{title}</h2>
-
-<form method=post action=$form->{script}>
-
-<table>
-<tr><td>
-
-<table>
-
- <tr class=listheading>
- <th colspan=4>| . $locale->text('Database') . qq|</th>
- </tr>
-
-<input type=hidden name=dbdriver value=$form->{dbdriver}>
-
- <tr><td>
- <table>
-
- <tr>
-
- <th align=right>| . $locale->text('Host') . qq|</th>
- <td><input name=dbhost size=25 value=$form->{dbhost}></td>
- <th align=right>| . $locale->text('Port') . qq|</th>
- <td><input name=dbport size=5 value=$form->{dbport}></td>
-
- </tr>
-
- <tr>
-
- <th align=right>| . $locale->text('User') . qq|</th>
- <td><input name=dbuser size=10 value=$form->{dbuser}></td>
- <th align=right>| . $locale->text('Password') . qq|</th>
- <td><input type=password name=dbpasswd size=10></td>
-
- </tr>
-
- <tr>
-
- <th align=right>$form->{connectstring}</th>
- <td colspan=3><input name=dbdefault size=10 value=$form->{dbdefault}></td>
-
- </tr>
-
-</table>
+ $form->{title} = "Lx-Office ERP / " . $locale->text('Database Administration');
-</td></tr>
-</table>
-
-<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&rpw=$form->{rpw}">
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=rpw value=$form->{rpw}>
-
-<br>
-
-<input type=submit class=submit name=action value="|
- . $locale->text('Create Dataset') . qq|">|;
-# Vorübergehend Deaktiviert
-# <input type=submit class=submit name=action value="|
-# . $locale->text('Update Dataset') . qq|">
-print qq| <input type=submit class=submit name=action value="|
- . $locale->text('Delete Dataset') . qq|">
-
-</form>
-
-</td></tr>
-</table>
-
-<p>|
- . $locale->text(
- 'This is a preliminary check for existing sources. Nothing will be created or deleted at this stage!'
- )
-
- . qq|
-<br>$msg{$form->{dbdriver}}
-
-
-</body>
-</html>
-|;
+ $form->{ALLOW_DBBACKUP} = "$pg_dump_exe" ne "DISABLED";
+ $form->header();
+ print $form->parse_html_template2("admin/dbadmin");
}
sub continue {
+ call_sub($form->{"nextsub"});
+}
- &{ $form->{nextsub} };
-
+sub back {
+ call_sub($form->{"back_nextsub"});
}
sub update_dataset {
-
- %needsupdate = User->dbneedsupdate(\%$form);
-
$form->{title} =
"Lx-Office ERP "
. $locale->text('Database Administration') . " / "
. $locale->text('Update Dataset');
- $form->header;
-
- print qq|
-<body class=admin>
+ my @need_updates = User->dbneedsupdate($form);
+ $form->{NEED_UPDATES} = \@need_updates;
+ $form->{ALL_UPDATED} = !scalar @need_updates;
+ $form->header();
+ print $form->parse_html_template2("admin/update_dataset");
+}
-<center>
-<h2>$form->{title}</h2>
-|;
- my $field_id = 0;
- foreach $key (sort keys %needsupdate) {
- if ($needsupdate{$key} ne $form->{dbversion}) {
- $upd .= qq|<input id="$field_id" name="db$key" type="checkbox" value="1" checked> $key\n|;
- $form->{dbupdate} .= "db$key ";
- $field_id++;
- }
- }
+sub dbupdate {
+ $form->{stylesheet} = "lx-office-erp.css";
+ $form->{title} = $locale->text("Dataset upgrade");
+ $form->header();
- chop $form->{dbupdate};
+ my $rowcount = $form->{rowcount} * 1;
+ my @update_rows = grep { $form->{"update_$_"} } (1 .. $rowcount);
+ $form->{NOTHING_TO_DO} = !scalar @update_rows;
+ my $saved_form = save_form();
- if ($form->{dbupdate}) {
+ $| = 1;
- print qq|
-<table width=100%>
-<form method=post action=$form->{script}>
+ print $form->parse_html_template2("admin/dbupgrade_all_header");
-<input type=hidden name=dbdriver value=$form->{dbdriver}>
-<input type=hidden name=dbhost value=$form->{dbhost}>
-<input type=hidden name=dbport value=$form->{dbport}>
-<input type=hidden name=dbuser value=$form->{dbuser}>
-<input type=hidden name=dbpasswd value=$form->{dbpasswd}>
-<input type=hidden name=dbdefault value=$form->{dbdefault}>
+ foreach my $i (@update_rows) {
+ restore_form($saved_form);
-<tr class=listheading>
- <th>| . $locale->text('The following Datasets need to be updated') . qq|</th>
-</tr>
-<tr>
-<td>
+ map { $form->{$_} = $form->{"${_}_${i}"} } qw(dbname dbdriver dbhost dbport dbuser dbpasswd);
-$upd
+ my $controls = parse_dbupdate_controls($form, $form->{dbdriver});
-</td>
-</tr>
-<tr>
-<td>
+ print $form->parse_html_template2("admin/dbupgrade_header");
-<input name=dbupdate type=hidden value="$form->{dbupdate}">
+ $form->{dbupdate} = $form->{dbname};
+ $form->{$form->{dbname}} = 1;
-<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&rpw=$form->{rpw}">
+ User->dbupdate($form);
+ User->dbupdate2($form, $controls);
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=rpw value=$form->{rpw}>
+ print $form->parse_html_template2("admin/dbupgrade_footer");
+ }
-<input type=hidden name=nextsub value=dbupdate>
+ print $form->parse_html_template2("admin/dbupgrade_all_done");
+}
-<hr size=3 noshade>
+sub create_dataset {
+ $form->{dbsources} = join " ", map { "[${_}]" } sort User->dbsources(\%$form);
-<br>
-<input type=submit class=submit name=action value="|
- . $locale->text('Continue') . qq|">
+ $form->{CHARTS} = [];
-</td></tr>
-</table>
-</form>
-|;
+ opendir SQLDIR, "sql/." or $form - error($ERRNO);
+ foreach $item (sort grep /-chart\.sql\z/, readdir SQLDIR) {
+ next if ($item eq 'Default-chart.sql');
+ $item =~ s/-chart\.sql//;
+ push @{ $form->{CHARTS} }, { "name" => $item,
+ "selected" => $item eq "Germany-DATEV-SKR03EU" };
+ }
+ closedir SQLDIR;
- } else {
+ my $default_charset = $dbcharset;
+ $default_charset ||= Common::DEFAULT_CHARSET;
- print $locale->text('All Datasets up to date!');
+ $form->{DBENCODINGS} = [];
+ foreach my $encoding (@Common::db_encodings) {
+ push @{ $form->{DBENCODINGS} }, { "dbencoding" => $encoding->{dbencoding},
+ "label" => $encoding->{label},
+ "selected" => $encoding->{charset} eq $default_charset };
}
- print qq|
-
-</body>
-</html>
-|;
+ $form->{title} =
+ "Lx-Office ERP "
+ . $locale->text('Database Administration') . " / "
+ . $locale->text('Create Dataset');
+ $form->header();
+ print $form->parse_html_template2("admin/create_dataset");
}
-sub dbupdate {
- $form->{"stylesheet"} = "lx-office-erp.css";
- $form->{"title"} = $main::locale->text("Dataset upgrade");
- $form->header();
- my $dbname =
- join(" ",
- map({ s/\s//g; s/^db//; $_; }
- grep({ $form->{$_} }
- split(/\s+/, $form->{"dbupdate"}))));
- print($form->parse_html_template("dbupgrade/header",
- { "dbname" => $dbname }));
+sub dbcreate {
+ $form->isblank("db", $locale->text('Dataset missing!'));
- User->dbupdate(\%$form);
+ User->dbcreate(\%$form);
- print qq|
-<hr>
+ $form->{title} =
+ "Lx-Office ERP "
+ . $locale->text('Database Administration') . " / "
+ . $locale->text('Create Dataset');
-| . $locale->text('Dataset updated!') . qq|
+ $form->header();
+ print $form->parse_html_template2("admin/dbcreate");
+}
-<br>
+sub delete_dataset {
+ @dbsources = User->dbsources_unused(\%$form, $memberfile);
+ $form->error($locale->text('Nothing to delete!')) unless @dbsources;
-<a id="enddatasetupdate" href="admin.pl?action=login&| .
-join("&", map({ "$_=" . $form->escape($form->{$_}); } qw(path rpw))) .
-qq|">| . $locale->text("Continue") . qq|</a>|;
+ $form->{title} =
+ "Lx-Office ERP "
+ . $locale->text('Database Administration') . " / "
+ . $locale->text('Delete Dataset');
+ $form->{DBSOURCES} = [ map { { "name", $_ } } sort @dbsources ];
+ $form->header();
+ print $form->parse_html_template2("admin/delete_dataset");
}
-sub create_dataset {
-
- foreach $item (sort User->dbsources(\%$form)) {
- $dbsources .= "[$item] ";
- }
+sub dbdelete {
- opendir SQLDIR, "sql/." or $form - error($!);
- foreach $item (sort grep /-chart\.sql/, readdir SQLDIR) {
- next if ($item eq 'Default-chart.sql');
- $item =~ s/-chart\.sql//;
- push @charts,
- qq| <input name=chart class=radio type=radio value="$item"> $item|;
+ if (!$form->{db}) {
+ $form->error($locale->text('No Dataset selected!'));
}
- closedir SQLDIR;
- $selectencoding = qq|<option>
- <option value=SQL_ASCII>ASCII
- <option value=EUC_JP>Japanese Extended UNIX Code
- <option value=EUC_CN>Chinese Extended UNIX Code
- <option value=EUC_KR>Korean Extended UNIX Code
- <option value=EUC_TW>Taiwan Extended UNIX Code
- <option value=UNICODE>UTF-8 Unicode
- <option value=MULE_INTERNAL>Mule internal type
- <option value=LATIN1>ISO 8859-1
- <option value=LATIN2>ISO 8859-2
- <option value=LATIN3>ISO 8859-3
- <option value=LATIN4>ISO 8859-4
- <option value=LATIN5>ISO 8859-5
- <option value=KOI8>KOI8-R
- <option value=WIN>Windows CP1251
- <option value=ALT>Windows CP866
- |;
+ User->dbdelete(\%$form);
$form->{title} =
"Lx-Office ERP "
. $locale->text('Database Administration') . " / "
- . $locale->text('Create Dataset');
+ . $locale->text('Delete Dataset');
+ $form->header();
+ print $form->parse_html_template2("admin/dbdelete");
+}
- $form->header;
+sub backup_dataset {
+ $form->{title} =
+ "Lx-Office ERP "
+ . $locale->text('Database Administration') . " / "
+ . $locale->text('Backup Dataset');
- print qq|
-<body class=admin>
+ if ("$pg_dump_exe" eq "DISABLED") {
+ $form->error($locale->text('Database backups and restorations are disabled in lx-erp.conf.'));
+ }
+ my @dbsources = sort User->dbsources($form);
+ $form->{DATABASES} = [ map { { "dbname" => $_ } } @dbsources ];
+ $form->{NO_DATABASES} = !scalar @dbsources;
-<center>
-<h2>$form->{title}</h2>
+ my $username = getpwuid $UID || "unknown-user";
+ my $hostname = hostname() || "unknown-host";
+ $form->{from} = "Lx-Office Admin <${username}\@${hostname}>";
-<form method=post action=$form->{script}>
+ $form->header();
+ print $form->parse_html_template2("admin/backup_dataset");
+}
-<table width=100%>
- <tr class=listheading>
- <th colspan=2> </th>
- </tr>
+sub backup_dataset_start {
+ $form->{title} =
+ "Lx-Office ERP "
+ . $locale->text('Database Administration') . " / "
+ . $locale->text('Backup Dataset');
- <tr>
+ $pg_dump_exe ||= "pg_dump";
- <th align=right nowrap>| . $locale->text('Existing Datasets') . qq|</th>
- <td>$dbsources</td>
+ if ("$pg_dump_exe" eq "DISABLED") {
+ $form->error($locale->text('Database backups and restorations are disabled in lx-erp.conf.'));
+ }
- </tr>
+ $form->isblank("dbname", $locale->text('The dataset name is missing.'));
+ $form->isblank("to", $locale->text('The email address is missing.')) if $form->{destination} eq "email";
- <tr>
+ my $tmpdir = "/tmp/lx_office_backup_" . Common->unique_id();
+ mkdir $tmpdir, 0700 || $form->error($locale->text('A temporary directory could not be created:') . " $ERRNO");
- <th align=right nowrap>| . $locale->text('Create Dataset') . qq|</th>
- <td><input name=db></td>
+ my $pgpass = IO::File->new("${tmpdir}/.pgpass", O_WRONLY | O_CREAT, 0600);
- </tr>
+ if (!$pgpass) {
+ unlink $tmpdir;
+ $form->error($locale->text('A temporary file could not be created:') . " $ERRNO");
+ }
- <tr>
+ print $pgpass "$form->{dbhost}:$form->{dbport}:$form->{dbname}:$form->{dbuser}:$form->{dbpasswd}\n";
+ $pgpass->close();
- <th align=right nowrap>| . $locale->text('Multibyte Encoding') . qq|</th>
- <td><select name=encoding>$selectencoding</select></td>
+ $ENV{HOME} = $tmpdir;
- </tr>
+ my @args = ("-Ft", "-c", "-o", "-h", $form->{dbhost}, "-U", $form->{dbuser});
+ push @args, ("-p", $form->{dbport}) if ($form->{dbport});
+ push @args, $form->{dbname};
- <tr>
+ my $cmd = "${pg_dump_exe} " . join(" ", map { s/\\/\\\\/g; s/\"/\\\"/g; $_ } @args);
+ my $name = "dataset_backup_$form->{dbname}_" . strftime("%Y%m%d", localtime()) . ".tar";
- <th align=right nowrap>|
- . $locale->text('Create Chart of Accounts') . qq|</th>
- <td>@charts</td>
+ if ($form->{destination} ne "email") {
+ my $in = IO::File->new("$cmd |");
- </tr>
+ if (!$in) {
+ unlink "${tmpdir}/.pgpass";
+ rmdir $tmpdir;
- <tr><td colspan=2>
-<p>
-<input type=hidden name=dbdriver value=$form->{dbdriver}>
-<input type=hidden name=dbuser value=$form->{dbuser}>
-<input type=hidden name=dbhost value=$form->{dbhost}>
-<input type=hidden name=dbport value=$form->{dbport}>
-<input type=hidden name=dbpasswd value=$form->{dbpasswd}>
-<input type=hidden name=dbdefault value=$form->{dbdefault}>
+ $form->error($locale->text('The pg_dump process could not be started.'));
+ }
-<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&rpw=$form->{rpw}">
+ print "content-type: application/x-tar\n";
+ print "content-disposition: attachment; filename=\"${name}\"\n\n";
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=rpw value=$form->{rpw}>
+ while (my $line = <$in>) {
+ print $line;
+ }
-<input type=hidden name=nextsub value=dbcreate>
+ $in->close();
-<hr size=3 noshade>
+ unlink "${tmpdir}/.pgpass";
+ rmdir $tmpdir;
-<br>
-<input type=submit class=submit name=action value="|
- . $locale->text('Continue') . qq|">
+ } else {
+ my $tmp = $tmpdir . "/dump_" . Common::unique_id();
- </td></tr>
-</table>
+ if (system("$cmd > $tmp") != 0) {
+ unlink "${tmpdir}/.pgpass", $tmp;
+ rmdir $tmpdir;
-</form>
+ $form->error($locale->text('The pg_dump process could not be started.'));
+ }
+ my $mail = new Mailer;
-</body>
-</html>
-|;
+ map { $mail->{$_} = $form->{$_} } qw(from to cc subject message);
-}
+ $mail->{charset} = $dbcharset ? $dbcharset : Common::DEFAULT_CHARSET;
+ $mail->{attachments} = [ { "filename" => $tmp, "name" => $name } ];
+ $mail->send();
-sub dbcreate {
+ unlink "${tmpdir}/.pgpass", $tmp;
+ rmdir $tmpdir;
- $form->isblank("db", $locale->text('Dataset missing!'));
+ $form->{title} =
+ "Lx-Office ERP "
+ . $locale->text('Database Administration') . " / "
+ . $locale->text('Backup Dataset');
- User->dbcreate(\%$form);
+ $form->header();
+ print $form->parse_html_template2("admin/backup_dataset_email_done");
+ }
+}
+sub restore_dataset {
$form->{title} =
"Lx-Office ERP "
. $locale->text('Database Administration') . " / "
- . $locale->text('Create Dataset');
+ . $locale->text('Restore Dataset');
- $form->header;
+ if ("$pg_restore_exe" eq "DISABLED") {
+ $form->error($locale->text('Database backups and restorations are disabled in lx-erp.conf.'));
+ }
- print qq|
-<body class=admin>
+ my $default_charset = $dbcharset;
+ $default_charset ||= Common::DEFAULT_CHARSET;
+ $form->{DBENCODINGS} = [];
-<center>
-<h2>$form->{title}</h2>
+ foreach my $encoding (@Common::db_encodings) {
+ push @{ $form->{DBENCODINGS} }, { "dbencoding" => $encoding->{dbencoding},
+ "label" => $encoding->{label},
+ "selected" => $encoding->{charset} eq $default_charset };
+ }
-<form method=post action=$form->{script}>|
+ $form->header();
+ print $form->parse_html_template2("admin/restore_dataset");
+}
- . $locale->text('Dataset')
- . " $form->{db} "
- . $locale->text('successfully created!')
+sub restore_dataset_start {
+ $form->{title} =
+ "Lx-Office ERP "
+ . $locale->text('Database Administration') . " / "
+ . $locale->text('Restore Dataset');
- . qq|
+ $pg_restore_exe ||= "pg_restore";
-<input type=hidden name=path value="$form->{path}">
-<input type=hidden name=rpw value="$form->{rpw}">
+ if ("$pg_restore_exe" eq "DISABLED") {
+ $form->error($locale->text('Database backups and restorations are disabled in lx-erp.conf.'));
+ }
-<input type=hidden name=nextsub value=list_users>
+ $form->isblank("new_dbname", $locale->text('The dataset name is missing.'));
+ $form->isblank("content", $locale->text('No backup file has been uploaded.'));
-<p><input type=submit class=submit name=action value="|
- . $locale->text('Continue') . qq|">
-</form>
+ # Create temporary directories. Write the backup file contents to a temporary
+ # file. Create a .pgpass file with the username and password for the pg_restore
+ # utility.
+ my $tmpdir = "/tmp/lx_office_backup_" . Common->unique_id();
+ mkdir $tmpdir, 0700 || $form->error($locale->text('A temporary directory could not be created:') . " $ERRNO");
-</body>
-</html>
-|;
+ my $pgpass = IO::File->new("${tmpdir}/.pgpass", O_WRONLY | O_CREAT, 0600);
-}
-
-sub delete_dataset {
-
- if (@dbsources = User->dbsources_unused(\%$form, $memberfile)) {
- foreach $item (sort @dbsources) {
- $dbsources .=
- qq|<input name=db class=radio type=radio value=$item> $item |;
- }
- } else {
- $form->error($locale->text('Nothing to delete!'));
+ if (!$pgpass) {
+ unlink $tmpdir;
+ $form->error($locale->text('A temporary file could not be created:') . " $ERRNO");
}
- $form->{title} =
- "Lx-Office ERP "
- . $locale->text('Database Administration') . " / "
- . $locale->text('Delete Dataset');
-
- $form->header;
-
- print qq|
-<body class=admin>
+ print $pgpass "$form->{dbhost}:$form->{dbport}:$form->{new_dbname}:$form->{dbuser}:$form->{dbpasswd}\n";
+ $pgpass->close();
-<h2>$form->{title}</h2>
+ $ENV{HOME} = $tmpdir;
-<form method=post action=$form->{script}>
+ my $tmp = $tmpdir . "/dump_" . Common::unique_id();
+ my $tmpfile;
-<table width=100%>
- <tr class=listheading>
- <th>|
- . $locale->text('The following Datasets are not in use and can be deleted')
- . qq|</th>
- </tr>
+ if (substr($form->{content}, 0, 2) eq "\037\213") {
+ $tmpfile = IO::File->new("| gzip -d > $tmp");
+ $tmpfile->binary();
- <tr>
- <td>
- $dbsources
- </td>
- </tr>
-
- <tr><td>
-<p>
-<input type=hidden name=dbdriver value=$form->{dbdriver}>
-<input type=hidden name=dbuser value=$form->{dbuser}>
-<input type=hidden name=dbhost value=$form->{dbhost}>
-<input type=hidden name=dbport value=$form->{dbport}>
-<input type=hidden name=dbpasswd value=$form->{dbpasswd}>
-<input type=hidden name=dbdefault value=$form->{dbdefault}>
+ } else {
+ $tmpfile = IO::File->new($tmp, O_WRONLY | O_CREAT | O_BINARY, 0600);
+ }
-<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&rpw=$form->{rpw}">
+ if (!$tmpfile) {
+ unlink "${tmpdir}/.pgpass";
+ rmdir $tmpdir;
-<input type=hidden name=path value="$form->{path}">
-<input type=hidden name=rpw value="$form->{rpw}">
+ $form->error($locale->text('A temporary file could not be created:') . " $ERRNO");
+ }
-<input type=hidden name=nextsub value=dbdelete>
+ print $tmpfile $form->{content};
+ $tmpfile->close();
-<hr size=3 noshade>
+ delete $form->{content};
-<br>
-<input type=submit class=submit name=action value="|
- . $locale->text('Continue') . qq|">
+ # Try to connect to the database. Find out if a database with the same name exists.
+ # If yes, then drop the existing database. Create a new one with the name and encoding
+ # given by the user.
- </td></tr>
-</table>
+ User::dbconnect_vars($form, "template1");
-</form>
+ my %myconfig = map { $_ => $form->{$_} } grep /^db/, keys %{ $form };
+ my $dbh = $form->dbconnect(\%myconfig) || $form->dberror();
-</body>
-</html>
-|;
+ my ($query, $sth);
-}
+ $form->{new_dbname} =~ s|[^a-zA-Z0-9_\-]||g;
-sub dbdelete {
-
- if (!$form->{db}) {
- $form->error($locale->text('No Dataset selected!'));
+ $query = qq|SELECT COUNT(*) FROM pg_database WHERE datname = ?|;
+ my ($count) = selectrow_query($form, $dbh, $query, $form->{new_dbname});
+ if ($count) {
+ do_query($form, $dbh, qq|DROP DATABASE $form->{new_dbname}|);
}
- User->dbdelete(\%$form);
-
- $form->{title} =
- "Lx-Office ERP "
- . $locale->text('Database Administration') . " / "
- . $locale->text('Delete Dataset');
+ my $found = 0;
+ foreach my $item (@Common::db_encodings) {
+ if ($item->{dbencoding} eq $form->{dbencoding}) {
+ $found = 1;
+ last;
+ }
+ }
+ $form->{dbencoding} = "LATIN9" unless $form->{dbencoding};
- $form->header;
+ do_query($form, $dbh, qq|CREATE DATABASE $form->{new_dbname} ENCODING ? TEMPLATE template0|, $form->{dbencoding});
- print qq|
-<body class=admin>
+ $dbh->disconnect();
+ # Spawn pg_restore on the temporary file.
-<center>
-<h2>$form->{title}</h2>
+ my @args = ("-h", $form->{dbhost}, "-U", $form->{dbuser}, "-d", $form->{new_dbname});
+ push @args, ("-p", $form->{dbport}) if ($form->{dbport});
+ push @args, $tmp;
-<form method=post action=$form->{script}>
+ my $cmd = "${pg_restore_exe} " . join(" ", map { s/\\/\\\\/g; s/\"/\\\"/g; $_ } @args);
-$form->{db} | . $locale->text('successfully deleted!')
+ my $in = IO::File->new("$cmd 2>&1 |");
- . qq|
+ if (!$in) {
+ unlink "${tmpdir}/.pgpass", $tmp;
+ rmdir $tmpdir;
-<input type=hidden name=path value="$form->{path}">
-<input type=hidden name=rpw value="$form->{rpw}">
+ $form->error($locale->text('The pg_restore process could not be started.'));
+ }
-<input type=hidden name=nextsub value=list_users>
+ $AUTOFLUSH = 1;
-<p><input type=submit class=submit name=action value="|
- . $locale->text('Continue') . qq|">
-</form>
+ $form->header();
+ print $form->parse_html_template2("admin/restore_dataset_start_header");
+ while (my $line = <$in>) {
+ print $line;
+ }
+ $in->close();
-</body>
-</html>
-|;
+ $form->{retval} = $CHILD_ERROR >> 8;
+ print $form->parse_html_template2("admin/restore_dataset_start_footer");
+ unlink "${tmpdir}/.pgpass", $tmp;
+ rmdir $tmpdir;
}
sub unlock_system {
unlink "$userspath/nologin";
$form->{callback} =
- "$form->{script}?action=list_users&path=$form->{path}&rpw=$root->{password}";
+ "$form->{script}?action=list_users&rpw=$root->{password}";
$form->redirect($locale->text('Lockfile removed!'));
close(FH);
$form->{callback} =
- "$form->{script}?action=list_users&path=$form->{path}&rpw=$root->{password}";
+ "$form->{script}?action=list_users&rpw=$root->{password}";
$form->redirect($locale->text('Lockfile created!'));
use SL::CA;
use SL::Form;
use SL::User;
+use SL::USTVA;
+use SL::Iconv;
+use CGI::Ajax;
+use CGI;
use Data::Dumper;
1;
-require "$form->{path}/common.pl";
+require "bin/mozilla/common.pl";
# end of main
-sub add { &{"add_$form->{type}"} }
-sub edit { &{"edit_$form->{type}"} }
-sub save { &{"save_$form->{type}"} }
-sub delete { &{"delete_$form->{type}"} }
+sub add { call_sub("add_$form->{type}"); }
+sub delete { call_sub("delete_$form->{type}"); }
+sub save { call_sub("save_$form->{type}"); }
+sub edit { call_sub("edit_$form->{type}"); }
+sub continue { call_sub($form->{"nextsub"}); }
sub add_account {
$lxdebug->enter_sub();
AM->get_account(\%myconfig, \%$form);
$form->{callback} =
- "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=list_account&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
&account_header;
sub account_header {
$lxdebug->enter_sub();
+ if ( $form->{action} eq 'edit_account') {
+ $form->{account_exists} = '1';
+ }
+
$form->{title} = $locale->text("$form->{title} Account");
- $checked{ $form->{charttype} } = "checked";
- $checked{"$form->{category}_"} = "checked";
- $checked{CT_tax} = ($form->{CT_tax}) ? "" : "checked";
+ $form->{"$form->{charttype}_checked"} = "checked";
+ $form->{"$form->{category}_checked"} = "checked";
- $form->{description} =~ s/\"/"/g;
+ $form->{select_tax} = "";
+
+ my @tax_report_pos = USTVA->report_variables({
+ myconfig => \%myconfig,
+ form => $form,
+ type => '',
+ attribute => 'position',
+ calc => '',
+ });
if (@{ $form->{TAXKEY} }) {
- foreach $item (@{ $form->{TAXKEY} }) {
- if ($item->{tax} == $form->{tax}) {
- $form->{selecttaxkey} .=
- "<option value=$item->{tax} selected>$item->{taxdescription}\n";
- } else {
- $form->{selecttaxkey} .=
- "<option value=$item->{tax}>$item->{taxdescription}\n";
+ foreach my $item (@{ $form->{TAXKEY} }) {
+ $item->{rate} = $item->{rate} * 100 . '%';
+ }
+
+ # Fill in empty row for new Taxkey
+ $newtaxkey_ref = {
+ id => '',
+ chart_id => '',
+ accno => '',
+ tax_id => '',
+ taxdescription => '',
+ rate => '',
+ taxkey_id => '',
+ pos_ustva => '',
+ startdate => '',
+ };
+
+ push @{ $form->{ACCOUNT_TAXKEYS} }, $newtaxkey_ref;
+
+ my $i = 0;
+ foreach my $taxkey_used (@{ $form->{ACCOUNT_TAXKEYS} } ) {
+
+ # Fill in a runningnumber
+ $form->{ACCOUNT_TAXKEYS}[$i]{runningnumber} = $i;
+
+ # Fill in the Taxkeys as select options
+ foreach my $item (@{ $form->{TAXKEY} }) {
+ if ($item->{id} == $taxkey_used->{tax_id}) {
+ $form->{ACCOUNT_TAXKEYS}[$i]{selecttaxkey} .=
+ qq|<option value="$item->{id}" selected="selected">|
+ . sprintf("%.2d", $item->{taxkey})
+ . qq|. $item->{taxdescription} ($item->{rate}) |
+ . $locale->text('Tax-o-matic Account')
+ . qq|: $item->{chart_accno}\n|;
+ }
+ else {
+ $form->{ACCOUNT_TAXKEYS}[$i]{selecttaxkey} .=
+ qq|<option value="$item->{id}">|
+ . sprintf("%.2d", $item->{taxkey})
+ . qq|. $item->{taxdescription} ($item->{rate}) |
+ . $locale->text('Tax-o-matic Account')
+ . qq|: $item->{chart_accno}\n|;
+ }
+
}
+
+ # Fill in the USTVA Numbers as select options
+ foreach my $item ( '', sort({ $a cmp $b } @tax_report_pos) ) {
+ if ($item eq ''){
+ $form->{ACCOUNT_TAXKEYS}[$i]{select_tax} .= qq|<option value="" selected="selected">-\n|;
+ }
+ elsif ( $item eq $taxkey_used->{pos_ustva} ) {
+ $form->{ACCOUNT_TAXKEYS}[$i]{select_tax} .= qq|<option value="$item" selected="selected">$item\n|;
+ }
+ else {
+ $form->{ACCOUNT_TAXKEYS}[$i]{select_tax} .= qq|<option value="$item">$item\n|;
+ }
+
+ }
+ $i++;
}
}
- $taxkey = qq|
- <tr>
- <th align=right>| . $locale->text('Steuersatz') . qq|</th>
- <td><select name=tax>$form->{selecttaxkey}</select></td>
- <th align=right>| . $locale->text('Gültig ab') . qq|</th>
- <td><input name=startdate value="$form->{startdate}"></td>
- </tr>|;
-
+ # Newaccount Folgekonto
if (@{ $form->{NEWACCOUNT} }) {
if (!$form->{new_chart_valid}) {
- $form->{selectnewaccount} = "<option value=></option>";
+ $form->{selectnewaccount} = qq|<option value=""> |. $locale->text('None') .q|</option>|;
}
foreach $item (@{ $form->{NEWACCOUNT} }) {
if ($item->{id} == $form->{new_chart_id}) {
$form->{selectnewaccount} .=
- "<option value=$item->{id} selected>$item->{accno}--$item->{description}</option>";
+ qq|<option value="$item->{id}" selected>$item->{accno}--$item->{description}</option>|;
} elsif (!$form->{new_chart_valid}) {
$form->{selectnewaccount} .=
- "<option value=$item->{id}>$item->{accno}--$item->{description}</option>";
+ qq|<option value="$item->{id}">$item->{accno}--$item->{description}</option>|;
}
}
}
- $newaccount = qq|
- <tr>
- <td colspan=2>
- <table>
- <tr>
- <th align=right>| . $locale->text('Folgekonto') . qq|</th>
- <td><select name=new_chart_id>$form->{selectnewaccount}</select></td>
- <th align=right>| . $locale->text('Gültig ab') . qq|</th>
- <td><input name=valid_from value="$form->{valid_from}"></td>
- </tr>
- </table>
- </td>
- </tr>|;
-
- $form->{selectustva} = "<option>\n";
-
- %ustva = (35 => $locale->text('UStVA-Nr. 35'),
- 36 => $locale->text('UStVA-Nr. 36'),
- 39 => $locale->text('UStVA-Nr. 39'),
- 41 => $locale->text('UStVA-Nr. 41'),
- 42 => $locale->text('UStVA-Nr. 42'),
- 43 => $locale->text('UStVA-Nr. 43'),
- 44 => $locale->text('UStVA-Nr. 44'),
- 45 => $locale->text('UStVA-Nr. 45'),
- 48 => $locale->text('UStVA-Nr. 48'),
- 49 => $locale->text('UStVA-Nr. 49'),
- 51 => $locale->text('UStVA-Nr. 51 left'),
- 511 => $locale->text('UStVA-Nr. 51 right'),
- 52 => $locale->text('UStVA-Nr. 52'),
- 53 => $locale->text('UStVA-Nr. 53'),
- 59 => $locale->text('UStVA-Nr. 59'),
- 60 => $locale->text('UStVA-Nr. 60'),
- 61 => $locale->text('UStVA-Nr. 61'),
- 62 => $locale->text('UStVA-Nr. 62'),
- 63 => $locale->text('UStVA-Nr. 63'),
- 64 => $locale->text('UStVA-Nr. 64'),
- 65 => $locale->text('UStVA-Nr. 65'),
- 66 => $locale->text('UStVA-Nr. 66'),
- 67 => $locale->text('UStVA-Nr. 67'),
- 69 => $locale->text('UStVA-Nr. 69'),
- 73 => $locale->text('UStVA-Nr. 73'),
- 74 => $locale->text('UStVA-Nr. 74'),
- 76 => $locale->text('UStVA-Nr. 76'),
- 77 => $locale->text('UStVA-Nr. 77'),
- 80 => $locale->text('UStVA-Nr. 80'),
- 84 => $locale->text('UStVA-Nr. 84'),
- 85 => $locale->text('UStVA-Nr. 85'),
- 86 => $locale->text('UStVA-Nr. 86 left'),
- 861 => $locale->text('UStVA-Nr. 86 right'),
- 91 => $locale->text('UStVA-Nr. 91'),
- 93 => $locale->text('UStVA-Nr. 93 left'),
- 931 => $locale->text('UStVA-Nr. 93 right'),
- 94 => $locale->text('UStVA-Nr. 94'),
- 95 => $locale->text('UStVA-Nr. 95'),
- 96 => $locale->text('UStVA-Nr. 96'),
- 97 => $locale->text('UStVA-Nr. 97 links'),
- 971 => $locale->text('UStVA-Nr. 97 rechts'),
- 98 => $locale->text('UStVA-Nr. 98'));
-
- foreach $item (sort({ $a cmp $b } keys %ustva)) {
- if ($item == $form->{pos_ustva}) {
- $form->{selectustva} .= "<option value=$item selected>$ustva{$item}\n";
- } else {
- $form->{selectustva} .= "<option value=$item>$ustva{$item}\n";
- }
-
- }
-
- $ustva = qq|
- <tr>
- <th align=right>| . $locale->text('Umsatzsteuervoranmeldung') . qq|</th>
- <td><select name=pos_ustva>$form->{selectustva}</select></td>
- <input type=hidden name=selectustva value="$form->{selectustva}">
- </tr>|;
-
- $form->{selecteur} = "<option>\n";
+ $select_eur = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
%eur = (1 => "Umsatzerlöse",
2 => "sonstige Erlöse",
3 => "Privatanteile",
30 => "Ausserordentlicher Aufwand",
31 => "Betriebliche Steuern");
foreach $item (sort({ $a <=> $b } keys(%eur))) {
+ my $text = H(SL::Iconv::convert("ISO-8859-15", $dbcharset, $eur{$item}));
if ($item == $form->{pos_eur}) {
- $form->{selecteur} .= "<option value=$item selected>$eur{$item}\n";
+ $select_eur .= qq|<option value=$item selected>|. sprintf("%.2d", $item) .qq|. $text</option>\n|;
} else {
- $form->{selecteur} .= "<option value=$item>$eur{$item}\n";
+ $select_eur .= qq|<option value=$item>|. sprintf("%.2d", $item) .qq|. $text</option>\n|;
}
}
- $eur = qq|
- <tr>
- <th align=right>| . $locale->text('EUER') . qq|</th>
- <td><select name=pos_eur>$form->{selecteur}</select></td>
- <input type=hidden name=selecteur value="$form->{selecteur}">
- </tr>|;
-
- $form->{selectbwa} = "<option>\n";
+ $select_bwa = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
%bwapos = (1 => 'Umsatzerlöse',
2 => 'Best.Verdg.FE/UE',
34 => 'Verr.kalk.Kosten',
35 => 'Steuern Eink.u.Ertr.');
foreach $item (sort({ $a <=> $b } keys %bwapos)) {
+ my $text = H(SL::Iconv::convert("ISO-8859-15", $dbcharset, $bwapos{$item}));
if ($item == $form->{pos_bwa}) {
- $form->{selectbwa} .= "<option value=$item selected>$bwapos{$item}\n";
+ $select_bwa .= qq|<option value="$item" selected>|. sprintf("%.2d", $item) .qq|. $text\n|;
} else {
- $form->{selectbwa} .= "<option value=$item>$bwapos{$item}\n";
+ $select_bwa .= qq|<option value="$item">|. sprintf("%.2d", $item) .qq|. $text\n|;
}
}
- $bwa = qq|
- <tr>
- <th align=right>| . $locale->text('BWA') . qq|</th>
- <td><select name=pos_bwa>$form->{selectbwa}</select></td>
- <input type=hidden name=selectbwa value="$form->{selectbwa}">
- </tr>|;
+# Wieder hinzugefügt zu evaluationszwecken (us) 09.03.2007
+ $select_bilanz = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
+ foreach $item ((1, 2, 3, 4)) {
+ if ($item == $form->{pos_bilanz}) {
+ $select_bilanz .= qq|<option value=$item selected>|. sprintf("%.2d", $item) .qq|.\n|;
+ } else {
+ $select_bilanz .= qq|<option value=$item>|. sprintf("%.2d", $item) .qq|.\n|;
+ }
-# Entfernt bis es ordentlich umgesetzt wird (hli) 30.03.2006
-# $form->{selectbilanz} = "<option>\n";
-# foreach $item ((1, 2, 3, 4)) {
-# if ($item == $form->{pos_bilanz}) {
-# $form->{selectbilanz} .= "<option value=$item selected>$item\n";
-# } else {
-# $form->{selectbilanz} .= "<option value=$item>$item\n";
-# }
-#
-# }
-#
-# $bilanz = qq|
-# <tr>
-# <th align=right>| . $locale->text('Bilanz') . qq|</th>
-# <td><select name=pos_bilanz>$form->{selectbilanz}</select></td>
-# <input type=hidden name=selectbilanz value="$form->{selectbilanz}">
-# </tr>|;
-
- # this is for our parser only!
+ }
+
+ # this is for our parser only! Do not remove.
# type=submit $locale->text('Add Account')
# type=submit $locale->text('Edit Account')
+
$form->{type} = "account";
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
+ # preselections category
+
+ $select_category = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
+
+ %category = (
+ 'A' => $locale->text('Asset'),
+ 'L' => $locale->text('Liability'),
+ 'Q' => $locale->text('Equity'),
+ 'I' => $locale->text('Revenue'),
+ 'E' => $locale->text('Expense'),
+ 'C' => $locale->text('Costs'),
+ );
+ foreach $item ( sort({ $a <=> $b } keys %category) ) {
+ if ($item eq $form->{category}) {
+ $select_category .= qq|<option value="$item" selected="selected">$category{$item} (|. sprintf("%s", $item) .qq|)\n|;
+ } else {
+ $select_category .= qq|<option value="$item">$category{$item} (|. sprintf("%s", $item) .qq|)\n|;
+ }
-<input type=hidden name=id value=$form->{id}>
-<input type=hidden name=type value=account>
-<input type=hidden name=orphaned value=$form->{orphaned}>
-<input type=hidden name=new_chart_valid value=$form->{new_chart_valid}>
+ }
+
+ # preselection chart type
+ my $select_charttype = q{};
-<input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>
-<input type=hidden name=income_accno_id value=$form->{income_accno_id}>
-<input type=hidden name=expense_accno_id value=$form->{expense_accno_id}>
-<input type=hidden name=fxgain_accno_id value=$form->{fxgain_accno_id}>
-<input type=hidden name=fxloss_accno_id value=$form->{fxloss_accno_id}>
+ my %charttype = (
+ 'A' => $locale->text('Account'),
+ 'H' => $locale->text('Header'),
+ );
+
+ foreach $item ( sort({ $a <=> $b } keys %charttype) ) {
+ if ($item eq $form->{charttype}) {
+ $select_charttype .= qq|<option value="$item" selected="selected">$charttype{$item}\n|;
-<table border=0 width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr valign=top>
- <td>
- <table>
- <tr>
- <th align=right>| . $locale->text('Account Number') . qq|</th>
- <td><input name=accno size=20 value=$form->{accno}></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Description') . qq|</th>
- <td><input name=description size=40 value="$form->{description}"></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Account Type') . qq|</th>
- <td>
- <table>
- <tr valign=top>
- <td><input name=category type=radio class=radio value=A $checked{A_}> |
- . $locale->text('Asset') . qq|\n<br>
- <input name=category type=radio class=radio value=L $checked{L_}> |
- . $locale->text('Liability') . qq|\n<br>
- <input name=category type=radio class=radio value=Q $checked{Q_}> |
- . $locale->text('Equity') . qq|\n<br>
- <input name=category type=radio class=radio value=I $checked{I_}> |
- . $locale->text('Revenue') . qq|\n<br>
- <input name=category type=radio class=radio value=E $checked{E_}> |
- . $locale->text('Expense') . qq|<br>
- <input name=category type=radio class=radio value=C $checked{C_}> |
- . $locale->text('Costs') . qq|</td>
- <td width=50> </td>
- <td>
- <input name=charttype type=radio class=radio value="H" $checked{H}> |
- . $locale->text('Heading') . qq|<br>
- <input name=charttype type=radio class=radio value="A" $checked{A}> |
- . $locale->text('Account') . qq|</td>
- </tr>
- </table>
- </td>
- </tr>
-|;
+ } else {
+ $select_charttype .= qq|<option value="$item">$charttype{$item}\n|;
+ }
- if ($form->{charttype} eq "A") {
- print qq|
- <tr>
- <td colspan=2>
- <table>
- <tr>
- <th align=left>|
- . $locale->text('Is this a summary account to record') . qq|</th>
- <td>
- <input name=AR type=checkbox class=checkbox value=AR $form->{AR}> |
- . $locale->text('AR')
- . qq| <input name=AP type=checkbox class=checkbox value=AP $form->{AP}> |
- . $locale->text('AP')
- . qq| <input name=IC type=checkbox class=checkbox value=IC $form->{IC}> |
- . $locale->text('Inventory')
- . qq|</td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <th colspan=2>| . $locale->text('Include in drop-down menus') . qq|</th>
- </tr>
- <tr valign=top>
- <td colspan=2>
- <table width=100%>
- <tr>
- <th align=left>| . $locale->text('Receivables') . qq|</th>
- <th align=left>| . $locale->text('Payables') . qq|</th>
- <th align=left>| . $locale->text('Parts Inventory') . qq|</th>
- <th align=left>| . $locale->text('Service Items') . qq|</th>
- </tr>
- <tr>
- <td>
- <input name=AR_amount type=checkbox class=checkbox value=AR_amount $form->{AR_amount}> |
- . $locale->text('Revenue') . qq|\n<br>
- <input name=AR_paid type=checkbox class=checkbox value=AR_paid $form->{AR_paid}> |
- . $locale->text('Receipt') . qq|\n<br>
- <input name=AR_tax type=checkbox class=checkbox value=AR_tax $form->{AR_tax}> |
- . $locale->text('Tax') . qq|
- </td>
- <td>
- <input name=AP_amount type=checkbox class=checkbox value=AP_amount $form->{AP_amount}> |
- . $locale->text('Expense/Asset') . qq|\n<br>
- <input name=AP_paid type=checkbox class=checkbox value=AP_paid $form->{AP_paid}> |
- . $locale->text('Payment') . qq|\n<br>
- <input name=AP_tax type=checkbox class=checkbox value=AP_tax $form->{AP_tax}> |
- . $locale->text('Tax') . qq|
- </td>
- <td>
- <input name=IC_sale type=checkbox class=checkbox value=IC_sale $form->{IC_sale}> |
- . $locale->text('Revenue') . qq|\n<br>
- <input name=IC_cogs type=checkbox class=checkbox value=IC_cogs $form->{IC_cogs}> |
- . $locale->text('Expense') . qq|\n<br>
- <input name=IC_taxpart type=checkbox class=checkbox value=IC_taxpart $form->{IC_taxpart}> |
- . $locale->text('Tax') . qq|
- </td>
- <td>
- <input name=IC_income type=checkbox class=checkbox value=IC_income $form->{IC_income}> |
- . $locale->text('Revenue') . qq|\n<br>
- <input name=IC_expense type=checkbox class=checkbox value=IC_expense $form->{IC_expense}> |
- . $locale->text('Expense') . qq|\n<br>
- <input name=IC_taxservice type=checkbox class=checkbox value=IC_taxservice $form->{IC_taxservice}> |
- . $locale->text('Tax') . qq|
- </td>
- </tr>
- </table>
- </td>
- </tr>
-|;
}
- print qq|
- $taxkey
- $ustva
- $eur
- $bwa
- $bilanz
- </table>
- </td>
- </tr>
- $newaccount
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-|;
+ my $ChartTypeIsAccount = ($form->{charttype} eq "A") ? "1":"";
+
+ $form->header();
+
+ my $parameters_ref = {
+ ChartTypeIsAccount => $ChartTypeIsAccount,
+ select_category => $select_category,
+ select_charttype => $select_charttype,
+ newaccount => $newaccount,
+ checked => $checked,
+ select_bwa => $select_bwa,
+ select_bilanz => $select_bilanz,
+ select_eur => $select_eur,
+ };
+
+ # Ausgabe des Templates
+ print($form->parse_html_template('am/edit_accounts', $parameters_ref));
+
$lxdebug->leave_sub();
}
<input name=callback type=hidden value="$form->{callback}">
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
. $locale->text('Delete') . qq|">|;
}
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
print qq|
</form>
sub save_account {
$lxdebug->enter_sub();
- $form->isblank("accno", $locale->text('Account Number missing!'));
- $form->isblank("category", $locale->text('Account Type missing!'));
+ $form->isblank("accno", $locale->text('Account Number missing!'));
+ $form->isblank("description", $locale->text('Account Description missing!'));
+
+ if ($form->{charttype} eq 'A'){
+ $form->isblank("category", $locale->text('Account Type missing!'));
+ }
$form->redirect($locale->text('Account saved!'))
if (AM->save_account(\%myconfig, \%$form));
# construct callback
$callback =
- "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}";
+ "$form->{script}?action=list_account&login=$form->{login}&password=$form->{password}";
- @column_index = qw(accno gifi_accno description debit credit link);
- $column_header{accno} = qq|<th>| . $locale->text('Account') . qq|</a></th>|;
- $column_header{gifi_accno} =
- qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
- $column_header{description} =
- qq|<th>| . $locale->text('Description') . qq|</a></th>|;
- $column_header{debit} = qq|<th>| . $locale->text('Debit') . qq|</a></th>|;
- $column_header{credit} = qq|<th>| . $locale->text('Credit') . qq|</a></th>|;
- $column_header{link} = qq|<th>| . $locale->text('Link') . qq|</a></th>|;
+
+ # escape callback
+ $callback = $form->escape($callback);
+
+ foreach $ca (@{ $form->{CA} }) {
+
+ $ca->{debit} = "";
+ $ca->{credit} = "";
+
+ if ($ca->{amount} > 0) {
+ $ca->{credit} = $form->format_amount(\%myconfig, $ca->{amount}, 2);
+ }
+ if ($ca->{amount} < 0) {
+ $ca->{debit} = $form->format_amount(\%myconfig, -1 * $ca->{amount}, 2);
+ }
+ $ca->{heading} = ( $ca->{charttype} eq 'H' ) ? 1:'';
+ $ca->{link_edit_account} =
+ qq|$form->{script}?action=edit_account&id=$ca->{id}|
+ .qq|&login=$form->{login}|
+ .qq|&password=$form->{password}&callback=$callback|;
+ }
+
+ # Ajax
+ my $list_account_details_url =
+ "$form->{script}?login=$form->{login}"
+ ."&password=$form->{password}&action=list_account_details&";
+
+
+ my $pjx = new CGI::Ajax('list_account_details' => $list_account_details_url);
+
+ # Eneable AJAX debuging
+ #$pjx->DEBUG(1);
+ #$pjx->JSDEBUG(1);
+
+ push(@ { $form->{AJAX} }, $pjx);
+
+ $form->{stylesheets} = "list_accounts.css";
$form->header;
- $colspan = $#column_index + 1;
+
+
+ my $parameters_ref = {
+ # hidden_variables => $_hidden_variables_ref,
+ };
+
+ # Ausgabe des Templates
+ print($form->parse_html_template2('am/list_accounts', $parameters_ref));
+
+ $lxdebug->leave_sub();
- print qq|
-<body>
+}
-<table width=100%>
- <tr>
- <th class=listtop colspan=$colspan>$form->{title}</th>
- </tr>
- <tr height=5></tr>
- <tr class=listheading>
-|;
- map { print "$column_header{$_}\n" } @column_index;
+sub list_account_details {
+# Ajax Funktion aus list_account_details
+ $lxdebug->enter_sub();
- print qq|
-</tr>
-|;
+ my $chart_id = $form->{args};
+
+ CA->all_accounts(\%myconfig, \%$form, $chart_id);
+
+ $form->{title} = $locale->text('Chart of Accounts');
+
+ # construct callback
+ $callback =
+ "$form->{script}?action=list_account&login=$form->{login}&password=$form->{password}";
+
+ $form->header;
# escape callback
$callback = $form->escape($callback);
}
if ($ca->{amount} < 0) {
$ca->{debit} =
- $form->format_amount(\%myconfig, -$ca->{amount}, 2, " ");
+ $form->format_amount(\%myconfig, -1 * $ca->{amount}, 2, " ");
}
- $ca->{link} =~ s/:/<br>/og;
-
- if ($ca->{charttype} eq "H") {
- print qq|<tr class=listheading>|;
-
- $column_data{accno} =
- qq|<th><a href=$form->{script}?action=edit_account&id=$ca->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{accno}</a></th>|;
- $column_data{gifi_accno} =
- qq|<th><a href=$form->{script}?action=edit_gifi&accno=$ca->{gifi_accno}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{gifi_accno}</a> </th>|;
- $column_data{description} = qq|<th>$ca->{description} </th>|;
- $column_data{debit} = qq|<th> </th>|;
- $column_data{credit} = qq| <th> </th>|;
- $column_data{link} = qq|<th> </th>|;
-
- } else {
- $i++;
- $i %= 2;
- print qq|
-<tr valign=top class=listrow$i>|;
- $column_data{accno} =
- qq|<td><a href=$form->{script}?action=edit_account&id=$ca->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{accno}</a></td>|;
- $column_data{gifi_accno} =
- qq|<td><a href=$form->{script}?action=edit_gifi&accno=$ca->{gifi_accno}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{gifi_accno}</a> </td>|;
- $column_data{description} = qq|<td>$ca->{description} </td>|;
- $column_data{debit} = qq|<td align=right>$ca->{debit}</td>|;
- $column_data{credit} = qq|<td align=right>$ca->{credit}</td>|;
- $column_data{link} = qq|<td>$ca->{link} </td>|;
-
+ my @links = split( q{:}, $ca->{link});
+
+ $ca->{link} = q{};
+
+ foreach my $link (@links){
+ $link = ( $link eq 'AR') ? $locale->text('Account Link AR')
+ : ( $link eq 'AP') ? $locale->text('Account Link AP')
+ : ( $link eq 'IC') ? $locale->text('Account Link IC')
+ : ( $link eq 'AR_amount' ) ? $locale->text('Account Link AR_amount')
+ : ( $link eq 'AR_paid' ) ? $locale->text('Account Link AR_paid')
+ : ( $link eq 'AR_tax' ) ? $locale->text('Account Link AR_tax')
+ : ( $link eq 'AP_amount' ) ? $locale->text('Account Link AP_amount')
+ : ( $link eq 'AP_paid' ) ? $locale->text('Account Link AP_paid')
+ : ( $link eq 'AP_tax' ) ? $locale->text('Account Link AP_tax')
+ : ( $link eq 'IC_sale' ) ? $locale->text('Account Link IC_sale')
+ : ( $link eq 'IC_cogs' ) ? $locale->text('Account Link IC_cogs')
+ : ( $link eq 'IC_taxpart' ) ? $locale->text('Account Link IC_taxpart')
+ : ( $link eq 'IC_income' ) ? $locale->text('Account Link IC_income')
+ : ( $link eq 'IC_expense' ) ? $locale->text('Account Link IC_expense')
+ : ( $link eq 'IC_taxservice' ) ? $locale->text('Account Link IC_taxservice')
+# : ( $link eq 'CT_tax' ) ? $locale->text('Account Link CT_tax')
+ : $locale->text('Unknown Link') . ': ' . $link;
+
+ $ca->{link} .= ($link ne '') ? "[$link] ":'';
}
+
+ $ca->{startdate} =~ s/,/<br>/og;
+ $ca->{tk_ustva} =~ s/,/<br>/og;
+ $ca->{taxkey} =~ s/,/<br>/og;
+ $ca->{taxaccount} =~ s/,/<br>/og;
+ $ca->{taxdescription} =~ s/,/<br>/og;
+ $ca->{datevautomatik} = ($ca->{datevautomatik}) ? $locale->text('On'):$locale->text('Off');
- map { print "$column_data{$_}\n" } @column_index;
+ $ca->{category} = ($ca->{category} eq 'A') ? $locale->text('Account Category A')
+ : ($ca->{category} eq 'E') ? $locale->text('Account Category E')
+ : ($ca->{category} eq 'L') ? $locale->text('Account Category L')
+ : ($ca->{category} eq 'I') ? $locale->text('Account Category I')
+ : ($ca->{category} eq 'Q') ? $locale->text('Account Category Q')
+ : ($ca->{category} eq 'C') ? $locale->text('Account Category C')
+ : ($ca->{category} eq 'G') ? $locale->text('Account Category G')
+ : $locale->text('Unknown Category') . ': ' . $ca->{category};
- print "</tr>\n";
+ $ca->{link_edit_account} =
+ qq|$form->{script}?action=edit_account&id=$ca->{id}|
+ .qq|&login=$form->{login}|
+ .qq|&password=$form->{password}&callback=$callback|;
}
- print qq|
- <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
-</table>
-</body>
-</html>
-|;
+
+ my $parameters_ref = {
+
+
+ # hidden_variables => $_hidden_variables_ref,
+ };
+
+ # Ausgabe des Templates
+ #my $q = CGI->new();
+ my $result = $form->parse_html_template('am/list_account_details', $parameters_ref);
+
+ print $result;
+# print "chart_id:$chart_id, form->chartid:$form->{chart_id}, rest=$rest";
+
$lxdebug->leave_sub();
+
}
sub delete_account {
$lxdebug->leave_sub();
}
-sub list_gifi {
+sub add_department {
$lxdebug->enter_sub();
- @{ $form->{fields} } = (accno, description);
- $form->{table} = "gifi";
- $form->{sortorder} = "accno";
+ $form->{title} = "Add";
+ $form->{role} = "P";
+
+ $form->{callback} =
+ "$form->{script}?action=add_department&login=$form->{login}&password=$form->{password}"
+ unless $form->{callback};
- AM->gifi_accounts(\%myconfig, \%$form);
+ &department_header;
+ &form_footer;
- $form->{title} = $locale->text('GIFI');
+ $lxdebug->leave_sub();
+}
- # construct callback
- $callback =
- "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
+sub edit_department {
+ $lxdebug->enter_sub();
+
+ $form->{title} = "Edit";
+
+ AM->get_department(\%myconfig, \%$form);
+
+ &department_header;
+ &form_footer;
+
+ $lxdebug->leave_sub();
+}
+
+sub list_department {
+ $lxdebug->enter_sub();
+
+ AM->departments(\%myconfig, \%$form);
+
+ $form->{callback} =
+ "$form->{script}?action=list_department&login=$form->{login}&password=$form->{password}";
+
+ $callback = $form->escape($form->{callback});
+
+ $form->{title} = $locale->text('Departments');
- @column_index = qw(accno description);
+ @column_index = qw(description cost profit);
- $column_header{accno} = qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
$column_header{description} =
- qq|<th>| . $locale->text('Description') . qq|</a></th>|;
+ qq|<th class=listheading width=90%>|
+ . $locale->text('Description')
+ . qq|</th>|;
+ $column_header{cost} =
+ qq|<th class=listheading nowrap>|
+ . $locale->text('Cost Center')
+ . qq|</th>|;
+ $column_header{profit} =
+ qq|<th class=listheading nowrap>|
+ . $locale->text('Profit Center')
+ . qq|</th>|;
$form->header;
- $colspan = $#column_index + 1;
print qq|
<body>
<table width=100%>
<tr>
- <th class=listtop colspan=$colspan>$form->{title}</th>
+ <th class=listtop>$form->{title}</th>
</tr>
<tr height="5"></tr>
- <tr class=listheading>
+ <tr>
+ <td>
+ <table width=100%>
+ <tr class=listheading>
|;
map { print "$column_header{$_}\n" } @column_index;
print qq|
-</tr>
+ </tr>
|;
- # escape callback
- $callback = $form->escape($callback);
-
- foreach $ca (@{ $form->{ALL} }) {
+ foreach $ref (@{ $form->{ALL} }) {
$i++;
$i %= 2;
print qq|
-<tr valign=top class=listrow$i>|;
+ <tr valign=top class=listrow$i>
+|;
- $column_data{accno} =
- qq|<td><a href=$form->{script}?action=edit_gifi&coa=1&accno=$ca->{accno}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{accno}</td>|;
- $column_data{description} = qq|<td>$ca->{description} </td>|;
+ $costcenter = ($ref->{role} eq "C") ? "X" : "";
+ $profitcenter = ($ref->{role} eq "P") ? "X" : "";
+
+ $column_data{description} =
+ qq|<td><a href=$form->{script}?action=edit_department&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
+ $column_data{cost} = qq|<td align=center>$costcenter</td>|;
+ $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
map { print "$column_data{$_}\n" } @column_index;
- print "</tr>\n";
+ print qq|
+ </tr>
+|;
}
print qq|
+ </table>
+ </td>
+ </tr>
<tr>
- <td colspan=$colspan><hr size=3 noshade></td>
+ <td><hr size=3 noshade></td>
</tr>
</table>
-</body>
-</html>
-|;
+<br>
+<form method=post action=$form->{script}>
- $lxdebug->leave_sub();
-}
+<input name=callback type=hidden value="$form->{callback}">
-sub add_gifi {
- $lxdebug->enter_sub();
+<input type=hidden name=type value=department>
- $form->{title} = "Add";
+<input type=hidden name=login value=$form->{login}>
+<input type=hidden name=password value=$form->{password}>
- # construct callback
- $form->{callback} =
- "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
+<input class=submit type=submit name=action value="|
+ . $locale->text('Add') . qq|">
- $form->{coa} = 1;
+ </form>
- &gifi_header;
- &gifi_footer;
+ </body>
+ </html>
+|;
$lxdebug->leave_sub();
}
-sub edit_gifi {
+sub department_header {
$lxdebug->enter_sub();
- $form->{title} = "Edit";
-
- AM->get_gifi(\%myconfig, \%$form);
-
- &gifi_header;
- &gifi_footer;
-
- $lxdebug->leave_sub();
-}
+ $form->{title} = $locale->text("$form->{title} Department");
-sub gifi_header {
- $lxdebug->enter_sub();
+ # $locale->text('Add Department')
+ # $locale->text('Edit Department')
- $form->{title} = $locale->text("$form->{title} GIFI");
+ $form->{description} =~ s/\"/"/g;
- # $locale->text('Add GIFI')
- # $locale->text('Edit GIFI')
+ 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->{description} =~ s/\"/"/g;
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=id value=$form->{accno}>
-<input type=hidden name=type value=gifi>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align=right>| . $locale->text('GIFI') . qq|</th>
- <td><input name=accno size=20 value=$form->{accno}></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Description') . qq|</th>
- <td><input name=description size=60 value="$form->{description}"></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td colspan=2><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
- $lxdebug->leave_sub();
-}
-
-sub gifi_footer {
- $lxdebug->enter_sub();
-
- print qq|
-
-<input name=callback type=hidden value="$form->{callback}">
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>
-
-<br><input type=submit class=submit name=action value="|
- . $locale->text('Save') . qq|">|;
-
- if ($form->{coa}) {
- print qq|
-<input type=submit class=submit name=action value="|
- . $locale->text('Copy to COA') . qq|">
-|;
-
- if ($form->{accno} && $form->{orphaned}) {
- print qq|<input type=submit class=submit name=action value="|
- . $locale->text('Delete') . qq|">|;
- }
- }
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
- </form>
-
-</body>
-</html>
-|;
-
- $lxdebug->leave_sub();
-}
-
-sub save_gifi {
- $lxdebug->enter_sub();
-
- $form->isblank("accno", $locale->text('GIFI missing!'));
- AM->save_gifi(\%myconfig, \%$form);
- $form->redirect($locale->text('GIFI saved!'));
-
- $lxdebug->leave_sub();
-}
-
-sub copy_to_coa {
- $lxdebug->enter_sub();
-
- $form->isblank("accno", $locale->text('GIFI missing!'));
-
- AM->save_gifi(\%myconfig, \%$form);
-
- delete $form->{id};
- $form->{gifi_accno} = $form->{accno};
- $form->{title} = "Add";
- $form->{charttype} = "A";
-
- &account_header;
- &form_footer;
-
- $lxdebug->leave_sub();
-}
-
-sub delete_gifi {
- $lxdebug->enter_sub();
-
- AM->delete_gifi(\%myconfig, \%$form);
- $form->redirect($locale->text('GIFI deleted!'));
-
- $lxdebug->leave_sub();
-}
-
-sub add_department {
- $lxdebug->enter_sub();
-
- $form->{title} = "Add";
- $form->{role} = "P";
-
- $form->{callback} =
- "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&password=$form->{password}"
- unless $form->{callback};
-
- &department_header;
- &form_footer;
-
- $lxdebug->leave_sub();
-}
-
-sub edit_department {
- $lxdebug->enter_sub();
-
- $form->{title} = "Edit";
-
- AM->get_department(\%myconfig, \%$form);
-
- &department_header;
- &form_footer;
-
- $lxdebug->leave_sub();
-}
-
-sub list_department {
- $lxdebug->enter_sub();
-
- AM->departments(\%myconfig, \%$form);
-
- $form->{callback} =
- "$form->{script}?action=list_department&path=$form->{path}&login=$form->{login}&password=$form->{password}";
-
- $callback = $form->escape($form->{callback});
-
- $form->{title} = $locale->text('Departments');
-
- @column_index = qw(description cost profit);
-
- $column_header{description} =
- qq|<th class=listheading width=90%>|
- . $locale->text('Description')
- . qq|</th>|;
- $column_header{cost} =
- qq|<th class=listheading nowrap>|
- . $locale->text('Cost Center')
- . qq|</th>|;
- $column_header{profit} =
- qq|<th class=listheading nowrap>|
- . $locale->text('Profit Center')
- . 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>
-|;
-
- $costcenter = ($ref->{role} eq "C") ? "X" : "";
- $profitcenter = ($ref->{role} eq "P") ? "X" : "";
-
- $column_data{description} =
- qq|<td><a href=$form->{script}?action=edit_department&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
- $column_data{cost} = qq|<td align=center>$costcenter</td>|;
- $column_data{profit} = qq|<td align=center>$profitcenter</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=department>
-
-<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|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
- </form>
-
- </body>
- </html>
-|;
-
- $lxdebug->leave_sub();
-}
-
-sub department_header {
- $lxdebug->enter_sub();
-
- $form->{title} = $locale->text("$form->{title} Department");
-
- # $locale->text('Add Department')
- # $locale->text('Edit Department')
-
- $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}">|;
- }
-
- $costcenter = "checked" if $form->{role} eq "C";
- $profitcenter = "checked" if $form->{role} eq "P";
+ $costcenter = "checked" if $form->{role} eq "C";
+ $profitcenter = "checked" if $form->{role} eq "P";
$form->header;
$form->{title} = "Add";
$form->{callback} =
- "$form->{script}?action=add_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=add_lead&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
&lead_header;
AM->lead(\%myconfig, \%$form);
$form->{callback} =
- "$form->{script}?action=list_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}";
+ "$form->{script}?action=list_lead&login=$form->{login}&password=$form->{password}";
$callback = $form->escape($form->{callback});
$lead = $ref->{lead};
$column_data{description} =
- qq|<td><a href=$form->{script}?action=edit_lead&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{lead}</td>|;
+ qq|<td><a href=$form->{script}?action=edit_lead&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{lead}</td>|;
map { print "$column_data{$_}\n" } @column_index;
<input type=hidden name=type value=lead>
-<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|">|;
+ . $locale->text('Add') . qq|">
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
</form>
</body>
$form->{title} = "Add";
$form->{callback} =
- "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=add_business&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
&business_header;
AM->business(\%myconfig, \%$form);
$form->{callback} =
- "$form->{script}?action=list_business&path=$form->{path}&login=$form->{login}&password=$form->{password}";
+ "$form->{script}?action=list_business&login=$form->{login}&password=$form->{password}";
$callback = $form->escape($form->{callback});
|;
$discount =
- $form->format_amount(\%myconfig, $ref->{discount} * 100, 1, " ");
+ $form->format_amount(\%myconfig, $ref->{discount} * 100);
$description =
- ($ref->{salesman})
- ? "<b>$ref->{description}</b>"
- : "$ref->{description}";
+ $ref->{description};
$column_data{description} =
- qq|<td><a href=$form->{script}?action=edit_business&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$description</td>|;
+ qq|<td><a href=$form->{script}?action=edit_business&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$description</td>|;
$column_data{discount} = qq|<td align=right>$discount</td>|;
$column_data{customernumberinit} =
qq|<td align=right>$ref->{customernumberinit}</td>|;
<input type=hidden name=type value=business>
-<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|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
+ . $locale->text('Add') . qq|">
</form>
$lxdebug->enter_sub();
$form->{title} = $locale->text("$form->{title} Business");
- $form->{salesman} = "checked" if $form->{salesman};
# $locale->text('Add Business')
# $locale->text('Edit Business')
<th align=right>| . $locale->text('Customernumberinit') . qq|</th>
<td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
</tr>
- <tr>
- <td align=right>| . $locale->text('Salesman') . qq|</td>
- <td><input name=salesman class=checkbox type=checkbox value=1 $form->{salesman}></td>
- </tr>
<td colspan=2><hr size=3 noshade></td>
</tr>
</table>
$lxdebug->enter_sub();
$form->isblank("description", $locale->text('Description missing!'));
+ $form->{discount} = $form->parse_amount(\%myconfig, $form->{discount}) / 100;
AM->save_business(\%myconfig, \%$form);
$form->redirect($locale->text('Business saved!'));
$form->{title} = "Add";
$form->{callback} =
- "$form->{script}?action=add_language&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=add_language&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
&language_header;
AM->language(\%myconfig, \%$form);
$form->{callback} =
- "$form->{script}?action=list_language&path=$form->{path}&login=$form->{login}&password=$form->{password}";
+ "$form->{script}?action=list_language&login=$form->{login}&password=$form->{password}";
$callback = $form->escape($form->{callback});
$column_data{description} =
- qq|<td><a href=$form->{script}?action=edit_language&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
+ qq|<td><a href=$form->{script}?action=edit_language&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
$column_data{template_code} = qq|<td align=right>$ref->{template_code}</td>|;
$column_data{article_code} =
qq|<td align=right>$ref->{article_code}</td>|;
<input type=hidden name=type value=language>
-<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|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
+ . $locale->text('Add') . qq|">
</form>
$form->{title} = "Add";
$form->{callback} =
- "$form->{script}?action=add_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=add_buchungsgruppe&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
AM->get_buchungsgruppe(\%myconfig, \%$form);
$form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"};
AM->buchungsgruppe(\%myconfig, \%$form);
$form->{callback} =
- "$form->{script}?action=list_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}";
+ "$form->{script}?action=list_buchungsgruppe&login=$form->{login}&password=$form->{password}";
$callback = $form->escape($form->{callback});
$form->{title} = $locale->text('Buchungsgruppen');
- @column_index = qw(description inventory_accno income_accno_0 expense_accno_0 income_accno_1 expense_accno_1 income_accno_2 expense_accno_2 income_accno_3 expense_accno_3 );
+ @column_index = qw(up down description inventory_accno
+ income_accno_0 expense_accno_0
+ income_accno_1 expense_accno_1
+ income_accno_2 expense_accno_2
+ income_accno_3 expense_accno_3 );
+ $column_header{up} =
+ qq|<th class="listheading" width="16">|
+ . qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">|
+ . qq|</th>|;
+ $column_header{down} =
+ qq|<th class="listheading" width="16">|
+ . qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">|
+ . qq|</th>|;
$column_header{description} =
- qq|<th class=listheading width=60%>|
+ qq|<th class="listheading" width="40%">|
. $locale->text('Description')
. qq|</th>|;
$column_header{inventory_accno} =
- qq|<th class=listheading width=10%>|
+ qq|<th class=listheading>|
. $locale->text('Bestandskonto')
. qq|</th>|;
$column_header{income_accno_0} =
qq|<th class=listheading>|
- . $locale->text('Erlöse Inland')
+ . $locale->text('National Revenues')
. qq|</th>|;
$column_header{expense_accno_0} =
qq|<th class=listheading>|
- . $locale->text('Aufwand Inland')
+ . $locale->text('National Expenses')
. qq|</th>|;
$column_header{income_accno_1} =
qq|<th class=listheading>|
- . $locale->text('Erlöse EU m. UStId')
+ . $locale->text('Revenues EU with UStId')
. qq|</th>|;
$column_header{expense_accno_1} =
qq|<th class=listheading>|
- . $locale->text('Aufwand EU m. UStId')
+ . $locale->text('Expenses EU with UStId')
. qq|</th>|;
$column_header{income_accno_2} =
qq|<th class=listheading>|
- . $locale->text('Erlöse EU o. UStId')
+ . $locale->text('Revenues EU without UStId')
. qq|</th>|;
$column_header{expense_accno_2} =
qq|<th class=listheading>|
- . $locale->text('Aufwand EU o. UStId')
+ . $locale->text('Expenses EU without UStId')
. qq|</th>|;
$column_header{income_accno_3} =
qq|<th class=listheading>|
- . $locale->text('Erlöse Ausland')
+ . $locale->text('Foreign Revenues')
. qq|</th>|;
$column_header{expense_accno_3} =
qq|<th class=listheading>|
- . $locale->text('Aufwand Ausland')
+ . $locale->text('Foreign Expenses')
. qq|</th>|;
$form->header;
</tr>
|;
+ my $swap_link = qq|$form->{script}?action=swap_buchungsgruppen&|;
+ map({ $swap_link .= $_ . "=" . $form->escape($form->{$_}) . "&" }
+ qw(login password));
+
+ my $row = 0;
foreach $ref (@{ $form->{ALL} }) {
$i++;
<tr valign=top class=listrow$i>
|;
-
+ if ($row) {
+ my $pref = $form->{ALL}->[$row - 1];
+ $column_data{up} =
+ qq|<td align="center" valign="center" width="16">| .
+ qq|<a href="${swap_link}id1=$ref->{id}&id2=$pref->{id}">| .
+ qq|<img border="0" src="image/up.png" alt="| . $locale->text("up") . qq|">| .
+ qq|</a></td>|;
+ } else {
+ $column_data{up} = qq|<td width="16"> </td>|;
+ }
+
+ if ($row == (scalar(@{ $form->{ALL} }) - 1)) {
+ $column_data{down} = qq|<td width="16"> </td>|;
+ } else {
+ my $nref = $form->{ALL}->[$row + 1];
+ $column_data{down} =
+ qq|<td align="center" valign="center" width="16">| .
+ qq|<a href="${swap_link}id1=$ref->{id}&id2=$nref->{id}">| .
+ qq|<img border="0" src="image/down.png" alt="| . $locale->text("down") . qq|">| .
+ qq|</a></td>|;
+ }
+
$column_data{description} =
- qq|<td><a href=$form->{script}?action=edit_buchungsgruppe&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
+ qq|<td><a href=$form->{script}?action=edit_buchungsgruppe&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
$column_data{inventory_accno} = qq|<td align=right>$ref->{inventory_accno}</td>|;
$column_data{income_accno_0} =
qq|<td align=right>$ref->{income_accno_0}</td>|;
print qq|
</tr>
|;
+
+ $row++;
}
print qq|
<input type=hidden name=type value=buchungsgruppe>
-<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|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
+ . $locale->text('Add') . qq|">
</form>
$form->{title} = $locale->text("$form->{title} Buchungsgruppe");
- # $locale->text('Buchungsgruppe hinzufügen')
- # $locale->text('Buchungsgruppe bearbeiten')
+ # $locale->text('Add Accounting Group')
+ # $locale->text('Edit Accounting Group')
my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {});
my %acc_type_map = (
$linkaccounts .= qq|
<tr>
- <th align=right>| . $locale->text('Erlöse Inland') . qq|</th>
+ <th align=right>| . $locale->text('National Revenues') . qq|</th>
<td><select name=income_accno_id_0>$form->{selectIC_income}</select></td>
</tr>
<tr>
- <th align=right>| . $locale->text('Aufwand Inland') . qq|</th>
+ <th align=right>| . $locale->text('National Expenses') . qq|</th>
<td><select name=expense_accno_id_0>$form->{selectIC_expense}</select></td>
</tr>|;
if ($form->{id}) {
$form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_1}/ value=$form->{expense_accno_id_1} selected/;
}
$linkaccounts .= qq| <tr>
- <th align=right>| . $locale->text('Erlöse EU m. UStId') . qq|</th>
+ <th align=right>| . $locale->text('Revenues EU with UStId') . qq|</th>
<td><select name=income_accno_id_1>$form->{selectIC_income}</select></td>
</tr>
<tr>
- <th align=right>| . $locale->text('Aufwand EU m UStId') . qq|</th>
+ <th align=right>| . $locale->text('Expenses EU with UStId') . qq|</th>
<td><select name=expense_accno_id_1>$form->{selectIC_expense}</select></td>
</tr>|;
}
$linkaccounts .= qq| <tr>
- <th align=right>| . $locale->text('Erlöse EU o. UStId') . qq|</th>
+ <th align=right>| . $locale->text('Revenues EU without UStId') . qq|</th>
<td><select name=income_accno_id_2>$form->{selectIC_income}</select></td>
</tr>
<tr>
- <th align=right>| . $locale->text('Aufwand EU o. UStId') . qq|</th>
+ <th align=right>| . $locale->text('Expenses EU without UStId') . qq|</th>
<td><select name=expense_accno_id_2>$form->{selectIC_expense}</select></td>
</tr>|;
}
$linkaccounts .= qq| <tr>
- <th align=right>| . $locale->text('Erlöse Ausland') . qq|</th>
+ <th align=right>| . $locale->text('Foreign Revenues') . qq|</th>
<td><select name=income_accno_id_3>$form->{selectIC_income}</select></td>
</tr>
<tr>
- <th align=right>| . $locale->text('Aufwand Ausland') . qq|</th>
+ <th align=right>| . $locale->text('Foreign Expenses') . qq|</th>
<td><select name=expense_accno_id_3>$form->{selectIC_expense}</select></td>
</tr>
|;
$form->isblank("description", $locale->text('Description missing!'));
AM->save_buchungsgruppe(\%myconfig, \%$form);
- $form->redirect($locale->text('Buchungsgruppe gespeichert!'));
+ $form->redirect($locale->text('Accounting Group saved!'));
$lxdebug->leave_sub();
}
$lxdebug->enter_sub();
AM->delete_buchungsgruppe(\%myconfig, \%$form);
- $form->redirect($locale->text('Buchungsgruppe gelöscht!'));
+ $form->redirect($locale->text('Accounting Group deleted!'));
+
+ $lxdebug->leave_sub();
+}
+
+sub swap_buchungsgruppen {
+ $lxdebug->enter_sub();
+
+ AM->swap_sortkeys(\%myconfig, $form, "buchungsgruppen");
+ list_buchungsgruppe();
$lxdebug->leave_sub();
}
$form->{title} = "Add";
$form->{callback} =
- "$form->{script}?action=add_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=add_printer&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
&printer_header;
AM->printer(\%myconfig, \%$form);
$form->{callback} =
- "$form->{script}?action=list_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}";
+ "$form->{script}?action=list_printer&login=$form->{login}&password=$form->{password}";
$callback = $form->escape($form->{callback});
$column_data{printer_description} =
- qq|<td><a href=$form->{script}?action=edit_printer&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{printer_description}</td>|;
+ qq|<td><a href=$form->{script}?action=edit_printer&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{printer_description}</td>|;
$column_data{printer_command} = qq|<td align=right>$ref->{printer_command}</td>|;
$column_data{template_code} =
qq|<td align=right>$ref->{template_code}</td>|;
<input type=hidden name=type value=printer>
-<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|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
+ . $locale->text('Add') . qq|">
</form>
$lxdebug->leave_sub();
}
-
sub add_payment {
$lxdebug->enter_sub();
$form->{title} = "Add";
$form->{callback} =
- "$form->{script}?action=add_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=add_payment&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
$form->{terms_netto} = 0;
$form->{terms_skonto} = 0;
$form->{percent_skonto} = 0;
+ my @languages = AM->language(\%myconfig, $form, 1);
+ map({ $_->{"language"} = $_->{"description"};
+ $_->{"language_id"} = $_->{"id"}; } @languages);
+ $form->{"TRANSLATION"} = \@languages;
&payment_header;
&form_footer;
$form->{title} = "Edit";
- AM->get_payment(\%myconfig, \%$form);
+ AM->get_payment(\%myconfig, $form);
+ $form->{percent_skonto} =
+ $form->format_amount(\%myconfig, $form->{percent_skonto} * 100);
&payment_header;
AM->payment(\%myconfig, \%$form);
- $form->{callback} =
- "$form->{script}?action=list_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}";
+ $form->{callback} = build_std_url("action=list_payment");
$callback = $form->escape($form->{callback});
$form->{title} = $locale->text('Payment Terms');
- @column_index = qw(description description_long terms_netto terms_skonto percent_skonto);
+ @column_index = qw(up down description description_long terms_netto
+ terms_skonto percent_skonto);
+ $column_header{up} =
+ qq|<th class="listheading" align="center" valign="center" width="16">|
+ . qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">|
+ . qq|</th>|;
+ $column_header{down} =
+ qq|<th class="listheading" align="center" valign="center" width="16">|
+ . qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">|
+ . qq|</th>|;
$column_header{description} =
qq|<th class=listheading>|
. $locale->text('Description')
</tr>
|;
+ my $swap_link = build_std_url("action=swap_payment_terms");
+
+ my $row = 0;
foreach $ref (@{ $form->{ALL} }) {
$i++;
<tr valign=top class=listrow$i>
|;
+ if ($row) {
+ my $pref = $form->{ALL}->[$row - 1];
+ $column_data{up} =
+ qq|<td align="center" valign="center" width="16">| .
+ qq|<a href="${swap_link}&id1=$ref->{id}&id2=$pref->{id}">| .
+ qq|<img border="0" src="image/up.png" alt="| . $locale->text("up") . qq|">| .
+ qq|</a></td>|;
+ } else {
+ $column_data{up} = qq|<td width="16"> </td>|;
+ }
+
+ if ($row == (scalar(@{ $form->{ALL} }) - 1)) {
+ $column_data{down} = qq|<td width="16"> </td>|;
+ } else {
+ my $nref = $form->{ALL}->[$row + 1];
+ $column_data{down} =
+ qq|<td align="center" valign="center" width="16">| .
+ qq|<a href="${swap_link}&id1=$ref->{id}&id2=$nref->{id}">| .
+ qq|<img border="0" src="image/down.png" alt="| . $locale->text("down") . qq|">| .
+ qq|</a></td>|;
+ }
$column_data{description} =
- qq|<td><a href=$form->{script}?action=edit_payment&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
- $column_data{description_long} = qq|<td align=right>$ref->{description_long}</td>|;
+ qq|<td><a href="| .
+ build_std_url("action=edit_payment", "id=$ref->{id}", "callback=$callback") .
+ qq|">| . H($ref->{description}) . qq|</a></td>|;
+ $column_data{description_long} =
+ qq|<td>| . H($ref->{description_long}) . qq|</td>|;
$column_data{terms_netto} =
qq|<td align=right>$ref->{terms_netto}</td>|;
$column_data{terms_skonto} =
qq|<td align=right>$ref->{terms_skonto}</td>|;
$column_data{percent_skonto} =
- qq|<td align=right>$ref->{percent_skonto} %</td>|;
+ qq|<td align=right>| .
+ $form->format_amount(\%myconfig, $ref->{percent_skonto} * 100) .
+ qq|%</td>|;
map { print "$column_data{$_}\n" } @column_index;
print qq|
</tr>
|;
+ $row++;
}
print qq|
<input type=hidden name=type value=payment>
-<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|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
+ . $locale->text('Add') . qq|">
</form>
<th align=right>| . $locale->text('Long Description') . qq|</th>
<td><input name=description_long size=50 value="$form->{description_long}"></td>
</tr>
+|;
+
+ foreach my $language (@{ $form->{"TRANSLATION"} }) {
+ print qq|
+ <tr>
+ <th align="right">| .
+ sprintf($locale->text('Translation (%s)'),
+ $language->{"language"})
+ . qq|</th>
+ <td><input name="description_long_$language->{language_id}" size="50"
+ value="| . Q($language->{"description_long"}) . qq|"></td>
+ </tr>
+|;
+ }
+
+ print qq|
<tr>
<th align=right>| . $locale->text('Netto Terms') . qq|</th>
<td><input name=terms_netto size=10 value="$form->{terms_netto}"></td>
<td colspan=2><hr size=3 noshade></td>
</tr>
</table>
-|;
+
+<p>| . $locale->text("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.")
+. qq|</p>
+
+<ul>
+ <li>| . $locale->text("<%netto_date%> -- Date the payment is due in " .
+ "full")
+. qq|</li>
+ <li>| . $locale->text("<%skonto_date%> -- Date the payment is due " .
+ "with discount")
+. qq|</li>
+ <li>| . $locale->text("<%skonto_amount%> -- The deductible amount")
+. qq|</li>
+ <li>| . $locale->text("<%total%> -- Amount payable")
+. qq|</li>
+ <li>| . $locale->text("<%total_wo_skonto%> -- Amount payable less discount")
+. qq|</li>
+ <li>| . $locale->text("<%invtotal%> -- Invoice total")
+. qq|</li>
+ <li>| . $locale->text("<%invtotal_wo_skonto%> -- Invoice total less discount")
+. qq|</li>
+ <li>| . $locale->text("<%currency%> -- The selected currency")
+. qq|</li>
+ <li>| . $locale->text("<%terms_netto%> -- The number of days for " .
+ "full payment")
+. qq|</li>
+ <li>| . $locale->text("<%account_number%> -- Your account number")
+. qq|</li>
+ <li>| . $locale->text("<%bank%> -- Your bank")
+. qq|</li>
+ <li>| . $locale->text("<%bank_code%> -- Your bank code")
+. qq|</li>
+</ul>|;
$lxdebug->leave_sub();
}
sub save_payment {
$lxdebug->enter_sub();
- $form->isblank("description", $locale->text('Language missing!'));
+ $form->isblank("description", $locale->text('Description missing!'));
+ $form->{"percent_skonto"} =
+ $form->parse_amount(\%myconfig, $form->{percent_skonto}) / 100;
AM->save_payment(\%myconfig, \%$form);
$form->redirect($locale->text('Payment Terms saved!'));
$lxdebug->leave_sub();
}
-sub add_sic {
+sub swap_payment_terms {
$lxdebug->enter_sub();
- $form->{title} = "Add";
-
- $form->{callback} =
- "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}"
- unless $form->{callback};
-
- &sic_header;
- &form_footer;
-
- $lxdebug->leave_sub();
-}
-
-sub edit_sic {
- $lxdebug->enter_sub();
-
- $form->{title} = "Edit";
-
- AM->get_sic(\%myconfig, \%$form);
-
- &sic_header;
-
- $form->{orphaned} = 1;
- &form_footer;
+ AM->swap_sortkeys(\%myconfig, $form, "payment_terms");
+ list_payment();
$lxdebug->leave_sub();
}
-sub list_sic {
+sub config {
$lxdebug->enter_sub();
- AM->sic(\%myconfig, \%$form);
-
- $form->{callback} =
- "$form->{script}?action=list_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}";
+ # get defaults for account numbers and last numbers
+ AM->defaultaccounts(\%myconfig, \%$form);
- $callback = $form->escape($form->{callback});
+ foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
+ $dateformat .=
+ ($item eq $myconfig{dateformat})
+ ? "<option selected>$item\n"
+ : "<option>$item\n";
+ }
- $form->{title} = $locale->text('Standard Industrial Codes');
+ foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
+ $numberformat .=
+ ($item eq $myconfig{numberformat})
+ ? "<option selected>$item\n"
+ : "<option>$item\n";
+ }
- @column_index = qw(code description);
+ foreach $item (qw(name company address signature)) {
+ $myconfig{$item} =~ s/\"/"/g;
+ }
- $column_header{code} =
- qq|<th class=listheading>| . $locale->text('Code') . qq|</th>|;
- $column_header{description} =
- qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
+ foreach $item (qw(address signature)) {
+ $myconfig{$item} =~ s/\\n/\r\n/g;
+ }
- $form->header;
+ @formats = ();
+ if ($opendocument_templates && $openofficeorg_writer_bin &&
+ $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)) {
+ push(@formats, { "name" => $locale->text("PDF (OpenDocument/OASIS)"),
+ "value" => "opendocument_pdf" });
+ }
+ if ($latex_templates) {
+ push(@formats, { "name" => $locale->text("PDF"), "value" => "pdf" });
+ }
+ push(@formats, { "name" => "HTML", "value" => "html" });
+ if ($latex_templates) {
+ push(@formats, { "name" => $locale->text("Postscript"),
+ "value" => "postscript" });
+ }
+ if ($opendocument_templates) {
+ push(@formats, { "name" => $locale->text("OpenDocument/OASIS"),
+ "value" => "opendocument" });
+ }
- print qq|
-<body>
+ if (!$myconfig{"template_format"}) {
+ $myconfig{"template_format"} = "pdf";
+ }
+ my $template_format = "";
+ foreach $item (@formats) {
+ $template_format .=
+ "<option value=\"$item->{value}\"" .
+ ($item->{"value"} eq $myconfig{"template_format"} ?
+ " selected" : "") .
+ ">" . H($item->{"name"}) . "</option>";
+ }
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>
+ if (!$myconfig{"default_media"}) {
+ $myconfig{"default_media"} = "screen";
+ }
+ my %selected = ($myconfig{"default_media"} => "selected");
+ my $default_media = qq|
+ <option value="screen" $selected{'screen'}>| . $locale->text("Screen") . qq|</option>
+ <option value="printer" $selected{'printer'}>| . $locale->text("Printer") . qq|</option>
+ <option value="queue" $selected{'queue'}>| . $locale->text("Queue") . qq|</option>
|;
- map { print "$column_header{$_}\n" } @column_index;
+ %selected = ();
+ $selected{$myconfig{"default_printer_id"}} = "selected"
+ if ($myconfig{"default_printer_id"});
+ my $default_printer = qq|<option></option>|;
+ AM->printer(\%myconfig, $form);
+ foreach my $printer (@{$form->{"ALL"}}) {
+ $default_printer .= qq|<option value="| . Q($printer->{"id"}) .
+ qq|" $selected{$printer->{'id'}}>| .
+ H($printer->{"printer_description"}) . qq|</option>|;
+ }
- print qq|
- </tr>
-|;
+ %countrycodes = User->country_codes;
+ $countrycodes = '';
+ foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
+ keys %countrycodes
+ ) {
+ $countrycodes .=
+ ($myconfig{countrycode} eq $key)
+ ? "<option selected value=$key>$countrycodes{$key}\n"
+ : "<option value=$key>$countrycodes{$key}\n";
+ }
+ $countrycodes = "<option>American English\n$countrycodes";
- foreach $ref (@{ $form->{ALL} }) {
+ foreach $key (keys %{ $form->{IC} }) {
+ foreach $accno (sort keys %{ $form->{IC}{$key} }) {
+ $myconfig{$key} .=
+ ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
+ ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
+ : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
+ }
+ }
- $i++;
- $i %= 2;
+# opendir CSS, "css/.";
+# @all = grep /.*\.css$/, readdir CSS;
+# closedir CSS;
- if ($ref->{sictype} eq 'H') {
- print qq|
- <tr valign=top class=listheading>
-|;
- $column_data{code} =
- qq|<th><a href=$form->{script}?action=edit_sic&code=$ref->{code}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{code}</th>|;
- $column_data{description} = qq|<th>$ref->{description}</th>|;
+# css dir has styles that are not intended as general layouts.
+# reverting to hardcoded list
+ @all = qw(lx-office-erp.css Win2000.css);
+ foreach $item (@all) {
+ if ($item eq $myconfig{stylesheet}) {
+ $selectstylesheet .= qq|<option selected>$item\n|;
} else {
- print qq|
- <tr valign=top class=listrow$i>
-|;
-
- $column_data{code} =
- qq|<td><a href=$form->{script}?action=edit_sic&code=$ref->{code}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{code}</td>|;
- $column_data{description} = qq|<td>$ref->{description}</td>|;
-
+ $selectstylesheet .= qq|<option>$item\n|;
}
-
- map { print "$column_data{$_}\n" } @column_index;
-
- print qq|
- </tr>
-|;
}
+ $selectstylesheet .= "<option>\n";
- 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=sic>
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>
+ $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
-<input class=submit type=submit name=action value="|
- . $locale->text('Add') . qq|">|;
+ $form->header;
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
+ if ($myconfig{menustyle} eq "old") {
+ $menustyle_old = "checked";
+ } elsif ($myconfig{menustyle} eq "neu") {
+ $menustyle_neu = "checked";
+ } elsif ($myconfig{menustyle} eq "v3") {
+ $menustyle_v3 = "checked";
}
- print qq|
- </form>
-
- </body>
- </html>
-|;
-
- $lxdebug->leave_sub();
-}
-
-sub sic_header {
- $lxdebug->enter_sub();
-
- $form->{title} = $locale->text("$form->{title} SIC");
-
- # $locale->text('Add SIC')
- # $locale->text('Edit SIC')
-
- $form->{code} =~ s/\"/"/g;
- $form->{description} =~ s/\"/"/g;
-
- $checked = ($form->{sictype} eq 'H') ? "checked" : "";
-
- $form->header;
+ my ($show_form_details, $hide_form_details);
+ $myconfig{"show_form_details"} = 1
+ unless (defined($myconfig{"show_form_details"}));
+ $show_form_details = "checked" if ($myconfig{"show_form_details"});
+ $hide_form_details = "checked" unless ($myconfig{"show_form_details"});
print qq|
<body>
<form method=post action=$form->{script}>
-<input type=hidden name=type value=sic>
-<input type=hidden name=id value=$form->{code}>
+<input type=hidden name=old_password value=$myconfig{password}>
+<input type=hidden name=type value=preferences>
+<input type=hidden name=role value=$myconfig{role}>
<table width=100%>
- <tr>
- <th class=listtop colspan=2>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <th align=right>| . $locale->text('Code') . qq|</th>
- <td><input name=code size=10 value=$form->{code}></td>
- <tr>
- <tr>
- <td></td>
- <th align=left><input name=sictype type=checkbox style=checkbox value="H" $checked> |
- . $locale->text('Heading') . qq|</th>
- <tr>
- <tr>
- <th align=right>| . $locale->text('Description') . qq|</th>
- <td><input name=description size=60 value="$form->{description}"></td>
- </tr>
- <td colspan=2><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
- $lxdebug->leave_sub();
-}
-
-sub save_sic {
- $lxdebug->enter_sub();
-
- $form->isblank("code", $locale->text('Code missing!'));
- $form->isblank("description", $locale->text('Description missing!'));
- AM->save_sic(\%myconfig, \%$form);
- $form->redirect($locale->text('SIC saved!'));
-
- $lxdebug->leave_sub();
-}
-
-sub delete_sic {
- $lxdebug->enter_sub();
-
- AM->delete_sic(\%myconfig, \%$form);
- $form->redirect($locale->text('SIC deleted!'));
-
- $lxdebug->leave_sub();
-}
-
-sub display_stylesheet {
- $lxdebug->enter_sub();
-
- $form->{file} = "css/$myconfig{stylesheet}";
- &display_form;
-
- $lxdebug->leave_sub();
-}
-
-sub display_form {
- $lxdebug->enter_sub();
-
- $form->{file} =~ s/^(.:)*?\/|\.\.\///g;
- $form->{file} =~ s/^\/*//g;
- $form->{file} =~ s/$userspath//;
-
- $form->error("$!: $form->{file}") unless -f $form->{file};
-
- AM->load_template(\%$form);
-
- $form->{title} = $form->{file};
-
- # if it is anything but html
- if ($form->{file} !~ /\.html$/) {
- $form->{body} = "<pre>\n$form->{body}\n</pre>";
- }
-
- $form->header;
-
- print qq|
-<body>
-
-$form->{body}
-
-<form method=post action=$form->{script}>
-
-<input name=file type=hidden value=$form->{file}>
-<input name=type type=hidden value=template>
-
-<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 name=action type=submit class=submit value="|
- . $locale->text('Edit') . qq|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
- </form>
-
-</body>
-</html>
-|;
-
- $lxdebug->leave_sub();
-}
-
-sub edit_template {
- $lxdebug->enter_sub();
-
- AM->load_template(\%$form);
-
- $form->{title} = $locale->text('Edit Template');
-
- # convert   to &nbsp;
- $form->{body} =~ s/ /&nbsp;/gi;
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input name=file type=hidden value=$form->{file}>
-<input name=type type=hidden value=template>
-
-<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 name=callback type=hidden value="$form->{script}?action=display_form&file=$form->{file}&path=$form->{path}&login=$form->{login}&password=$form->{password}">
-
-<textarea name=body rows=25 cols=70>
-$form->{body}
-</textarea>
-
-<br>
-<input type=submit class=submit name=action value="|
- . $locale->text('Save') . qq|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print q|
- </form>
-
-
-</body>
-</html>
-|;
-
- $lxdebug->leave_sub();
-}
-
-sub save_template {
- $lxdebug->enter_sub();
-
- AM->save_template(\%$form);
- $form->redirect($locale->text('Template saved!'));
-
- $lxdebug->leave_sub();
-}
-
-sub config {
- $lxdebug->enter_sub();
-
- # get defaults for account numbers and last numbers
- AM->defaultaccounts(\%myconfig, \%$form);
-
- foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
- $dateformat .=
- ($item eq $myconfig{dateformat})
- ? "<option selected>$item\n"
- : "<option>$item\n";
- }
-
- foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
- $numberformat .=
- ($item eq $myconfig{numberformat})
- ? "<option selected>$item\n"
- : "<option>$item\n";
- }
-
- foreach $item (qw(name company address signature)) {
- $myconfig{$item} =~ s/\"/"/g;
- }
-
- foreach $item (qw(address signature)) {
- $myconfig{$item} =~ s/\\n/\r\n/g;
- }
-
- @formats = ();
- if ($opendocument_templates && $openofficeorg_writer_bin &&
- $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)) {
- push(@formats, { "name" => $locale->text("PDF (OpenDocument/OASIS)"),
- "value" => "opendocument_pdf" });
- }
- if ($latex_templates) {
- push(@formats, { "name" => $locale->text("PDF"), "value" => "pdf" });
- }
- push(@formats, { "name" => "HTML", "value" => "html" });
- if ($latex_templates) {
- push(@formats, { "name" => $locale->text("Postscript"),
- "value" => "postscript" });
- }
- if ($opendocument_templates) {
- push(@formats, { "name" => $locale->text("OpenDocument/OASIS"),
- "value" => "opendocument" });
- }
-
- if (!$myconfig{"template_format"}) {
- $myconfig{"template_format"} = "pdf";
- }
- $template_format = "";
- foreach $item (@formats) {
- $template_format .=
- "<option value=\"$item->{value}\"" .
- ($item->{"value"} eq $myconfig{"template_format"} ?
- " selected" : "") .
- ">" . H($item->{"name"}) . "</option>";
- }
-
- %countrycodes = User->country_codes;
- $countrycodes = '';
- foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
- keys %countrycodes
- ) {
- $countrycodes .=
- ($myconfig{countrycode} eq $key)
- ? "<option selected value=$key>$countrycodes{$key}\n"
- : "<option value=$key>$countrycodes{$key}\n";
- }
- $countrycodes = "<option>American English\n$countrycodes";
-
- # use an other input number format than output numberformat
- # look at Form.pm, sub parse_amount
- my $in_numberformat = '';
- $text1 = qq|value="0">| . $locale->text('equal Outputformat');
- $text2 = qq|value="1">| . $locale->text('1000,00 or 1000.00');
- @in_nf = ($text1, $text2);
- foreach $item (@in_nf) {
- $in_numberformat .=
- (substr($item, 7, 1) eq $myconfig{in_numberformat})
- ? "<option selected $item\n"
- : "<option $item\n";
- }
-
- foreach $key (keys %{ $form->{IC} }) {
- foreach $accno (sort keys %{ $form->{IC}{$key} }) {
- $myconfig{$key} .=
- ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
- ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
- : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
- }
- }
-
- opendir CSS, "css/.";
- @all = grep /.*\.css$/, readdir CSS;
- closedir CSS;
-
- foreach $item (@all) {
- if ($item eq $myconfig{stylesheet}) {
- $selectstylesheet .= qq|<option selected>$item\n|;
- } else {
- $selectstylesheet .= qq|<option>$item\n|;
- }
- }
- $selectstylesheet .= "<option>\n";
-
- $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
-
- $form->header;
-
- if ($myconfig{menustyle} eq "old") {
- $menustyle_old = "checked";
- } elsif ($myconfig{menustyle} eq "neu") {
- $menustyle_neu = "checked";
- } elsif ($myconfig{menustyle} eq "v3") {
- $menustyle_v3 = "checked";
- }
-
- my ($show_form_details, $hide_form_details);
- $myconfig{"show_form_details"} = 1
- unless (defined($myconfig{"show_form_details"}));
- $show_form_details = "checked" if ($myconfig{"show_form_details"});
- $hide_form_details = "checked" unless ($myconfig{"show_form_details"});
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=old_password value=$myconfig{password}>
-<input type=hidden name=type value=preferences>
-<input type=hidden name=role value=$myconfig{role}>
-
-<table width=100%>
- <tr><th class=listtop>$form->{title}</th></tr>
+ <tr><th class=listtop>$form->{title}</th></tr>
<tr>
<td>
<table>
<th align=right>| . $locale->text('Output Number Format') . qq|</th>
<td><select name=numberformat>$numberformat</select></td>
</tr>
- <tr>
- <th align=right>| . $locale->text('Input Number Format') . qq|</th>
- <td><select name=in_numberformat>$in_numberformat</select></td>
- </tr>
<tr>
<th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
<th align=right>| . $locale->text('Default template format') . qq|</th>
<td><select name="template_format">$template_format</select></td>
</tr>
+ <tr>
+ <th align=right>| . $locale->text('Default output medium') . qq|</th>
+ <td><select name="default_media">$default_media</select></td>
+ </tr>
+ <tr>
+ <th align=right>| . $locale->text('Default printer') . qq|</th>
+ <td><select name="default_printer_id">$default_printer</select></td>
+ </tr>
<tr>
<th align=right>| . $locale->text('Number of copies') . qq|</th>
<td><input name="copies" size="10" value="| .
</tr>
</table>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
<br>
<input type=submit class=submit name=action value="|
- . $locale->text('Save') . qq|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
+ . $locale->text('Save') . qq|">
- print qq|
</form>
</body>
$lxdebug->leave_sub();
}
-sub backup {
- $lxdebug->enter_sub();
-
- if ($form->{media} eq 'email') {
- $form->error($locale->text('No email address for') . " $myconfig{name}")
- unless ($myconfig{email});
-
- $form->{OUT} = "$sendmail";
-
- }
-
- AM->backup(\%myconfig, \%$form, $userspath);
-
- if ($form->{media} eq 'email') {
- $form->redirect($locale->text('Backup sent to') . qq| $myconfig{email}|);
- }
-
- $lxdebug->leave_sub();
-}
-
sub audit_control {
$lxdebug->enter_sub();
<form method=post action=$form->{script}>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
$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|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print 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->{nextsub} };
-
- $lxdebug->leave_sub();
-}
-
sub edit_units {
$lxdebug->enter_sub();
@languages = AM->language(\%myconfig, $form, 1);
- @unit_list = ();
- foreach $name (sort({ lc($a) cmp lc($b) } grep({ !$units->{$_}->{"base_unit"} } keys(%{$units})))) {
- map({ push(@unit_list, $units->{$_}); }
- sort({ ($units->{$a}->{"resolved_factor"} * 1) <=> ($units->{$b}->{"resolved_factor"} * 1) }
- grep({ $units->{$_}->{"resolved_base_unit"} eq $name } keys(%{$units}))));
- }
+ @unit_list = sort({ $a->{"sortkey"} <=> $b->{"sortkey"} } values(%{$units}));
+
my $i = 1;
foreach (@unit_list) {
- $_->{"factor"} = $form->format_amount(\%myconfig, $_->{"factor"}, 5) if ($_->{"factor"});
+ $_->{"factor"} = $form->format_amount(\%myconfig, $_->{"factor"} * 1) if ($_->{"factor"});
$_->{"UNITLANGUAGES"} = [];
foreach my $lang (@languages) {
push(@{ $_->{"UNITLANGUAGES"} },
$units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
$ddbox = AM->unit_select_data($units, undef, 1);
+ my $updownlink = build_std_url("action=swap_units", "unit_type");
+
$form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
$form->header();
print($form->parse_html_template("am/edit_units",
{ "UNITS" => \@unit_list,
"NEW_BASE_UNIT_DDBOX" => $ddbox,
- "LANGUAGES" => \@languages }));
+ "LANGUAGES" => \@languages,
+ "updownlink" => $updownlink }));
$lxdebug->leave_sub();
}
$lxdebug->leave_sub();
}
+
+sub show_history_search {
+ $lxdebug->enter_sub();
+
+ $form->{title} = $locale->text("History Search");
+ $form->header();
+
+ print $form->parse_html_template("/common/search_history");
+
+ $lxdebug->leave_sub();
+}
+
+sub show_am_history {
+ $lxdebug->enter_sub();
+ my %search = ( "Artikelnummer" => "parts",
+ "Kundennummer" => "customer",
+ "Lieferantennummer" => "vendor",
+ "Projektnummer" => "project",
+ "Buchungsnummer" => "oe",
+ "Eingangsrechnungnummer" => "ap",
+ "Ausgangsrechnungnummer" => "ar",
+ "Mahnungsnummer" => "dunning"
+ );
+ my %searchNo = ( "Artikelnummer" => "partnumber",
+ "Kundennummer" => "customernumber",
+ "Lieferantennummer" => "vendornumber",
+ "Projektnummer" => "projectnummer",
+ "Buchungsnummer" => "ordnumber",
+ "Eingangsrechnungnummer" => "invnumber",
+ "Ausgangsrechnungnummer" => "invnumber",
+ "Mahnungsnummer" => "dunning_id"
+ );
+
+ my $restriction;
+ my $tempNo = 0;
+ foreach(split(/\,/, $form->{einschraenkungen})) {
+ if($tempNo == 0) {
+ $restriction .= " AND addition = '" . $_ . "'";
+ $tempNo = 1;
+ }
+ else {
+ $restriction .= " OR addition = '" . $_ . "'";
+ }
+ }
+ $restriction .= (($form->{transdate} ne "" && $form->{reqdate} ne "")
+ ? qq| AND st.itime::date >= '| . $form->{transdate} . qq|' AND st.itime::date <= '| . $form->{reqdate} . qq|'|
+ : (($form->{transdate} ne "" && $form->{reqdate} eq "")
+ ? qq| AND st.itime::date >= '| . $form->{transdate} . qq|'|
+ : ($form->{transdate} eq "" && $form->{reqdate} ne "")
+ ? qq| AND st.itime::date <= '| . $form->{reqdate} . qq|'|
+ : ""
+ )
+ );
+ $restriction .= ($form->{mitarbeiter} eq "" ? ""
+ : ($form->{mitarbeiter} =~ /^[0-9]*$/
+ ? " AND employee_id = " . $form->{mitarbeiter}
+ : " AND employee_id = " . &get_employee_id($form->{mitarbeiter}, $dbh)));
+
+ my $dbh = $form->dbconnect(\%myconfig);
+ my $query = qq|SELECT trans_id AS id FROM history_erp | .
+ ($form->{'searchid'} ?
+ qq| WHERE snumbers = '| . $searchNo{$form->{'what2search'}} . qq|_| . $form->{'searchid'} . qq|'| :
+ qq| WHERE snumbers ~ '^| . $searchNo{$form->{'what2search'}} . qq|'|);
+
+ my $sth = $dbh->prepare($query);
+
+ $sth->execute() || $form->dberror($query);
+
+ $form->{title} = $locale->text("History Search");
+ $form->header();
+
+ my $i = 1;
+ my $daten = qq||;
+ while(my $hash_ref = $sth->fetchrow_hashref()){
+ if($i) {
+ $daten .= $hash_ref->{id};
+ $i = 0;
+ }
+ else {
+ $daten .= " OR trans_id = " . $hash_ref->{id};
+ }
+ }
+
+ my ($sort, $sortby) = split(/\-\-/, $form->{order});
+ $sort =~ s/.*\.(.*)$/$1/;
+
+ print $form->parse_html_template("/common/show_history",
+ {"DATEN" => $form->get_history($dbh, $daten, $restriction, $form->{order}),
+ "SUCCESS" => ($form->get_history($dbh, $daten, $restriction, $form->{order}) ne "0"),
+ "NONEWWINDOW" => 1,
+ uc($sort) => 1,
+ uc($sort)."BY" => $sortby
+ });
+ $dbh->disconnect();
+ $lxdebug->leave_sub();
+}
+
+sub get_employee_id {
+ $lxdebug->enter_sub();
+ my $query = qq|SELECT id FROM employee WHERE name = '| . $_[0] . qq|'|;
+ my $sth = $_[1]->prepare($query);
+ $sth->execute() || $form->dberror($query);
+ my $return = $sth->fetch();
+ $sth->finish();
+ return ${$return}[0];
+ $lxdebug->leave_sub();
+}
+
+sub swap_units {
+ $lxdebug->enter_sub();
+
+ my $dir = $form->{"dir"} eq "down" ? "down" : "up";
+ my $unit_type = $form->{"unit_type"} eq "dimension" ?
+ "dimension" : "service";
+ AM->swap_units(\%myconfig, $form, $dir, $form->{"name"}, $unit_type);
+
+ edit_units();
+
+ $lxdebug->leave_sub();
+}
+
+sub add_tax {
+ $lxdebug->enter_sub();
+
+ $form->{title} = $locale->text('Add');
+
+ $form->{callback} =
+ "$form->{script}?action=add_tax&login=$form->{login}&password=$form->{password}"
+ unless $form->{callback};
+
+ _get_taxaccount_selection();
+
+ $form->header();
+
+ my $parameters_ref = {
+# ChartTypeIsAccount => $ChartTypeIsAccount,
+ };
+
+ # Ausgabe des Templates
+ print($form->parse_html_template2('am/edit_tax', $parameters_ref));
+
+ $lxdebug->leave_sub();
+}
+
+sub edit_tax {
+ $lxdebug->enter_sub();
+
+ $form->{title} = $locale->text('Edit');
+
+ AM->get_tax(\%myconfig, \%$form);
+ _get_taxaccount_selection();
+
+ $form->{rate} = $form->format_amount(\%myconfig, $form->{rate}, 2);
+
+ $form->header();
+
+ my $parameters_ref = {
+ };
+
+ # Ausgabe des Templates
+ print($form->parse_html_template2('am/edit_tax', $parameters_ref));
+
+ $lxdebug->leave_sub();
+}
+
+sub list_tax {
+ $lxdebug->enter_sub();
+
+ AM->taxes(\%myconfig, \%$form);
+
+ map { $_->{rate} = $form->format_amount(\%myconfig, $_->{rate}, 2) } @{ $form->{TAX} };
+
+ $form->{callback} = build_std_url('action=list_tax');
+
+ $form->{title} = $locale->text('Tax-O-Matic');
+
+ $form->header();
+
+ # Ausgabe des Templates
+ print($form->parse_html_template2('am/list_tax', $parameters_ref));
+
+ $lxdebug->leave_sub();
+}
+
+sub _get_taxaccount_selection{
+ $lxdebug->enter_sub();
+
+ AM->get_tax_accounts(\%myconfig, \%$form);
+
+ map { $_->{selected} = $form->{chart_id} == $_->{id} } @{ $form->{ACCOUNTS} };
+
+ $lxdebug->leave_sub();
+}
+
+sub save_tax {
+ $lxdebug->enter_sub();
+
+ $form->isblank("rate", $locale->text('Taxrate missing!'));
+ $form->isblank("taxdescription", $locale->text('Taxdescription missing!'));
+ $form->isblank("taxkey", $locale->text('Taxkey missing!'));
+
+ $form->{rate} = $form->parse_amount(\%myconfig, $form->{rate});
+
+ if ( $form->{rate} < 0 || $form->{rate} >= 100 ) {
+ $form->error($locale->text('Tax Percent is a number between 0 and 100'));
+ }
+
+ if ( $form->{rate} <= 0.99 && $form->{rate} > 0 ) {
+ $form->error($locale->text('Tax Percent is a number between 0 and 100'));
+ }
+
+ AM->save_tax(\%myconfig, \%$form);
+ $form->redirect($locale->text('Tax saved!'));
+
+ $lxdebug->leave_sub();
+}
+
+sub delete_tax {
+ $lxdebug->enter_sub();
+
+ AM->delete_tax(\%myconfig, \%$form);
+ $form->redirect($locale->text('Tax deleted!'));
+
+ $lxdebug->leave_sub();
+}
--- /dev/null
+#=====================================================================
+# LX-Office ERP
+# Copyright (C) 2004
+# Based on SQL-Ledger Version 2.1.9
+# Web http://www.lx-office.org
+#
+#=====================================================================
+# SQL-Ledger Accounting
+# Copyright (c) 1998-2002
+#
+# Author: Dieter Simader
+# Email: dsimader@sql-ledger.org
+# Web: http://www.sql-ledger.org
+#
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#======================================================================
+#
+# administration
+#
+#======================================================================
+
+use SL::AM;
+use SL::Form;
+
+use Data::Dumper;
+
+1;
+
+require "bin/mozilla/common.pl";
+
+# end of main
+
+sub display {
+ call_sub($form->{display_nextsub});
+}
+
+sub save {
+ call_sub($form->{save_nextsub});
+}
+
+sub edit {
+ call_sub($form->{edit_nextsub});
+}
+
+sub display_template {
+ $lxdebug->enter_sub();
+
+ $form->{edit} = 0;
+ display_template_form();
+
+ $lxdebug->leave_sub();
+}
+
+sub edit_template {
+ $lxdebug->enter_sub();
+
+ $form->{edit} = 1;
+ display_template_form();
+
+ $lxdebug->leave_sub();
+}
+
+sub save_template {
+ $lxdebug->enter_sub();
+
+ $form->isblank("formname", $locale->text("You're not editing a file.")) unless ($form->{type} eq "stylesheet");
+
+ my ($filename) = AM->prepare_template_filename(\%myconfig, $form);
+ if (my $error = AM->save_template($filename, $form->{content})) {
+ $form->error(sprintf($locale->text("Saving the file '%s' failed. OS error message: %s"), $filename, $error));
+ }
+
+ $form->{edit} = 0;
+ display_template_form();
+
+ $lxdebug->leave_sub();
+}
+
+sub display_template_form {
+ $lxdebug->enter_sub();
+
+ $form->{"formname"} =~ s|.*/||;
+ my $format = $form->{"format"} eq "html" ? "html" : "tex";
+
+ $form->{"title"} = $form->{"type"} eq "stylesheet" ? $locale->text("Edit the stylesheet") : $locale->text("Edit templates");
+
+ my %options;
+
+ my @hidden = qw(login password type format);
+
+ if (($form->{"type"} ne "stylesheet") && !$form->{"edit"}) {
+ $options{"SHOW_EDIT_OPTIONS"} = 1;
+
+ #
+ # Setup "formname" selection
+ #
+
+ $form->get_lists("printers" => "ALL_PRINTERS",
+ "languages" => "ALL_LANGUAGES",
+ "dunning_configs" => "ALL_DUNNING_CONFIGS");
+
+ my %formname_setup =
+ (
+ "balance_sheet" => { "translation" => $locale->text('Balance Sheet'), "html" => 1 },
+ "bin_list" => $locale->text('Bin List'),
+ "bwa" => { "translation" => $locale->text('BWA'), "html" => 1 },
+ "check" => { "translation" => $locale->text('Check'), "html" => 1 },
+ "credit_note" => $locale->text('Credit Note'),
+ "income_statement" => { "translation" => $locale->text('Income Statement'), "html" => 1 },
+ "invoice" => $locale->text('Invoice'),
+ "packing_list" => $locale->text('Packing List'),
+ "pick_list" => $locale->text('Pick List'),
+ "proforma" => $locale->text('Proforma Invoice'),
+ "purchase_order" => $locale->text('Purchase Order'),
+ "receipt" => { "translation" => $locale->text('Receipt'), "tex" => 1 },
+ "request_quotation" => $locale->text('RFQ'),
+ "sales_order" => $locale->text('Confirmation'),
+ "sales_quotation" => $locale->text('Quotation'),
+ "statement" => $locale->text('Statement'),
+ "storno_invoice" => $locale->text('Storno Invoice'),
+ "storno_packing_list" => $locale->text('Storno Packing List'),
+ "ustva-2004" => { "translation" => $locale->text("USTVA 2004"), "tex" => 1 },
+ "ustva-2005" => { "translation" => $locale->text("USTVA 2005"), "tex" => 1 },
+ "ustva-2006" => { "translation" => $locale->text("USTVA 2006"), "tex" => 1 },
+ "ustva-2007" => { "translation" => $locale->text("USTVA 2007"), "tex" => 1 },
+ "ustva" => $locale->text("USTVA"),
+ );
+
+ my (@values, $file, $setup);
+
+ while (($file, $setup) = each(%formname_setup)) {
+ next if ref($setup) && !$setup->{$format};
+
+ push(@values,
+ { "value" => $file,
+ "label" => ref($setup) ? $setup->{"translation"} : $setup,
+ "default" => $file eq $form->{"formname"} });
+ }
+
+ # "zahlungserinnerung" => $locale->text('Payment Reminder'),
+
+ foreach my $ref (@{ $form->{"ALL_DUNNING_CONFIGS"} }) {
+ next if !$ref->{"template"};
+
+ push(@values,
+ { "value" => $ref->{"template"},
+ "label" => $locale->text('Payment Reminder') . ": " . $ref->{"dunning_description"},
+ "default" => $ref->{"template"} eq $form->{"formname"} });
+ }
+
+ @values = sort({ $a->{"label"} cmp $b->{"label"} } @values);
+
+ $options{"FORMNAME"} = [ @values ];
+
+ #
+ # Setup "language" selection
+ #
+
+ @values = ( { "value" => "", "label" => "", "default" => 0 } );
+
+ foreach my $item (@{ $form->{"ALL_LANGUAGES"} }) {
+ next unless ($item->{"template_code"});
+
+ my $key = "$item->{id}--$item->{template_code}";
+
+ push(@values,
+ { "value" => $key,
+ "label" => $item->{"description"},
+ "default" => $key eq $form->{"language"} });
+ }
+
+ $options{"LANGUAGE"} = [ @values ];
+ $options{"SHOW_LANGUAGE"} = scalar(@values) > 1;
+
+ @values = ( { "value" => "", "label" => "", "default" => 0 } );
+
+ #
+ # Setup "printer" selection
+ #
+
+ foreach my $item (@{ $form->{"ALL_PRINTERS"} }) {
+ next unless ($item->{"template_code"});
+
+ my $key = "$item->{id}--$item->{template_code}";
+
+ push(@values,
+ { "value" => $key,
+ "label" => $item->{"printer_description"},
+ "default" => $key eq $form->{"printer"} });
+ }
+
+ $options{"PRINTER"} = [ @values ];
+ $options{"SHOW_PRINTER"} = scalar(@values) > 1;
+
+ } else {
+ push(@hidden, qw(formname language printer));
+ }
+
+ if ($form->{formname} || ($form->{type} eq "stylesheet")) {
+ $options{"SHOW_CONTENT"} = 1;
+
+ ($options{"filename"}, $options{"display_filename"})
+ = AM->prepare_template_filename(\%myconfig, $form);
+
+ ($options{"content"}, $options{"lines"})
+ = AM->load_template($options{"filename"});
+
+ $options{"CAN_EDIT"} = $form->{"edit"};
+
+ if ($form->{edit}) {
+ $form->{fokus} = "Form.content";
+
+ } else {
+ $options{"content"} = "\n\n" if (!$options{"content"});
+ $options{"SHOW_SECOND_EDIT_BUTTON"} = $options{"lines"} > 25;
+ }
+ }
+
+ $options{"HIDDEN"} = [ map(+{ "name" => $_, "value" => $form->{$_} }, @hidden) ];
+
+ $form->header;
+ print($form->parse_html_template("am/edit_templates", \%options));
+
+ $lxdebug->leave_sub();
+}
+
+1;
#
#======================================================================
+use POSIX qw(strftime);
+
use SL::AP;
use SL::IR;
+use SL::IS;
use SL::PE;
+use SL::ReportGenerator;
-require "$form->{path}/arap.pl";
+require "bin/mozilla/arap.pl";
+require "bin/mozilla/common.pl";
+require "bin/mozilla/drafts.pl";
+require "bin/mozilla/reportgenerator.pl";
1;
sub add {
$lxdebug->enter_sub();
+ return $lxdebug->leave_sub() if (load_draft_maybe());
+
$form->{title} = "Add";
$form->{callback} =
- "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=add&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
- &create_links;
AP->get_transdate(\%myconfig, $form);
+ $form->{initial_transdate} = $form->{transdate};
+ &create_links;
+ $form->{transdate} = $form->{initial_transdate};
&display_form;
$lxdebug->leave_sub();
# build the popup menus
$form->{taxincluded} = ($form->{id}) ? $form->{taxincluded} : "checked";
- map {
- $tax .=
- qq|<option value=\"$_->{id}--$_->{rate}\">$_->{taxdescription} |
- . ($_->{rate} * 100) . qq| %|
- } @{ $form->{TAX} };
- $form->{taxchart} = $tax;
- $form->{selecttaxchart} = $tax;
+ # notes
+ $form->{notes} = $form->{intnotes} unless $form->{notes};
# currencies
@curr = split(/:/, $form->{currencies});
$form->{employee} = "$form->{employee}--$form->{employee_id}";
- # forex
- $form->{forex} = $form->{exchangerate};
- $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
-
- foreach $key (keys %{ $form->{AP_links} }) {
- foreach $ref (@{ $form->{AP_links}{$key} }) {
- if ($key eq "AP_paid") {
- $form->{"select$key"} .=
- "<option value=\"$ref->{accno}\">$ref->{accno}--$ref->{description}</option>\n";
- } else {
- $form->{"select$key"} .=
- "<option value=\"$ref->{accno}--$ref->{tax_id}\">$ref->{accno}--$ref->{description}</option>\n";
- }
- }
-
- $form->{$key} = $form->{"select$key"};
-
- # if there is a value we have an old entry
- my $j = 0;
- my $k = 0;
-
- for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
-
- if ($key eq "AP_paid") {
- $j++;
- $form->{"AP_paid_$j"} =
- "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
- $form->{"paid_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{amount};
- $form->{"datepaid_$j"} =
- $form->{acc_trans}{$key}->[$i - 1]->{transdate};
- $form->{"source_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{source};
- $form->{"memo_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{memo};
-
- $form->{"forex_$j"} = $form->{"exchangerate_$i"} =
- $form->{acc_trans}{$key}->[$i - 1]->{exchangerate};
- $form->{"AP_paid_$j"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}";
- $form->{paidaccounts}++;
- } else {
-
- $akey = $key;
- $akey =~ s/AP_//;
-
- if (($key eq "AP_tax") || ($key eq "AR_tax")) {
- $form->{"${key}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} =
- "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
- $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} =
- $form->round_amount(
- $form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate,
- 2);
-
- if ($form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"} > 0) {
- $totaltax +=
- $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
- $taxrate +=
- $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
- } else {
- $totalwithholding +=
- $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
- $withholdingrate +=
- $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
- }
- $index = $form->{acc_trans}{$key}->[$i - 1]->{index};
- $form->{"tax_$index"} =
- $form->{acc_trans}{$key}->[$i - 1]->{amount} * -1;
- $totaltax += $form->{"tax_$index"};
-
- } else {
- $k++;
- $form->{"${akey}_$k"} =
- $form->round_amount(
- $form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate,
- 2);
- if ($akey eq 'amount') {
- $form->{rowcount}++;
- $form->{"${akey}_$i"} *= -1;
- $totalamount += $form->{"${akey}_$i"};
- $form->{taxrate} = $form->{acc_trans}{$key}->[$i - 1]->{rate};
- $form->{"oldprojectnumber_$k"} = $form->{"projectnumber_$k"} =
- "$form->{acc_trans}{$key}->[$i-1]->{projectnumber}";
- $form->{"project_id_$k"} =
- "$form->{acc_trans}{$key}->[$i-1]->{project_id}";
- }
- $form->{"${key}_$k"} =
- "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
- my $q_description = quotemeta($form->{acc_trans}{$key}->[$i-1]->{description});
- $form->{"select${key}"} =~
- /<option value=\"($form->{acc_trans}{$key}->[$i-1]->{accno}--[^\"]*)\">$form->{acc_trans}{$key}->[$i-1]->{accno}--${q_description}<\/option>\n/;
- $form->{"${key}_$k"} = $1;
- if ($akey eq 'amount') {
- $form->{"taxchart_$k"} = $form->{taxchart};
- $form->{"taxchart_$k"} =~
- /<option value=\"($form->{acc_trans}{$key}->[$i-1]->{id}--[^\"]*)/;
- $form->{"taxchart_$k"} = $1;
- }
- }
- }
- }
- }
-
- $form->{taxincluded} = $taxincluded if ($form->{id});
- $form->{paidaccounts} = 1 if not defined $form->{paidaccounts};
-
- if ($form->{taxincluded} && $form->{taxrate} && $totalamount) {
-
- # add tax to amounts and invtotal
- for $i (1 .. $form->{rowcount}) {
- $taxamount =
- ($totaltax + $totalwithholding) * $form->{"amount_$i"} / $totalamount;
- $tax = $form->round_amount($taxamount, 2);
- $diff += ($taxamount - $tax);
- $form->{"amount_$i"} += $form->{"tax_$i"};
- }
- $form->{amount_1} += $form->round_amount($diff, 2);
- }
-
- $taxamount = $form->round_amount($taxamount, 2);
-
- $form->{invtotal} = $totalamount + $totaltax;
+ AP->setup_form($form);
$form->{locked} =
($form->datetonum($form->{transdate}, \%myconfig) <=
};
//-->
</script>|;
+ # show history button
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/show_history.js"></script>|;
+ #/show hhistory button
# set option selected
foreach $item (qw(vendor currency department)) {
$form->{radier} =
($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
$readonly = ($form->{radier}) ? "" : $readonly;
- $selectAP_amount_unquoted = $form->{selectAP_amount};
- $taxchart = $form->{taxchart};
- map { $form->{$_} =~ s/\"/"/g }
- qw(AP_amount selectAP_amount AP taxchart);
+
+ $form->{exchangerate} = $exchangerate
+ if (
+ $form->{forex} = (
+ $exchangerate =
+ $form->check_exchangerate(
+ \%myconfig, $form->{currency}, $form->{transdate}, 'sell'
+ )));
+
# format amounts
$form->{exchangerate} =
$form->format_amount(\%myconfig, $form->{exchangerate});
-
+ if ($form->{exchangerate} == 0) {
+ $form->{exchangerate} = "";
+ }
$form->{creditlimit} =
$form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
$form->{creditremaining} =
$vendor =
($form->{selectvendor})
- ? qq|<select name=vendor>$form->{selectvendor}</select>|
+ ? qq|<select name="vendor"
+onchange="document.getElementById('update_button').click();">$form->{
+selectvendor } </select>|
: qq|<input name=vendor value="$form->{vendor}" size=35>|;
+ my @old_project_ids = ();
+ map({ push(@old_project_ids, $form->{"project_id_$_"})
+ if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
+
+ $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
+ "all" => 0,
+ "old_id" => \@old_project_ids },
+ "charts" => { "key" => "ALL_CHARTS",
+ "transdate" => $form->{transdate} },
+ "taxcharts" => "ALL_TAXCHARTS");
+
+ map({ $_->{link_split} = [ split(/:/, $_->{link}) ]; }
+ @{ $form->{ALL_CHARTS} });
+
+ my %project_labels = ();
+ my @project_values = ("");
+ foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
+ push(@project_values, $item->{"id"});
+ $project_labels{$item->{"id"}} = $item->{"projectnumber"};
+ }
+
+ my (%AP_amount_labels, @AP_amount_values);
+ my (%AP_labels, @AP_values);
+ my (%AP_paid_labels, @AP_paid_values);
+ my %charts;
+ my $taxchart_init;
+
+ foreach my $item (@{ $form->{ALL_CHARTS} }) {
+ if (grep({ $_ eq "AP_amount" } @{ $item->{link_split} })) {
+ $taxchart_init = $item->{tax_id} if ($taxchart_init eq "");
+ my $key = "$item->{accno}--$item->{tax_id}";
+ push(@AP_amount_values, $key);
+ $AP_amount_labels{$key} =
+ "$item->{accno}--$item->{description}";
+
+ } elsif (grep({ $_ eq "AP" } @{ $item->{link_split} })) {
+ push(@AP_values, $item->{accno});
+ $AP_labels{$item->{accno}} = "$item->{accno}--$item->{description}";
+
+ } elsif (grep({ $_ eq "AP_paid" } @{ $item->{link_split} })) {
+ push(@AP_paid_values, $item->{accno});
+ $AP_paid_labels{$item->{accno}} =
+ "$item->{accno}--$item->{description}";
+ }
+
+ $charts{$item->{accno}} = $item;
+ }
+
+ my %taxchart_labels = ();
+ my @taxchart_values = ();
+ my %taxcharts = ();
+ foreach my $item (@{ $form->{ALL_TAXCHARTS} }) {
+ my $key = "$item->{id}--$item->{rate}";
+ $taxchart_init = $key if ($taxchart_init eq $item->{id});
+ push(@taxchart_values, $key);
+ $taxchart_labels{$key} =
+ "$item->{taxdescription} " . ($item->{rate} * 100) . ' %';
+ $taxcharts{$item->{id}} = $item;
+ }
+
# use JavaScript Calendar or not
- $form->{jsscript} = $jscalendar;
+ $form->{jsscript} = 1;
$jsscript = "";
if ($form->{jsscript}) {
# with JavaScript Calendar
$button1 = qq|
- <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}> $readonly</td>
+ <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" onBlur=\"check_right_date_format(this)\"> $readonly</td>
<td><input type=button name=transdate id="trigger1" value=|
. $locale->text('button') . qq|></td>
|;
$button2 = qq|
- <td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}> $readonly</td>
+ <td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value="$form->{duedate}" onBlur=\"check_right_date_format(this)\"> $readonly</td>
<td><input type=button name=duedate id="trigger2" value=|
. $locale->text('button') . qq|></td></td>
|;
# without JavaScript Calendar
$button1 =
- qq|<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}> $readonly</td>|;
+ qq|<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" onBlur=\"check_right_date_format(this)\"> $readonly</td>|;
$button2 =
- qq|<td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}> $readonly</td>|;
+ qq|<td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value="$form->{duedate}" onBlur=\"check_right_date_format(this)\"> $readonly</td>|;
}
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/show_vc_details.js"></script>|;
$form->header;
-
+ $onload = qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
+ $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
print qq|
-<body>
+<body onLoad="$onload">
<form method=post action=$form->{script}>
<input type=hidden name=locked value=$form->{locked}>
<input type=hidden name=title value="$title">
+| . ($form->{saved_message} ? qq|<p>$form->{saved_message}</p>| : "") . qq|
+
<table width=100%>
<tr class=listtop>
<th class=listtop>$form->{title}</th>
<table>
<tr>
<th align=right nowrap>| . $locale->text('Vendor') . qq|</th>
- <td colspan=3>$vendor</td>
+ <td colspan=3>$vendor <input type="button" value="?" onclick="show_vc_details('vendor')"></td>
<input type=hidden name=selectvendor value="$form->{selectvendor}">
<input type=hidden name=oldvendor value="$form->{oldvendor}">
<input type=hidden name=vendor_id value="$form->{vendor_id}">
$jsscript
- <input type=hidden name=selectAP_amount value="$form->{selectAP_amount}">
- <input type=hidden name=AP_amount value="$form->{AP_amount}">
- <input type=hidden name=taxchart value="$form->{taxchart}">
<input type=hidden name=rowcount value=$form->{rowcount}>
<tr>
<td>
$form->{"amount_$i"} =
$form->format_amount(\%myconfig, $form->{"amount_$i"}, 2);
$form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2);
- $selectAP_amount = $selectAP_amount_unquoted;
- $re_amount = quotemeta($form->{"AP_amount_$i"});
- $selectAP_amount =~
- s/option value=\"${re_amount}\"/option value=\"$form->{"AP_amount_$i"}\" selected/;
- $tax = $taxchart;
- $tax_selected = $form->{"taxchart_$i"};
- $tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/;
- $tax =
- qq|<td><select id="taxchart_$i" name="taxchart_$i" style="width:200px">$tax</select></td>|;
+
+ my $selected_accno_full;
+ my ($accno_row) = split(/--/, $form->{"AP_amount_$i"});
+ my $item = $charts{$accno_row};
+ $selected_accno_full = "$item->{accno}--$item->{tax_id}";
+
+ my $selected_taxchart = $form->{"taxchart_$i"};
+ my ($selected_accno, $selected_tax_id) = split(/--/, $selected_accno_full);
+ my ($previous_accno, $previous_tax_id) = split(/--/, $form->{"previous_AP_amount_$i"});
+
+ if ($previous_accno &&
+ ($previous_accno eq $selected_accno) &&
+ ($previous_tax_id ne $selected_tax_id)) {
+ my $item = $taxcharts{$selected_tax_id};
+ $selected_taxchart = "$item->{id}--$item->{rate}";
+ }
+
+ $selected_taxchart = $taxchart_init unless ($form->{"taxchart_$i"});
+
+ $selectAP_amount =
+ NTI($cgi->popup_menu('-name' => "AP_amount_$i",
+ '-id' => "AP_amount_$i",
+ '-style' => 'width:400px',
+ '-onChange' => "setTaxkey(this, $i)",
+ '-values' => \@AP_amount_values,
+ '-labels' => \%AP_amount_labels,
+ '-default' => $selected_accno_full))
+ . $cgi->hidden('-name' => "previous_AP_amount_$i",
+ '-default' => $selected_accno_full);
+
+ $tax = qq|<td>| .
+ NTI($cgi->popup_menu('-name' => "taxchart_$i",
+ '-id' => "taxchart_$i",
+ '-style' => 'width:200px',
+ '-values' => \@taxchart_values,
+ '-labels' => \%taxchart_labels,
+ '-default' => $selected_taxchart))
+ . qq|</td>|;
my $korrektur = $form->{"korrektur_$i"} ? 'checked' : '';
+ my $projectnumber =
+ NTI($cgi->popup_menu('-name' => "project_id_$i",
+ '-values' => \@project_values,
+ '-labels' => \%project_labels,
+ '-default' => $form->{"project_id_$i"} ));
+
print qq|
<tr>
- <td width=50%><select name="AP_amount_$i" onChange="setTaxkey(this, $i)" style="width:100%">$selectAP_amount</select></td>
+ <td>$selectAP_amount</td>
<td><input name="amount_$i" size=10 value=$form->{"amount_$i"}></td>
<td><input name="tax_$i" size=10 value=$form->{"tax_$i"}></td>
<td><input type="checkbox" name="korrektur_$i" value="1" "$korrektur"></td>
$tax
- <td><input name="projectnumber_$i" size=20 value="$form->{"projectnumber_$i"}">
- <input type=hidden name="project_id_$i" value=$form->{"project_id_$i"}>
- <input type=hidden name="oldprojectnumber_$i" value="$form->{"oldprojectnumber_$i"}"></td>
+ <td>$projectnumber</td>
</tr>
|;
$amount = "";
? $locale->text('Tax Included')
: $locale->text('Tax');
+ $form->{invtotal_unformatted} = $form->{invtotal};
$form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2);
+ $APselected =
+ NTI($cgi->popup_menu('-name' => "APselected", '-id' => "APselected",
+ '-style' => 'width:400px',
+ '-values' => \@AP_values, '-labels' => \%AP_labels,
+ '-default' => $form->{APselected}));
print qq|
<tr>
<td colspan=6>
</td>
</tr>
<tr>
- <td><select name=APselected>$form->{selectAP}</select></td>
- <input type=hidden name=AP value="$form->{AP}">
+ <td>${APselected}</td>
<th align=left>$form->{invtotal}</th>
<input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
<td>
<table width=100%>
<tr class=listheading>
- <th class=listheading colspan=6>| . $locale->text('Payments') . qq|</th>
+ <th class=listheading colspan=7>| . $locale->text('Payments') . qq|</th>
</tr>
|;
if ($form->{currency} eq $form->{defaultcurrency}) {
- @column_index = qw(datepaid source memo paid AP_paid);
+ @column_index = qw(datepaid source memo paid AP_paid paid_project_id);
} else {
- @column_index = qw(datepaid source memo paid exchangerate AP_paid);
+ @column_index = qw(datepaid source memo paid exchangerate AP_paid paid_project_id);
}
$column_data{datepaid} = "<th>" . $locale->text('Date') . "</th>";
$column_data{AP_paid} = "<th>" . $locale->text('Account') . "</th>";
$column_data{source} = "<th>" . $locale->text('Source') . "</th>";
$column_data{memo} = "<th>" . $locale->text('Memo') . "</th>";
+ $column_data{paid_project_id} = "<th>" . $locale->text('Project Number') . "</th>";
print "
<tr>
</tr>
";
- my @triggers = ();
+ my @triggers = ();
+ my $totalpaid = 0;
+
$form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
for $i (1 .. $form->{paidaccounts}) {
print "
<tr>
";
- $form->{"selectAP_paid_$i"} = $form->{selectAP_paid};
- $form->{"selectAP_paid_$i"} =~
- s/option value=\"$form->{"AP_paid_$i"}\">/option value=\"$form->{"AP_paid_$i"}\" selected>/;
+ $selectAP_paid =
+ NTI($cgi->popup_menu('-name' => "AP_paid_$i",
+ '-id' => "AP_paid_$i",
+ '-values' => \@AP_paid_values,
+ '-labels' => \%AP_paid_labels,
+ '-default' => $form->{"AP_paid_$i"}));
+
+ $totalpaid += $form->{"paid_$i"};
# format amounts
if ($form->{"paid_$i"}) {
}
$form->{"exchangerate_$i"} =
$form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
+ if ($form->{"exchangerate_$i"} == 0) {
+ $form->{"exchangerate_$i"} = "";
+ }
$exchangerate = qq| |;
if ($form->{currency} ne $form->{defaultcurrency}) {
|;
$column_data{"paid_$i"} =
- qq|<td align=center><input name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
+ qq|<td align=center><input name="paid_$i" size=11 value="$form->{"paid_$i"}" onBlur=\"check_right_number_format(this)\"></td>|;
$column_data{"AP_paid_$i"} =
- qq|<td align=center><select name="AP_paid_$i">$form->{"selectAP_paid_$i"}</select></td>|;
+ qq|<td align=center>${selectAP_paid}</td>|;
$column_data{"exchangerate_$i"} = qq|<td align=center>$exchangerate</td>|;
$column_data{"datepaid_$i"} =
- qq|<td align=center><input name="datepaid_$i" size=11 title="($myconfig{'dateformat'})" value=$form->{"datepaid_$i"}>
+ qq|<td align=center><input name="datepaid_$i" id="datepaid_$i" size=11 title="($myconfig{'dateformat'})" value="$form->{"datepaid_$i"}" onBlur=\"check_right_date_format(this)\">
<input type="button" name="datepaid_$i" id="trigger_datepaid_$i" value="?"></td>|;
$column_data{"source_$i"} =
qq|<td align=center><input name="source_$i" size=11 value="$form->{"source_$i"}"></td>|;
$column_data{"memo_$i"} =
qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></td>|;
+ $column_data{"paid_project_id_$i"} =
+ qq|<td>|
+ . NTI($cgi->popup_menu('-name' => "paid_project_id_$i",
+ '-values' => \@project_values,
+ '-labels' => \%project_labels,
+ '-default' => $form->{"paid_project_id_$i"} ))
+ . qq|</td>|;
map { print qq|$column_data{"${_}_$i"}\n| } @column_index;
";
push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
}
- map { $form->{$_} =~ s/\"/"/g } qw(selectAP_paid);
- print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
+
+ my $paid_missing = $form->{invtotal_unformatted} - $totalpaid;
+
+ print qq|
+ <tr>
+ <td></td>
+ <td></td>
+ <td align="center">| . $locale->text('Total') . qq|</td>
+ <td align="center">| . H($form->format_amount(\%myconfig, $totalpaid, 2)) . qq|</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td align="center">| . $locale->text('Missing amount') . qq|</td>
+ <td align="center">| . H($form->format_amount(\%myconfig, $paid_missing, 2)) . qq|</td>
+ </tr>
+| . $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
qq|
<input type=hidden name=paidaccounts value=$form->{paidaccounts}>
- <input type=hidden name=selectAP_paid value="$form->{selectAP_paid}">
</table>
</td>
print qq|
<input name=callback type=hidden value="$form->{callback}">
+<input name="gldate" type="hidden" value="| . Q($form->{gldate}) . qq|">
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
+|
+. $cgi->hidden('-name' => 'draft_id', '-default' => [$form->{draft_id}])
+. $cgi->hidden('-name' => 'draft_description', '-default' => [$form->{draft_description}])
+. qq|
<br>
|;
+ if (!$form->{id} && $form->{draft_id}) {
+ print(NTI($cgi->checkbox('-name' => 'remove_draft', '-id' => 'remove_draft',
+ '-value' => 1, '-checked' => $form->{remove_draft},
+ '-label' => '')) .
+ qq| <label for="remove_draft">| .
+ $locale->text("Remove draft when posting") .
+ qq|</label><br>|);
+ }
+
$transdate = $form->datetonum($form->{transdate}, \%myconfig);
$closedto = $form->datetonum($form->{closedto}, \%myconfig);
- if ($form->{id}) {
+ print qq|<input class="submit" type="submit" name="action" id="update_button" value="| . $locale->text('Update') . qq|">|;
- # print qq|<input class=submit type=submit name=action value="|.$locale->text('Update').qq|">
- # |;
- if ($form->{radier}) {
- print qq|
- <input class=submit type=submit name=action value="|
- . $locale->text('Post') . qq|">
- <input class=submit type=submit name=action value="|
- . $locale->text('Delete') . qq|">
+ if ($form->{id}) {
+ if ($form->{radier}) {
+ print qq| <input class=submit type=submit name=action value="| . $locale->text('Post') . qq|">
+ <input class=submit type=submit name=action value="| . $locale->text('Delete') . qq|">
|;
- }
+ }
- print qq|
-<input class=submit type=submit name=action value="|
- . $locale->text('Use As Template') . qq|">
+ # ToDO: - insert a global check for stornos, so that a storno is only possible a limited time after saving it
+ print qq| <input class=submit type=submit name=action value="| . $locale->text('Storno') . qq|"> |
+ if ($form->{id} && !IS->has_storno(\%myconfig, $form, 'ap') && !IS->is_storno(\%myconfig, $form, 'ap', $form->{id}));
+
+ print qq| <input class=submit type=submit name=action value="| . $locale->text('Post Payment') . qq|">
+ <input class=submit type=submit name=action value="| . $locale->text('Use As Template') . qq|">
|;
-
- } else {
- if (($transdate > $closedto) && !$form->{id}) {
- print qq|<input class=submit type=submit name=action value="|
- . $locale->text('Update') . qq|">
- <input class=submit type=submit name=action value="|
- . $locale->text('Post') . qq|">|;
- }
+ } elsif (($transdate > $closedto) && !$form->{id}) {
+ print qq|
+ <input class=submit type=submit name=action value="| . $locale->text('Post') . qq|"> | .
+ NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'), '-class' => 'submit'));
}
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
+ # button for saving history
+ if($form->{id} ne "") {
+ print qq| <input type="button" class="submit" onclick="set_history_window($form->{id});" name="history" id="history" value="| . $locale->text('history') . qq|"> |;
}
-
+ # /button for saving history
+ # mark_as_paid button
+ if($form->{id} ne "") {
+ print qq| <input type="submit" class="submit" name="action" value="| . $locale->text('mark as paid') . qq|"> |;
+ }
+ # /mark_as_paid button
print "
</form>
$lxdebug->leave_sub();
}
+sub mark_as_paid {
+ $lxdebug->enter_sub();
+ &mark_as_paid_common(\%myconfig,"ap");
+ $lxdebug->leave_sub();
+}
+
sub update {
$lxdebug->enter_sub();
my $display = shift;
- # if ($display) {
- # goto TAXCALC;
- # }
-
$form->{invtotal} = 0;
- # $form->{selectAP_amount} = $form->{AP_amount};
- # $form->{selectAP_amount} =~
- # s/value=\"$form->{AP_amountselected}\"/value=\"$form->{AP_amountselected}\" selected/;
-
- $form->{selectAP} = $form->{AP};
- $form->{selectAP} =~
- s/value=\"$form->{APselected}\"/value=\"$form->{APselected}\" selected/;
-
- ($AP_amountaccno, $AP_amounttaxkey) =
- split(/--/, $form->{AP_amountselected});
- $form->{selecttaxchart} = $form->{taxchart};
- $form->{selecttaxchart} =~
- s/value=\"$AP_amounttaxkey--([^\"]*)\"/value=\"$AP_amounttaxkey--$1\" selected/;
-
- $form->{rate} = $1;
-
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
qw(exchangerate creditlimit creditremaining);
&check_name(vendor);
$form->{AP} = $save_AP;
- &check_project;
$form->{rowcount} = $count + 1;
$form->{invtotal} =
$lxdebug->leave_sub();
}
+
+sub post_payment {
+ $lxdebug->enter_sub();
+
+ $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
+
+ for $i (1 .. $form->{paidaccounts}) {
+ if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
+ $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
+
+ $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
+
+ $form->error($locale->text('Cannot post payment for a closed period!'))
+ if ($datepaid <= $closedto);
+
+ if ($form->{currency} ne $form->{defaultcurrency}) {
+ $form->{"exchangerate_$i"} = $form->{exchangerate}
+ if ($invdate == $datepaid);
+ $form->isblank("exchangerate_$i",
+ $locale->text('Exchangerate for payment missing!'));
+ }
+ }
+ }
+
+ ($form->{AP}) = split /--/, $form->{AP};
+ ($form->{AP_paid}) = split /--/, $form->{AP_paid};
+ $form->redirect($locale->text('Payment posted!'))
+ if (AP->post_payment(\%myconfig, \%$form));
+ $form->error($locale->text('Cannot post payment!'));
+
+
+ $lxdebug->leave_sub();
+}
+
+
sub post {
$lxdebug->enter_sub();
$closedto = $form->datetonum($form->{closedto}, \%myconfig);
$transdate = $form->datetonum($form->{transdate}, \%myconfig);
+ $form->error($locale->text('Cannot post transaction for a closed period!')) if ($transdate <= $closedto);
+
+ my $zero_amount_posting = 1;
+ for $i (1 .. $form->{rowcount}) {
+ if ($form->parse_amount(\%myconfig, $form->{"amount_$i"})) {
+ $zero_amount_posting = 0;
+ last;
+ }
+ }
- $form->error($locale->text('Cannot post transaction for a closed period!'))
- if ($transdate <= $closedto);
+ $form->error($locale->text('Zero amount posting!')) if $zero_amount_posting;
$form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
if ($form->{currency} ne $form->{defaultcurrency});
$form->{AP}{amount_1} = $debitaccno;
$form->{AP}{payables} = $payablesaccno;
$form->{taxkey} = $taxkey;
+ $form->{storno} = 0;
$form->{id} = 0 if $form->{postasnew};
- $form->redirect($locale->text('Transaction posted!'))
- if (AP->post_transaction(\%myconfig, \%$form));
+ if (AP->post_transaction(\%myconfig, \%$form)) {
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
+ $form->{addition} = "POSTED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
+ remove_draft() if $form->{remove_draft};
+ $form->redirect($locale->text('Transaction posted!'));
+ }
$form->error($locale->text('Cannot post transaction!'));
$lxdebug->leave_sub();
$lxdebug->enter_sub();
$form->{postasnew} = 1;
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
+ $form->{addition} = "POSTED AS NEW";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
&post;
$lxdebug->leave_sub();
sub yes {
$lxdebug->enter_sub();
-
- $form->redirect($locale->text('Transaction deleted!'))
- if (AP->delete_transaction(\%myconfig, \%$form, $spool));
+ if (AP->delete_transaction(\%myconfig, \%$form, $spool)) {
+ # saving the history
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
+ $form->{addition} = "DELETED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
+ $form->redirect($locale->text('Transaction deleted!'));
+ }
$form->error($locale->text('Cannot delete transaction!'));
$lxdebug->leave_sub();
$form->{title} = $locale->text('AP Transactions');
# use JavaScript Calendar or not
- $form->{jsscript} = $jscalendar;
+ $form->{jsscript} = 1;
$jsscript = "";
if ($form->{jsscript}) {
# with JavaScript Calendar
$button1 = qq|
- <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
+ <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
<input type=button name=transdatefrom id="trigger1" value=|
. $locale->text('button') . qq|></td>
|;
$button2 = qq|
- <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
+ <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
<input type=button name=transdateto name=transdateto id="trigger2" value=|
. $locale->text('button') . qq|></td>
|;
# without JavaScript Calendar
$button1 = qq|
- <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
+ <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|;
$button2 = qq|
- <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
+ <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|;
}
- $form->header;
+ $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
+ "all" => 1 });
+ my %labels = ();
+ my @values = ("");
+ foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{"id"}} = $item->{"projectnumber"};
+ }
+ my $projectnumber =
+ NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values,
+ '-labels' => \%labels));
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
+ $form->header;
+ $onload = qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
+ $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
print qq|
-<body>
+<body onLoad="$onload">
<form method=post action=$form->{script}>
<th align=right nowrap>| . $locale->text('Notes') . qq|</th>
<td colspan=3><input name=notes size=40></td>
</tr>
+ <tr>
+ <th align="right">| . $locale->text("Project Number") . qq|</th>
+ <td colspan="3">$projectnumber</td>
+ </tr>
<tr>
<th align=right nowrap>| . $locale->text('From') . qq|</th>
$button1
<tr>
<td align=right><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
<td nowrap>| . $locale->text('Subtotal') . qq|</td>
+ <td align=right><input name="l_globalprojectnumber" class=checkbox type=checkbox value=Y></td>
+ <td nowrap>| . $locale->text('Project Number') . qq|</td>
</tr>
</table>
</td>
<br>
<input type=hidden name=nextsub value=$form->{nextsub}>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
$lxdebug->leave_sub();
}
+sub create_subtotal_row {
+ $lxdebug->enter_sub();
+
+ my ($totals, $columns, $column_alignment, $subtotal_columns, $class) = @_;
+
+ my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => $column_alignment->{$_}, } } @{ $columns } };
+
+ map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, 2) } @{ $subtotal_columns };
+
+ $row->{tax}->{data} = $form->format_amount(\%myconfig, $totals->{amount} - $totals->{netamount}, 2);
+
+ map { $totals->{$_} = 0 } @{ $subtotal_columns };
+
+ $lxdebug->leave_sub();
+
+ return $row;
+}
+
sub ap_transactions {
$lxdebug->enter_sub();
- $form->{vendor} = $form->unescape($form->{vendor});
($form->{vendor}, $form->{vendor_id}) = split(/--/, $form->{vendor});
+ $form->{sort} ||= 'transdate';
+
AP->ap_transactions(\%myconfig, \%$form);
- $callback =
- "$form->{script}?action=ap_transactions&path=$form->{path}&login=$form->{login}&password=$form->{password}";
- $href = $callback;
+ $form->{title} = $locale->text('AP Transactions');
+
+ my $report = SL::ReportGenerator->new(\%myconfig, $form);
+
+ my @columns =
+ qw(transdate id type invnumber ordnumber name netamount tax amount paid datepaid
+ due duedate transaction_description notes employee globalprojectnumber);
+
+ my @hidden_variables = map { "l_${_}" } @columns;
+ push @hidden_variables, "l_subtotal", qw(open closed vendor invnumber ordnumber transaction_description notes project_id transdatefrom transdateto);
+
+ my $href = build_std_url('action=ap_transactions', grep { $form->{$_} } @hidden_variables);
+
+ my %column_defs = (
+ 'transdate' => { 'text' => $locale->text('Date'), },
+ 'id' => { 'text' => $locale->text('ID'), },
+ 'type' => { 'text' => $locale->text('Type'), },
+ 'invnumber' => { 'text' => $locale->text('Invoice'), },
+ 'ordnumber' => { 'text' => $locale->text('Order'), },
+ 'name' => { 'text' => $locale->text('Vendor'), },
+ 'netamount' => { 'text' => $locale->text('Amount'), },
+ 'tax' => { 'text' => $locale->text('Tax'), },
+ 'amount' => { 'text' => $locale->text('Total'), },
+ 'paid' => { 'text' => $locale->text('Paid'), },
+ 'datepaid' => { 'text' => $locale->text('Date Paid'), },
+ 'due' => { 'text' => $locale->text('Amount Due'), },
+ 'duedate' => { 'text' => $locale->text('Due Date'), },
+ 'transaction_description' => { 'text' => $locale->text('Transaction description'), },
+ 'notes' => { 'text' => $locale->text('Notes'), },
+ 'employee' => { 'text' => $locale->text('Salesperson'), },
+ 'globalprojectnumber' => { 'text' => $locale->text('Project Number'), },
+ );
+ foreach my $name (qw(id transdate duedate invnumber ordnumber name datepaid
+ employee shippingpoint shipvia)) {
+ $column_defs{$name}->{link} = $href . "&sort=$name";
+ }
+
+ my %column_alignment = map { $_ => 'right' } qw(netamount tax amount paid due);
+
+ $form->{"l_type"} = "Y";
+ map { $column_defs{$_}->{visible} = $form->{"l_${_}"} ? 1 : 0 } @columns;
+
+ $report->set_columns(%column_defs);
+ $report->set_column_order(@columns);
+
+ $report->set_export_options('ap_transactions', @hidden_variables);
+
+ $report->set_sort_indicator($form->{sort}, 1);
+
+ my @options;
if ($form->{vendor}) {
- $callback .= "&vendor=" . $form->escape($form->{vendor}, 1);
- $href .= "&vendor=" . $form->escape($form->{vendor});
- $option .= $locale->text('Vendor') . " : $form->{vendor}";
+ push @options, $locale->text('Vendor') . " : $form->{vendor}";
}
if ($form->{department}) {
- $callback .= "&department=" . $form->escape($form->{department}, 1);
- $href .= "&department=" . $form->escape($form->{department});
($department) = split /--/, $form->{department};
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Department') . " : $department";
+ push @options, $locale->text('Department') . " : $department";
}
if ($form->{invnumber}) {
- $callback .= "&invnumber=" . $form->escape($form->{invnumber}, 1);
- $href .= "&invnumber=" . $form->escape($form->{invnumber});
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Invoice Number') . " : $form->{invnumber}";
+ push @options, $locale->text('Invoice Number') . " : $form->{invnumber}";
}
if ($form->{ordnumber}) {
- $callback .= "&ordnumber=" . $form->escape($form->{ordnumber}, 1);
- $href .= "&ordnumber=" . $form->escape($form->{ordnumber});
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Order Number') . " : $form->{ordnumber}";
+ push @options, $locale->text('Order Number') . " : $form->{ordnumber}";
}
if ($form->{notes}) {
- $callback .= "¬es=" . $form->escape($form->{notes}, 1);
- $href .= "¬es=" . $form->escape($form->{notes});
- $option .= "\n<br>" if $option;
- $option .= $locale->text('Notes') . " : $form->{notes}";
+ push @options, $locale->text('Notes') . " : $form->{notes}";
+ }
+ if ($form->{transaction_description}) {
+ push @options, $locale->text('Transaction description') . " : $form->{transaction_description}";
}
-
if ($form->{transdatefrom}) {
- $callback .= "&transdatefrom=$form->{transdatefrom}";
- $href .= "&transdatefrom=$form->{transdatefrom}";
- $option .= "\n<br>" if ($option);
- $option .=
- $locale->text('From') . " "
- . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
+ push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
}
if ($form->{transdateto}) {
- $callback .= "&transdateto=$form->{transdateto}";
- $href .= "&transdateto=$form->{transdateto}";
- $option .= "\n<br>" if ($option);
- $option .=
- $locale->text('Bis') . " "
- . $locale->date(\%myconfig, $form->{transdateto}, 1);
+ push @options, $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{transdateto}, 1);
}
if ($form->{open}) {
- $callback .= "&open=$form->{open}";
- $href .= "&open=$form->{open}";
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Open');
+ push @options, $locale->text('Open');
}
if ($form->{closed}) {
- $callback .= "&closed=$form->{closed}";
- $href .= "&closed=$form->{closed}";
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Closed');
+ push @options, $locale->text('Closed');
}
- @columns = $form->sort_columns(
- qw(transdate id invnumber ordnumber name netamount tax amount paid datepaid due duedate notes employee)
- );
+ $report->set_options('top_info_text' => join("\n", @options),
+ 'raw_bottom_info_text' => $form->parse_html_template('ap/ap_transactions_bottom'),
+ 'output_format' => 'HTML',
+ 'title' => $form->{title},
+ 'attachment_basename' => $locale->text('invoice_list') . strftime('_%Y%m%d', localtime time),
+ );
+ $report->set_options_from_form();
- foreach $item (@columns) {
- if ($form->{"l_$item"} eq "Y") {
- push @column_index, $item;
+ # add sort and escape callback, this one we use for the add sub
+ $form->{callback} = $href .= "&sort=$form->{sort}";
- # add column to href and callback
- $callback .= "&l_$item=Y";
- $href .= "&l_$item=Y";
- }
- }
+ # escape callback for href
+ $callback = $form->escape($href);
- if ($form->{l_subtotal} eq 'Y') {
- $callback .= "&l_subtotal=Y";
- $href .= "&l_subtotal=Y";
- }
+ my @subtotal_columns = qw(netamount amount paid due);
- $column_header{id} =
- qq|<th><a class=listheading href=$href&sort=id>|
- . $locale->text('ID')
- . qq|</a></th>|;
- $column_header{transdate} =
- qq|<th><a class=listheading href=$href&sort=transdate>|
- . $locale->text('Date')
- . qq|</a></th>|;
- $column_header{duedate} =
- qq|<th><a class=listheading href=$href&sort=duedate>|
- . $locale->text('Due Date')
- . qq|</a></th>|;
- $column_header{due} =
- qq|<th class=listheading>| . $locale->text('Amount Due') . qq|</th>|;
- $column_header{invnumber} =
- qq|<th><a class=listheading href=$href&sort=invnumber>|
- . $locale->text('Invoice')
- . qq|</a></th>|;
- $column_header{ordnumber} =
- qq|<th><a class=listheading href=$href&sort=ordnumber>|
- . $locale->text('Order')
- . qq|</a></th>|;
- $column_header{name} =
- qq|<th><a class=listheading href=$href&sort=name>|
- . $locale->text('Vendor')
- . qq|</a></th>|;
- $column_header{netamount} =
- qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
- $column_header{tax} =
- qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
- $column_header{amount} =
- qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
- $column_header{paid} =
- qq|<th class=listheading>| . $locale->text('Paid') . qq|</th>|;
- $column_header{datepaid} =
- qq|<th><a class=listheading href=$href&sort=datepaid>|
- . $locale->text('Date Paid')
- . qq|</a></th>|;
- $column_header{notes} =
- qq|<th class=listheading>| . $locale->text('Notes') . qq|</th>|;
- $column_header{employee} =
- "<th><a class=listheading href=$href&sort=employee>"
- . $locale->text('Employee') . "</th>";
+ my %totals = map { $_ => 0 } @subtotal_columns;
+ my %subtotals = map { $_ => 0 } @subtotal_columns;
- $form->{title} = $locale->text('AP Transactions');
+ my $idx = 0;
- $form->header;
-
- print qq|
-<body>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>$option</td>
- </tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>
-|;
-
- map { print "\n$column_header{$_}" } @column_index;
-
- print qq|
- </tr>
-|;
-
- # add sort and escape callback
- $form->{callback} = "$callback&sort=$form->{sort}";
- $callback = $form->escape($form->{callback});
-
- if (@{ $form->{AP} }) {
- $sameitem = $form->{AP}->[0]->{ $form->{sort} };
- }
-
- # sums and tax on reports by Antonio Gallardo
- #
foreach $ap (@{ $form->{AP} }) {
+ $ap->{tax} = $ap->{amount} - $ap->{netamount};
+ $ap->{due} = $ap->{amount} - $ap->{paid};
- if ($form->{l_subtotal} eq 'Y') {
- if ($sameitem ne $ap->{ $form->{sort} }) {
- &ap_subtotal;
- $sameitem = $ap->{ $form->{sort} };
- }
- }
+ map { $subtotals{$_} += $ap->{$_};
+ $totals{$_} += $ap->{$_} } @subtotal_columns;
- $column_data{netamount} =
- "<td align=right>"
- . $form->format_amount(\%myconfig, $ap->{netamount}, 2, " ")
- . "</td>";
- $column_data{tax} = "<td align=right>"
- . $form->format_amount(\%myconfig, $ap->{amount} - $ap->{netamount},
- 2, " ")
- . "</td>";
- $column_data{amount} =
- "<td align=right>"
- . $form->format_amount(\%myconfig, $ap->{amount}, 2, " ") . "</td>";
- $column_data{paid} =
- "<td align=right>"
- . $form->format_amount(\%myconfig, $ap->{paid}, 2, " ") . "</td>";
- $column_data{due} = "<td align=right>"
- . $form->format_amount(\%myconfig, $ap->{amount} - $ap->{paid},
- 2, " ")
- . "</td>";
-
- $totalnetamount += $ap->{netamount};
- $totalamount += $ap->{amount};
- $totalpaid += $ap->{paid};
- $totaldue += ($ap->{amount} - $ap->{paid});
-
- $subtotalnetamount += $ap->{netamount};
- $subtotalamount += $ap->{amount};
- $subtotalpaid += $ap->{paid};
- $subtotaldue += ($ap->{amount} - $ap->{paid});
-
- $column_data{transdate} = "<td>$ap->{transdate} </td>";
- $column_data{duedate} = "<td>$ap->{duedate} </td>";
- $column_data{datepaid} = "<td>$ap->{datepaid} </td>";
-
- $module = ($ap->{invoice}) ? "ir.pl" : $form->{script};
-
- $column_data{invnumber} =
- qq|<td><a href="$module?action=edit&path=$form->{path}&id=$ap->{id}&login=$form->{login}&password=$form->{password}&callback=$callback">$ap->{invnumber}</a></td>|;
- $column_data{id} = "<td>$ap->{id}</td>";
- $column_data{ordnumber} = "<td>$ap->{ordnumber} </td>";
- $column_data{name} = "<td>$ap->{name}</td>";
- $ap->{notes} =~ s/\r\n/<br>/g;
- $column_data{notes} = "<td>$ap->{notes} </td>";
- $column_data{employee} = "<td>$ap->{employee} </td>";
-
- $i++;
- $i %= 2;
- print "
- <tr class=listrow$i >
-";
+ map { $ap->{$_} = $form->format_amount(\%myconfig, $ap->{$_}, 2) } qw(netamount tax amount paid due);
- map { print "\n$column_data{$_}" } @column_index;
-
- print qq|
- </tr>
-|;
-
- }
-
- if ($form->{l_subtotal} eq 'Y') {
- &ap_subtotal;
- }
-
- # print totals
- print qq|
- <tr class=listtotal>
-|;
-
- map { $column_data{$_} = "<td> </td>" } @column_index;
-
- $column_data{netamount} =
- "<th class=listtotal align=right>"
- . $form->format_amount(\%myconfig, $totalnetamount, 2, " ") . "</th>";
- $column_data{tax} = "<th class=listtotal align=right>"
- . $form->format_amount(\%myconfig, $totalamount - $totalnetamount,
- 2, " ")
- . "</th>";
- $column_data{amount} =
- "<th class=listtotal align=right>"
- . $form->format_amount(\%myconfig, $totalamount, 2, " ") . "</th>";
- $column_data{paid} =
- "<th class=listtotal align=right>"
- . $form->format_amount(\%myconfig, $totalpaid, 2, " ") . "</th>";
- $column_data{due} =
- "<th class=listtotal align=right>"
- . $form->format_amount(\%myconfig, $totaldue, 2, " ") . "</th>";
-
- map { print "$column_data{$_}\n" } @column_index;
+ $ap->{type} =
+ $ap->{invoice} ? $locale->text("Invoice (one letter abbreviation)") :
+ $locale->text("AP Transaction (abbreviation)");
- print qq|
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
+ my $row = { };
-<br>
-<form method=post action=$form->{script}>
+ foreach my $column (@columns) {
+ $row->{$column} = {
+ 'data' => $ap->{$column},
+ 'align' => $column_alignment{$column},
+ };
+ }
-<input name=callback type=hidden value="$form->{callback}">
+ $row->{invnumber}->{link} = build_std_url("script=" . ($ap->{invoice} ? 'ir.pl' : 'ap.pl'), 'action=edit')
+ . "&id=" . E($ap->{id}) . "&callback=${callback}";
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>
+ my $row_set = [ $row ];
-<input class=submit type=submit name=action value="|
- . $locale->text('AP Transaction') . qq|">
+ if (($form->{l_subtotal} eq 'Y')
+ && (($idx == (scalar @{ $form->{AP} } - 1))
+ || ($ap->{ $form->{sort} } ne $form->{AP}->[$idx + 1]->{ $form->{sort} }))) {
+ push @{ $row_set }, create_subtotal_row(\%subtotals, \@columns, \%column_alignment, \@subtotal_columns, 'listsubtotal');
+ }
-<input class=submit type=submit name=action value="|
- . $locale->text('Vendor Invoice') . qq|">|;
+ $report->add_data($row_set);
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
+ $idx++;
}
- print qq|
- </form>
+ $report->add_separator();
+ $report->add_data(create_subtotal_row(\%totals, \@columns, \%column_alignment, \@subtotal_columns, 'listtotal'));
-</body>
-</html>
-|;
+ $report->generate_with_headers();
$lxdebug->leave_sub();
}
-sub ap_subtotal {
+sub storno {
$lxdebug->enter_sub();
- map { $column_data{$_} = "<td> </td>" } @column_index;
-
- $column_data{netamount} =
- "<th class=listsubtotal align=right>"
- . $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ")
- . "</th>";
- $column_data{tax} = "<th class=listsubtotal align=right>"
- . $form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount,
- 2, " ")
- . "</th>";
- $column_data{amount} =
- "<th class=listsubtotal align=right>"
- . $form->format_amount(\%myconfig, $subtotalamount, 2, " ") . "</th>";
- $column_data{paid} =
- "<th class=listsubtotal align=right>"
- . $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "</th>";
- $column_data{due} =
- "<th class=listsubtotal align=right>"
- . $form->format_amount(\%myconfig, $subtotaldue, 2, " ") . "</th>";
-
- $subtotalnetamount = 0;
- $subtotalamount = 0;
- $subtotalpaid = 0;
- $subtotaldue = 0;
-
- print "<tr class=listsubtotal>";
-
- map { print "\n$column_data{$_}" } @column_index;
+ if (IS->has_storno(\%myconfig, $form, 'ap')) {
+ $form->{title} = $locale->text("Cancel Accounts Payables Transaction");
+ $form->error($locale->text("Transaction has already been cancelled!"));
+ }
- print qq|
- </tr>
-|;
+ AP->storno($form, \%myconfig, $form->{id});
+
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $form->{snumbers} = "ordnumber_$form->{ordnumber}";
+ $form->{addition} = "STORNO";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
+
+ $form->redirect(sprintf $locale->text("Transaction %d cancelled."), $form->{storno_id});
$lxdebug->leave_sub();
}
#
#======================================================================
+use POSIX qw(strftime);
+
use SL::AR;
use SL::IS;
use SL::PE;
-use Data::Dumper;
+use SL::ReportGenerator;
+
+# use strict;
+#use warnings;
-require "$form->{path}/arap.pl";
+# imports
+our ($cgi, $form, $lxdebug, $locale, %myconfig);
+
+require "bin/mozilla/arap.pl";
+require "bin/mozilla/common.pl";
+require "bin/mozilla/drafts.pl";
+require "bin/mozilla/reportgenerator.pl";
1;
sub add {
$lxdebug->enter_sub();
+ return $lxdebug->leave_sub() if (load_draft_maybe());
+
+ # saving the history
+ if(!exists $form->{addition} && ($form->{id} ne "")) {
+ $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
+ $form->{addition} = "ADDED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
+
$form->{title} = "Add";
$form->{callback} =
- "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=add&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
- &create_links;
AR->get_transdate(\%myconfig, $form);
+ $form->{initial_transdate} = $form->{transdate};
+ &create_links;
+ $form->{transdate} = $form->{initial_transdate};
&display_form;
-
$lxdebug->leave_sub();
}
sub edit {
$lxdebug->enter_sub();
-
+ # show history button
+ $form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
+ #/show hhistory button
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
$form->{title} = "Edit";
&create_links;
sub create_links {
$lxdebug->enter_sub();
+ my ($duedate, $taxincluded, @curr);
+
$form->create_links("AR", \%myconfig, "customer");
$duedate = $form->{duedate};
$form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
$form->{rowcount} = 1;
+ # notes
+ $form->{notes} = $form->{intnotes} unless $form->{notes};
+
# currencies
@curr = split(/:/, $form->{currencies});
chomp $curr[0];
# build the popup menus
$form->{taxincluded} = ($form->{id}) ? $form->{taxincluded} : "checked";
- map {
- $tax .=
- qq|<option value=\"$_->{id}--$_->{rate}\">$_->{taxdescription} |
- . ($_->{rate} * 100) . qq| %|
- } @{ $form->{TAX} };
- $form->{taxchart} = $tax;
- $form->{selecttaxchart} = $tax;
-
- # forex
- $form->{forex} = $form->{exchangerate};
- $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
- foreach $key (keys %{ $form->{AR_links} }) {
-
- foreach $ref (@{ $form->{AR_links}{$key} }) {
- if ($key eq "AR_paid") {
- $form->{"select$key"} .=
- "<option value=\"$ref->{accno}\">$ref->{accno}--$ref->{description}</option>\n";
- } else {
- $form->{"select$key"} .=
- "<option value=\"$ref->{accno}--$ref->{tax_id}\">$ref->{accno}--$ref->{description}</option>\n";
- }
- }
-
- $form->{$key} = $form->{"select$key"};
-
- # if there is a value we have an old entry
- my $j = 0;
- my $k = 0;
-
- for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
- if ($key eq "AR_paid") {
- $j++;
- $form->{"AR_paid_$j"} =
- "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
-
- # reverse paid
- $form->{"paid_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{amount} * -1;
- $form->{"datepaid_$j"} =
- $form->{acc_trans}{$key}->[$i - 1]->{transdate};
- $form->{"source_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{source};
- $form->{"memo_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{memo};
-
- $form->{"forex_$j"} = $form->{"exchangerate_$i"} =
- $form->{acc_trans}{$key}->[$i - 1]->{exchangerate};
- $form->{"AR_paid_$j"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}";
- $form->{paidaccounts}++;
- } else {
-
- $akey = $key;
- $akey =~ s/AR_//;
-
- if ($key eq "AR_tax" || $key eq "AP_tax") {
- $form->{"${key}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} =
- "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
- $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} =
- $form->round_amount(
- $form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate,
- 2);
-
- if ($form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"} > 0) {
- $totaltax +=
- $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
- $taxrate +=
- $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
- } else {
- $totalwithholding +=
- $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
- $withholdingrate +=
- $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
- }
- $index = $form->{acc_trans}{$key}->[$i - 1]->{index};
- $form->{"tax_$index"} = $form->{acc_trans}{$key}->[$i - 1]->{amount};
- $totaltax += $form->{"tax_$index"};
-
- } else {
- $k++;
- $form->{"${akey}_$k"} =
- $form->round_amount(
- $form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate,
- 2);
- if ($akey eq 'amount') {
- $form->{rowcount}++;
- $totalamount += $form->{"${akey}_$i"};
-
- $form->{"oldprojectnumber_$k"} = $form->{"projectnumber_$k"} =
- "$form->{acc_trans}{$key}->[$i-1]->{projectnumber}";
- $form->{taxrate} = $form->{acc_trans}{$key}->[$i - 1]->{rate};
- $form->{"project_id_$k"} =
- "$form->{acc_trans}{$key}->[$i-1]->{project_id}";
- }
- $form->{"${key}_$k"} =
- "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
- $form->{"${key}_$i"} =
- "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
- my $q_description = quotemeta($form->{acc_trans}{$key}->[$i-1]->{description});
- $form->{"select${key}"} =~
- /<option value=\"($form->{acc_trans}{$key}->[$i-1]->{accno}--[^\"]*)\">$form->{acc_trans}{$key}->[$i-1]->{accno}--${q_description}<\/option>\n/;
- $form->{"${key}_$k"} = $1;
- if ($akey eq 'amount') {
- $form->{"taxchart_$k"} = $form->{taxchart};
- $form->{"taxchart_$k"} =~
- /<option value=\"($form->{acc_trans}{$key}->[$i-1]->{id}--[^\"]*)/;
- $form->{"taxchart_$k"} = $1;
- }
- }
- }
- }
- }
-
- $form->{taxincluded} = $taxincluded if ($form->{id});
- $form->{paidaccounts} = 1 if not defined $form->{paidaccounts};
-
- if ($form->{taxincluded} && $form->{taxrate} && $totalamount) {
-
- # add tax to amounts and invtotal
- for $i (1 .. $form->{rowcount}) {
- $taxamount =
- ($totaltax + $totalwithholding) * $form->{"amount_$i"} / $totalamount;
- $tax = $form->round_amount($taxamount, 2);
- $diff += ($taxamount - $tax);
- $form->{"amount_$i"} += $form->{"tax_$i"};
- }
- $form->{amount_1} += $form->round_amount($diff, 2);
- }
-
- $taxamount = $form->round_amount($taxamount, 2);
- $form->{tax} = $taxamount;
-
- $form->{invtotal} = $totalamount + $totaltax;
+ AR->setup_form($form);
$form->{locked} =
($form->datetonum($form->{transdate}, \%myconfig) <=
sub form_header {
$lxdebug->enter_sub();
+ my ($title, $readonly, $exchangerate, $rows);
+ my ($taxincluded, $notes, $department, $customer, $employee, $amount, $project);
+ my ($jsscript, $button1, $button2, $onload);
+ my ($selectAR_amount, $selectAR_paid, $korrektur_checked, $ARselected, $tax);
+ my (@column_index, %column_data);
+
+
$title = $form->{title};
$form->{title} = $locale->text("$title Accounts Receivables Transaction");
};
//-->
</script>|;
-
+ # show history button js
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/show_history.js"></script>|;
+ #/show history button js
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
$readonly = ($form->{id}) ? "readonly" : "";
$form->{radier} =
$readonly = ($form->{radier}) ? "" : $readonly;
# set option selected
- foreach $item (qw(customer currency department employee)) {
+ foreach my $item (qw(customer currency department employee)) {
$form->{"select$item"} =~ s/ selected//;
$form->{"select$item"} =~
s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
}
- $selectAR_amount_unquoted = $form->{selectAR_amount};
- $taxchart = $form->{taxchart};
- map { $form->{$_} =~ s/\"/"/g }
- qw(AR_amount selectAR_amount AR taxchart);
+
+ $form->{exchangerate} = $exchangerate
+ if (
+ $form->{forex} = (
+ $exchangerate =
+ $form->check_exchangerate(
+ \%myconfig, $form->{currency}, $form->{transdate}, 'buy'
+ )));
# format amounts
$form->{exchangerate} =
$form->format_amount(\%myconfig, $form->{exchangerate});
+ if ($form->{exchangerate} == 0) {
+ $form->{exchangerate} = "";
+ }
+
$form->{creditlimit} =
$form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
$form->{creditremaining} =
}
}
- $taxincluded = "";
-
$taxincluded = qq|
<tr>
<td align=right><input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}></td>
</tr>
| if $form->{selectdepartment};
- $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
+ my $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
- $customer =
- ($form->{selectcustomer})
- ? qq|<select name=customer>$form->{selectcustomer}</select>|
+ $customer = ($form->{selectcustomer})
+ ? qq|<select name="customer" onchange="document.getElementById('update_button').click();">$form->{selectcustomer}</select>|
: qq|<input name=customer value="$form->{customer}" size=35>|;
$employee = qq|
|;
}
+ my @old_project_ids = ();
+ map({ push(@old_project_ids, $form->{"project_id_$_"})
+ if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
+
+ $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
+ "all" => 0,
+ "old_id" => \@old_project_ids },
+ "charts" => { "key" => "ALL_CHARTS",
+ "transdate" => $form->{transdate} },
+ "taxcharts" => "ALL_TAXCHARTS");
+
+ map({ $_->{link_split} = [ split(/:/, $_->{link}) ]; }
+ @{ $form->{ALL_CHARTS} });
+
+ my %project_labels = ();
+ my @project_values = ("");
+ foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
+ push(@project_values, $item->{"id"});
+ $project_labels{$item->{"id"}} = $item->{"projectnumber"};
+ }
+
+ my (%AR_amount_labels, @AR_amount_values);
+ my (%AR_labels, @AR_values);
+ my (%AR_paid_labels, @AR_paid_values);
+ my %charts;
+ my $taxchart_init;
+
+ foreach my $item (@{ $form->{ALL_CHARTS} }) {
+ if (grep({ $_ eq "AR_amount" } @{ $item->{link_split} })) {
+ $taxchart_init = $item->{tax_id} if ($taxchart_init eq "");
+ my $key = "$item->{accno}--$item->{tax_id}";
+ push(@AR_amount_values, $key);
+ $AR_amount_labels{$key} =
+ "$item->{accno}--$item->{description}";
+
+ } elsif (grep({ $_ eq "AR" } @{ $item->{link_split} })) {
+ push(@AR_values, $item->{accno});
+ $AR_labels{$item->{accno}} = "$item->{accno}--$item->{description}";
+
+ } elsif (grep({ $_ eq "AR_paid" } @{ $item->{link_split} })) {
+ push(@AR_paid_values, $item->{accno});
+ $AR_paid_labels{$item->{accno}} =
+ "$item->{accno}--$item->{description}";
+ }
+
+ $charts{$item->{accno}} = $item;
+ }
+
+ my %taxchart_labels = ();
+ my @taxchart_values = ();
+ my %taxcharts = ();
+ foreach my $item (@{ $form->{ALL_TAXCHARTS} }) {
+ my $key = "$item->{id}--$item->{rate}";
+ $taxchart_init = $key if ($taxchart_init eq $item->{id});
+ push(@taxchart_values, $key);
+ $taxchart_labels{$key} =
+ "$item->{taxdescription} " . ($item->{rate} * 100) . ' %';
+ $taxcharts{$item->{id}} = $item;
+ }
+
$form->{fokus} = "arledger.customer";
# use JavaScript Calendar or not
- $form->{jsscript} = $jscalendar;
+ $form->{jsscript} = 1;
$jsscript = "";
if ($form->{jsscript}) {
# with JavaScript Calendar
$button1 = qq|
- <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>
+ <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" onBlur=\"check_right_date_format(this)\"></td>
<td><input type=button name=transdate id="trigger1" value=|
. $locale->text('button') . qq|></td>
|;
$button2 = qq|
- <td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>
+ <td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value="$form->{duedate}" onBlur=\"check_right_date_format(this)\"></td>
<td><input type=button name=duedate id="trigger2" value=|
. $locale->text('button') . qq|></td></td>
|;
# without JavaScript Calendar
$button1 =
- qq|<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>|;
+ qq|<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" onBlur=\"check_right_date_format(this)\"></td>|;
$button2 =
- qq|<td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>|;
+ qq|<td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value="$form->{duedate}" onBlur=\"check_right_date_format(this)\"></td>|;
}
- $form->header;
+ $form->{javascript} .=
+ qq|<script type="text/javascript" src="js/common.js"></script>| .
+ qq|<script type="text/javascript" src="js/show_vc_details.js"></script>|;
+ $form->header;
+ $onload = qq|focus()|;
+ $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
+ $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
print qq|
-<body onLoad="fokus()">
+<body onLoad="$onload">
<form method=post name="arledger" action=$form->{script}>
<input type=hidden name=locked value=$form->{locked}>
<input type=hidden name=title value="$title">
+| . ($form->{saved_message} ? qq|<p>$form->{saved_message}</p>| : "") . qq|
+
<table width=100%>
<tr class=listtop>
<th class=listtop>$form->{title}</th>
<table>
<tr>
<th align="right" nowrap>| . $locale->text('Customer') . qq|</th>
- <td colspan=3>$customer</td>
+ <td colspan=3>$customer <input type="button" value="?" onclick="show_vc_details('customer')"></td>
<input type=hidden name=selectcustomer value="$form->{selectcustomer}">
<input type=hidden name=oldcustomer value="$form->{oldcustomer}">
<input type=hidden name=customer_id value="$form->{customer_id}">
<th align=right nowrap>| . $locale->text('Due Date') . qq|</th>
$button2
</tr>
- </table>
+ </table>
</td>
</tr>
</table>
</tr>
$jsscript
- <input type=hidden name=selectAR_amount value="$form->{selectAR_amount}">
- <input type=hidden name=AR_amount value="$form->{AR_amount}">
- <input type=hidden name=taxchart value="$form->{taxchart}">
<input type=hidden name=rowcount value=$form->{rowcount}>
<tr>
<td>
$amount = $locale->text('Amount');
$project = $locale->text('Project');
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
# format amounts
$form->{"amount_$i"} =
$form->format_amount(\%myconfig, $form->{"amount_$i"}, 2);
$form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2);
- $selectAR_amount = $selectAR_amount_unquoted;
- $selectAR_amount =~
- s/option value=\"$form->{"AR_amount_$i"}\"/option value=\"$form->{"AR_amount_$i"}\" selected/;
- $tax = $taxchart;
- $tax_selected = $form->{"taxchart_$i"};
- $tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/;
- $tax =
- qq|<td><select id="taxchart_$i" name="taxchart_$i" style="width:200px">$tax</select></td>|;
+
+ my $selected_accno_full;
+ my ($accno_row) = split(/--/, $form->{"AR_amount_$i"});
+ my $item = $charts{$accno_row};
+ $selected_accno_full = "$item->{accno}--$item->{tax_id}";
+
+ my $selected_taxchart = $form->{"taxchart_$i"};
+ my ($selected_accno, $selected_tax_id) = split(/--/, $selected_accno_full);
+ my ($previous_accno, $previous_tax_id) = split(/--/, $form->{"previous_AR_amount_$i"});
+
+ if ($previous_accno &&
+ ($previous_accno eq $selected_accno) &&
+ ($previous_tax_id ne $selected_tax_id)) {
+ my $item = $taxcharts{$selected_tax_id};
+ $selected_taxchart = "$item->{id}--$item->{rate}";
+ }
+
+ $selected_taxchart = $taxchart_init unless ($form->{"taxchart_$i"});
+
+ $selectAR_amount =
+ NTI($cgi->popup_menu('-name' => "AR_amount_$i",
+ '-id' => "AR_amount_$i",
+ '-style' => 'width:400px',
+ '-onChange' => "setTaxkey(this, $i)",
+ '-values' => \@AR_amount_values,
+ '-labels' => \%AR_amount_labels,
+ '-default' => $selected_accno_full))
+ . $cgi->hidden('-name' => "previous_AR_amount_$i",
+ '-default' => $selected_accno_full);
+
+ $tax = qq|<td>| .
+ NTI($cgi->popup_menu('-name' => "taxchart_$i",
+ '-id' => "taxchart_$i",
+ '-style' => 'width:200px',
+ '-values' => \@taxchart_values,
+ '-labels' => \%taxchart_labels,
+ '-default' => $selected_taxchart))
+ . qq|</td>|;
+
$korrektur_checked = ($form->{"korrektur_$i"} ? 'checked' : '');
+ my $projectnumber =
+ NTI($cgi->popup_menu('-name' => "project_id_$i",
+ '-values' => \@project_values,
+ '-labels' => \%project_labels,
+ '-default' => $form->{"project_id_$i"} ));
+
print qq|
<tr>
- <td width=50%><select name="AR_amount_$i" onChange="setTaxkey(this, $i)" style="width:100%">$selectAR_amount</select></td>
+ <td>$selectAR_amount</td>
<td><input name="amount_$i" size=10 value=$form->{"amount_$i"}></td>
<td><input name="tax_$i" size=10 value=$form->{"tax_$i"}></td>
<td><input type="checkbox" name="korrektur_$i" value="1" $korrektur_checked></td>
$tax
- <td><input name="projectnumber_$i" size=20 value="$form->{"projectnumber_$i"}">
- <input type=hidden name="project_id_$i" value=$form->{"project_id_$i"}>
- <input type=hidden name="oldprojectnumber_$i" value="$form->{"oldprojectnumber_$i"}"></td>
+ <td>$projectnumber</td>
</tr>
|;
$amount = "";
$project = "";
}
+ $form->{invtotal_unformatted} = $form->{invtotal};
$form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2);
+ $ARselected =
+ NTI($cgi->popup_menu('-name' => "ARselected", '-id' => "ARselected",
+ '-style' => 'width:400px',
+ '-values' => \@AR_values, '-labels' => \%AR_labels,
+ '-default' => $form->{ARselected}));
+
print qq|
<tr>
<td colspan=6>
</td>
</tr>
<tr>
- <td><select name=ARselected>$form->{selectAR}</select></td>
- <input type=hidden name=AR value="$form->{AR}">
+ <td>${ARselected}</td>
<th align=left>$form->{invtotal}</th>
<input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
<td>
<table width=100%>
<tr class=listheading>
- <th colspan=6 class=listheading>|
+ <th colspan=7 class=listheading>|
. $locale->text('Incoming Payments') . qq|</th>
</tr>
|;
if ($form->{currency} eq $form->{defaultcurrency}) {
- @column_index = qw(datepaid source memo paid AR_paid);
+ @column_index = qw(datepaid source memo paid AR_paid paid_project_id);
} else {
- @column_index = qw(datepaid source memo paid exchangerate AR_paid);
+ @column_index = qw(datepaid source memo paid exchangerate AR_paid paid_project_id);
}
$column_data{datepaid} = "<th>" . $locale->text('Date') . "</th>";
$column_data{exchangerate} = "<th>" . $locale->text('Exch') . "</th>";
$column_data{AR_paid} = "<th>" . $locale->text('Account') . "</th>";
$column_data{source} = "<th>" . $locale->text('Source') . "</th>";
- $column_data{memo} = "<th>" . $locale->text('Memo') . "</th>";
+ $column_data{memo} = "<th>" . $locale->text('Memo') . "</th>";
+ $column_data{paid_project_id} = "<th>" . $locale->text('Project Number') . "</th>";
print "
<tr>
</tr>
";
- my @triggers = ();
+ my @triggers = ();
+ my $totalpaid = 0;
+
$form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
- for $i (1 .. $form->{paidaccounts}) {
+ for my $i (1 .. $form->{paidaccounts}) {
print "
<tr>
";
- $form->{"selectAR_paid_$i"} = $form->{selectAR_paid};
- $form->{"selectAR_paid_$i"} =~
- s/option value=\"$form->{"AR_paid_$i"}\">/option value=\"$form->{"AR_paid_$i"}\" selected>/;
+ $selectAR_paid =
+ NTI($cgi->popup_menu('-name' => "AR_paid_$i",
+ '-id' => "AR_paid_$i",
+ '-values' => \@AR_paid_values,
+ '-labels' => \%AR_paid_labels,
+ '-default' => $form->{"AR_paid_$i"}));
+
+ $totalpaid += $form->{"paid_$i"};
# format amounts
if ($form->{"paid_$i"}) {
$form->{"exchangerate_$i"} =
$form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
+ if ($form->{"exchangerate_$i"} == 0) {
+ $form->{"exchangerate_$i"} = "";
+ }
+
$exchangerate = qq| |;
if ($form->{currency} ne $form->{defaultcurrency}) {
if ($form->{"forex_$i"}) {
|;
$column_data{paid} =
- qq|<td align=center><input name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
+ qq|<td align=center><input name="paid_$i" size=11 value="$form->{"paid_$i"}" onBlur=\"check_right_number_format(this)\"></td>|;
$column_data{AR_paid} =
- qq|<td align=center><select name="AR_paid_$i">$form->{"selectAR_paid_$i"}</select></td>|;
+ qq|<td align=center>${selectAR_paid}</td>|;
$column_data{exchangerate} = qq|<td align=center>$exchangerate</td>|;
$column_data{datepaid} =
- qq|<td align=center><input name="datepaid_$i" size=11 value=$form->{"datepaid_$i"}>
+ qq|<td align=center><input name="datepaid_$i" id="datepaid_$i" size=11 value="$form->{"datepaid_$i"}" onBlur=\"check_right_date_format(this)\">
<input type="button" name="datepaid_$i" id="trigger_datepaid_$i" value="?"></td>|;
$column_data{source} =
qq|<td align=center><input name="source_$i" size=11 value="$form->{"source_$i"}"></td>|;
$column_data{memo} =
qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></td>|;
+ $column_data{paid_project_id} =
+ qq|<td>|
+ . NTI($cgi->popup_menu('-name' => "paid_project_id_$i",
+ '-values' => \@project_values,
+ '-labels' => \%project_labels,
+ '-default' => $form->{"paid_project_id_$i"} ))
+ . qq|</td>|;
+
map { print qq|$column_data{$_}\n| } @column_index;
print "
";
push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
}
- map { $form->{$_} =~ s/\"/"/g } qw(selectAR_paid);
- print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
+ my $paid_missing = $form->{invtotal_unformatted} - $totalpaid;
+
+ print qq|
+ <tr>
+ <td></td>
+ <td></td>
+ <td align="center">| . $locale->text('Total') . qq|</td>
+ <td align="center">| . H($form->format_amount(\%myconfig, $totalpaid, 2)) . qq|</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td align="center">| . $locale->text('Missing amount') . qq|</td>
+ <td align="center">| . H($form->format_amount(\%myconfig, $paid_missing, 2)) . qq|</td>
+ </tr>
+| . $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
qq|
<input type=hidden name=paidaccounts value=$form->{paidaccounts}>
-<input type=hidden name=selectAR_paid value="$form->{selectAR_paid}">
</table>
</td>
sub form_footer {
$lxdebug->enter_sub();
+ my ($transdate, $closedto);
+
print qq|
+<input name=gldate type=hidden value="| . Q($form->{gldate}) . qq|">
+
<input name=callback type=hidden value="$form->{callback}">
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
+|
+. $cgi->hidden('-name' => 'draft_id', '-default' => [$form->{draft_id}])
+. $cgi->hidden('-name' => 'draft_description', '-default' => [$form->{draft_description}])
+. qq|
<br>
|;
+ if (!$form->{id} && $form->{draft_id}) {
+ print(NTI($cgi->checkbox('-name' => 'remove_draft', '-id' => 'remove_draft',
+ '-value' => 1, '-checked' => $form->{remove_draft},
+ '-label' => '')) .
+ qq| <label for="remove_draft">| .
+ $locale->text("Remove draft when posting") .
+ qq|</label><br>|);
+ }
+
$transdate = $form->datetonum($form->{transdate}, \%myconfig);
$closedto = $form->datetonum($form->{closedto}, \%myconfig);
+ print qq|<input class="submit" type="submit" name="action" id="update_button" value="| . $locale->text('Update') . qq|">\n|;
+
+ # ToDO: - insert a global check for stornos, so that a storno is only possible a limited time after saving it
+ print qq| <input class=submit type=submit name=action value="| . $locale->text('Storno') . qq|"> |
+ if ($form->{id} && !IS->has_storno(\%myconfig, $form, 'ar') && !IS->is_storno(\%myconfig, $form, 'ar'));
+
if ($form->{id}) {
if ($form->{radier}) {
- print qq|<input class=submit type=submit name=action value="|
- . $locale->text('Update') . qq|">
- |;
-
- print qq|
- <input class=submit type=submit name=action value="|
- . $locale->text('Post') . qq|">
- <input class=submit type=submit name=action value="|
- . $locale->text('Delete') . qq|">
- |;
- }
- if ($transdate > $closedto) {
- print qq|
- <input class=submit type=submit name=action value="|
- . $locale->text('Use As Template') . qq|">
- |;
- }
-
+ print qq|
+ <input class=submit type=submit name=action value="| . $locale->text('Post') . qq|">
+ <input class=submit type=submit name=action value="| . $locale->text('Delete') . qq|"> |;
+ }
+ if ($transdate > $closedto) {
+ print qq|
+ <input class=submit type=submit name=action value="| . $locale->text('Use As Template') . qq|"> |;
+ }
+ print qq|
+ <input class=submit type=submit name=action value="| . $locale->text('Post Payment') . qq|"> |;
+
} else {
if ($transdate > $closedto) {
- print qq|<input class=submit type=submit name=action value="|
- . $locale->text('Update') . qq|">
- <input class=submit type=submit name=action value="|
- . $locale->text('Post') . qq|">|;
+ print qq| <input class=submit type=submit name=action value="| . $locale->text('Post') . qq|"> | .
+ NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'), '-class' => 'submit'));
}
}
if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
+ require "bin/mozilla/menu.pl";
&menubar;
}
+ # button for saving history
+ if($form->{id} ne "") {
+ print qq| <input type=button class=submit onclick=set_history_window($form->{id}); name=history id=history value=| . $locale->text('history') . qq|> |;
+ }
+ # /button for saving history
+ # mark_as_paid button
+ if($form->{id} ne "") {
+ print qq|<input type="submit" class="submit" name="action" value="|
+ . $locale->text('mark as paid') . qq|">|;
+ }
+ # /mark_as_paid button
print "
</form>
$lxdebug->leave_sub();
}
+sub mark_as_paid {
+ $lxdebug->enter_sub();
+ &mark_as_paid_common(\%myconfig,"ar");
+ $lxdebug->leave_sub();
+}
+
sub update {
$lxdebug->enter_sub();
my $display = shift;
- # if ($display) {
- # goto TAXCALC;
- # }
+ my ($totaltax, $exchangerate, $totalpaid);
$form->{invtotal} = 0;
- # $form->{selectAR_amount} = $form->{AR_amount};
- # $form->{selectAR_amount} =~
- # s/value=\"$form->{AR_amountselected}\"/value=\"$form->{AR_amountselected}\" selected/;
-
- $form->{selectAR} = $form->{AR};
-
- $form->{selectAR} =~
- s/value=\"$form->{ARselected}\"/value=\"$form->{ARselected}\" selected/;
-
- ($AR_amountaccno, $AR_amounttaxkey) =
- split(/--/, $form->{AR_amountselected});
- $form->{selecttaxchart} = $form->{taxchart};
- $form->{selecttaxchart} =~
- s/value=\"$AR_amounttaxkey--([^\"]*)\"/value=\"$AR_amounttaxkey--$1\" selected/;
-
- $form->{rate} = $1;
-
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
qw(exchangerate creditlimit creditremaining);
- @flds = qw(amount AR_amount projectnumber oldprojectnumber project_id);
- $count = 0;
- @a = ();
+ my @flds = qw(amount AR_amount projectnumber oldprojectnumber project_id);
+ my $count = 0;
+ my @a = ();
- for $i (1 .. $form->{rowcount}) {
- $form->{"amount_$i"} =
- $form->parse_amount(\%myconfig, $form->{"amount_$i"});
+ for my $i (1 .. $form->{rowcount}) {
+ $form->{"amount_$i"} = $form->parse_amount(\%myconfig, $form->{"amount_$i"});
$form->{"tax_$i"} = $form->parse_amount(\%myconfig, $form->{"tax_$i"});
if ($form->{"amount_$i"}) {
push @a, {};
- $j = $#a;
+ my $j = $#a;
if (!$form->{"korrektur_$i"}) {
- ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
+ my ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
if ($taxkey > 1) {
if ($form->{taxincluded}) {
$form->{"tax_$i"} = $form->{"amount_$i"} / ($rate + 1) * $rate;
)));
$form->{invdate} = $form->{transdate};
- $save_AR = $form->{AR};
- &check_name(customer);
+ my $save_AR = $form->{AR};
+ check_name("customer");
$form->{AR} = $save_AR;
- &check_project;
-
$form->{invtotal} =
($form->{taxincluded}) ? $form->{invtotal} : $form->{invtotal} + $totaltax;
- for $i (1 .. $form->{paidaccounts}) {
+ for my $i (1 .. $form->{paidaccounts}) {
if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
map {
$form->{"${_}_$i"} =
$lxdebug->leave_sub();
}
+#
+# ToDO: fix $closedto and $invdate
+#
+sub post_payment {
+ $lxdebug->enter_sub();
+
+ $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
+
+ for my $i (1 .. $form->{paidaccounts}) {
+
+ if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
+ my $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
+
+ $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
+
+# $form->error($locale->text('Cannot post payment for a closed period!')) if ($datepaid <= $closedto);
+
+ if ($form->{currency} ne $form->{defaultcurrency}) {
+# $form->{"exchangerate_$i"} = $form->{exchangerate} if ($invdate == $datepaid);
+ $form->isblank("exchangerate_$i", $locale->text('Exchangerate for payment missing!'));
+ }
+ }
+ }
+
+ ($form->{AR}) = split /--/, $form->{AR};
+ ($form->{AR_paid}) = split /--/, $form->{AR_paid};
+ $form->redirect($locale->text('Payment posted!')) if (AR->post_payment(\%myconfig, \%$form));
+ $form->error($locale->text('Cannot post payment!'));
+
+ $lxdebug->leave_sub();
+}
+
+sub _post {
+ # inline post
+ post(1);
+}
+
sub post {
$lxdebug->enter_sub();
+ my ($inline) = @_;
+
+ my ($datepaid);
+
# check if there is an invoice number, invoice and due date
$form->isblank("transdate", $locale->text('Invoice Date missing!'));
$form->isblank("duedate", $locale->text('Due Date missing!'));
$form->isblank("customer", $locale->text('Customer missing!'));
- $closedto = $form->datetonum($form->{closedto}, \%myconfig);
- $transdate = $form->datetonum($form->{transdate}, \%myconfig);
+ my $closedto = $form->datetonum($form->{closedto}, \%myconfig);
+ my $transdate = $form->datetonum($form->{transdate}, \%myconfig);
+ $form->error($locale->text('Cannot post transaction for a closed period!')) if ($transdate <= $closedto);
- $form->error($locale->text('Cannot post transaction for a closed period!'))
- if ($transdate <= $closedto);
+ $form->error($locale->text('Zero amount posting!'))
+ unless grep $_*1, map $form->parse_amount(\%myconfig, $form->{"amount_$_"}), 1..$form->{rowcount};
$form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
if ($form->{currency} ne $form->{defaultcurrency});
delete($form->{AR});
- for $i (1 .. $form->{paidaccounts}) {
+ for my $i (1 .. $form->{paidaccounts}) {
if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
$datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
if ($datepaid <= $closedto);
if ($form->{currency} ne $form->{defaultcurrency}) {
- $form->{"exchangerate_$i"} = $form->{exchangerate}
- if ($transdate == $datepaid);
- $form->isblank("exchangerate_$i",
- $locale->text('Exchangerate for payment missing!'));
+ $form->{"exchangerate_$i"} = $form->{exchangerate} if ($transdate == $datepaid);
+ $form->isblank("exchangerate_$i", $locale->text('Exchangerate for payment missing!'));
}
}
}
# if oldcustomer ne customer redo form
- ($customer) = split /--/, $form->{customer};
+ my ($customer) = split /--/, $form->{customer};
if ($form->{oldcustomer} ne "$customer--$form->{customer_id}") {
- &update;
+ update();
exit;
}
- ($creditaccno, $credittaxkey) = split /--/, $form->{AR_amountselected};
- ($taxkey, $NULL) = split /--/, $form->{taxchartselected};
- ($receivablesaccno, $payablestaxkey) = split /--/, $form->{ARselected};
- $form->{AR}{amount_1} = $creditaccno;
- $form->{AR}{receivables} = $receivablesaccno;
- $form->{taxkey} = $taxkey;
-
- $form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber")
- unless $form->{invnumber};
+ $form->{AR}{receivables} = $form->{ARselected};
+ $form->{storno} = 0;
+ $lxdebug->message(0, $form->{amount});
$form->{id} = 0 if $form->{postasnew};
+ $form->error($locale->text('Cannot post transaction!')) unless AR->post_transaction(\%myconfig, \%$form);
- $form->redirect($locale->text('Transaction posted!'))
- if (AR->post_transaction(\%myconfig, \%$form));
- $form->error($locale->text('Cannot post transaction!'));
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $form->{snumbers} = "invnumber_$form->{invnumber}";
+ $form->{addition} = "POSTED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
+ remove_draft() if $form->{remove_draft};
+
+ $form->redirect($locale->text('Transaction posted!')) unless $inline;
$lxdebug->leave_sub();
}
$lxdebug->enter_sub();
$form->{postasnew} = 1;
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
+ $form->{addition} = "POSTED AS NEW";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
&post;
$lxdebug->leave_sub();
<form method=post action=$form->{script}>
|;
- foreach $key (keys %$form) {
+ foreach my $key (keys %$form) {
$form->{$key} =~ s/\"/"/g;
print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
}
sub yes {
$lxdebug->enter_sub();
-
- $form->redirect($locale->text('Transaction deleted!'))
- if (AR->delete_transaction(\%myconfig, \%$form, $spool));
+ if (AR->delete_transaction(\%myconfig, \%$form)) {
+ # saving the history
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
+ $form->{addition} = "DELETED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
+ $form->redirect($locale->text('Transaction deleted!'));
+ }
$form->error($locale->text('Cannot delete transaction!'));
$lxdebug->leave_sub();
sub search {
$lxdebug->enter_sub();
+ my ($customer, $department);
+ my ($jsscript, $button1, $button2, $onload);
+
# setup customer selection
$form->all_vc(\%myconfig, "customer", "AR");
| if $form->{selectdepartment};
$form->{title} = $locale->text('AR Transactions');
-
+
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
+
# use JavaScript Calendar or not
- $form->{jsscript} = $jscalendar;
+ $form->{jsscript} = 1;
$jsscript = "";
if ($form->{jsscript}) {
# with JavaScript Calendar
$button1 = qq|
- <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
+ <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
<input type=button name=transdatefrom id="trigger1" value=|
. $locale->text('button') . qq|></td>
|;
$button2 = qq|
- <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
+ <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
<input type=button name=transdateto name=transdateto id="trigger2" value=|
. $locale->text('button') . qq|></td>
|;
# without JavaScript Calendar
$button1 = qq|
- <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
+ <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|;
$button2 = qq|
- <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
+ <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|;
}
+ $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
+ "all" => 1 });
+
+ my %labels = ();
+ my @values = ("");
+ foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{"id"}} = $item->{"projectnumber"};
+ }
+ my $projectnumber =
+ NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values,
+ '-labels' => \%labels));
+
$form->{fokus} = "search.customer";
$form->header;
-
+ $onload = qq|focus()|;
+ $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
+ $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
print qq|
-<body onLoad="fokus()">
+<body onLoad="$onload">
<form method=post name="search" action=$form->{script}>
<th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
<td colspan=3><input name=ordnumber size=20></td>
</tr>
+ <tr>
+ <th align=right nowrap>| . $locale->text('Transaction description') . qq|</th>
+ <td colspan=3><input name=transaction_description size=40></td>
+ </tr>
<tr>
<th align=right nowrap>| . $locale->text('Notes') . qq|</th>
<td colspan=3><input name=notes size=40></td>
</tr>
+ <tr>
+ <th align="right">| . $locale->text("Project Number") . qq|</th>
+ <td colspan="3">$projectnumber</td>
+ </tr>
<tr>
<th align=right nowrap>| . $locale->text('From') . qq|</th>
$button1
<td align=right><input name="l_shipvia" class=checkbox type=checkbox value=Y></td>
<td nowrap>| . $locale->text('Ship via') . qq|</td>
</tr>
+ <tr>
+ <td align=right><input name="l_marge_total" class=checkbox type=checkbox value=Y></td><td> |
+ . $locale->text('Ertrag') . qq|</td>
+ <td align=right><input name="l_marge_percent" class=checkbox type=checkbox value=Y></td><td> |
+ . $locale->text('Ertrag prozentual') . qq|</td>
+ </tr>
<tr>
<td align=right><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
<td nowrap>| . $locale->text('Subtotal') . qq|</td>
+ <td align=right><input name="l_globalprojectnumber" class=checkbox type=checkbox value=Y></td>
+ <td nowrap>| . $locale->text('Project Number') . qq|</td>
+ <td align=right><input name="l_transaction_description" class=checkbox type=checkbox value=Y></td>
+ <td nowrap>| . $locale->text('Transaction description') . qq|</td>
</tr>
</table>
</td>
<input type=hidden name=nextsub value=$form->{nextsub}>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
$lxdebug->leave_sub();
}
+sub create_subtotal_row {
+ $lxdebug->enter_sub();
+
+ my ($totals, $columns, $column_alignment, $subtotal_columns, $class) = @_;
+
+ my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => $column_alignment->{$_}, } } @{ $columns } };
+
+ map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, 2) } @{ $subtotal_columns };
+
+ $row->{tax}->{data} = $form->format_amount(\%myconfig, $totals->{amount} - $totals->{netamount}, 2);
+
+ map { $totals->{$_} = 0 } @{ $subtotal_columns };
+
+ $lxdebug->leave_sub();
+
+ return $row;
+}
+
sub ar_transactions {
$lxdebug->enter_sub();
+ my ($callback, $href, @columns);
+
$form->{customer} = $form->unescape($form->{customer});
($form->{customer}, $form->{customer_id}) = split(/--/, $form->{customer});
+ $form->{sort} ||= 'transdate';
+
AR->ar_transactions(\%myconfig, \%$form);
- $callback =
- "$form->{script}?action=ar_transactions&path=$form->{path}&login=$form->{login}&password=$form->{password}";
- $href = $callback;
+ $form->{title} = $locale->text('AR Transactions');
+
+ my $report = SL::ReportGenerator->new(\%myconfig, $form);
+
+ @columns =
+ qw(transdate id type invnumber ordnumber name netamount tax amount paid
+ datepaid due duedate transaction_description notes employee shippingpoint shipvia
+ marge_total marge_percent globalprojectnumber);
+
+ my @hidden_variables = map { "l_${_}" } @columns;
+ push @hidden_variables, "l_subtotal", qw(open closed customer invnumber ordnumber transaction_description notes project_id transdatefrom transdateto);
+
+ $href = build_std_url('action=ar_transactions', grep { $form->{$_} } @hidden_variables);
+
+ my %column_defs = (
+ 'transdate' => { 'text' => $locale->text('Date'), },
+ 'id' => { 'text' => $locale->text('ID'), },
+ 'type' => { 'text' => $locale->text('Type'), },
+ 'invnumber' => { 'text' => $locale->text('Invoice'), },
+ 'ordnumber' => { 'text' => $locale->text('Order'), },
+ 'name' => { 'text' => $locale->text('Customer'), },
+ 'netamount' => { 'text' => $locale->text('Amount'), },
+ 'tax' => { 'text' => $locale->text('Tax'), },
+ 'amount' => { 'text' => $locale->text('Total'), },
+ 'paid' => { 'text' => $locale->text('Paid'), },
+ 'datepaid' => { 'text' => $locale->text('Date Paid'), },
+ 'due' => { 'text' => $locale->text('Amount Due'), },
+ 'duedate' => { 'text' => $locale->text('Due Date'), },
+ 'transaction_description' => { 'text' => $locale->text('Transaction description'), },
+ 'notes' => { 'text' => $locale->text('Notes'), },
+ 'employee' => { 'text' => $locale->text('Salesperson'), },
+ 'shippingpoint' => { 'text' => $locale->text('Shipping Point'), },
+ 'shipvia' => { 'text' => $locale->text('Ship via'), },
+ 'globalprojectnumber' => { 'text' => $locale->text('Project Number'), },
+ 'marge_total' => { 'text' => $locale->text('Ertrag'), },
+ 'marge_percent' => { 'text' => $locale->text('Ertrag prozentual'), },
+ );
+
+ foreach my $name (qw(id transdate duedate invnumber ordnumber name datepaid
+ employee shippingpoint shipvia)) {
+ $column_defs{$name}->{link} = $href . "&sort=$name";
+ }
+
+ my %column_alignment = map { $_ => 'right' } qw(netamount tax amount paid due);
+
+ $form->{"l_type"} = "Y";
+ map { $column_defs{$_}->{visible} = $form->{"l_${_}"} ? 1 : 0 } @columns;
+
+ $report->set_columns(%column_defs);
+ $report->set_column_order(@columns);
+
+ $report->set_export_options('ar_transactions', @hidden_variables);
+
+ $report->set_sort_indicator($form->{sort}, 1);
+ my @options;
if ($form->{customer}) {
- $callback .= "&customer=" . $form->escape($form->{customer}, 1);
- $href .= "&customer=" . $form->escape($form->{customer});
- $option = $locale->text('Customer') . " : $form->{customer}";
+ push @options, $locale->text('Customer') . " : $form->{customer}";
}
if ($form->{department}) {
- $callback .= "&department=" . $form->escape($form->{department}, 1);
- $href .= "&department=" . $form->escape($form->{department});
- ($department) = split /--/, $form->{department};
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Department') . " : $department";
+ my ($department) = split /--/, $form->{department};
+ push @options, $locale->text('Department') . " : $department";
}
if ($form->{invnumber}) {
- $callback .= "&invnumber=" . $form->escape($form->{invnumber}, 1);
- $href .= "&invnumber=" . $form->escape($form->{invnumber});
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Invoice Number') . " : $form->{invnumber}";
+ push @options, $locale->text('Invoice Number') . " : $form->{invnumber}";
}
if ($form->{ordnumber}) {
- $callback .= "&ordnumber=" . $form->escape($form->{ordnumber}, 1);
- $href .= "&ordnumber=" . $form->escape($form->{ordnumber});
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Order Number') . " : $form->{ordnumber}";
+ push @options, $locale->text('Order Number') . " : $form->{ordnumber}";
}
if ($form->{notes}) {
- $callback .= "¬es=" . $form->escape($form->{notes}, 1);
- $href .= "¬es=" . $form->escape($form->{notes});
- $option .= "\n<br>" if $option;
- $option .= $locale->text('Notes') . " : $form->{notes}";
+ push @options, $locale->text('Notes') . " : $form->{notes}";
+ }
+ if ($form->{transaction_description}) {
+ push @options, $locale->text('Transaction description') . " : $form->{transaction_description}";
}
-
if ($form->{transdatefrom}) {
- $callback .= "&transdatefrom=$form->{transdatefrom}";
- $href .= "&transdatefrom=$form->{transdatefrom}";
- $option .= "\n<br>" if ($option);
- $option .=
- $locale->text('From') . " "
- . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
+ push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
}
if ($form->{transdateto}) {
- $callback .= "&transdateto=$form->{transdateto}";
- $href .= "&transdateto=$form->{transdateto}";
- $option .= "\n<br>" if ($option);
- $option .=
- $locale->text('Bis') . " "
- . $locale->date(\%myconfig, $form->{transdateto}, 1);
+ push @options, $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{transdateto}, 1);
}
if ($form->{open}) {
- $callback .= "&open=$form->{open}";
- $href .= "&open=$form->{open}";
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Open');
+ push @options, $locale->text('Open');
}
if ($form->{closed}) {
- $callback .= "&closed=$form->{closed}";
- $href .= "&closed=$form->{closed}";
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Closed');
- }
-
- @columns = $form->sort_columns(
- qw(transdate id type invnumber ordnumber name netamount tax amount paid datepaid due duedate notes employee shippingpoint shipvia)
- );
-
- $form->{"l_type"} = "Y";
-
- foreach $item (@columns) {
- if ($form->{"l_$item"} eq "Y") {
- push @column_index, $item;
-
- # add column to href and callback
- $callback .= "&l_$item=Y";
- $href .= "&l_$item=Y";
- }
- }
-
- if ($form->{l_subtotal} eq 'Y') {
- $callback .= "&l_subtotal=Y";
- $href .= "&l_subtotal=Y";
+ push @options, $locale->text('Closed');
}
- $column_header{id} =
- "<th><a class=listheading href=$href&sort=id>"
- . $locale->text('ID')
- . "</a></th>";
- $column_header{transdate} =
- "<th><a class=listheading href=$href&sort=transdate>"
- . $locale->text('Date')
- . "</a></th>";
- $column_header{duedate} =
- "<th><a class=listheading href=$href&sort=duedate>"
- . $locale->text('Due Date')
- . "</a></th>";
- $column_header{type} =
- "<th class=\"listheading\">" . $locale->text('Type') . "</th>";
- $column_header{invnumber} =
- "<th><a class=listheading href=$href&sort=invnumber>"
- . $locale->text('Invoice')
- . "</a></th>";
- $column_header{ordnumber} =
- "<th><a class=listheading href=$href&sort=ordnumber>"
- . $locale->text('Order')
- . "</a></th>";
- $column_header{name} =
- "<th><a class=listheading href=$href&sort=name>"
- . $locale->text('Customer')
- . "</a></th>";
- $column_header{netamount} =
- "<th class=listheading>" . $locale->text('Amount') . "</th>";
- $column_header{tax} =
- "<th class=listheading>" . $locale->text('Tax') . "</th>";
- $column_header{amount} =
- "<th class=listheading>" . $locale->text('Total') . "</th>";
- $column_header{paid} =
- "<th class=listheading>" . $locale->text('Paid') . "</th>";
- $column_header{datepaid} =
- "<th><a class=listheading href=$href&sort=datepaid>"
- . $locale->text('Date Paid')
- . "</a></th>";
- $column_header{due} =
- "<th class=listheading>" . $locale->text('Amount Due') . "</th>";
- $column_header{notes} =
- "<th class=listheading>" . $locale->text('Notes') . "</th>";
- $column_header{employee} =
- "<th><a class=listheading href=$href&sort=employee>"
- . $locale->text('Salesperson') . "</th>";
-
- $column_header{shippingpoint} =
- "<th><a class=listheading href=$href&sort=shippingpoint>"
- . $locale->text('Shipping Point')
- . "</a></th>";
- $column_header{shipvia} =
- "<th><a class=listheading href=$href&sort=shipvia>"
- . $locale->text('Ship via')
- . "</a></th>";
-
- $form->{title} = $locale->text('AR Transactions');
-
- $form->header;
-
- print qq|
-<body>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>$option</td>
- </tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>
-|;
-
- map { print "\n$column_header{$_}" } @column_index;
-
- print qq|
- </tr>
-|;
+ $report->set_options('top_info_text' => join("\n", @options),
+ 'raw_bottom_info_text' => $form->parse_html_template('ar/ar_transactions_bottom'),
+ 'output_format' => 'HTML',
+ 'title' => $form->{title},
+ 'attachment_basename' => $locale->text('invoice_list') . strftime('_%Y%m%d', localtime time),
+ );
+ $report->set_options_from_form();
# add sort and escape callback, this one we use for the add sub
- $form->{callback} = $callback .= "&sort=$form->{sort}";
+ $form->{callback} = $href .= "&sort=$form->{sort}";
# escape callback for href
- $callback = $form->escape($callback);
-
- if (@{ $form->{AR} }) {
- $sameitem = $form->{AR}->[0]->{ $form->{sort} };
- }
+ $callback = $form->escape($href);
- # sums and tax on reports by Antonio Gallardo
- #
- foreach $ar (@{ $form->{AR} }) {
+ my @subtotal_columns = qw(netamount amount paid due marge_total);
- if ($form->{l_subtotal} eq 'Y') {
- if ($sameitem ne $ar->{ $form->{sort} }) {
- &ar_subtotal;
- }
- }
+ my %totals = map { $_ => 0 } @subtotal_columns;
+ my %subtotals = map { $_ => 0 } @subtotal_columns;
- $column_data{netamount} =
- "<td align=right>"
- . $form->format_amount(\%myconfig, $ar->{netamount}, 2, " ")
- . "</td>";
- $column_data{tax} = "<td align=right>"
- . $form->format_amount(\%myconfig, $ar->{amount} - $ar->{netamount},
- 2, " ")
- . "</td>";
- $column_data{amount} =
- "<td align=right>"
- . $form->format_amount(\%myconfig, $ar->{amount}, 2, " ") . "</td>";
- $column_data{paid} =
- "<td align=right>"
- . $form->format_amount(\%myconfig, $ar->{paid}, 2, " ") . "</td>";
- $column_data{due} = "<td align=right>"
- . $form->format_amount(\%myconfig, $ar->{amount} - $ar->{paid},
- 2, " ")
- . "</td>";
-
- $subtotalnetamount += $ar->{netamount};
- $subtotalamount += $ar->{amount};
- $subtotalpaid += $ar->{paid};
- $subtotaldue += $ar->{amount} - $ar->{paid};
-
- $totalnetamount += $ar->{netamount};
- $totalamount += $ar->{amount};
- $totalpaid += $ar->{paid};
- $totaldue += ($ar->{amount} - $ar->{paid});
-
- $column_data{transdate} = "<td>$ar->{transdate} </td>";
- $column_data{id} = "<td>$ar->{id}</td>";
- $column_data{datepaid} = "<td>$ar->{datepaid} </td>";
- $column_data{duedate} = "<td>$ar->{duedate} </td>";
-
- $module = ($ar->{invoice}) ? "is.pl" : $form->{script};
-
- $column_data{invnumber} =
- "<td><a href=$module?action=edit&id=$ar->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ar->{invnumber}</a></td>";
- $column_data{type} = "<td>" .
- ($ar->{storno} ? $locale->text("Storno (one letter abbreviation)") :
- $ar->{amount} < 0 ?
- $locale->text("Credit note (one letter abbreviation)") :
- $locale->text("Invoice (one letter abbreviation)")) . "</td>";
- $column_data{ordnumber} = "<td>$ar->{ordnumber} </td>";
- $column_data{name} = "<td>$ar->{name}</td>";
- $ar->{notes} =~ s/\r\n/<br>/g;
- $column_data{notes} = "<td>$ar->{notes} </td>";
- $column_data{shippingpoint} = "<td>$ar->{shippingpoint} </td>";
- $column_data{shipvia} = "<td>$ar->{shipvia} </td>";
- $column_data{employee} = "<td>$ar->{employee} </td>";
-
- $i++;
- $i %= 2;
- print "
- <tr class=listrow$i>
-";
+ my $idx = 0;
- map { print "\n$column_data{$_}" } @column_index;
+ foreach my $ar (@{ $form->{AR} }) {
+ $ar->{tax} = $ar->{amount} - $ar->{netamount};
+ $ar->{due} = $ar->{amount} - $ar->{paid};
- print qq|
- </tr>
-|;
+ map { $subtotals{$_} += $ar->{$_};
+ $totals{$_} += $ar->{$_} } @subtotal_columns;
- }
+ map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 2) } qw(netamount tax amount paid due marge_total marge_percent);
- if ($form->{l_subtotal} eq 'Y') {
- &ar_subtotal;
- }
+ my $is_storno = $ar->{storno} && !$ar->{storno_id};
+ my $has_storno = $ar->{storno} && $ar->{storno_id};
- # print totals
- print qq|
- <tr class=listtotal>
-|;
+ $ar->{type} =
+ $has_storno ? $locale->text("Invoice with Storno (abbreviation)") :
+ $is_storno ? $locale->text("Storno (one letter abbreviation)") :
+ $ar->{amount} < 0 ? $locale->text("Credit note (one letter abbreviation)") :
+ $ar->{invoice} ? $locale->text("Invoice (one letter abbreviation)") :
+ $locale->text("AR Transaction (abbreviation)");
- map { $column_data{$_} = "<td> </td>" } @column_index;
-
- $column_data{netamount} =
- "<th class=listtotal align=right>"
- . $form->format_amount(\%myconfig, $totalnetamount, 2, " ") . "</th>";
- $column_data{tax} = "<th class=listtotal align=right>"
- . $form->format_amount(\%myconfig, $totalamount - $totalnetamount,
- 2, " ")
- . "</th>";
- $column_data{amount} =
- "<th class=listtotal align=right>"
- . $form->format_amount(\%myconfig, $totalamount, 2, " ") . "</th>";
- $column_data{paid} =
- "<th class=listtotal align=right>"
- . $form->format_amount(\%myconfig, $totalpaid, 2, " ") . "</th>";
- $column_data{due} =
- "<th class=listtotal align=right>"
- . $form->format_amount(\%myconfig, $totaldue, 2, " ") . "</th>";
-
- map { print "\n$column_data{$_}" } @column_index;
+ my $row = { };
- print qq|
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
+ foreach my $column (@columns) {
+ $row->{$column} = {
+ 'data' => $ar->{$column},
+ 'align' => $column_alignment{$column},
+ };
+ }
-<br>
-<form method=post action=$form->{script}>
+ $row->{invnumber}->{link} = build_std_url("script=" . ($ar->{invoice} ? 'is.pl' : 'ar.pl'), 'action=edit')
+ . "&id=" . E($ar->{id}) . "&callback=${callback}";
-<input name=callback type=hidden value="$form->{callback}">
+ my $row_set = [ $row ];
-<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->{l_subtotal} eq 'Y')
+ && (($idx == (scalar @{ $form->{AR} } - 1))
+ || ($ar->{ $form->{sort} } ne $form->{AR}->[$idx + 1]->{ $form->{sort} }))) {
+ push @{ $row_set }, create_subtotal_row(\%subtotals, \@columns, \%column_alignment, \@subtotal_columns, 'listsubtotal');
+ }
-<input class=submit type=submit name=action value="|
- . $locale->text('AR Transaction') . qq|">
-<input class=submit type=submit name=action value="|
- . $locale->text('Sales Invoice') . qq|">|;
+ $report->add_data($row_set);
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
+ $idx++;
}
- print qq|
-</form>
+ $report->add_separator();
+ $report->add_data(create_subtotal_row(\%totals, \@columns, \%column_alignment, \@subtotal_columns, 'listtotal'));
-</body>
-</html>
-|;
+ $report->generate_with_headers();
$lxdebug->leave_sub();
}
-sub ar_subtotal {
+sub storno {
$lxdebug->enter_sub();
- map { $column_data{$_} = "<td> </td>" } @column_index;
-
- $column_data{tax} = "<th class=listsubtotal align=right>"
- . $form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount,
- 2, " ")
- . "</th>";
- $column_data{amount} =
- "<th class=listsubtotal align=right>"
- . $form->format_amount(\%myconfig, $subtotalamount, 2, " ") . "</th>";
- $column_data{paid} =
- "<th class=listsubtotal align=right>"
- . $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "</th>";
- $column_data{due} =
- "<th class=listsubtotal align=right>"
- . $form->format_amount(\%myconfig, $subtotaldue, 2, " ") . "</th>";
-
- $subtotalnetamount = 0;
- $subtotalamount = 0;
- $subtotalpaid = 0;
- $subtotaldue = 0;
-
- $sameitem = $ar->{ $form->{sort} };
+ # don't cancel cancelled transactions
+ if (IS->has_storno(\%myconfig, $form, 'ar')) {
+ $form->{title} = $locale->text("Cancel Accounts Receivables Transaction");
+ $form->error($locale->text("Transaction has already been cancelled!"));
+ }
- print "<tr class=listsubtotal>";
+ AR->storno($form, \%myconfig, $form->{id});
- map { print "\n$column_data{$_}" } @column_index;
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $form->{snumbers} = "ordnumber_$form->{ordnumber}";
+ $form->{addition} = "STORNO";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
- print "
-</tr>
-";
+ $form->redirect(sprintf $locale->text("Transaction %d cancelled."), $form->{storno_id});
$lxdebug->leave_sub();
}
#
# any custom scripts for this one
-if (-f "$form->{path}/custom_arap.pl") {
- eval { require "$form->{path}/custom_arap.pl"; };
+if (-f "bin/mozilla/custom_arap.pl") {
+ eval { require "bin/mozilla/custom_arap.pl"; };
}
-if (-f "$form->{path}/$form->{login}_arap.pl") {
- eval { require "$form->{path}/$form->{login}_arap.pl"; };
+if (-f "bin/mozilla/$form->{login}_arap.pl") {
+ eval { require "bin/mozilla/$form->{login}_arap.pl"; };
}
1;
+require "bin/mozilla/common.pl";
+
# end of main
sub check_name {
my ($name) = @_;
+ $name = $name eq "customer" ? "customer" : "vendor";
+
my ($new_name, $new_id) = split /--/, $form->{$name};
my $i = 0;
# if we use a selection
} else {
# name is not on file
+ # $locale->text('Customer not on file or locked!')
+ # $locale->text('Vendor not on file or locked!')
$msg = ucfirst $name . " not on file or locked!";
$form->error($locale->text($msg));
}
$lxdebug->enter_sub();
for $i (1 .. $form->{rowcount}) {
- $form->{"project_id_$i"} = "" unless $form->{"projectnumber_$i"};
- if ($form->{"projectnumber_$i"} ne $form->{"oldprojectnumber_$i"}) {
- if ($form->{"projectnumber_$i"}) {
+ my $suffix = $i ? "_$i" : "";
+ my $prefix = $i ? "" : "global";
+ $form->{"${prefix}project_id${suffix}"} = "" unless $form->{"${prefix}projectnumber$suffix"};
+ if ($form->{"${prefix}projectnumber${suffix}"} ne $form->{"old${prefix}projectnumber${suffix}"}) {
+ if ($form->{"${prefix}projectnumber${suffix}"}) {
# get new project
- $form->{projectnumber} = $form->{"projectnumber_$i"};
+ $form->{projectnumber} = $form->{"${prefix}projectnumber${suffix}"};
if (($rows = PE->projects(\%myconfig, $form)) > 1) {
# check form->{project_list} how many there are
$form->{rownumber} = $i;
- &select_project;
+ &select_project($i ? undef : 1);
exit;
}
if ($rows == 1) {
- $form->{"project_id_$i"} = $form->{project_list}->[0]->{id};
- $form->{"projectnumber_$i"} =
+ $form->{"${prefix}project_id${suffix}"} =
+ $form->{project_list}->[0]->{id};
+ $form->{"${prefix}projectnumber${suffix}"} =
$form->{project_list}->[0]->{projectnumber};
- $form->{"oldprojectnumber_$i"} =
+ $form->{"old${prefix}projectnumber${suffix}"} =
$form->{project_list}->[0]->{projectnumber};
} else {
$form->error($locale->text('Project not on file!'));
}
} else {
- $form->{"oldprojectnumber_$i"} = "";
+ $form->{"old${prefix}projectnumber${suffix}"} = "";
}
}
}
sub select_project {
$lxdebug->enter_sub();
+ my ($is_global) = @_;
+
@column_index = qw(ndx projectnumber description);
$column_data{ndx} = qq|<th> </th>|;
|;
# delete action variable
- map { delete $form->{$_} } qw(action project_list header);
+ map { delete $form->{$_} } qw(action project_list header update);
# save all other form variables
foreach $key (keys %${form}) {
}
print qq|
+<input type="hidden" name="is_global" value="$is_global">
<input type=hidden name=nextsub value=project_selected>
<br>
# index for new item
$i = $form->{ndx};
- $form->{"projectnumber_$form->{rownumber}"} =
+ my $prefix = $form->{"is_global"} ? "global" : "";
+ my $suffix = $form->{"is_global"} ? "" : "_$form->{rownumber}";
+
+ $form->{"${prefix}projectnumber${suffix}"} =
$form->{"new_projectnumber_$i"};
- $form->{"oldprojectnumber_$form->{rownumber}"} =
+ $form->{"old${prefix}projectnumber${suffix}"} =
$form->{"new_projectnumber_$i"};
- $form->{"project_id_$form->{rownumber}"} = $form->{"new_id_$i"};
+ $form->{"${prefix}project_id${suffix}"} = $form->{"new_id_$i"};
# delete all the new_ variables
for $i (1 .. $form->{lastndx}) {
map { delete $form->{"new_${_}_$i"} } qw(id projectnumber description);
}
- map { delete $form->{$_} } qw(ndx lastndx nextsub);
+ map { delete $form->{$_} } qw(ndx lastndx nextsub is_global);
if ($form->{update}) {
- &{ $form->{update} };
+ call_sub($form->{"update"});
} else {
&update;
}
$lxdebug->leave_sub();
}
-sub continue { &{ $form->{nextsub} } }
+sub continue { call_sub($form->{"nextsub"}); }
sub gl_transaction { &add }
sub ar_transaction { &add_transaction('ar') }
sub ap_transaction { &add_transaction('ap') }
#======================================================================
use SL::BP;
+use Data::Dumper;
1;
+require "bin/mozilla/common.pl";
+
# end of main
sub search {
}
# use JavaScript Calendar or not
- $form->{jsscript} = $jscalendar;
+ $form->{jsscript} = 1;
$jsscript = "";
if ($form->{jsscript}) {
# with JavaScript Calendar
$button1 = qq|
- <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
+ <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
<input type=button name=transdatefrom id="trigger1" value=|
. $locale->text('button') . qq|></td>
|;
$button2 = qq|
- <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
+ <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
<input type=button name=transdateto name=transdateto id="trigger2" value=|
. $locale->text('button') . qq|></td>
|;
# without JavaScript Calendar
$button1 = qq|
- <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
+ <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|;
$button2 = qq|
- <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
+ <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|;
}
-
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
$form->header;
-
+ $onload = qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
+ $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
print qq|
-<body>
+<body onLoad="$onload">
<form method=post action=$form->{script}>
<input type=hidden name=nextsub value=list_spool>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
sub print {
$lxdebug->enter_sub();
+ $form->get_lists(printers => 'ALL_PRINTERS');
+ # use the command stored in the databse or fall back to $myconfig{printer}
+ my $selected_printer = (grep { $_->{id} eq $form->{printer} } @{ $form->{ALL_PRINTERS} })[0]->{'printer_command'} || $myconfig{printer};
+
if ($form->{callback}) {
map { $form->{callback} .= "&checked_$_=1" if $form->{"checked_$_"} }
(1 .. $form->{rowcount});
for $i (1 .. $form->{rowcount}) {
if ($form->{"checked_$i"}) {
- $form->{OUT} = "| $myconfig{printer}";
$form->info($locale->text('Printing ... '));
- if (BP->print_spool(\%myconfig, \%$form, $spool)) {
+ if (BP->print_spool(\%myconfig, \%$form, $spool, "| $selected_printer")) {
print $locale->text('done');
$form->redirect($locale->text('Marked entries printed!'));
}
$title = $form->escape($form->{title});
$href =
- "$form->{script}?action=list_spool&path=$form->{path}&login=$form->{login}&password=$form->{password}&vc=$form->{vc}&type=$form->{type}&title=$title";
+ "$form->{script}?action=list_spool&login=$form->{login}&password=$form->{password}&vc=$form->{vc}&type=$form->{type}&title=$title";
$title = $form->escape($form->{title}, 1);
$callback =
- "$form->{script}?action=list_spool&path=$form->{path}&login=$form->{login}&password=$form->{password}&vc=$form->{vc}&type=$form->{type}&title=$title";
+ "$form->{script}?action=list_spool&login=$form->{login}&password=$form->{password}&vc=$form->{vc}&type=$form->{type}&title=$title";
if ($form->{ $form->{vc} }) {
$callback .= "&$form->{vc}=" . $form->escape($form->{ $form->{vc} }, 1);
}
$column_data{invnumber} =
- "<td><a href=$module?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&type=$form->{type}&callback=$callback>$ref->{invnumber}</a></td>";
+ "<td><a href=$module?action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&type=$form->{type}&callback=$callback>$ref->{invnumber}</a></td>";
$column_data{ordnumber} =
- "<td><a href=$module?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&type=$form->{type}&callback=$callback>$ref->{ordnumber}</a></td>";
+ "<td><a href=$module?action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&type=$form->{type}&callback=$callback>$ref->{ordnumber}</a></td>";
$column_data{quonumber} =
- "<td><a href=$module?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&type=$form->{type}&callback=$callback>$ref->{quonumber}</a></td>";
+ "<td><a href=$module?action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&type=$form->{type}&callback=$callback>$ref->{quonumber}</a></td>";
$column_data{name} = "<td>$ref->{name}</td>";
$column_data{spoolfile} =
qq|<td><a href=$spool/$ref->{spoolfile}>$ref->{spoolfile}</a></td>
<input type=hidden name=account value="$form->{account}">
-<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 ($myconfig{printer}) {
+# if ($myconfig{printer}) {
print qq|
<input type=hidden name=transdateto value=$form->{transdateto}>
<input type=hidden name=transdatefrom value=$form->{transdatefrom}>
<input type=hidden name=vendor value=$form->{vendor}>
<input class=submit type=submit name=action value="|
. $locale->text('Select all') . qq|">
-<input class=submit type=submit name=action value="|
- . $locale->text('Print') . qq|">
<input class=submit type=submit name=action value="|
. $locale->text('Remove') . qq|">
+<input class=submit type=submit name=action value="|
+ . $locale->text('Print') . qq|">
|;
- }
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
+$form->get_lists(printers=>"ALL_PRINTERS");
+print qq|<select name="printer">|;
+print map(qq|<option value="$_->{id}">| . $form->quote_html($_->{printer_description}) . qq|</option>|, @{ $form->{ALL_PRINTERS} });
+print qq|</select>|;
+
+# }
print qq|
</form>
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub select_all {
$lxdebug->leave_sub();
}
-sub continue { &{ $form->{nextsub} } }
+sub continue { call_sub($form->{"nextsub"}); }
#
#======================================================================
+use POSIX qw(strftime);
+
use SL::CA;
+use SL::ReportGenerator;
+
+require "bin/mozilla/reportgenerator.pl";
1;
sub chart_of_accounts {
$lxdebug->enter_sub();
- CA->all_accounts(\%myconfig, \%$form);
-
- @column_index = qw(accno gifi_accno description debit credit);
-
- $column_header{accno} =
- qq|<th class=listheading>| . $locale->text('Account') . qq|</th>\n|;
- $column_header{gifi_accno} =
- qq|<th class=listheading>| . $locale->text('GIFI') . qq|</th>\n|;
- $column_header{description} =
- qq|<th class=listheading>| . $locale->text('Description') . qq|</th>\n|;
- $column_header{debit} =
- qq|<th class=listheading>| . $locale->text('Debit') . qq|</th>\n|;
- $column_header{credit} =
- qq|<th class=listheading>| . $locale->text('Credit') . qq|</th>\n|;
-
$form->{title} = $locale->text('Chart of Accounts');
- $colspan = $#column_index + 1;
+ CA->all_accounts(\%myconfig, \%$form);
- $form->header;
+ my @columns = qw(accno description debit credit);
+ my %column_defs = (
+ 'accno' => { 'text' => $locale->text('Account'), },
+ 'description' => { 'text' => $locale->text('Description'), },
+ 'debit' => { 'text' => $locale->text('Debit'), },
+ 'credit' => { 'text' => $locale->text('Credit'), },
+ );
- print qq|
-<body>
+ my $report = SL::ReportGenerator->new(\%myconfig, $form);
-<table border=0 width=100%>
- <tr><th class=listtop colspan=$colspan>$form->{title}</th></tr>
- <tr height="5"></tr>
- <tr class=listheading>|;
+ $report->set_options('output_format' => 'HTML',
+ 'title' => $form->{title},
+ 'attachment_basename' => $locale->text('chart_of_accounts') . strftime('_%Y%m%d', localtime time),
+ 'std_column_visibility' => 1,
+ );
+ $report->set_options_from_form();
- map { print $column_header{$_} } @column_index;
+ $report->set_columns(%column_defs);
+ $report->set_column_order(@columns);
- print qq|
- </tr>
-|;
+ $report->set_export_options('chart_of_accounts');
- foreach $ca (@{ $form->{CA} }) {
+ $report->set_sort_indicator($form->{sort}, 1);
- $description = $form->escape($ca->{description});
- $gifi_description = $form->escape($ca->{gifi_description});
+ my %totals = ('debit' => 0, 'credit' => 0);
- $href =
- qq|$form->{script}?path=$form->{path}&action=list&accno=$ca->{accno}&login=$form->{login}&password=$form->{password}&description=$description&gifi_accno=$ca->{gifi_accno}&gifi_description=$gifi_description|;
+ foreach my $ca (@{ $form->{CA} }) {
+ my $row = { };
- if ($ca->{charttype} eq "H") {
- print qq|<tr class=listheading>|;
- map { $column_data{$_} = "<th>$ca->{$_}</th>"; } qw(accno description);
- $column_data{gifi_accno} = "<th>$ca->{gifi_accno} </th>";
- } else {
- $i++;
- $i %= 2;
- print qq|<tr class=listrow$i>|;
- $column_data{accno} = "<td><a href=$href>$ca->{accno}</a></td>";
- $column_data{gifi_accno} =
- "<td><a href=$href&accounttype=gifi>$ca->{gifi_accno}</a> </td>";
- $column_data{description} = "<td>$ca->{description}</td>";
- }
- my $debit = "";
- my $credit = "";
- if ($ca->{debit}) {
- $debit = $form->format_amount(\%myconfig, $ca->{debit}, 2, " ");
+ foreach (qw(debit credit)) {
+ $totals{$_} += $ca->{$_} * 1;
+ $ca->{$_} = $form->format_amount(\%myconfig, $ca->{$_}, 2) if ($ca->{$_});
}
- if ($ca->{credit}) {
- $credit = $form->format_amount(\%myconfig, $ca->{credit}, 2, " ");
- }
- $column_data{debit} =
- "<td align=right>"
- . $debit
- . "</td>\n";
- $column_data{credit} =
- "<td align=right>"
- . $credit
- . "</td>\n";
-
- $totaldebit += $ca->{debit};
- $totalcredit += $ca->{credit};
-
- map { print $column_data{$_} } @column_index;
-
- print qq|
-</tr>
-|;
- }
- map { $column_data{$_} = "<td> </td>"; }
- qw(accno gifi_accno description);
+ map { $row->{$_} = { 'data' => $ca->{$_} } } @columns;
- $column_data{debit} =
- "<th align=right class=listtotal>"
- . $form->format_amount(\%myconfig, $totaldebit, 2, 0) . "</th>";
- $column_data{credit} =
- "<th align=right class=listtotal>"
- . $form->format_amount(\%myconfig, $totalcredit, 2, 0) . "</th>";
+ map { $row->{$_}->{align} = 'right' } qw(debit credit);
+ map { $row->{$_}->{class} = 'listheading' } @columns if ($ca->{charttype} eq "H");
- print "<tr class=listtotal>";
+ $row->{accno}->{link} = build_std_url('action=list', 'accno=' . E($ca->{accno}), 'description=' . E($ca->{description}));
- map { print $column_data{$_} } @column_index;
+ $report->add_data($row);
+ }
- print qq|
-</tr>
-<tr>
- <td colspan=$colspan><hr size=3 noshade></td>
-</tr>
-</table>
+ my $row = { map { $_ => { 'class' => 'listtotal', 'align' => 'right' } } @columns };
+ map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals{$_}, 2) } qw(debit credit);
-</body>
-</html>
-|;
+ $report->add_separator();
+ $report->add_data($row);
+
+ $report->generate_with_headers();
$lxdebug->leave_sub();
}
$lxdebug->enter_sub();
$form->{title} = $locale->text('List Transactions');
- if ($form->{accounttype} eq 'gifi') {
- $form->{title} .= " - " . $locale->text('GIFI') . " $form->{gifi_accno}";
- } else {
- $form->{title} .= " - " . $locale->text('Account') . " $form->{accno}";
- }
+ $form->{title} .= " - " . $locale->text('Account') . " $form->{accno}";
# get departments
$form->all_departments(\%myconfig);
$form->header;
- map { $form->{$_} =~ s/\"/"/g; } qw(description gifi_description);
+ $form->{description} =~ s/\"/"/g;
print qq|
<body>
<input type=hidden name=sort value=transdate>
<input type=hidden name=eur value=$eur>
<input type=hidden name=accounttype value=$form->{accounttype}>
-<input type=hidden name=gifi_accno value=$form->{gifi_accno}>
-<input type=hidden name=gifi_description value="$form->{gifi_description}">
<table border=0 width=100%>
<tr><th class=listtop>$form->{title}</th></tr>
</table>
<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=password value=$form->{password}>
<br><input class=submit type=submit name=action value="|
sub list_transactions {
$lxdebug->enter_sub();
- CA->all_transactions(\%myconfig, \%$form);
-
- $description = $form->escape($form->{description});
- $gifi_description = $form->escape($form->{gifi_description});
- $department = $form->escape($form->{department});
- $projectnumber = $form->escape($form->{projectnumber});
- $title = $form->escape($form->{title});
-
- # construct href
- $href =
- "$form->{script}?path=$form->{path}&action=list_transactions&accno=$form->{accno}&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&description=$description&accounttype=$form->{accounttype}&gifi_accno=$form->{gifi_accno}&gifi_description=$gifi_description&l_heading=$form->{l_heading}&l_subtotal=$form->{l_subtotal}&department=$department&projectnumber=$projectnumber&project_id=$form->{project_id}&title=$title";
-
- $description = $form->escape($form->{description}, 1);
- $gifi_description = $form->escape($form->{gifi_description}, 1);
- $department = $form->escape($form->{department}, 1);
- $projectnumber = $form->escape($form->{projectnumber}, 1);
- $title = $form->escape($form->{title}, 1);
-
- # construct callback
- $callback =
- "$form->{script}?path=$form->{path}&action=list_transactions&accno=$form->{accno}&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&description=$description&accounttype=$form->{accounttype}&gifi_accno=$form->{gifi_accno}&gifi_description=$gifi_description&l_heading=$form->{l_heading}&l_subtotal=$form->{l_subtotal}&department=$department&projectnumber=$projectnumber&project_id=$form->{project_id}&title=$title";
-
- # figure out which column comes first
- $column_header{transdate} =
- qq|<th><a class=listheading href=$href&sort=transdate>|
- . $locale->text('Date')
- . qq|</a></th>|;
- $column_header{reference} =
- qq|<th><a class=listheading href=$href&sort=reference>|
- . $locale->text('Reference')
- . qq|</a></th>|;
- $column_header{description} =
- qq|<th><a class=listheading href=$href&sort=description>|
- . $locale->text('Description')
- . qq|</a></th>|;
- $column_header{debit} = qq|<th>| . $locale->text('Debit') . qq|</th>|;
- $column_header{credit} = qq|<th>| . $locale->text('Credit') . qq|</th>|;
- $column_header{balance} = qq|<th>| . $locale->text('Balance') . qq|</th>|;
-
- @column_index =
- $form->sort_columns(qw(transdate reference description debit credit));
-
- if ($form->{accounttype} eq 'gifi') {
- map { $form->{$_} = $form->{"gifi_$_"} } qw(accno description);
- }
- if ($form->{accno}) {
- push @column_index, "balance";
- }
+ $form->{title} = $locale->text('Account') . " $form->{accno} - $form->{description}";
- $form->{title} =
- ($form->{accounttype} eq 'gifi')
- ? $locale->text('GIFI')
- : $locale->text('Account');
-
- $form->{title} .= " $form->{accno} - $form->{description}";
+ CA->all_transactions(\%myconfig, \%$form);
+ my @options;
if ($form->{department}) {
- ($department) = split /--/, $form->{department};
- $options = $locale->text('Department') . " : $department<br>";
+ my ($department) = split /--/, $form->{department};
+ push @options, $locale->text('Department') . " : $department";
}
if ($form->{projectnumber}) {
- $options .= $locale->text('Project Number');
- $options .= " : $form->{projectnumber}<br>";
+ push @options, $locale->text('Project Number') . " : $form->{projectnumber}<br>";
}
+ my $period;
if ($form->{fromdate} || $form->{todate}) {
+ my ($fromdate, $todate);
+
if ($form->{fromdate}) {
$fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
}
$todate = $locale->date(\%myconfig, $form->{todate}, 1);
}
- $form->{period} = "$fromdate - $todate";
+ $period = "$fromdate - $todate";
+
} else {
- $form->{period} =
- $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
+ $period = $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
}
- $options .= $form->{period};
+ push @options, $period;
- $form->header;
+ my @columns = qw(transdate reference description debit credit balance);
+ my %column_defs = (
+ 'transdate' => { 'text' => $locale->text('Date'), },
+ 'reference' => { 'text' => $locale->text('Reference'), },
+ 'description' => { 'text' => $locale->text('Description'), },
+ 'debit' => { 'text' => $locale->text('Debit'), },
+ 'credit' => { 'text' => $locale->text('Credit'), },
+ 'balance' => { 'text' => $locale->text('Balance'), },
+ );
+ my %column_alignment = map { $_ => 'right' } qw(debit credit balance);
- print qq|
-<body>
+ my @hidden_variables = qw(accno fromdate todate description accounttype l_heading l_subtotal department projectnumber project_id sort);
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>$options</td>
- </tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>
-|;
+ my $link = build_std_url('action=list_transactions', grep { $form->{$_} } @hidden_variables);
+ map { $column_defs{$_}->{link} = $link . "&sort=$_" } qw(transdate reference description);
- map { print "$column_header{$_}\n" } @column_index;
+ $form->{callback} = $link . '&sort=' . E($form->{sort});
- print qq|
- </tr>
-|;
+ my $report = SL::ReportGenerator->new(\%myconfig, $form);
- # add sort to callback
- $callback = $form->escape($callback . "&sort=$form->{sort}");
+ $report->set_options('top_info_text' => join("\n", @options),
+ 'output_format' => 'HTML',
+ 'title' => $form->{title},
+ 'attachment_basename' => $locale->text('list_of_transactions') . strftime('_%Y%m%d', localtime time),
+ 'std_column_visibility' => 1,
+ );
+ $report->set_options_from_form();
- if (@{ $form->{CA} }) {
- $sameitem = $form->{CA}->[0]->{ $form->{sort} };
- }
+ $report->set_columns(%column_defs);
+ $report->set_column_order(@columns);
- $ml = ($form->{category} =~ /(A|E)/) ? -1 : 1;
- if ($form->{accno} && $form->{balance}) {
+ $report->set_export_options('list_transactions', @hidden_variables);
- map { $column_data{$_} = "<td> </td>" } @column_index;
+ $report->set_sort_indicator($form->{sort}, 1);
- $column_data{balance} =
- "<td align=right>"
- . $form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)
- . "</td>";
+ $column_defs->{balance}->{visible} = $form->{accno} ? 1 : 0;
- $i++;
- $i %= 2;
- print qq|
- <tr class=listrow$i>
-|;
- map { print $column_data{$_} } @column_index;
- print qq|
- </tr>
-|;
+ my $ml = ($form->{category} =~ /(A|E)/) ? -1 : 1;
+
+ if ($form->{accno} && $form->{balance}) {
+ my $row = {
+ 'balance' => {
+ 'data' => $form->format_amount(\%myconfig, $form->{balance} * $ml, 2),
+ 'align' => 'right',
+ },
+ };
+
+ $report->add_data($row);
}
- foreach $ca (@{ $form->{CA} }) {
+ my $idx = 0;
+ my %totals = ( 'debit' => 0, 'credit' => 0 );
+ my %subtotals = ( 'debit' => 0, 'credit' => 0 );
+ my ($previous_index, $row_set);
+
+ foreach my $ca (@{ $form->{CA} }) {
+ $form->{balance} += $ca->{amount};
- if ($form->{l_subtotal} eq 'Y') {
- if ($sameitem ne $ca->{ $form->{sort} }) {
- &ca_subtotal;
- }
+ foreach (qw(debit credit)) {
+ $subtotals{$_} += $ca->{$_};
+ $totals{$_} += $ca->{$_};
+ $ca->{$_} = $form->format_amount(\%myconfig, $ca->{$_}, 2) if ($ca->{$_} != 0);
}
- # construct link to source
- $href =
- "<a href=$ca->{module}.pl?path=$form->{path}&action=edit&id=$ca->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{reference}</a>";
- my $debit = ($ca->{debit} != 0) ? $form->format_amount(\%myconfig, $ca->{debit}, 2, " ") : " ";
- $column_data{debit} =
- "<td align=right>$debit</td>";
- my $credit = ($ca->{credit} != 0) ? $form->format_amount(\%myconfig, $ca->{credit}, 2, " ") : " ";
- $column_data{credit} =
- "<td align=right>$credit</td>";
+ $ca->{balance} = $form->format_amount(\%myconfig, $form->{balance} * $ml, 2);
- $form->{balance} += $ca->{amount};
- $column_data{balance} =
- "<td align=right>"
- . $form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)
- . "</td>";
+ my $row = { };
- $subtotaldebit += $ca->{debit};
- $subtotalcredit += $ca->{credit};
+ foreach (@columns) {
+ $row->{$_} = {
+ 'data' => $ca->{$_},
+ 'align' => $column_alignment{$_},
+ };
+ }
- $totaldebit += $ca->{debit};
- $totalcredit += $ca->{credit};
+ if ($ca->{index} ne $previous_index) {
+ $report->add_data($row_set) if ($row_set);
- $column_data{transdate} = qq|<td>$ca->{transdate}</td>|;
- $column_data{reference} = qq|<td>$href</td>|;
- $column_data{description} = qq|<td>$ca->{description}</td>|;
+ $row_set = [ ];
+ $previous_index = $ca->{index};
- $i++;
- $i %= 2;
- print qq|
- <tr class=listrow$i>
-|;
+ $row->{reference}->{link} = build_std_url("script=$ca->{module}.pl", 'action=edit', 'id=' . E($ca->{id}), 'callback');
- map { print $column_data{$_} } @column_index;
+ } else {
+ map { $row->{$_}->{data} = '' } qw(reference description);
+ $row->{transdate}->{data} = '' if ($form->{sort} eq 'transdate');
+ }
- print qq|
- </tr>
-|;
+ push @{ $row_set }, $row;
- }
+ if (($form->{l_subtotal} eq 'Y')
+ && (($idx == scalar @{ $form->{CA} } - 1)
+ || ($ca->{$form->{sort}} ne $form->{CA}->[$idx + 1]->{$form->{sort}}))) {
+ $report->add_data(create_subtotal_row(\%subtotals, \@columns, \%column_alignment, 'listsubtotal'));
+ }
- if ($form->{l_subtotal} eq 'Y') {
- &ca_subtotal;
+ $idx++;
}
- map { $column_data{$_} = "<td> </td>" } @column_index;
+ $report->add_data($row_set) if ($row_set);
- $column_data{debit} =
- "<th align=right>"
- . $form->format_amount(\%myconfig, $totaldebit, 2, " ") . "</th>";
- $column_data{credit} =
- "<th align=right>"
- . $form->format_amount(\%myconfig, $totalcredit, 2, " ") . "</th>";
- $column_data{balance} =
- "<th align=right>"
- . $form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0) . "</th>";
+ $report->add_separator();
- print qq|
- <tr class=listtotal>
-|;
+ my $row = create_subtotal_row(\%totals, \@columns, \%column_alignment, 'listtotal');
+ $row->{balance}->{data} = $form->format_amount(\%myconfig, $form->{balance} * $ml, 2);
+ $report->add_data($row);
- map { print $column_data{$_} } @column_index;
-
- print qq|
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-</body>
-</html>
-|;
+ $report->generate_with_headers();
$lxdebug->leave_sub();
}
-sub ca_subtotal {
+sub create_subtotal_row {
$lxdebug->enter_sub();
- map { $column_data{$_} = "<td> </td>" } @column_index;
-
- $column_data{debit} =
- "<th align=right>"
- . $form->format_amount(\%myconfig, $subtotaldebit, 2, " ") . "</th>";
- $column_data{credit} =
- "<th align=right>"
- . $form->format_amount(\%myconfig, $subtotalcredit, 2, " ") . "</th>";
-
- $subtotaldebit = 0;
- $subtotalcredit = 0;
-
- $sameitem = $ca->{ $form->{sort} };
+ my ($totals, $columns, $column_alignment, $class) = @_;
- print qq|
- <tr class=listsubtotal>
-|;
+ my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => $column_alignment->{$_}, } } @{ $columns } };
- map { print "$column_data{$_}\n" } @column_index;
+ map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, 2) } qw(credit debit);
- print qq|
- </tr>
-|;
+ map { $totals->{$_} = 0 } qw(debit credit);
$lxdebug->leave_sub();
+
+ return $row;
}
+++ /dev/null
-#=====================================================================
-# LX-Office ERP
-# Copyright (C) 2004
-# Based on SQL-Ledger Version 2.1.9
-# Web http://www.lx-office.org
-#
-#=====================================================================
-# SQL-Ledger Accounting
-# Copyright (c) 1998-2002
-#
-# Author: Dieter Simader
-# Email: dsimader@sql-ledger.org
-# Web: http://www.sql-ledger.org
-#
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#======================================================================
-#
-# Inventory invoicing module
-#
-#======================================================================
-
-use SL::IS;
-use SL::PE;
-use Data::Dumper;
-
-require "$form->{path}/io.pl";
-require "$form->{path}/arap.pl";
-
-1;
-
-# end of main
-
-sub add {
- $lxdebug->enter_sub();
-
- $form->{title} = $locale->text('Add Credit Note');
-
- $form->{callback} =
- "$form->{script}?action=add&type=$form->{type}&login=$form->{login}&path=$form->{path}&password=$form->{password}"
- unless $form->{callback};
-
- $form{jsscript} = "date";
-
-
- &credit_note_links;
- &prepare_credit_note;
- $form->{format} = "pdf";
-
- &display_form;
-
- $lxdebug->leave_sub();
-}
-
-sub edit {
- $lxdebug->enter_sub();
-
- $form->{title} = $locale->text('Edit Credit Note');
-
-
- if ($form->{print_and_post}) {
- $form->{action} = "print";
- $form->{resubmit} = 1;
- }
- &credit_note_links;
- &prepare_credit_note;
- &display_form;
-
- $lxdebug->leave_sub();
-}
-
-sub credit_note_links {
- $lxdebug->enter_sub();
-
- $form->{vc} = 'customer';
-
- # create links
- $form->{webdav} = $webdav;
- $form->{lizenzen} = $lizenzen;
-
- $form->create_links("AR", \%myconfig, "customer");
-
- if ($form->{all_customer}) {
- unless ($form->{customer_id}) {
- $form->{customer_id} = $form->{all_customer}->[0]->{id};
- }
- }
-
- if ($form->{payment_id}) {
- $payment_id = $form->{payment_id};
- }
- if ($form->{language_id}) {
- $language_id = $form->{language_id};
- }
-
- $cp_id = $form->{cp_id};
- IS->get_customer(\%myconfig, \%$form);
-
- IS->retrieve_invoice(\%myconfig, \%$form);
- $form->{cp_id} = $cp_id;
-
- if ($payment_id) {
- $form->{payment_id} = $payment_id;
- }
- if ($language_id) {
- $form->{language_id} = $language_id;
- }
-
- # currencies
- @curr = split /:/, $form->{currencies};
- chomp $curr[0];
- $form->{defaultcurrency} = $curr[0];
-
- map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
-
- $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
-
- if ($form->{all_customer}) {
- $form->{customer} = "$form->{customer}--$form->{customer_id}";
- map { $form->{selectcustomer} .= "<option>$_->{name}--$_->{id}\n" }
- (@{ $form->{all_customer} });
- }
-
- # departments
- if ($form->{all_departments}) {
- $form->{selectdepartment} = "<option>\n";
- $form->{department} = "$form->{department}--$form->{department_id}";
-
- map {
- $form->{selectdepartment} .=
- "<option>$_->{description}--$_->{id}\n"
- } (@{ $form->{all_departments} });
- }
-
- $form->{employee} = "$form->{employee}--$form->{employee_id}";
-
- # sales staff
- if ($form->{all_employees}) {
- $form->{selectemployee} = "";
- map { $form->{selectemployee} .= "<option>$_->{name}--$_->{id}\n" }
- (@{ $form->{all_employees} });
- }
-
- # forex
- $form->{forex} = $form->{exchangerate};
- $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
-
- foreach $key (keys %{ $form->{AR_links} }) {
- foreach $ref (@{ $form->{AR_links}{$key} }) {
- $form->{"select$key"} .= "<option>$ref->{accno}--$ref->{description}\n";
- }
-
- if ($key eq "AR_paid") {
- for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
- $form->{"AR_paid_$i"} =
- "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
-
- # reverse paid
- $form->{"paid_$i"} = $form->{acc_trans}{$key}->[$i - 1]->{amount} * -1;
- $form->{"datepaid_$i"} =
- $form->{acc_trans}{$key}->[$i - 1]->{transdate};
- $form->{"forex_$i"} = $form->{"exchangerate_$i"} =
- $form->{acc_trans}{$key}->[$i - 1]->{exchangerate};
- $form->{"source_$i"} = $form->{acc_trans}{$key}->[$i - 1]->{source};
- $form->{"memo_$i"} = $form->{acc_trans}{$key}->[$i - 1]->{memo};
-
- $form->{paidaccounts} = $i;
- }
- } else {
- $form->{$key} =
- "$form->{acc_trans}{$key}->[0]->{accno}--$form->{acc_trans}{$key}->[0]->{description}";
- }
-
- }
-
- $form->{paidaccounts} = 1 unless (exists $form->{paidaccounts});
-
- $form->{AR} = $form->{AR_1} unless $form->{id};
-
- $form->{locked} =
- ($form->datetonum($form->{invdate}, \%myconfig) <=
- $form->datetonum($form->{closedto}, \%myconfig));
-
- $lxdebug->leave_sub();
-}
-
-sub prepare_credit_note {
- $lxdebug->enter_sub();
-
- $form->{type} = "credit_note";
- $form->{formname} = "credit_note";
- $form->{media} = "screen";
-
- if ($form->{id}) {
-
- map { $form->{$_} =~ s/\"/"/g }
- qw(invnumber ordnumber quonumber shippingpoint shipvia notes intnotes);
-
- # # get pricegroups for parts
- # IS->get_pricegroups_for_parts(\%myconfig, \%$form);
-
- foreach $ref (@{ $form->{invoice_details} }) {
- $i++;
- map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref};
- $form->{"discount_$i"} =
- $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100);
- ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
- $dec = length $dec;
- $decimalplaces = ($dec > 2) ? $dec : 2;
-
- $form->{"sellprice_$i"} =
- $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
- $decimalplaces);
-
- (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
- $dec_qty = length $dec_qty;
-
- $form->{"qty_$i"} =
- $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
-
- map { $form->{"${_}_$i"} =~ s/\"/"/g }
- qw(partnumber description unit partnotes);
- $form->{rowcount} = $i;
-
- }
- }
- $lxdebug->leave_sub();
-}
-
-sub form_header {
- $lxdebug->enter_sub();
-
- $payment = qq|<option value=""></option>|;
- foreach $item (@{ $form->{payment_terms} }) {
- if ($form->{payment_id} eq $item->{id}) {
- $payment .= qq|<option value="$item->{id}" selected>$item->{description}</option>|;
- } else {
- $payment .= qq|<option value="$item->{id}">$item->{description}</option>|;
- }
- }
-
- # set option selected
- foreach $item (qw(AR customer currency department employee contact)) {
- $form->{"select$item"} =~ s/ selected//;
- $form->{"select$item"} =~
- s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
- }
-
- #build contacts
- if ($form->{all_contacts}) {
-
- $form->{selectcontact} = "";
- foreach $item (@{ $form->{all_contacts} }) {
- if ($form->{cp_id} == $item->{cp_id}) {
- $form->{selectcontact} .=
- "<option selected>$item->{cp_name}--$item->{cp_id}";
- } else {
- $form->{selectcontact} .= "<option>$item->{cp_name}--$item->{cp_id}";
- }
- }
- }
-
- #else {$form->{all_contacts} = 0;}
-
- $form->{exchangerate} =
- $form->format_amount(\%myconfig, $form->{exchangerate});
-
- $form->{creditlimit} =
- $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
- $form->{creditremaining} =
- $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
-
- $exchangerate = "";
- if ($form->{currency} ne $form->{defaultcurrency}) {
- if ($form->{forex}) {
- $exchangerate .=
- qq|<th align=right>|
- . $locale->text('Exchangerate')
- . qq|</th><td>$form->{exchangerate}<input type=hidden name=exchangerate value=$form->{exchangerate}></td>|;
- } else {
- $exchangerate .=
- qq|<th align=right>|
- . $locale->text('Exchangerate')
- . qq|</th><td><input name=exchangerate size=10 value=$form->{exchangerate}></td>|;
- }
- }
- $exchangerate .= qq|
-<input type=hidden name=forex value=$form->{forex}>
-|;
-
- $customer =
- ($form->{selectcustomer})
- ? qq|<select name=customer>$form->{selectcustomer}</select>\n<input type=hidden name="selectcustomer" value="$form->{selectcustomer}">|
- : qq|<input name=customer value="$form->{customer}" size=35>|;
-
- #sk
- $contact =
- ($form->{selectcontact})
- ? qq|<select name=contact>$form->{selectcontact}</select>\n<input type=hidden name="selectcontact" value="$form->{selectcontact}">|
- : qq|<input name=contact value="$form->{contact}" size=35>|;
-
- $department = qq|
- <tr>
- <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
- <td colspan=3><select name=department>$form->{selectdepartment}</select>
- <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
- </td>
- </tr>
-| if $form->{selectdepartment};
-
- $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
-
- if ($form->{business}) {
- $business = qq|
- <tr>
- <th align=right>| . $locale->text('Business') . qq|</th>
- <td>$form->{business}</td>
- <th align=right>| . $locale->text('Trade Discount') . qq|</th>
- <td>|
- . $form->format_amount(\%myconfig, $form->{tradediscount} * 100)
- . qq| %</td>
- </tr>
-|;
- }
-
- $form->{fokus} = "invoice.customer";
-
- # use JavaScript Calendar or not
- $form->{jsscript} = $jscalendar;
- $jsscript = "";
- if ($form->{jsscript}) {
-
- # with JavaScript Calendar
- $button1 = qq|
- <td><input name=invdate id=invdate size=11 title="$myconfig{dateformat}" value=$form->{invdate}></td>
- <td><input type=button name=invdate id="trigger1" value=|
- . $locale->text('button') . qq|></td>
- |;
- $button2 = qq|
- <td width="13"><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>
- <td width="4"><input type=button name=duedate id="trigger2" value=|
- . $locale->text('button') . qq|></td></td>
- |;
- $button3 = qq|
- <td width="13"><input name=deliverydate id=deliverydate size=11 title="$myconfig{dateformat}" value=$form->{deliverydate}></td>
- <td width="4"><input type=button name=deliverydate id="trigger3" value=|
- . $locale->text('button') . qq|></td></td>
- |;
-
- #write Trigger
- $jsscript =
- Form->write_trigger(\%myconfig, "3",
- "invdate", "BL",
- "trigger1", "duedate",
- "BL", "trigger2",
- "deliverydate", "BL",
- "trigger3");
- } else {
-
- # without JavaScript Calendar
- $button1 =
- qq|<td><input name=invdate size=11 title="$myconfig{dateformat}" value=$form->{invdate}></td>|;
- $button2 =
- qq|<td width="13"><input name=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>|;
- }
- if ($form->{resubmit} && ($form->{format} eq "html")) {
- $onload =
- qq|window.open('about:blank','Beleg'); document.invoice.target = 'Beleg';document.invoice.submit()|;
- } elsif ($form->{resubmit}) {
- $onload = qq|document.invoice.submit()|;
- } else {
- $onload = "fokus()";
- }
- $form->header;
-
- print qq|
-<body onLoad="$onload">
-<script type="text/javascript" src="js/common.js"></script>
-<script type="text/javascript" src="js/delivery_customer_selection.js"></script>
-<script type="text/javascript" src="js/vendor_selection.js"></script>
-<script type="text/javascript" src="js/calculate_qty.js"></script>
-
-<form method=post name="invoice" action=$form->{script}>
-
-
-<input type=hidden name=id value=$form->{id}>
-<input type=hidden name=action value=$form->{action}>
-
-<input type=hidden name=type value=$form->{type}>
-<input type=hidden name=media value=$form->{media}>
-<input type=hidden name=format value=$form->{format}>
-
-<input type=hidden name=queued value="$form->{queued}">
-<input type=hidden name=printed value="$form->{printed}">
-<input type=hidden name=emailed value="$form->{emailed}">
-
-<input type=hidden name=title value="$form->{title}">
-<input type=hidden name=vc value=$form->{vc}>
-
-<input type=hidden name=discount value=$form->{discount}>
-<input type=hidden name=creditlimit value=$form->{creditlimit}>
-<input type=hidden name=creditremaining value=$form->{creditremaining}>
-
-<input type=hidden name=tradediscount value=$form->{tradediscount}>
-<input type=hidden name=business value=$form->{business}>
-
-<input type=hidden name=closedto value=$form->{closedto}>
-<input type=hidden name=locked value=$form->{locked}>
-
-<input type=hidden name=shipped value=$form->{shipped}>
-<input type=hidden name=lizenzen value=$lizenzen>
-
-<table width=100%>
- <tr class=listtop>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table width=100%>
- <tr valign=top>
- <td>
- <table>
- <tr>
- <th align=right nowrap>| . $locale->text('Customer') . qq|</th>
- <td colspan=3>$customer</td>
- <input type=hidden name=customer_klass value=$form->{customer_klass}>
- <input type=hidden name=customer_id value=$form->{customer_id}>
- <input type=hidden name=oldcustomer value="$form->{oldcustomer}">
- <th align=richt nowrap>|
- . $locale->text('Contact Person') . qq|</th>
- <td colspan=3>$contact</td>
- </tr>
- <tr>
- <td></td>
- <td colspan=3>
- <table>
- <tr>
- <th nowrap>| . $locale->text('Credit Limit') . qq|</th>
- <td>$form->{creditlimit}</td>
- <td width=20%></td>
- <th nowrap>| . $locale->text('Remaining') . qq|</th>
- <td class="plus$n">$form->{creditremaining}</td>
- </tr>
- </table>
- </td>
- </tr>
- $business
- <tr>
- <th align=right nowrap>| . $locale->text('Record in') . qq|</th>
- <td colspan=3><select name=AR>$form->{selectAR}</select></td>
- <input type=hidden name=selectAR value="$form->{selectAR}">
- </tr>
- $department
- <tr>
- <th align=right nowrap>| . $locale->text('Currency') . qq|</th>
- <td><select name=currency>$form->{selectcurrency}</select></td>
- <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
- <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
- <input type=hidden name=fxgain_accno value=$form->{fxgain_accno}>
- <input type=hidden name=fxloss_accno value=$form->{fxloss_accno}>
- $exchangerate
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Shipping Point') . qq|</th>
- <td colspan=3><input name=shippingpoint size=35 value="$form->{shippingpoint}"></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Ship via') . qq|</th>
- <td colspan=3><input name=shipvia size=35 value="$form->{shipvia}"></td>
- </tr>
- <tr>
- <td colspan=4>
- <table>
- <tr>
- <td colspan=2>
- <button type="button" onclick="delivery_customer_selection_window('delivery_customer_string','delivery_customer_id')">| . $locale->text('Choose Customer') . qq|</button>
- </td>
- <td colspan=2><input type=hidden name=delivery_customer_id value="$form->{delivery_customer_id}">
- <input id=delivery_customer_string name=delivery_customer_string value="$form->{delivery_customer_string}"></td>
- </tr>
- <tr>
- <td colspan=2>
- <button type="button" onclick="vendor_selection_window('delivery_vendor_string','delivery_vendor_id')">| . $locale->text('Choose Vendor') . qq|</button>
- </td>
- <td colspan=2><input type=hidden name=delivery_vendor_id value="$form->{delivery_vendor_id}">
- <input id=delivery_vendor_string name=delivery_vendor_string value="$form->{delivery_vendor_string}"></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- <td align=right>
- <table>
- <tr>
- <th align=right nowrap>| . $locale->text('Salesperson') . qq|</th>
- <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
- <input type=hidden name=selectemployee value="$form->{selectemployee}">
- <td></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Credit Note Number') . qq|</th>
- <td><input name=invnumber size=11 value="$form->{invnumber}"></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Credit Note Date') . qq|</th>
- $button1
- </tr>
- <tr>
- <th align=right>| . $locale->text('Due Date') . qq|</th>
- $button2
- </tr>
- <tr>
- <th align=right>| . $locale->text('Delivery Date') . qq|</th>
- $button3
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
- <td><input name=ordnumber size=11 value="$form->{ordnumber}"></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Quotation Number') . qq|</th>
- <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Customer Order Number') . qq|</th>
- <td><input name=cusordnumber size=11 value="$form->{cusordnumber}"></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td>
- </td>
- </tr>
-
-$jsscript
-
-<!-- shipto are in hidden variables -->
-
-<input type=hidden name=shiptoname value="$form->{shiptoname}">
-<input type=hidden name=shiptostreet value="$form->{shiptostreet}">
-<input type=hidden name=shiptozipcode value="$form->{shiptozipcode}">
-<input type=hidden name=shiptocity value="$form->{shiptocity}">
-<input type=hidden name=shiptocountry value="$form->{shiptocountry}">
-<input type=hidden name=shiptocontact value="$form->{shiptocontact}">
-<input type=hidden name=shiptophone value="$form->{shiptophone}">
-<input type=hidden name=shiptofax value="$form->{shiptofax}">
-<input type=hidden name=shiptoemail value="$form->{shiptoemail}">
-
-<!-- email variables -->
-<input type=hidden name=message value="$form->{message}">
-<input type=hidden name=email value="$form->{email}">
-<input type=hidden name=subject value="$form->{subject}">
-<input type=hidden name=cc value="$form->{cc}">
-<input type=hidden name=bcc value="$form->{bcc}">
-<input type=hidden name=webdav value=$webdav>
-<input type=hidden name=taxaccounts value="$form->{taxaccounts}">
-|;
-
- foreach $item (split / /, $form->{taxaccounts}) {
- print qq|
-<input type=hidden name="${item}_rate" value="$form->{"${item}_rate"}">
-<input type=hidden name="${item}_description" value="$form->{"${item}_description"}">
-<input type=hidden name="${item}_taxnumber" value="$form->{"${item}_taxnumber"}">
-|;
- }
- $lxdebug->leave_sub();
-}
-
-sub form_footer {
- $lxdebug->enter_sub();
-
- $form->{invtotal} = $form->{invsubtotal};
-
- if (($rows = $form->numtextrows($form->{notes}, 26, 8)) < 2) {
- $rows = 2;
- }
- if (($introws = $form->numtextrows($form->{intnotes}, 35, 8)) < 2) {
- $introws = 2;
- }
- $rows = ($rows > $introws) ? $rows : $introws;
- $notes =
- qq|<textarea name=notes rows=$rows cols=26 wrap=soft>$form->{notes}</textarea>|;
- $intnotes =
- qq|<textarea name=intnotes rows=$rows cols=35 wrap=soft>$form->{intnotes}</textarea>|;
-
- $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
-
- $taxincluded = "";
- if ($form->{taxaccounts}) {
- $taxincluded = qq|
- <input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}> <b>|
- . $locale->text('Tax Included') . qq|</b><br><br>|;
- }
-
- if (!$form->{taxincluded}) {
-
- foreach $item (split / /, $form->{taxaccounts}) {
- if ($form->{"${item}_base"}) {
- $form->{"${item}_total"} =
- $form->round_amount(
- $form->{"${item}_base"} * $form->{"${item}_rate"},
- 2);
- $form->{invtotal} += $form->{"${item}_total"};
- $form->{"${item}_total"} =
- $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
-
- $tax .= qq|
- <tr>
- <th align=right>$form->{"${item}_description"}</th>
- <td align=right>$form->{"${item}_total"}</td>
- </tr>
-|;
- }
- }
-
- $form->{invsubtotal} =
- $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0);
-
- $subtotal = qq|
- <tr>
- <th align=right>| . $locale->text('Subtotal') . qq|</th>
- <td align=right>$form->{invsubtotal}</td>
- </tr>
-|;
-
- }
-
- if ($form->{taxincluded}) {
- foreach $item (split / /, $form->{taxaccounts}) {
- if ($form->{"${item}_base"}) {
- $form->{"${item}_total"} =
- $form->round_amount(
- ($form->{"${item}_base"} * $form->{"${item}_rate"} /
- (1 + $form->{"${item}_rate"})
- ),
- 2);
- $form->{"${item}_netto"} =
- $form->round_amount(
- ($form->{"${item}_base"} - $form->{"${item}_total"}),
- 2);
- $form->{"${item}_total"} =
- $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
- $form->{"${item}_netto"} =
- $form->format_amount(\%myconfig, $form->{"${item}_netto"}, 2);
-
- $tax .= qq|
- <tr>
- <th align=right>Enthaltene $form->{"${item}_description"}</th>
- <td align=right>$form->{"${item}_total"}</td>
- </tr>
- <tr>
- <th align=right>Nettobetrag</th>
- <td align=right>$form->{"${item}_netto"}</td>
- </tr>
-|;
- }
- }
-
- }
-
- $form->{oldinvtotal} = $form->{invtotal};
- $form->{invtotal} =
- $form->format_amount(\%myconfig, $form->{invtotal}, 2, 0);
-
- print qq|
- <tr>
- <td>
- <table width=100%>
- <tr valign=bottom>
- <td>
- <table>
- <tr>
- <th align=left>| . $locale->text('Notes') . qq|</th>
- <th align=left>| . $locale->text('Internal Notes') . qq|</th>
- <th align=right>| . $locale->text('Payment Terms') . qq|</th>
- </tr>
- <tr valign=top>
- <td>$notes</td>
- <td>$intnotes</td>
- <td><select name=payment_id tabindex=24>$payment
- </select></td>
- </tr>
- </table>
- </td>
- <td align=right width=100%>
- $taxincluded
- <table width=100%>
- $subtotal
- $tax
- <tr>
- <th align=right>| . $locale->text('Total') . qq|</th>
- <td align=right>$form->{invtotal}</td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-|;
- if ($webdav) {
- $webdav_list = qq|
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
- <tr>
- <th class=listtop align=left>Dokumente im Webdav-Repository</th>
- </tr>
- <table width=100%>
- <td align=left width=30%><b>Dateiname</b></td>
- <td align=left width=70%><b>Webdavlink</b></td>
-|;
- foreach $file (keys %{ $form->{WEBDAV} }) {
- $webdav_list .= qq|
- <tr>
- <td align=left>$file</td>
- <td align=left><a href="$form->{WEBDAV}{$file}">$form->{WEBDAV}{$file}</a></td>
- </tr>
-|;
- }
- $webdav_list .= qq|
- </table>
- </tr>
-|;
-
- print $webdav_list;
- }
- print qq|
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>
- <th colspan=6 class=listheading>|
- . $locale->text('Incoming Payments') . qq|</th>
- </tr>
-|;
-
- if ($form->{currency} eq $form->{defaultcurrency}) {
- @column_index = qw(datepaid source memo paid AR_paid);
- } else {
- @column_index = qw(datepaid source memo paid exchangerate AR_paid);
- }
-
- $column_data{datepaid} = "<th>" . $locale->text('Date') . "</th>";
- $column_data{paid} = "<th>" . $locale->text('Amount') . "</th>";
- $column_data{exchangerate} = "<th>" . $locale->text('Exch') . "</th>";
- $column_data{AR_paid} = "<th>" . $locale->text('Account') . "</th>";
- $column_data{source} = "<th>" . $locale->text('Source') . "</th>";
- $column_data{memo} = "<th>" . $locale->text('Memo') . "</th>";
-
- print "
- <tr>
-";
- map { print "$column_data{$_}\n" } @column_index;
- print "
- </tr>
-";
-
- $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
- for $i (1 .. $form->{paidaccounts}) {
-
- print "
- <tr>\n";
-
- $form->{"selectAR_paid_$i"} = $form->{selectAR_paid};
- $form->{"selectAR_paid_$i"} =~
- s/option>\Q$form->{"AR_paid_$i"}\E/option selected>$form->{"AR_paid_$i"}/;
-
- # format amounts
- $totalpaid += $form->{"paid_$i"};
- $form->{"paid_$i"} =
- $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2);
- $form->{"exchangerate_$i"} =
- $form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
-
- $exchangerate = qq| |;
- if ($form->{currency} ne $form->{defaultcurrency}) {
- if ($form->{"forex_$i"}) {
- $exchangerate =
- qq|<input type=hidden name="exchangerate_$i" value=$form->{"exchangerate_$i"}>$form->{"exchangerate_$i"}|;
- } else {
- $exchangerate =
- qq|<input name="exchangerate_$i" size=10 value=$form->{"exchangerate_$i"}>|;
- }
- }
-
- $exchangerate .= qq|
-<input type=hidden name="forex_$i" value=$form->{"forex_$i"}>
-|;
-
- $column_data{"paid_$i"} =
- qq|<td align=center><input name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
- $column_data{"exchangerate_$i"} = qq|<td align=center>$exchangerate</td>|;
- $column_data{"AR_paid_$i"} =
- qq|<td align=center><select name="AR_paid_$i">$form->{"selectAR_paid_$i"}</select></td>|;
- $column_data{"datepaid_$i"} =
- qq|<td align=center><input name="datepaid_$i" size=11 title="$myconfig{dateformat}" value=$form->{"datepaid_$i"}></td>|;
- $column_data{"source_$i"} =
- qq|<td align=center><input name="source_$i" size=11 value="$form->{"source_$i"}"></td>|;
- $column_data{"memo_$i"} =
- qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></td>|;
-
- map { print qq|$column_data{"${_}_$i"}\n| } @column_index;
- print "
- </tr>\n";
- }
-
- print qq|
-<input type=hidden name=paidaccounts value=$form->{paidaccounts}>
-<input type=hidden name=selectAR_paid value="$form->{selectAR_paid}">
-<input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
-<input type=hidden name=oldtotalpaid value=$totalpaid>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
- <tr>
- <td>
-|;
-
- &print_options;
-
- print qq|
- </td>
- </tr>
-</table>
-|;
-
- $invdate = $form->datetonum($form->{invdate}, \%myconfig);
- $closedto = $form->datetonum($form->{closedto}, \%myconfig);
-
- if ($form->{id}) {
- print qq|
- <input class=submit type=submit name=action value="|
- . $locale->text('Update') . qq|">
- <input class=submit type=submit name=action value="|
- . $locale->text('Ship to') . qq|">
- <input class=submit type=submit name=action value="|
- . $locale->text('Print') . qq|">
- <input class=submit type=submit name=action value="|
- . $locale->text('E-mail') . qq|">
-|;
-
- if (!$form->{revtrans}) {
- if (!$form->{locked}) {
- print qq|
- <input class=submit type=submit name=action value="|
- . $locale->text('Post') . qq|">
- <input class=submit type=submit name=action value="|
- . $locale->text('Delete') . qq|">
-|;
- }
- }
-
- if ($invdate > $closedto) {
- print qq|
- <input class=submit type=submit name=action value="|
- . $locale->text('Post as new') . qq|">
- <input class=submit type=submit name=action value="|
- . $locale->text('Order') . qq|">
-|;
- }
-
- } else {
- if ($invdate > $closedto) {
- print qq|<input class=submit type=submit name=action value="|
- . $locale->text('Update') . qq|">
- <input class=submit type=submit name=action value="|
- . $locale->text('Ship to') . qq|">
- <input class=submit type=submit name=action value="|
- . $locale->text('Preview') . qq|">
- <input class=submit type=submit name=action value="|
- . $locale->text('E-mail') . qq|">
- <input class=submit type=submit name=action value="|
- . $locale->text('Print and Post') . qq|">
- <input class=submit type=submit name=action value="|
- . $locale->text('Post') . qq|">|;
- }
- }
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
-
-<input type=hidden name=rowcount value=$form->{rowcount}>
-
-<input name=callback type=hidden value="$form->{callback}">
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>
-
-</form>
-
-</body>
-
- </html>
-|;
-
- $lxdebug->leave_sub();
-}
-
-sub update {
- $lxdebug->enter_sub();
-
- map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
- qw(exchangerate creditlimit creditremaining);
- if ($form->{second_run}) {
- $form->{print_and_post} = 0;
- }
- &check_name(customer);
-
- &check_project;
-
- $form->{exchangerate} = $exchangerate
- if (
- $form->{forex} = (
- $exchangerate =
- $form->check_exchangerate(
- \%myconfig, $form->{currency}, $form->{invdate}, 'buy'
- )));
-
- for $i (1 .. $form->{paidaccounts}) {
- if ($form->{"paid_$i"}) {
- map {
- $form->{"${_}_$i"} =
- $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
- } qw(paid exchangerate);
-
- $form->{"exchangerate_$i"} = $exchangerate
- if (
- $form->{"forex_$i"} = (
- $exchangerate =
- $form->check_exchangerate(
- \%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'buy'
- )));
- }
- }
-
- $i = $form->{rowcount};
- $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
-
- # if last row empty, check the form otherwise retrieve new item
- if ( ($form->{"partnumber_$i"} eq "")
- && ($form->{"description_$i"} eq "")
- && ($form->{"partsgroup_$i"} eq "")) {
-
- $form->{creditremaining} += ($form->{oldinvtotal} - $form->{oldtotalpaid});
- &check_form;
-
- } else {
-
- IS->retrieve_item(\%myconfig, \%$form);
-
- $rows = scalar @{ $form->{item_list} };
-
- $form->{"discount_$i"} =
- $form->format_amount(\%myconfig, $form->{discount} * 100);
-
- if ($rows) {
- $form->{"qty_$i"} = ($form->{"qty_$i"} * 1) ? $form->{"qty_$i"} : 1;
-
- if ($rows > 1) {
-
- &select_item;
- exit;
-
- } else {
-
- $sellprice = $form->format_amount(\%myconfig, $form->{"sellprice_$i"});
-
- map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
- qw(partnumber description unit);
- map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} }
- keys %{ $form->{item_list}[0] };
-
- $form->{"discount_$i"} = $form->{discount} * 100;
-
- $s = ($sellprice) ? $sellprice : $form->{"sellprice_$i"};
- ($dec) = ($s =~ /\.(\d+)/);
- $dec = length $dec;
- $decimalplaces = ($dec > 2) ? $dec : 2;
-
- if ($sellprice) {
- $form->{"sellprice_$i"} = $sellprice;
- } else {
-
- # if there is an exchange rate adjust sellprice
- $form->{"sellprice_$i"} *= (1 - $form->{tradediscount});
- $form->{"sellprice_$i"} /= $exchangerate;
- }
-
- $form->{"listprice_$i"} /= $exchangerate;
-
- $amount =
- $form->{"sellprice_$i"} * $form->{"qty_$i"} *
- (1 - $form->{"discount_$i"} / 100);
- map { $form->{"${_}_base"} = 0 } (split / /, $form->{taxaccounts});
- map { $form->{"${_}_base"} += $amount }
- (split / /, $form->{"taxaccounts_$i"});
- map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
- split / /, $form->{"taxaccounts_$i"}
- if !$form->{taxincluded};
-
- $form->{creditremaining} -= $amount;
-
- map {
- $form->{"${_}_$i"} =
- $form->format_amount(\%myconfig, $form->{"${_}_$i"},
- $decimalplaces)
- } qw(sellprice listprice);
-
- $form->{"qty_$i"} =
- $form->format_amount(\%myconfig, $form->{"qty_$i"});
-
- if ($lizenzen) {
- if ($form->{"inventory_accno_$i"} ne "") {
- $form->{"lizenzen_$i"} = qq|<option></option>|;
- foreach $item (@{ $form->{LIZENZEN}{ $form->{"id_$i"} } }) {
- $form->{"lizenzen_$i"} .=
- qq|<option value="$item->{"id"}">$item->{"licensenumber"}</option>|;
- }
- $form->{"lizenzen_$i"} .=
- qq|<option value=-1>Neue Lizenz</option>|;
- }
- }
-
- # get pricegroups for parts
- IS->get_pricegroups_for_parts(\%myconfig, \%$form);
-
- # build up html code for prices_$i
- &set_pricegroup($i);
- }
-
- &display_form;
-
- } else {
-
- # ok, so this is a new part
- # ask if it is a part or service item
-
- if ( $form->{"partsgroup_$i"}
- && ($form->{"partsnumber_$i"} eq "")
- && ($form->{"description_$i"} eq "")) {
- $form->{rowcount}--;
- $form->{"discount_$i"} = "";
- &display_form;
- } else {
-
- $form->{"id_$i"} = 0;
- $form->{"unit_$i"} = $locale->text('ea');
-
- &new_item;
-
- }
- }
- }
- $lxdebug->leave_sub();
-}
-
-sub post {
- $lxdebug->enter_sub();
- $form->isblank("invdate", $locale->text('Invoice Date missing!'));
- $form->isblank("customer", $locale->text('Customer missing!'));
-
- # if oldcustomer ne customer redo form
- if (&check_name(customer)) {
- &update;
- exit;
- }
- if ($form->{second_run}) {
- $form->{print_and_post} = 0;
- }
-
- &validate_items;
-
- $closedto = $form->datetonum($form->{closedto}, \%myconfig);
- $invdate = $form->datetonum($form->{invdate}, \%myconfig);
-
- $form->error($locale->text('Cannot post invoice for a closed period!'))
- if ($invdate <= $closedto);
-
- $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
- if ($form->{currency} ne $form->{defaultcurrency});
-
- for $i (1 .. $form->{paidaccounts}) {
- if ($form->{"paid_$i"}) {
- $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
-
- $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
-
- $form->error($locale->text('Cannot post payment for a closed period!'))
- if ($datepaid <= $closedto);
-
- if ($form->{currency} ne $form->{defaultcurrency}) {
- $form->{"exchangerate_$i"} = $form->{exchangerate}
- if ($invdate == $datepaid);
- $form->isblank("exchangerate_$i",
- $locale->text('Exchangerate for payment missing!'));
- }
- }
- }
-
- ($form->{AR}) = split /--/, $form->{AR};
- ($form->{AR_paid}) = split /--/, $form->{AR_paid};
-
- $form->{label} = $locale->text('Invoice');
-
- $form->{id} = 0 if $form->{postasnew};
-
- # get new invnumber in sequence if no invnumber is given or if posasnew was requested
- if (!$form->{invnumber} || $form->{postasnew}) {
- $form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber");
- }
- if ($print_post) {
- if (!(IS->post_invoice(\%myconfig, \%$form))) {
- $form->error($locale->text('Cannot post invoice!'));
- }
- } else {
- $form->redirect(
- $form->{label} . " $form->{invnumber} " . $locale->text('posted!'))
- if (IS->post_invoice(\%myconfig, \%$form));
- $form->error($locale->text('Cannot post invoice!'));
- }
-
- $lxdebug->leave_sub();
-}
-
-sub print_and_post {
- $lxdebug->enter_sub();
-
- $old_form = new Form;
- $print_post = 1;
- $form->{print_and_post} = 1;
- &post();
-
- &edit();
- $lxdebug->leave_sub();
-
-}
-
-sub preview {
- $lxdebug->enter_sub();
-
- $form->{preview} = 1;
- $old_form = new Form;
- for (keys %$form) { $old_form->{$_} = $form->{$_} }
- $old_form->{rowcount}++;
-
- &print_form($old_form);
- $lxdebug->leave_sub();
-
-}
-
-sub delete {
- $lxdebug->enter_sub();
- if ($form->{second_run}) {
- $form->{print_and_post} = 0;
- }
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-|;
-
- # delete action variable
- map { delete $form->{$_} } qw(action header);
-
- foreach $key (keys %$form) {
- $form->{$key} =~ s/\"/"/g;
- print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
- }
-
- print qq|
-<h2 class=confirm>| . $locale->text('Confirm!') . qq|</h2>
-
-<h4>|
- . $locale->text('Are you sure you want to delete Invoice Number')
- . qq| $form->{invnumber}
-</h4>
-
-<p>
-<input name=action class=submit type=submit value="|
- . $locale->text('Yes') . qq|">
-</form>
-|;
-
- $lxdebug->leave_sub();
-}
-
-sub yes {
- $lxdebug->enter_sub();
-
- $form->redirect($locale->text('Invoice deleted!'))
- if (IS->delete_invoice(\%myconfig, \%$form, $spool));
- $form->error($locale->text('Cannot delete invoice!'));
-
- $lxdebug->leave_sub();
-}
#
######################################################################
-use Data::Dumper;
-
+use SL::Form;
use SL::Common;
+use SL::MoreCommon;
-sub save_form {
+sub build_std_url {
$lxdebug->enter_sub();
- my (@names, @values);
- foreach my $key (keys(%{$form})) {
- push(@names, "\$form->{\"$key\"}");
- push(@values, $form->{$key});
- }
- my $dumper = Data::Dumper->new(\@values, \@names);
- $dumper->Indent(0);
- my $old_form = $dumper->Dump();
+ my $script = $form->{script};
- $lxdebug->leave_sub();
+ my @parts;
- return $old_form;
-}
+ foreach my $key ((qw(login password), @_)) {
+ next unless ($key);
-sub restore_form {
- $lxdebug->enter_sub();
+ if ($key =~ /(.*?)=(.*)/) {
+ if ($1 eq 'script') {
+ $script = $2;
+ } else {
+ push @parts, $key;
+ }
- my ($old_form, $no_delete) = @_;
+ } else {
+ push @parts, "${key}=" . E($form->{$key});
+ }
+ }
- map({ delete($form->{$_}); } keys(%{$form})) unless ($no_delete);
- eval($old_form);
+ my $url = "${script}?" . join('&', @parts);
$lxdebug->leave_sub();
+
+ return $url;
}
sub select_employee {
restore_form($form->{"old_form"});
- &{ $callback_sub }($new_id, $new_name);
+ call_sub($callback_sub, $new_id, $new_name);
$lxdebug->leave_sub();
}
restore_form($form->{"old_form"});
- &{ $callback_sub }($new_item);
+ call_sub($callback_sub, $new_item);
$lxdebug->leave_sub();
}
my $callback = "$form->{script}?action=part_selection_internal&";
map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" }
- (qw(login path password partnumber description input_partnumber input_description input_partsid), grep({ /^[fl]_/ } keys %$form)));
+ (qw(login password partnumber description input_partnumber input_description input_partsid), grep({ /^[fl]_/ } keys %$form)));
my @header_sort = qw(partnumber description);
my %header_title = ( "partnumber" => $locale->text("Part Number"),
my $callback = "$form->{script}?action=project_selection_internal&";
map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" }
- (qw(login path password projectnumber description input_projectnumber input_description input_project_id), grep({ /^[fl]_/ } keys %$form)));
+ (qw(login password projectnumber description input_projectnumber input_description input_project_id), grep({ /^[fl]_/ } keys %$form)));
my @header_sort = qw(projectnumber description);
my %header_title = ( "projectnumber" => $locale->text("Project Number"),
my $callback = "$form->{script}?action=employee_selection_internal&";
map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" }
- (qw(login path password name input_name input_id), grep({ /^[fl]_/ } keys %$form)));
+ (qw(login password name input_name input_id), grep({ /^[fl]_/ } keys %$form)));
my @header_sort = qw(name);
my %header_title = ( "name" => $locale->text("Name"),
my $callback = "$form->{script}?action=delivery_customer_selection&";
map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" }
- (qw(login path password name input_name input_id), grep({ /^[fl]_/ } keys %$form)));
+ (qw(login password name input_name input_id), grep({ /^[fl]_/ } keys %$form)));
my @header_sort = qw(name customernumber address);
my %header_title = ( "name" => $locale->text("Name"),
my $callback = "$form->{script}?action=vendor_selection&";
map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" }
- (qw(login path password name input_name input_id), grep({ /^[fl]_/ } keys %$form)));
+ (qw(login password name input_name input_id), grep({ /^[fl]_/ } keys %$form)));
my @header_sort = qw(name customernumber address);
my %header_title = ( "name" => $locale->text("Name"),
my $callback = "$form->{script}?action=set_longdescription&";
map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" }
- (qw(login path password name input_name input_id), grep({ /^[fl]_/ } keys %$form)));
+ (qw(login password name input_name input_id), grep({ /^[fl]_/ } keys %$form)));
$form->{"title"} = $locale->text("Enter longdescription");
$form->header();
return $form->quote_html($_[0]);
}
+sub Q {
+ return $form->quote($_[0]);
+}
+
+sub E {
+ return $form->escape($_[0]);
+}
+
+sub NTI {
+ my ($element) = @_;
+
+ $element =~ s/tabindex\s*=\s*"\d+"//;
+ return $element;
+}
+
sub format_dates {
$lxdebug->enter_sub();
$lxdebug->leave_sub();
}
+sub show_history {
+ $lxdebug->enter_sub();
+ my $dbh = $form->dbconnect(\%myconfig);
+ my ($sort, $sortby) = split(/\-\-/, $form->{order});
+ $sort =~ s/.*\.(.*)/$1/;
+
+ $form->{title} = $locale->text("History");
+ $form->header();
+ print $form->parse_html_template( "common/show_history", {
+ "DATEN" => $form->get_history($dbh,$form->{input_name},"",$form->{order}),
+ "SUCCESS" => ($form->get_history($dbh,$form->{input_name}) ne "0"),
+ uc($sort) => 1,
+ uc($sort)."BY" => $sortby
+ } );
+
+ $dbh->disconnect();
+ $lxdebug->leave_sub();
+}
+
+sub call_sub {
+ $lxdebug->enter_sub();
+
+ my $name = shift;
+
+ if (!$name) {
+ $form->error($locale->text("Trying to call a sub without a name"));
+ }
+
+ $name =~ s/[^a-zA-Z0-9_]//g;
+
+ if (!defined(&{ $name })) {
+ $form->error(sprintf($locale->text("Attempt to call an undefined sub named '%s'"), $name));
+ }
+
+ &{ $name }(@_);
+
+ $lxdebug->leave_sub();
+}
+
+sub show_vc_details {
+ $lxdebug->enter_sub();
+
+ $form->{vc} = $form->{vc} eq "customer" ? "customer" : "vendor";
+ $form->isblank("vc_id",
+ $form->{vc} eq "customer" ?
+ $locale->text("No customer has been selected yet.") :
+ $locale->text("No vendor has been selected yet."));
+
+ Common->get_vc_details(\%myconfig, $form, $form->{vc}, $form->{vc_id});
+
+ $form->{title} = $form->{vc} eq "customer" ?
+ $locale->text("Customer details") : $locale->text("Vendor details");
+ $form->header();
+ print($form->parse_html_template("common/show_vc_details",
+ { "is_customer" => $form->{vc} eq "customer" }));
+
+ $lxdebug->leave_sub();
+}
+
+sub mark_as_paid_common {
+ $lxdebug->enter_sub();
+ use SL::DBUtils;
+ my ($myconfig, $db_name) = @_;
+
+ if($form->{mark_as_paid}) {
+ my $dbh ||= $form->get_standard_dbh($myconfig);
+ my $query = qq|UPDATE $db_name SET paid = amount WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{id});
+ $dbh->commit();
+ $form->redirect($locale->text("Marked as paid"));
+}
+ else {
+ my $referer = $ENV{HTTP_REFERER};
+ $referer =~ s/^(.*)action\=.*\&(.*)$/$1action\=mark_as_paid\&mark_as_paid\=1\&login\=$form->{login}\&password\=$form->{password}\&id\=$form->{id}\&$2/;
+ $form->header();
+ print qq|<body>|;
+ print qq|<p><b>|.$locale->text('Mark as paid?').qq|</b></p>|;
+ print qq|<input type="button" value="|.$locale->text('yes').qq|" onclick="document.location.href='|.$referer.qq|'"> |;
+ print qq|<input type="button" value="|.$locale->text('no').qq|" onclick="javascript:history.back();">|;
+ print qq|</body></html>|;
+}
+
+ $lxdebug->leave_sub();
+}
+
1;
use SL::IS;
use SL::IR;
-require "$form->{path}/arap.pl";
+use strict ("vars", "subs");
+#use warnings;
+
+require "bin/mozilla/arap.pl";
+require "bin/mozilla/common.pl";
+
+our ($form, %myconfig, $lxdebug, $locale);
1;
sub payment {
$lxdebug->enter_sub();
+ my (@curr);
+
$form->{ARAP} = ($form->{type} eq 'receipt') ? "AR" : "AP";
$form->{arap} = lc $form->{ARAP};
} @{ $form->{PR}{ $form->{ARAP} } };
# currencies
- @curr = split /:/, $form->{currencies};
+ @curr = split(/:/, $form->{currencies});
chomp $curr[0];
$form->{defaultcurrency} = $form->{currency} = $form->{oldcurrency} =
$curr[0];
sub form_header {
$lxdebug->enter_sub();
+ my ($vc, $vclabel, $allvc, $arap, $department, $exchangerate);
+ my ($jsscript, $button1, $button2, $onload);
+
$vclabel = ucfirst $form->{vc};
$vclabel = $locale->text($vclabel);
}
}
- foreach $item ($form->{vc}, account, currency, $form->{ARAP}, department) {
+ foreach my $item ($form->{vc}, "account", "currency", $form->{ARAP}, "department") {
$form->{"select$item"} =~ s/ selected//;
$form->{"select$item"} =~
s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
</tr>
| if $form->{selectdepartment};
- $form->{jsscript} = $jscalendar;
+ $form->{jsscript} = 1;
$jsscript = "";
if ($form->{jsscript}) {
# with JavaScript Calendar
$button1 = qq|
- <td><input name=datepaid id=datepaid size=11 title="$myconfig{dateformat}" value="$form->{datepaid}">
+ <td><input name=datepaid id=datepaid size=11 title="$myconfig{dateformat}" value="$form->{datepaid}" onBlur=\"check_right_date_format(this)\">
<input type=button name=datepaid id="trigger1" value=|
. $locale->text('button') . qq|></td>
|;
# without JavaScript Calendar
$button1 = qq|
- <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
+ <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|;
}
-
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
$form->header;
$arap = lc $form->{ARAP};
-
+ $onload = qq|focus()|;
+ $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
+ $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
print qq|
-<body>
+<body onLoad="$onload">
<form method=post action=$form->{script}>
<td align=right>
<table>
$department
- <tr>
- <th align=right nowrap>| . $locale->text($form->{ARAP}) . qq|</th>
- <td colspan=3><select name=$form->{ARAP}>$form->{"select$form->{ARAP}"}</select>
- </td>
- <input type=hidden name="select$form->{ARAP}" value="$form->{"select$form->{ARAP}"}">
- </tr>
<tr>
<th align=right nowrap>| . $locale->text('Account') . qq|</th>
<td colspan=3><select name=account>$form->{selectaccount}</select>
<td colspan=3><input name=source value="$form->{source}" size=10></td>
</tr>
<tr>
- <th align=right nowrap>| . $locale->text('Amount') . qq|</th>
- <td colspan=3><input name=amount size=10 value=|
- . $form->format_amount(\%myconfig, $form->{amount}, 2) . qq|></td>
+ <th align="right" nowrap>| . $locale->text('Amount') . qq|</th>
+ <td colspan="3"><input name="amount" size="10" value="|
+ . $form->format_amount(\%myconfig, $form->{amount}, 2) . qq|" onBlur=\"check_right_number_format(this)\"></td>
</tr>
</table>
</td>
sub list_invoices {
$lxdebug->enter_sub();
+ my (@column_index, %column_data, $colspan, $invoice);
+ my ($totalamount, $totaldue, $totalpaid);
+
@column_index = qw(invnumber transdate amount due checked paid);
$colspan = $#column_index + 1;
</tr>
|;
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
+
+ my $j = 0;
map {
$form->{"${_}_$i"} =
sub form_footer {
$lxdebug->enter_sub();
+ my ($media, $format, $latex_templates);
+
$form->{DF}{ $form->{format} } = "selected";
$form->{OP}{ $form->{media} } = "selected";
</table>
<input type=hidden name=rowcount value=$form->{rowcount}>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
print qq|
<select name=format>$format</select>
<select name=media>$media</select>
-|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
- print qq|
</form>
</body>
my ($new_name_selected) = @_;
+ my ($buysell, $newvc, $updated, $exchangerate, $amount);
+
if ($form->{vc} eq 'customer') {
$buysell = "buy";
} else {
$form->{queued} = "";
- $i = 0;
- foreach $ref (@{ $form->{PR} }) {
+ my $i = 0;
+ foreach my $ref (@{ $form->{PR} }) {
$i++;
$form->{"id_$i"} = $ref->{id};
$form->{"invnumber_$i"} = $ref->{invnumber};
# Modified from $amount = $form->{amount} by J.Zach to update amount to total
# payment amount in Zahlungsausgang
$amount = 0;
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
map {
$form->{"${_}_$i"} =
unless $form->{exchangerate};
}
- $msg1 = "$form->{origtitle} posted!";
- $msg2 = "Cannot post $form->{origtitle}!";
+ my $msg1 = "$form->{origtitle} posted!";
+ my $msg2 = "Cannot post $form->{origtitle}!";
# $locale->text('Payment posted!')
# $locale->text('Receipt posted!')
sub print {
$lxdebug->enter_sub();
+ my ($whole, $check, %queued, $spool, $filename, $userspath);
+
&check_form;
- ($whole, $form->{decimal}) = split /\./, $form->{amount};
+ ($whole, $form->{decimal}) = split(/\./, $form->{amount});
$form->{amount} = $form->format_amount(\%myconfig, $form->{amount}, 2);
- $form->{decimal} .= "00";
+ #$form->{decimal} .= "00";
$form->{decimal} = substr($form->{decimal}, 0, 2);
$check = new CP $myconfig{countrycode};
$check->init;
$form->{text_amount} = $check->num2text($whole);
- &{"$form->{vc}_details"};
+ call_sub("$form->{vc}_details");
$form->{callback} = "";
$form->{pdf} = 1;
}
+ delete $form->{OUT};
+
if ($form->{media} eq 'printer') {
$form->{OUT} = "| $myconfig{printer}";
}
if ($form->{media} eq 'queue') {
- %queued = split / /, $form->{queued};
+ %queued = map { s|.*/|| } split / /, $form->{queued};
if ($filename = $queued{ $form->{formname} }) {
unlink "$spool/$filename";
if ($form->{media} ne 'screen') {
$form->{callback} =
- "$form->{script}?action=payment&vc=$form->{vc}&path=$form->{path}&login=$form->{login}&password=$form->{password}&all_vc=$form->{all_vc}";
+ "$form->{script}?action=payment&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&all_vc=$form->{all_vc}";
$form->redirect if (CP->process_payment(\%myconfig, \%$form));
$form->error($locale->text('Cannot post payment!'));
sub check_form {
$lxdebug->enter_sub();
+ my ($closedto, $datepaid, $amount);
+
&check_name($form->{vc});
if ($form->{currency} ne $form->{oldcurrency}) {
exit;
}
+ $form->error($locale->text('Zero amount posting!')) if !$form->parse_amount(\%myconfig, $form->{amount});
$form->error($locale->text('Date missing!')) unless $form->{datepaid};
$closedto = $form->datetonum($form->{closedto}, \%myconfig);
$amount = $form->parse_amount(\%myconfig, $form->{amount});
$form->{amount} = $amount;
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
- $amount -= $form->parse_amount($myconfig, $form->{"paid_$i"});
+ $amount -= $form->parse_amount(\%myconfig, $form->{"paid_$i"});
push(@{ $form->{paid} }, $form->{"paid_$i"});
push(@{ $form->{due} }, $form->{"due_$i"});
# $locale->text('Add Customer')
# $locale->text('Add Vendor')
-use SL::CT;
-use CGI::Ajax;
use CGI;
-use Data::Dumper;
+use CGI::Ajax;
+use POSIX qw(strftime);
+
+use SL::CT;
+use SL::ReportGenerator;
+
+require "bin/mozilla/common.pl";
+require "bin/mozilla/reportgenerator.pl";
1;
$form->{title} = "Add";
$form->{callback} =
- "$form->{script}?action=add&db=$form->{db}&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=add&db=$form->{db}&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
- CT->taxaccounts(\%myconfig, \%$form);
+ CT->populate_drop_down_boxes(\%myconfig, \%$form);
&form_header;
&form_footer;
sub search {
$lxdebug->enter_sub();
- $label = ucfirst $form->{db};
- $form->{title} = $locale->text($label . "s");
-
- if ($form->{db} eq 'vendor') {
- $gifi = qq|
- <td><input name="l_gifi_accno" type=checkbox class=checkbox value=Y> |
- . $locale->text('GIFI') . qq|</td>
-|;
- }
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=db value=$form->{db}>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr valign=top>
- <td>
- <table>
- <tr>
- <th align=right nowrap>| . $locale->text($label . ' Number') . qq|</th>
- <td><input name=$form->{db}number size=35></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Company Name') . qq|</th>
- <td><input name=name size=35></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Contact') . qq|</th>
- <td><input name=contact size=35></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
- <td><input name=email size=35></td>
- </tr>
- <tr>
- <td></td>
- <td><input name=status class=radio type=radio value=all checked> |
- . $locale->text('All') . qq|
- <input name=status class=radio type=radio value=orphaned> |
- . $locale->text('Orphaned') . qq|</td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
- <td>
- <table>
- <tr>
- <td><input name="l_id" type=checkbox class=checkbox value=Y> |
- . $locale->text('ID') . qq|</td>
- <td><input name="l_$form->{db}number" type=checkbox class=checkbox value=Y> |
- . $locale->text($label . ' Number') . qq|</td>
- <td><input name="l_name" type=checkbox class=checkbox value=Y checked> |
- . $locale->text('Company Name') . qq|</td>
- <td><input name="l_address" type=checkbox class=checkbox value=Y> |
- . $locale->text('Address') . qq|</td>
- </tr>
- <tr>
- <td><input name="l_contact" type=checkbox class=checkbox value=Y checked> |
- . $locale->text('Contact') . qq|</td>
- <td><input name="l_phone" type=checkbox class=checkbox value=Y checked> |
- . $locale->text('Phone') . qq|</td>
- <td><input name="l_fax" type=checkbox class=checkbox value=Y> |
- . $locale->text('Fax') . qq|</td>
- <td><input name="l_email" type=checkbox class=checkbox value=Y checked> |
- . $locale->text('E-mail') . qq|</td>
- </tr>
- <tr>
- <td><input name="l_taxnumber" type=checkbox class=checkbox value=Y> |
- . $locale->text('Tax Number') . qq|</td>
- $gifi
- <td><input name="l_sic_code" type=checkbox class=checkbox value=Y> |
- . $locale->text('SIC') . qq|</td>
- <td><input name="l_business" type=checkbox class=checkbox value=Y> |
- . $locale->text('Type of Business') . qq|</td>
- </tr>
- <tr>
- <td><input name="l_invnumber" type=checkbox class=checkbox value=Y> |
- . $locale->text('Invoices') . qq|</td>
- <td><input name="l_ordnumber" type=checkbox class=checkbox value=Y> |
- . $locale->text('Orders') . qq|</td>
- <td><input name="l_quonumber" type=checkbox class=checkbox value=Y> |
- . $locale->text('Quotations') . qq|</td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
+ $form->{IS_CUSTOMER} = $form->{db} eq 'customer';
-<input type=hidden name=nextsub value=list_names>
+ $form->get_lists("business_types" => "ALL_BUSINESS_TYPES");
+ $form->{SHOW_BUSINESS_TYPES} = scalar @{ $form->{ALL_BUSINESS_TYPES} } > 0;
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>
+ $form->{title} = $form->{IS_CUSTOMER} ? $locale->text('Customers') : $locale->text('Vendors');
+ $form->{fokus} = 'Form.name';
-<br>
-<input type=submit class=submit name=action value="|
- . $locale->text('Continue') . qq|">
-</form>
+ $form->header();
+ print $form->parse_html_template2('ct/search');
-</body>
-</html>
-|;
- $lxdebug->leave_sub();
-}
-
-sub search_delivery {
- $lxdebug->enter_sub();
-
- $label = ucfirst $form->{db};
- $form->{title} = $locale->text($label . "s");
-
- if ($form->{db} eq 'vendor') {
- $gifi = qq|
- <td><input name="l_gifi_accno" type=checkbox class=checkbox value=Y> |
- . $locale->text('GIFI') . qq|</td>
-|;
- }
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=db value=$form->{db}>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr valign=top>
- <td>
- <table>
- <tr>
- <th align=right nowrap>| . $locale->text($label . ' Number') . qq|</th>
- <td><input name=$form->{db}number size=35></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Company Name') . qq|</th>
- <td><input name=name size=35></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Contact') . qq|</th>
- <td><input name=contact size=35></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
- <td><input name=email size=35></td>
- </tr>
- <tr>
- <td></td>
- <td><input name=status class=radio type=radio value=all checked> |
- . $locale->text('All') . qq|
- <input name=status class=radio type=radio value=orphaned> |
- . $locale->text('Orphaned') . qq|</td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
- <td>
- <table>
- <tr>
- <td><input name="l_id" type=checkbox class=checkbox value=Y> |
- . $locale->text('ID') . qq|</td>
- <td><input name="l_$form->{db}number" type=checkbox class=checkbox value=Y> |
- . $locale->text($label . ' Number') . qq|</td>
- <td><input name="l_name" type=checkbox class=checkbox value=Y checked> |
- . $locale->text('Company Name') . qq|</td>
- <td><input name="l_address" type=checkbox class=checkbox value=Y> |
- . $locale->text('Address') . qq|</td>
- </tr>
- <tr>
- <td><input name="l_contact" type=checkbox class=checkbox value=Y checked> |
- . $locale->text('Contact') . qq|</td>
- <td><input name="l_phone" type=checkbox class=checkbox value=Y checked> |
- . $locale->text('Phone') . qq|</td>
- <td><input name="l_fax" type=checkbox class=checkbox value=Y> |
- . $locale->text('Fax') . qq|</td>
- <td><input name="l_email" type=checkbox class=checkbox value=Y checked> |
- . $locale->text('E-mail') . qq|</td>
- </tr>
- <tr>
- <td><input name="l_taxnumber" type=checkbox class=checkbox value=Y> |
- . $locale->text('Tax Number') . qq|</td>
- $gifi
- <td><input name="l_sic_code" type=checkbox class=checkbox value=Y> |
- . $locale->text('SIC') . qq|</td>
- <td><input name="l_business" type=checkbox class=checkbox value=Y> |
- . $locale->text('Type of Business') . qq|</td>
- </tr>
- <tr>
- <td><input name="l_invnumber" type=checkbox class=checkbox value=Y> |
- . $locale->text('Invoices') . qq|</td>
- <td><input name="l_ordnumber" type=checkbox class=checkbox value=Y> |
- . $locale->text('Orders') . qq|</td>
- <td><input name="l_quonumber" type=checkbox class=checkbox value=Y> |
- . $locale->text('Quotations') . qq|</td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<input type=hidden name=nextsub value=list_names>
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>
-
-<br>
-<input type=submit class=submit name=action value="|
- . $locale->text('Continue') . qq|">
-</form>
-
-</body>
-</html>
-|;
$lxdebug->leave_sub();
}
sub list_names {
$lxdebug->enter_sub();
- CT->search(\%myconfig, \%$form);
+ $form->{IS_CUSTOMER} = $form->{db} eq 'customer';
- $callback =
- "$form->{script}?action=list_names&db=$form->{db}&path=$form->{path}&login=$form->{login}&password=$form->{password}&status=$form->{status}";
- $href = $callback;
-
- @columns =
- $form->sort_columns(id, name,
- "$form->{db}number", address,
- contact, phone,
- fax, email,
- taxnumber, gifi_accno,
- sic_code, business,
- invnumber, ordnumber,
- quonumber);
-
- foreach $item (@columns) {
- if ($form->{"l_$item"} eq "Y") {
- push @column_index, $item;
-
- # add column to href and callback
- $callback .= "&l_$item=Y";
- $href .= "&l_$item=Y";
- }
- }
- $number =
- ($form->{db} eq "customer")
- ? $locale->text('Customer Number')
- : $locale->text('Vendor Number');
+ CT->search(\%myconfig, \%$form);
+ my @options;
if ($form->{status} eq 'all') {
- $option = $locale->text('All');
- }
- if ($form->{status} eq 'orphaned') {
- $option .= $locale->text('Orphaned');
+ push @options, $locale->text('All');
+
+ } elsif ($form->{status} eq 'orphaned') {
+ push @options, $locale->text('Orphaned');
}
+
if ($form->{name}) {
- $callback .= "&name=" . $form->escape($form->{name}, 1);
- $href .= "&name=" . $form->escape($form->{name});
- $option .= "\n<br>" . $locale->text('Name') . " : $form->{name}";
+ push @options, $locale->text('Name') . " : $form->{name}";
}
if ($form->{contact}) {
- $callback .= "&contact=" . $form->escape($form->{contact}, 1);
- $href .= "&contact=" . $form->escape($form->{contact});
- $option .= "\n<br>" . $locale->text('Contact') . " : $form->{contact}";
+ push @options, $locale->text('Contact') . " : $form->{contact}";
}
if ($form->{"$form->{db}number"}) {
- $callback .=
- qq|&$form->{db}number=| . $form->escape($form->{"$form->{db}number"}, 1);
- $href .=
- "&$form->{db}number=" . $form->escape($form->{"$form->{db}number"});
- $option .=
- "\n<br>" . $locale->text('Number') . qq| : $form->{"$form->{db}number"}|;
+ push @options, $locale->text('Number') . qq| : $form->{"$form->{db}number"}|;
}
if ($form->{email}) {
- $callback .= "&email=" . $form->escape($form->{email}, 1);
- $href .= "&email=" . $form->escape($form->{email});
- $option .= "\n<br>" . $locale->text('E-mail') . " : $form->{email}";
+ push @options, $locale->text('E-mail') . " : $form->{email}";
}
- $form->{callback} = "$callback&sort=$form->{sort}";
- $callback = $form->escape($form->{callback});
-
- $column_header{id} =
- qq|<th class=listheading>| . $locale->text('ID') . qq|</th>|;
- $column_header{"$form->{db}number"} =
- qq|<th><a class=listheading href=$href&sort=$form->{db}number>$number</a></th>|;
- $column_header{name} =
- qq|<th><a class=listheading href=$href&sort=name>|
- . $locale->text('Name')
- . qq|</a></th>|;
- $column_header{address} =
- qq|<th><a class=listheading href=$href&sort=address>|
- . $locale->text('Address')
- . qq|</a></th>|;
- $column_header{contact} =
- qq|<th><a class=listheading href=$href&sort=contact>|
- . $locale->text('Contact')
- . qq|</a></th>|;
- $column_header{phone} =
- qq|<th><a class=listheading href=$href&sort=phone>|
- . $locale->text('Phone')
- . qq|</a></th>|;
- $column_header{fax} =
- qq|<th><a class=listheading href=$href&sort=fax>|
- . $locale->text('Fax')
- . qq|</a></th>|;
- $column_header{email} =
- qq|<th><a class=listheading href=$href&sort=email>|
- . $locale->text('E-mail')
- . qq|</a></th>|;
- $column_header{cc} =
- qq|<th><a class=listheading href=$href&sort=cc>|
- . $locale->text('Cc')
- . qq|</a></th>|;
-
- $column_header{taxnumber} =
- qq|<th><a class=listheading href=$href&sort=taxnumber>|
- . $locale->text('Tax Number')
- . qq|</a></th>|;
- $column_header{gifi_accno} =
- qq|<th><a class=listheading href=$href&sort=gifi_accno>|
- . $locale->text('GIFI')
- . qq|</a></th>|;
- $column_header{sic_code} =
- qq|<th><a class=listheading href=$href&sort=sic_code>|
- . $locale->text('SIC')
- . qq|</a></th>|;
- $column_header{business} =
- qq|<th><a class=listheading href=$href&sort=business>|
- . $locale->text('Type of Business')
- . qq|</a></th>|;
+ my @columns = (
+ 'id', 'name', "$form->{db}number", 'address', 'contact', 'phone',
+ 'fax', 'email', 'taxnumber', 'sic_code', 'business', 'invnumber',
+ 'ordnumber', 'quonumber'
+ );
+
+ my %column_defs = (
+ 'id' => { 'text' => $locale->text('ID'), },
+ "$form->{db}number" => { 'text' => $form->{IS_CUSTOMER} ? $locale->text('Customer Number') : $locale->text('Vendor Number'), },
+ 'name' => { 'text' => $locale->text('Name'), },
+ 'address' => { 'text' => $locale->text('Address'), },
+ 'contact' => { 'text' => $locale->text('Contact'), },
+ 'phone' => { 'text' => $locale->text('Phone'), },
+ 'fax' => { 'text' => $locale->text('Fax'), },
+ 'email' => { 'text' => $locale->text('E-mail'), },
+ 'cc' => { 'text' => $locale->text('Cc'), },
+ 'taxnumber' => { 'text' => $locale->text('Tax Number'), },
+ 'sic_code' => { 'text' => $locale->text('SIC'), },
+ 'business' => { 'text' => $locale->text('Type of Business'), },
+ 'invnumber' => { 'text' => $locale->text('Invoice'), },
+ 'ordnumber' => { 'text' => $form->{IS_CUSTOMER} ? $locale->text('Sales Order') : $locale->text('Purchase Order'), },
+ 'quonumber' => { 'text' => $form->{IS_CUSTOMER} ? $locale->text('Quotation') : $locale->text('Request for Quotation'), },
+ );
+
+ map { $column_defs{$_}->{visible} = $form->{"l_$_"} eq 'Y' } @columns;
+
+ my @hidden_variables = (qw(db status obsolete), map { "l_$_" } @columns);
+ my @hidden_nondefault = grep({ $form->{$_} } @hidden_variables);
+ my $callback = build_std_url('action=list_names', grep { $form->{$_} } @hidden_variables);
+ $form->{callback} = "$callback&sort=" . E($form->{sort});
+
+ map { $column_defs{$_}->{link} = "${callback}&sort=${_}" } @columns;
+
+ my ($ordertype, $quotationtype, $attachment_basename);
+ if ($form->{IS_CUSTOMER}) {
+ $form->{title} = $locale->text('Customers');
+ $ordertype = 'sales_order';
+ $quotationtype = 'sales_quotation';
+ $attachment_basename = $locale->text('customer_list');
- $column_header{invnumber} =
- qq|<th><a class=listheading href=$href&sort=invnumber>|
- . $locale->text('Invoice')
- . qq|</a></th>|;
- $column_header{ordnumber} =
- qq|<th><a class=listheading href=$href&sort=ordnumber>|
- . $locale->text('Order')
- . qq|</a></th>|;
- $column_header{quonumber} =
- qq|<th><a class=listheading href=$href&sort=quonumber>|
- . $locale->text('Quotation')
- . qq|</a></th>|;
-
- $label = ucfirst $form->{db} . "s";
- $form->{title} = $locale->text($label);
-
- $form->header;
-
- print qq|
-<body>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>$option</td>
- </tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>
-|;
-
- map { print "$column_header{$_}\n" } @column_index;
-
- print qq|
- </tr>
-|;
-
- $ordertype = ($form->{db} eq 'customer') ? 'sales_order' : 'purchase_order';
- $quotationtype =
- ($form->{db} eq 'customer') ? 'sales_quotation' : 'request_quotation';
-
- foreach $ref (@{ $form->{CT} }) {
+ } else {
+ $form->{title} = $locale->text('Vendors');
+ $ordertype = 'purchase_order';
+ $quotationtype = 'request_quotation';
+ $attachment_basename = $locale->text('vendor_list');
+ }
- if ($ref->{id} eq $sameid) {
- map { $column_data{$_} = "<td> </td>" } @column_index;
- } else {
- map { $column_data{$_} = "<td>$ref->{$_} </td>" } @column_index;
+ my $report = SL::ReportGenerator->new(\%myconfig, $form);
- map { $column_data{$_} = "<td>$ref->{$_} </td>" }
- (invnumber, ordnumber, quonumber);
+ $report->set_options('top_info_text' => join("\n", @options),
+ 'raw_bottom_info_text' => $form->parse_html_template2('ct/list_names_bottom'),
+ 'output_format' => 'HTML',
+ 'title' => $form->{title},
+ 'attachment_basename' => $attachment_basename . strftime('_%Y%m%d', localtime time),
+ );
+ $report->set_options_from_form();
- $column_data{name} =
- "<td align=left><a href=$form->{script}?action=edit&id=$ref->{id}&db=$form->{db}&path=$form->{path}&login=$form->{login}&password=$form->{password}&status=$form->{status}&callback=$callback>$ref->{name} </td>";
+ $report->set_columns(%column_defs);
+ $report->set_column_order(@columns);
- if ($ref->{email}) {
- $email = $ref->{email};
- $email =~ s/</\</;
- $email =~ s/>/\>/;
+ $report->set_export_options('list_names', @hidden_variables);
- $column_data{email} =
- qq|<td><a href="mailto:$ref->{email}">$email</a></td>|;
- }
+ $report->set_sort_indicator($form->{sort}, 1);
- }
+ my $previous_id;
- if ($ref->{formtype} eq 'invoice') {
- $column_data{invnumber} =
- "<td><a href=$ref->{module}.pl?action=edit&id=$ref->{invid}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber} </td>";
- }
+ foreach my $ref (@{ $form->{CT} }) {
+ my $row = { map { $_ => { 'data' => '' } } @columns };
- if ($ref->{formtype} eq 'order') {
- $column_data{ordnumber} =
- "<td><a href=$ref->{module}.pl?action=edit&id=$ref->{invid}&type=$ordertype&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{ordnumber} </td>";
- }
+ if ($ref->{id} ne $previous_id) {
+ $previous_id = $ref->{id};
+ map { $row->{$_}->{data} = $ref->{$_} } @columns;
- if ($ref->{formtype} eq 'quotation') {
- $column_data{quonumber} =
- "<td><a href=$ref->{module}.pl?action=edit&id=$ref->{invid}&type=$quotationtype&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{quonumber} </td>";
+ $row->{name}->{link} = build_std_url('action=edit', 'id=' . E($ref->{id}), 'callback', @hidden_nondefault);
+ $row->{email}->{link} = 'mailto:' . E($ref->{email});
}
- $i++;
- $i %= 2;
- print "
- <tr class=listrow$i>
-";
-
- map { print "$column_data{$_}\n" } @column_index;
-
- print qq|
- </tr>
-|;
-
- $sameid = $ref->{id};
+ my $base_url = build_std_url("script=$ref->{module}.pl", 'action=edit', 'id=' . E($ref->{invid}), 'callback', @hidden_nondefault);
+ $row->{invnumber}->{link} = $base_url;
+ $row->{ordnumber}->{link} = $base_url . "&type=${ordertype}";
+ $row->{quonumber}->{link} = $base_url . "&type=${quotationtype}";
+ my $column = $ref->{formtype} eq 'invoice' ? 'invnumber' : $ref->{formtype} eq 'order' ? 'ordnumber' : 'quonumber';
+ $row->{$column}->{data} = $ref->{$column};
+ $report->add_data($row);
}
- 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 name=db type=hidden value=$form->{db}>
-
-<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|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
- </form>
-
-</body>
-</html>
-|;
+ $report->generate_with_headers();
$lxdebug->leave_sub();
}
sub edit {
$lxdebug->enter_sub();
+ # show history button
+ $form->{javascript} = qq|<script type=text/javascript src=js/show_history.js></script>|;
+ #/show hhistory button
+
# $locale->text('Edit Customer')
# $locale->text('Edit Vendor')
CT->get_tuple(\%myconfig, \%$form);
+ CT->populate_drop_down_boxes(\%myconfig, \%$form);
# format " into "
map { $form->{$_} =~ s/\"/"/g } keys %$form;
sub form_header {
$lxdebug->enter_sub();
+ $form->get_lists("employees" => "ALL_SALESMEN",
+ "taxzones" => "ALL_TAXZONES");
+
$form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
$form->{creditlimit} =
$form->format_amount(\%myconfig, $form->{creditlimit}, 0);
}
}
- if (@{ $form->{TAXZONE} }) {
- foreach $item (@{ $form->{TAXZONE} }) {
- if ($item->{id} == $form->{taxzone_id}) {
- $form->{selecttaxzone} .=
- "<option value=$item->{id} selected>$item->{description}\n";
- } else {
- $form->{selecttaxzone} .=
- "<option value=$item->{id}>$item->{description}\n";
- }
-
- }
+ %labels = ();
+ @values = ();
+ foreach my $item (@{ $form->{"ALL_TAXZONES"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{"id"}} = $item->{"description"};
}
$taxzone = qq|
- <tr>
<th align=right>| . $locale->text('Steuersatz') . qq|</th>
- <td><select name=taxzone_id>$form->{selecttaxzone}</select></td>
- <input type=hidden name=selecttaxzone value="$form->{selecttaxzone}">
- </tr>|;
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"},
+ '-values' => \@values, '-labels' => \%labels)) . qq|
+ </td>
+|;
$get_contact_url =
- "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=get_contact";
+ "$form->{script}?login=$form->{login}&password=$form->{password}&action=get_contact";
my $pjx = new CGI::Ajax( 'get_contact' => $get_contact_url );
- $form->{selectcontact} = "<option value=0></option>";
+ $form->{selectcontact} = "<option value=0>" . $locale->text('New contact') . "</option>";
if (@{ $form->{CONTACTS} }) {
foreach $item (@{ $form->{CONTACTS} }) {
if ($item->{cp_id} == $form->{cp_id}) {
<input type=hidden name=selectcontact value="$form->{selectcontact}">
</tr>|;
$get_shipto_url =
- "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=get_shipto";
+ "$form->{script}?login=$form->{login}&password=$form->{password}&action=get_shipto";
my $pjy = new CGI::Ajax( 'get_shipto' => $get_shipto_url );
$form->{selectshipto} = "<option value=0></option>";
$get_delivery_url =
- "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=get_delivery";
+ "$form->{script}?login=$form->{login}&password=$form->{password}&action=get_delivery";
my $pjz = new CGI::Ajax( 'get_delivery' => $get_delivery_url );
<td><select id=delivery_id name=delivery_id onChange="get_delivery(['shipto_id__' + this.value, 'from__' + from.value, 'to__' + to.value, 'id__' + cvid.value, 'db__' + db.value], ['delivery'])">$form->{selectshipto}</select></td>
</tr>|;
- foreach $item (split / /, $form->{taxaccounts}) {
- if (($form->{tax}{$item}{taxable}) || !($form->{id})) {
- $taxable .=
- qq| <input name="tax_$item" value=1 class=checkbox type=checkbox checked> <b>$form->{tax}{$item}{description}</b>|;
- } else {
- $taxable .=
- qq| <input name="tax_$item" value=1 class=checkbox type=checkbox> <b>$form->{tax}{$item}{description}</b>|;
- }
- }
-
-##LINET
- $taxable = "";
-
- if ($taxable) {
- $tax = qq|
- <tr>
- <th align=right>| . $locale->text('Taxable') . qq|</th>
- <td colspan=2>
- <table>
- <tr>
- <td>$taxable</td>
- <td><input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}></td>
- <th align=left>| . $locale->text('Tax Included') . qq|</th>
- </tr>
- </table>
- </td>
- </tr>
-|;
- }
$form->{selectbusiness} = qq|<option>\n|;
map {
$form->{selectbusiness} .=
if ($form->{db} eq 'vendor') {
$customer = qq|
<th align=right>| . $locale->text('Kundennummer') . qq|</th>
- <td><input name=v_customer_id size=10 tabindex=18 maxlength=35 value="$form->{v_customer_id}"></td>
+ <td><input name=v_customer_id size=10 value="$form->{v_customer_id}"></td>
|;
}
$customer = qq|
<th align=right>| . $locale->text('KNr. beim Kunden') . qq|</th>
- <td><input name=c_vendor_id size=10 tabindex=18 maxlength=35 value="$form->{c_vendor_id}"></td>
+ <td><input name=c_vendor_id size=10 value="$form->{c_vendor_id}"></td>
|;
}
- $business_salesman = "";
- $business = "<th></th><td></td>";
- if ($vertreter) {
- $business_salesman = qq|
- <tr>
- <td colspan=3>
- <table>
- <th align=right>| . $locale->text('Type of Business') . qq|</th>
- <td><select name=business tabindex=1>$form->{selectbusiness}</select></td>
- <th align=right>| . $locale->text('Salesman') . qq|</th>
- <td><input name=salesman tabindex=2 value="$form->{salesman}"></td>
- <input type=hidden name=salesman_id value="$form->{salesman_id}">
- <input type=hidden name=oldsalesman value="$form->{oldsalesman}">
- </table>
- </td>
- <tr>|;
- $business = qq|
- <th align=right>| . $locale->text('Username') . qq|</th>
- <td><input name=username maxlength=50 tabindex=22 value="$form->{username}"></td>
- <th align=right>| . $locale->text('Password') . qq|</th>
- <td><input name=user_password maxlength=12 tabindex=23 value="$form->{user_password}"></td>|;
- } else {
- $business = qq|
+
+ $business = qq|
<th align=right>| . $locale->text('Type of Business') . qq|</th>
- <td><select name=business tabindex=22>$form->{selectbusiness}</select></td>
+ <td><select name=business>$form->{selectbusiness}</select></td>
|;
+
+ $salesman = "";
+
+ if ($form->{db} eq "customer") {
+ my (@salesman_values, %salesman_labels);
+ push(@salesman_values, undef);
+ foreach my $item (@{ $form->{ALL_SALESMEN} }) {
+ push(@salesman_values, $item->{id});
+ $salesman_labels{$item->{id}} = $item->{name} ne "" ? $item->{name} : $item->{login};
+ }
+
+ $salesman =
+ qq| <th align="right">| . $locale->text('Salesman') . qq|</th>
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{salesman_id},
+ '-values' => \@salesman_values, '-labels' => \%salesman_labels))
+ . qq|</td>|;
}
## LINET: Create a drop-down box with all prior titles and greetings.
s/(<option value="\Q$form->{klass}\E")/$1 selected/;
$pricegroup .=
- qq|<select name=klass tabindex=24>$form->{selectpricegroup}</select>|;
+ qq|<select name=klass>$form->{selectpricegroup}</select>|;
}
}
<table width=100%>
<tr height="5"></tr>
- $business_salesman
<tr>
<th align=right nowrap>| . $locale->text($label . ' Number') . qq|</th>
- <td><input name="$form->{db}number" size=35 maxlength=35 value="$form->{"$form->{db}number"}"></td>
+ <td><input name="$form->{db}number" size=35 value="$form->{"$form->{db}number"}"></td>
</tr>
<tr>
<th align=right nowrap>| . $locale->text('Greeting') . qq|</th>
- <td><input id=greeting name=greeting size=30 maxlength=30 value="$form->{greeting}">
+ <td><input id=greeting name=greeting size=30 value="$form->{greeting}">
$select_company_greeting</td>
</tr>
<tr>
</tr>
<tr>
<th align=right>| . $locale->text('Account Number') . qq|</th>
- <td><input name=account_number size=10 value="$form->{account_number}"></td>
+ <td><input name="account_number" size="10" maxlength="15" value="$form->{account_number}"></td>
<th align=right>| . $locale->text('Bank Code Number') . qq|</th>
- <td><input name=bank_code size=10 value="$form->{bank_code}"></td>
+ <td><input name="bank_code" size="10" maxlength="10" value="$form->{bank_code}"></td>
<th align=right>| . $locale->text('Bank') . qq|</th>
<td><input name=bank size=30 value="$form->{bank}"></td>
</tr>
<tr>
$business
<th align=right>| . $locale->text('Language') . qq|</th>
- <td><select name=language_id tabindex=23>$lang
+ <td><select name=language_id>$lang
</select></td>|;
if ($form->{db} eq 'customer') {
<td align=right>| . $locale->text('Obsolete') . qq|</td>
<td><input name=obsolete class=checkbox type=checkbox value=1 $form->{obsolete}></td>
</tr>
- $taxzone
+ <tr>
+ $taxzone
+ $salesman
+ </tr>
</table>
<table>
<tr>
<tr>
<th align=right nowrap>|
. $locale->text('Zipcode') . "/" . $locale->text('City') . qq|</th>
- <td><input id=shiptozipcode name=shiptozipcode size=5 maxlength=10 value="$form->{shiptozipcode}">
+ <td><input id=shiptozipcode name=shiptozipcode size=5 maxlength=75 value="$form->{shiptozipcode}">
<input id=shiptocity name=shiptocity size=30 maxlength=75 value="$form->{shiptocity}"></td>
</tr>
<tr>
<th align=right nowrap>| . $locale->text('Country') . qq|</th>
- <td><input id=shiptocountry name=shiptocountry size=35 maxlength=35 value="$form->{shiptocountry}"></td>
+ <td><input id=shiptocountry name=shiptocountry size=35 maxlength=75 value="$form->{shiptocountry}"></td>
</tr>
<tr>
<th align=right nowrap>| . $locale->text('Contact') . qq|</th>
$ansprechpartner
<tr>
<th align=left nowrap>| . $locale->text('Greeting') . qq|</th>
- <td><input id=cp_greeting name=cp_greeting size=30 maxlength=30 value="$form->{cp_greeting}">
+ <td><input id=cp_greeting name=cp_greeting size=40 maxlength=75 value="$form->{cp_greeting}">
$select_greeting</td>
</tr>
<tr>
<th align=left nowrap>| . $locale->text('Title') . qq|</th>
- <td><input id=cp_title name=cp_title size=30 maxlength=30 value="$form->{cp_title}">
+ <td><input id=cp_title name=cp_title size=40 maxlength=75 value="$form->{cp_title}">
$select_title</td>
</tr>
<tr>
<th align=left nowrap>| . $locale->text('Department') . qq|</th>
- <td><input id=cp_abteilung name=cp_abteilung size=30 maxlength=40 value="$form->{cp_abteilung}">
+ <td><input id=cp_abteilung name=cp_abteilung size=40 value="$form->{cp_abteilung}">
$select_department</td>
</tr>
<tr>
<th align=left nowrap>|
. $locale->text('Given Name') . qq|</th>
- <td><input id=cp_givenname name=cp_givenname size=30 maxlength=40 value="$form->{cp_givenname}"></td>
+ <td><input id="cp_givenname" name="cp_givenname" size="40" maxlength="75" value="$form->{cp_givenname}"></td>
</tr>
<tr>
<th align=left nowrap>| . $locale->text('Name') . qq|</th>
- <td><input id=cp_name name=cp_name size=30 maxlength=40 value="$form->{cp_name}"></td>
+ <td><input id="cp_name" name="cp_name" size="40" maxlength="75" value="$form->{cp_name}"></td>
</tr>
<tr>
<th align=left nowrap>| . $locale->text('Phone1') . qq|</th>
- <td><input id=cp_phone1 name=cp_phone1 size=30 maxlength=30 value="$form->{cp_phone1}"></td>
+ <td><input id="cp_phone1" name="cp_phone1" size="40" maxlength="75" value="$form->{cp_phone1}"></td>
</tr>
<tr>
<th align=left nowrap>| . $locale->text('Phone2') . qq|</th>
- <td><input id=cp_phone2 name=cp_phone2 size=30 maxlength=30 value="$form->{cp_phone2}"></td>
+ <td><input id="cp_phone2" name="cp_phone2" size="40" maxlength="75" value="$form->{cp_phone2}"></td>
</tr>
<tr>
<th align=left nowrap>| . $locale->text('Fax') . qq|</th>
- <td><input id=cp_fax name=cp_fax size=30 maxlength=30 value="$form->{cp_fax}"></td>
+ <td><input id=cp_fax name=cp_fax size=40 value="$form->{cp_fax}"></td>
</tr>
<tr>
<th align=left nowrap>| . $locale->text('Mobile1') . qq|</th>
- <td><input id=cp_mobile1 name=cp_mobile1 size=30 maxlength=30 value="$form->{cp_mobile1}"></td>
+ <td><input id=cp_mobile1 name=cp_mobile1 size=40 value="$form->{cp_mobile1}"></td>
</tr>
<tr>
<th align=left nowrap>| . $locale->text('Mobile2') . qq|</th>
- <td><input id=cp_mobile2 name=cp_mobile2 size=30 maxlength=30 value="$form->{cp_mobile2}"></td>
+ <td><input id=cp_mobile2 name=cp_mobile2 size=40 value="$form->{cp_mobile2}"></td>
</tr>
<tr>
<th align=left nowrap>| . $locale->text('Sat. Phone') . qq|</th>
- <td><input id=cp_satphone name=cp_satphone size=30 maxlength=30 value="$form->{cp_satphone}"></td>
+ <td><input id=cp_satphone name=cp_satphone size=40 value="$form->{cp_satphone}"></td>
</tr>
<tr>
<th align=left nowrap>| . $locale->text('Sat. Fax') . qq|</th>
- <td><input id=cp_satfax name=cp_satfax size=30 maxlength=30 value="$form->{cp_satfax}"></td>
+ <td><input id=cp_satfax name=cp_satfax size=40 value="$form->{cp_satfax}"></td>
</tr>
<tr>
<th align=left nowrap>| . $locale->text('Project') . qq|</th>
- <td><input id=cp_project name=cp_project size=30 maxlength=40 value="$form->{cp_project}"></td>
+ <td><input id=cp_project name=cp_project size=40 value="$form->{cp_project}"></td>
</tr>
<tr>
<th align=left nowrap>| . $locale->text('E-mail') . qq|</th>
- <td><input id=cp_email name=cp_email size=30 maxlength=40 value="$form->{cp_email}"></td>
+ <td><input id=cp_email name=cp_email size=40 value="$form->{cp_email}"></td>
</tr>
<tr>
<th align=left nowrap>| . $locale->text('Private Phone') . qq|</th>
- <td><input id=cp_privatphone name=cp_privatphone size=30 maxlength=40 value="$form->{cp_privatphone}"></td>
+ <td><input id=cp_privatphone name=cp_privatphone size=40 value="$form->{cp_privatphone}"></td>
</tr>
<tr>
<th align=left nowrap>| . $locale->text('Private E-mail') . qq|</th>
- <td><input id=cp_privatemail name=cp_privatemail size=30 maxlength=40 value="$form->{cp_privatemail}"></td>
+ <td><input id=cp_privatemail name=cp_privatemail size=40 value="$form->{cp_privatemail}"></td>
</tr>
<tr>
<th align=left nowrap>| . $locale->text('Birthday') . qq|</th>
- <td><input id=cp_birthday name=cp_birthday size=30 maxlength=40 value="$form->{cp_birthday}"></td>
+ <td><input id=cp_birthday name=cp_birthday size=40 value="$form->{cp_birthday}"></td>
</tr>
</table>
<tr>
<th align=left nowrap>| . $locale->text('From') . qq|</th>
<td><input id=from name=from size=10 maxlength=10 value="$form->{from}">
- <input type="button" name="from" id="trigger_from" value="?"></td>
+ <input type="button" name="fromB" id="trigger_from" value="?"></td>
<th align=left nowrap>| . $locale->text('To (time)') . qq|</th>
<td><input id=to name=to size=10 maxlength=10 value="$form->{to}">
- <input type="button" name="to" id="trigger_to" value="?"></td>
+ <input type="button" name="toB" id="trigger_to" value="?"></td>
</tr>
<tr>
<td colspan=4>
</div>
-| . $form->write_trigger(\%myconfig, 2, "from", "BL", "trigger_from",
- "to", "BL", "trigger_to");
+| . $form->write_trigger(\%myconfig, 2, "fromB", "BL", "trigger_from",
+ "toB", "BL", "trigger_to");
$lxdebug->leave_sub();
}
($form->{db} eq 'customer')
? $locale->text('Save and AR Transaction')
: $locale->text('Save and AP Transaction');
- if ($vertreter) {
- $update_button =
- qq|<input class=submit type=submit name=action accesskey="u" value="|
- . $locale->text("Update") . qq|">|;
- } else {
- $update_button = "";
- }
##<input class=submit type=submit name=action value="|.$locale->text("Save and Quotation").qq|">
##<input class=submit type=submit name=action value="|.$locale->text("Save and RFQ").qq|">
print qq|
<input name=id type=hidden id=cvid value=$form->{id}>
-<input name=taxaccounts type=hidden value="$form->{taxaccounts}">
<input name=business_save type=hidden value="$form->{selectbusiness}">
<input name=title_save type=hidden value="$form->{title}">
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
<br>
-$update_button
<input class=submit type=submit name=action accesskey="s" value="|
. $locale->text("Save") . qq|">
<input class=submit type=submit name=action accesskey="s" value="|
. qq|">\n|;
}
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
+ # button for saving history
+ if($form->{id} ne "") {
+ print qq|
+ <input type=button class=submit onclick=set_history_window(|
+ . $form->{id}
+ . qq|); name=history id=history value=|
+ . $locale->text('history')
+ . qq|>|;
}
+ # /button for saving history
print qq|
sub add_transaction {
$lxdebug->enter_sub();
+# # saving the history
+# if(!exists $form->{addition}) {
+# $form->{addition} = "ADD TRANSACTION";
+# $form->save_history($form->dbconnect(\%myconfig));
+# }
+# # /saving the history
+
$form->isblank("name", $locale->text("Name missing!"));
- if ($vertreter && $form->{db} eq "customer") {
- $form->isblank("salesman_id", $locale->text("Salesman missing!"));
+ if ($form->{"db"} eq "customer") {
+ CT->save_customer(\%myconfig, \%$form);
+ } else {
+ CT->save_vendor(\%myconfig, \%$form);
}
- &{"CT::save_$form->{db}"}("", \%myconfig, \%$form);
$form->{callback} = $form->escape($form->{callback}, 1);
$name = $form->escape("$form->{name}", 1);
$form->{callback} =
- "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=add&vc=$form->{db}&$form->{db}_id=$form->{id}&$form->{db}=$name&type=$form->{type}&callback=$form->{callback}";
-
+ "$form->{script}?login=$form->{login}&password=$form->{password}&action=add&vc=$form->{db}&$form->{db}_id=$form->{id}&$form->{db}=$name&type=$form->{type}&callback=$form->{callback}";
$form->redirect;
$lxdebug->leave_sub();
$lxdebug->enter_sub();
$form->{script} = "ap.pl";
+ # saving the history
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
+ $form->{addition} = "SAVED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
&add_transaction;
-
$lxdebug->leave_sub();
}
$lxdebug->enter_sub();
$form->{script} = "ar.pl";
+ # saving the history
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
+ $form->{addition} = "SAVED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
&add_transaction;
-
$lxdebug->leave_sub();
}
$form->{script} = ($form->{db} eq 'customer') ? "is.pl" : "ir.pl";
$form->{type} = "invoice";
+ # saving the history
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
+ $form->{addition} = "SAVED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
&add_transaction;
-
$lxdebug->leave_sub();
}
$form->{script} = "oe.pl";
$form->{type} = "request_quotation";
+ # 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
&add_transaction;
-
$lxdebug->leave_sub();
}
$form->{script} = "oe.pl";
$form->{type} = "sales_quotation";
+ # 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
&add_transaction;
-
$lxdebug->leave_sub();
}
$form->{script} = "oe.pl";
$form->{type} =
($form->{db} eq 'customer') ? "sales_order" : "purchase_order";
+ # 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
&add_transaction;
-
$lxdebug->leave_sub();
}
$imsg .= " saved!";
$form->isblank("name", $locale->text("Name missing!"));
- if ($vertreter && $form->{db} eq "customer") {
- $form->isblank("salesman_id", $locale->text("Salesman missing!"));
+ if ($form->{"db"} eq "customer") {
+ $rc = CT->save_customer(\%myconfig, \%$form);
+ } else {
+ $rc = CT->save_vendor(\%myconfig, \%$form);
}
- $rc = &{"CT::save_$form->{db}"}("", \%myconfig, \%$form);
if ($rc == 3) {
$form->error($locale->text('customernumber not unique!'));
}
+ # saving the history
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = ($form->{"db"} eq "customer" ? qq|customernumber_| . $form->{customernumber} : qq|vendornumber_| . $form->{vendornumber});
+ $form->{addition} = "SAVED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
$form->redirect($locale->text($msg));
$lxdebug->leave_sub();
$imsg .= " saved!";
$form->isblank("name", $locale->text("Name missing!"));
- if ($vertreter && $form->{db} eq "customer") {
- $form->isblank("salesman_id", $locale->text("Salesman missing!"));
+
+ my $res;
+ if ($form->{"db"} eq "customer") {
+ $res = CT->save_customer(\%myconfig, \%$form);
+ } else {
+ $res = CT->save_vendor(\%myconfig, \%$form);
}
- print(STDERR "SHIPTO in sub save $form->{shipto_id}\n");
- &{"CT::save_$form->{db}"}("", \%myconfig, \%$form);
+ if (3 == $res) {
+ if ($form->{"db"} eq "customer") {
+ $form->error($locale->text('This customer number is already in use.'));
+ } else {
+ $form->error($locale->text('This vendor number is already in use.'));
+ }
+ }
+ # saving the history
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = ($form->{"db"} eq "customer" ? qq|customernumber_| . $form->{customernumber} : qq|vendornumber_| . $form->{vendornumber});
+ $form->{addition} = "SAVED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
&edit;
exit;
$lxdebug->leave_sub();
$msg = ucfirst $form->{db};
$msg .= " deleted!";
+ # saving the history
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = ($form->{"db"} eq "customer" ? qq|customernumber_| . $form->{customernumber} : qq|vendornumber_| . $form->{vendornumber});
+ $form->{addition} = "DELETED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
$form->redirect($locale->text($msg));
$msg = "Cannot delete $form->{db}";
sub update {
$lxdebug->enter_sub();
- &check_salesman($form->{salesman});
-
- # $form->get_salesman(\%myconfig, $form->{salesman});
&display();
$lxdebug->leave_sub();
}
-sub check_salesman {
- $lxdebug->enter_sub();
-
- my ($name) = @_;
-
- my ($new_name, $new_id) = split /--/, $form->{$name};
- my $i = 0;
-
- # check name, combine name and id
- if ($form->{"oldsalesman"} ne $form->{"salesman"}) {
-
- # return one name or a list of names in $form->{name_list}
- if (($i = $form->get_salesman(\%myconfig, $name)) > 1) {
- &select_salesman($name);
- exit;
- }
-
- if ($i == 1) {
-
- # we got one name
- $form->{"salesman_id"} = $form->{salesman_list}[0]->{id};
- $form->{salesman} = $form->{salesman_list}[0]->{name};
- $form->{"oldsalesman"} = $form->{salesman};
-
- } else {
-
- # name is not on file
- # $locale->text('Customer not on file!')
- # $locale->text('Vendor not on file!')
- $msg = ucfirst $name . " not on file or locked!";
- $form->error($locale->text($msg));
- }
- }
-
- $lxdebug->leave_sub();
-
- return $i;
-}
-
-sub select_salesman {
- $lxdebug->enter_sub();
-
- my ($table) = @_;
-
- @column_index = qw(ndx name);
-
- $label = ucfirst $table;
- $column_data{ndx} = qq|<th> </th>|;
- $column_data{name} =
- qq|<th class=listheading>| . $locale->text($label) . qq|</th>|;
-
- # list items with radio button on a form
- $form->header;
-
- $title = $locale->text('Select from one of the names below');
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<table width=100%>
- <tr>
- <th class=listtop>$title</th>
- </tr>
- <tr space=5></tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>|;
-
- map { print "\n$column_data{$_}" } @column_index;
-
- print qq|
- </tr>
-|;
-
- my $i = 0;
- foreach $ref (@{ $form->{salesman_list} }) {
- $checked = ($i++) ? "" : "checked";
-
- $ref->{name} =~ s/\"/"/g;
-
- $column_data{ndx} =
- qq|<td><input name=ndx class=radio type=radio value=$i $checked></td>|;
- $column_data{name} =
- qq|<td><input name="new_name_$i" type=hidden value="$ref->{name}">$ref->{name}</td>|;
-
- $j++;
- $j %= 2;
- print qq|
- <tr class=listrow$j>|;
-
- map { print "\n$column_data{$_}" } @column_index;
-
- print qq|
- </tr>
-
-<input name="new_id_$i" type=hidden value=$ref->{id}>
-
-|;
-
- }
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<input name=lastndx type=hidden value=$i>
-
-|;
-
- # delete variables
- map { delete $form->{$_} } qw(action name_list header);
-
- # save all other form variables
- foreach $key (keys %${form}) {
- $form->{$key} =~ s/\"/"/g;
- print qq|<input name=$key type=hidden value="$form->{$key}">\n|;
- }
-
- print qq|
-<input type=hidden name=nextsub value=salesman_selected>
-
-<input type=hidden name=vc value=$table>
-<br>
-<input class=submit type=submit name=action value="|
- . $locale->text('Continue') . qq|">
-</form>
-
-</body>
-</html>
-|;
-
- $lxdebug->leave_sub();
-}
-
-sub salesman_selected {
- $lxdebug->enter_sub();
-
- # replace the variable with the one checked
-
- # index for new item
- $i = $form->{ndx};
-
- $form->{salesman} = $form->{"new_name_$i"};
- $form->{"salesman_id"} = $form->{"new_id_$i"};
- $form->{"oldsalesman"} = $form->{salesman};
-
- # delete all the new_ variables
- for $i (1 .. $form->{lastndx}) {
- map { delete $form->{"new_${_}_$i"} } (id, name);
- }
-
- map { delete $form->{$_} } qw(ndx lastndx nextsub);
-
- &update(1);
-
- $lxdebug->leave_sub();
-}
-
sub get_contact {
$lxdebug->enter_sub();
}
-
sub get_shipto {
$lxdebug->enter_sub();
transdate,
description,
qty,
- unit);
+ unit,
+ sellprice);
qq|<th class=listheading>| . $locale->text('Qty') . qq|</th>|;
$column_header{unit} =
qq|<th class=listheading>| . $locale->text('Unit') . qq|</th>|;
+ $column_header{sellprice} =
+ qq|<th class=listheading>| . $locale->text('Sell Price') . qq|</th>|;
$result .= qq|
<table width=100%>
} else {
map { $column_data{$_} = "<td>$ref->{$_} </td>" } @column_index;
}
-
+ $column_data{sellprice} = "<td>". $form->format_amount(\%myconfig,$ref->{sellprice},2)." </td>";
$i++;
$i %= 2;
$result .= "
}
-sub continue { &{ $form->{nextsub} } }
+sub continue { call_sub($form->{nextsub}); }
# end of main
-sub continue { &{ $form->{nextsub} } }
+require "bin/mozilla/common.pl";
+
+sub continue { call_sub($form->{"nextsub"}); }
sub export {
$lxdebug->enter_sub();
<td align=left nowrap>| . $locale->text("Mandantennummer") . qq|</td>
<td><input name=mandantennr size=10 maxlength=5 value="$form->{mandantennr}"></td>
- <td align=left nowrap>| . $locale->text("Datenträgernummer") . qq|</td>
+ <td align=left nowrap>| . $locale->text("Medium Number") . qq|</td>
<td><input name=datentraegernr size=5 maxlength=3 value="$form->{datentraegernr}"></td>
</tr>
<tr>
<input type=hidden name=nextsub value=export2>
-<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 type=hidden name=nextsub value=export3>
-<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 type=hidden name=nextsub value=export3>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
DATEV->save_datev_stamm(\%myconfig, \%$form);
my $link = $form->{"script"} . "?";
- map({ $link .= "${_}=" . $form->escape($form->{$_}) . "&"; } qw(path login password));
+ map({ $link .= "${_}=" . $form->escape($form->{$_}) . "&"; } qw(login password));
$link .= "action=download";
if ($form->{kne}) {
#
#======================================================================
+use POSIX;
+
use SL::IS;
use SL::PE;
use SL::DN;
-use Data::Dumper;
+use SL::ReportGenerator;
-require "$form->{path}/io.pl";
-require "$form->{path}/arap.pl";
+require "bin/mozilla/common.pl";
+require "bin/mozilla/reportgenerator.pl";
+require "bin/mozilla/io.pl";
+require "bin/mozilla/arap.pl";
1;
sub edit_config {
$lxdebug->enter_sub();
- # edit all dunning config data
-
- $form->header;
DN->get_config(\%myconfig, \%$form);
- $form->{title} = $locale->text('Edit Dunning Process Config');
-
- $form->{callback} =
- "$form->{script}?action=edit_config&path=$form->{path}&login=$form->{login}&password=$form->{password}"
- unless $form->{callback};
-
- @column_index = qw(dunning_level dunning_description active auto email payment_terms terms fee interest template);
-
- $column_header{dunning_level} =
- qq|<th class=listheading>|
- . $locale->text('Dunning Level')
- . qq|</th>|;
- $column_header{dunning_description} =
- qq|<th class=listheading>|
- . $locale->text('Dunning Description')
- . qq|</th>|;
- $column_header{active} =
- qq|<th class=listheading>|
- . $locale->text('Active?')
- . qq|</th>|;
- $column_header{auto} =
- qq|<th class=listheading>|
- . $locale->text('Auto Send?')
- . qq|</th>|;
- $column_header{email} =
- qq|<th class=listheading>|
- . $locale->text('eMail Send?')
- . qq|</th>|;
- $column_header{payment_terms} =
- qq|<th class=listheading>|
- . $locale->text('Fristsetzung')
- . qq|</th>|;
- $column_header{terms} =
- qq|<th class=listheading>|
- . $locale->text('Duedate +Days')
- . qq|</th>|;
- $column_header{fee} =
- qq|<th class=listheading>|
- . $locale->text('Fee')
- . qq|</th>|;
- $column_header{interest} =
- qq|<th class=listheading>|
- . $locale->text('Interest Rate')
- . qq|</th>|;
- $column_header{template} =
- qq|<th class=listheading>|
- . $locale->text('Template')
- . qq|</th>|;
- print qq|
-<body>
-<script type="text/javascript" src="js/common.js"></script>
-<script type="text/javascript" src="js/dunning.js"></script>
-<form method=post action=$form->{script}>
-
-
-<table width=100%>
- <tr>
- <th class=listtop colspan=9>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>|;
- map { print "$column_header{$_}\n" } @column_index;
-
- print qq|
- </tr>
-|;
- my $i = 0;
- foreach $ref (@{ $form->{DUNNING} }) {
-
- $i++;
- my $j = $i % 2;
-
- print qq|
- <tr valign=top class=listrow$j>
-|;
-
-
- $column_data{dunning_level} =
- qq|<td><input type=hidden name=dunning_level_$i size=2 value="$i"><input type=hidden name=id_$i value="$ref->{id}">$i</td>|;
- $column_data{dunning_description} = qq|<td><input name=dunning_description_$i value="$ref->{dunning_description}"></td>|;
- my $active = ($ref->{active}) ? "checked" : "";
- $column_data{active} =
- qq|<td><input type=checkbox name=active_$i value=1 $active></td>|;
- my $email = ($ref->{email}) ? "checked" : "";
- $column_data{email} =
- qq|<td><input type=checkbox name=email_$i value=1 $email><button type="button" onclick="set_email_window('email_subject_$i', 'email_body_$i', 'email_attachment_$i')">| . $locale->text('L') . qq|</button><input type=hidden name=email_body_$i value="$ref->{email_body}"><input type=hidden name=email_subject_$i value="$ref->{email_subject}"><input type=hidden name=email_attachment_$i value="$ref->{email_attachment}"></td>|;
+ $form->get_lists('charts' => { 'key' => 'ALL_CHARTS',
+ 'transdate' => 'current_date' });
- my $auto = ($ref->{auto}) ? "checked" : "";
- $column_data{auto} =
- qq|<td><input type=checkbox name=auto_$i value=1 $auto></td>|;
- $column_data{payment_terms} = qq|<td><input name=payment_terms_$i size=3 value="$ref->{payment_terms}"></td>|;
- $column_data{terms} = qq|<td><input name=terms_$i size=3 value="$ref->{terms}"></td>|;
- $column_data{fee} = qq|<td><input name=fee_$i size=5 value="$ref->{fee}"></td>|;
- $column_data{interest} = qq|<td><input name=interest_$i size=4 value="$ref->{interest}">%</td>|;
- $column_data{template} = qq|<td><input name=template_$i value="$ref->{template}"></td>|;
+ $form->{SELECT_AR_AMOUNT} = [];
+ $form->{SELECT_AR} = [];
+ foreach my $chart (@{ $form->{ALL_CHARTS} }) {
+ $chart->{LINKS} = { map { $_, 1 } split m/:/, $chart->{link} };
+ if ($chart->{LINKS}->{AR}) {
+ $chart->{AR_selected} = "selected" if $chart->{id} == $form->{AR};
+ push @{ $form->{SELECT_AR} }, $chart;
+ }
- map { print "$column_data{$_}\n" } @column_index;
-
- print qq|
- </tr>
-|;
- }
- $i++;
- my $j = $i % 2;
-
- print qq|
- <tr valign=top class=listrow$j>
-|;
-
-
- $column_data{dunning_level} =
- qq|<td><input type=hidden size=2 name=dunning_level_$i value=$i>$i</td>|;
- $column_data{dunning_description} = qq|<td><input name=dunning_description_$i ></td>|;
- my $active = "";
- $column_data{active} =
- qq|<td><input type=checkbox name=active_$i value=1 $active></td>|;
- my $email = "";
- $column_data{email} =
- qq|<td><input type=checkbox name=email_$i value=1 $email><button type="button" onclick="set_email_window('email_subject_$i', 'email_body_$i', 'email_attachment_$i')">| . $locale->text('L') . qq|</button><input type=hidden name=email_body_$i><input type=hidden name=email_subject_$i><input type=hidden name=email_attachment_$i></td>|;
- my $auto = "";
- $column_data{auto} =
- qq|<td><input type=checkbox name=auto_$i value=1 $auto></td>|;
- $column_data{payment_terms} = qq|<td><input size=3 name=payment_terms_$i></td>|;
- $column_data{terms} = qq|<td><input size=3 name=terms_$i></td>|;
- $column_data{fee} = qq|<td><input size=5 name=fee_$i></td>|;
- $column_data{interest} = qq|<td><input size=4 name=interest_$i>%</td>|;
- $column_data{template} = qq|<td><input name=template_$i></td>|;
-
-
- $form->{rowcount} = $i;
- 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 name=rowcount type=hidden value="$form->{rowcount}">
-
-<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('Save') . qq|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
+ if ($chart->{LINKS}->{AR_amount}) {
+ $chart->{AR_amount_fee_selected} = "selected" if $chart->{id} == $form->{AR_amount_fee};
+ $chart->{AR_amount_interest_selected} = "selected" if $chart->{id} == $form->{AR_amount_interest};
+ push @{ $form->{SELECT_AR_AMOUNT} }, $chart;
+ }
}
- print qq|
+ $form->{title} = $locale->text('Edit Dunning Process Config');
+ $form->{callback} ||= build_std_url("action=edit_config");
- </form>
-
- </body>
- </html>
-|;
+ $form->header();
+ print $form->parse_html_template2("dunning/edit_config");
$lxdebug->leave_sub();
}
sub add {
$lxdebug->enter_sub();
+
# setup customer selection
$form->all_vc(\%myconfig, "customer", "AR");
DN->get_config(\%myconfig, \%$form);
- if (@{ $form->{all_customer} }) {
- map { $customer .= "<option>$_->{name}--$_->{id}\n" }
- @{ $form->{all_customer} };
- $customer = qq|<select name=customer><option>\n$customer</select>|;
- } else {
- $customer = qq|<input name=customer size=35>|;
- }
+ $form->{SHOW_CUSTOMER_SELECTION} = $form->{all_customer} && scalar @{ $form->{all_customer} };
+ $form->{SHOW_DUNNING_LEVEL_SELECTION} = $form->{DUNNING} && scalar @{ $form->{DUNNING} };
+ $form->{SHOW_DEPARTMENT_SELECTION} = $form->{all_departments} && scalar @{ $form->{all_departments} };
- # dunning levels
- if (@{ $form->{DUNNING} }) {
- $form->{selectdunning_level} = "<option></option\n";
- map {
- $form->{selectdunning_level} .=
- "<option value=$_->{id}>$_->{dunning_description}</option>\n"
- } (@{ $form->{DUNNING} });
- }
- $dunning_level = qq|
- <tr>
- <th align=right nowrap>| . $locale->text('Next Dunning Level') . qq|</th>
- <td colspan=3><select name=dunning_level>$form->{selectdunning_level}</select></td>
- </tr>
- | if $form->{selectdunning_level};
-
- # departments
- if (@{ $form->{all_departments} }) {
- $form->{selectdepartment} = "<option>\n";
- map {
- $form->{selectdepartment} .=
- "<option>$_->{description}--$_->{id}\n"
- } (@{ $form->{all_departments} });
- }
- $department = qq|
- <tr>
- <th align=right nowrap>| . $locale->text('Department') . qq|</th>
- <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
- </tr>
- | if $form->{selectdepartment};
- $form->{title} = $locale->text('Start Dunning Process');
- $form->{nextsub} = "show_invoices";
-
- # use JavaScript Calendar or not
- $form->{jsscript} = $jscalendar;
- $jsscript = "";
- if ($form->{jsscript}) {
-
- # with JavaScript Calendar
- $button1 = qq|
- <td><input name=paymentuntil id=paymentuntil size=11 title="$myconfig{dateformat}">
- <input type=button name=paymentuntil id="trigger1" value=|
- . $locale->text('button') . qq|></td>
- |;
-
- #write Trigger
- $jsscript =
- Form->write_trigger(\%myconfig, "1", "paymentuntil", "BR", "trigger1");
- } else {
+ $form->{title} = $locale->text('Start Dunning Process');
+ $form->{jsscript} = 1;
+ $form->{fokus} = "search.customer";
+ $form->header();
- # without JavaScript Calendar
- $button1 =
- qq|<td><input name=paymentuntil id=paymentuntil size=11 title="$myconfig{dateformat}"></td>|;
- }
- $form->{fokus} = "search.customer";
- $form->header;
- print qq|
-<body onLoad="fokus()">
-
-<form method=post name="search" action=$form->{script}>
-
-<table width=100%>
- <tr><th class=listtop>$form->{title}</th></tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align=right>| . $locale->text('Customer') . qq|</th>
- <td colspan=3>$customer</td>
- </tr>
- $dunning_level
- $department
- <tr>
- <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
- <td colspan=3><input name=invnumber size=20></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
- <td colspan=3><input name=ordnumber size=20></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Notes') . qq|</th>
- <td colspan=3><input name=notes size=40></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Payment until') . qq|</th>
- $button1
- </tr>
- <input type=hidden name=sort value=transdate>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align=right nowrap>| . $locale->text('Minimum Amount') . qq|</th>
- <td><input name=minamount size=6></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Group Invoices') . qq|</th>
- <td><input type=checkbox value=1 name=groupinvoices checked></td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-<input type=hidden name=nextsub value=$form->{nextsub}>
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>
-
-<br>
-<input class=submit type=submit name=action value="|
- . $locale->text('Continue') . qq|">
-
-</form>
-
-</body>
-
-$jsscript
-
-</html>
-|;
+ print $form->parse_html_template("dunning/add");
$lxdebug->leave_sub();
-
}
sub show_invoices {
DN->get_invoices(\%myconfig, \%$form);
$form->{title} = $locale->text('Start Dunning Process');
- if (@{ $form->{DUNNING_CONFIG} }) {
- foreach $item (@{ $form->{DUNNING_CONFIG} }) {
- $form->{selectdunning} .=
- "<option value=$item->{id}>$item->{dunning_description}</option>";
- }
- }
-
-
- $form->{nextsub} = "save_dunning";
-
- $form->{callback} =
- "$form->{script}?action=show_invoices&path=$form->{path}&login=$form->{login}&password=$form->{password}&customer=$form->{customer}&invnumber=$form->{invnumber}&ordnumber=$form->{ordnumber}&paymentuntil=$form->{paymentuntil}&groupinvoices=$form->{groupinvoices}&minamount=$form->{minamount}&dunning_level=$form->{dunning_level}¬es=$form->{notes}"
- unless $form->{callback};
-
- @column_index = qw(dunning_description active email customername invnumber invdate inv_duedate invamount next_duedate fee interest );
-
- $column_header{dunning_description} =
- qq|<th class=listheading>|
- . $locale->text('Current / Next Level')
- . qq|</th>|;
- $column_header{active} =
- qq|<th class=listheading>|
- . $locale->text('Active?')
- . qq|</th>|;
- $column_header{email} =
- qq|<th class=listheading>|
- . $locale->text('eMail?')
- . qq|</th>|;
- $column_header{customername} =
- qq|<th class=listheading>|
- . $locale->text('Customername')
- . qq|</th>|;
- $column_header{invnumber} =
- qq|<th class=listheading>|
- . $locale->text('Invno.')
- . qq|</th>|;
- $column_header{inv_duedate} =
- qq|<th class=listheading>|
- . $locale->text('Inv. Duedate')
- . qq|</th>|;
- $column_header{next_duedate} =
- qq|<th class=listheading>|
- . $locale->text('Dunning Duedate')
- . qq|</th>|;
- $column_header{invdate} =
- qq|<th class=listheading>|
- . $locale->text('Invdate')
- . qq|</th>|;
- $column_header{invamount} =
- qq|<th class=listheading>|
- . $locale->text('Amount')
- . qq|</th>|;
- $column_header{fee} =
- qq|<th class=listheading>|
- . $locale->text('Total Fees')
- . qq|</th>|;
- $column_header{interest} =
- qq|<th class=listheading>|
- . $locale->text('Total Interest')
- . qq|</th>|;
-
- $form->header;
-
-
- print qq|
-<body>
-<script type="text/javascript" src="js/common.js"></script>
-<script type="text/javascript" src="js/dunning.js"></script>
-<form name=Form method=post action=$form->{script}>
-
-
-<table width=100%>
- <tr>
- <th class=listtop colspan=9>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>|;
- map { print "$column_header{$_}\n" } @column_index;
-
- print qq|
- </tr>
-|;
- my $i = 0;
- foreach $ref (@{ $form->{DUNNINGS} }) {
-
- $i++;
- my $j = $i % 2;
-
- print qq|
- <tr valign=top class=listrow$j>
-|;
-
- $form->{selectdunning} =~ s/ selected//g;
- if ($ref->{next_dunning_id} ne "") {
- $form->{selectdunning} =~ s/value=$ref->{next_dunning_id}/value=$ref->{next_dunning_id} selected/;
- }
-
-
- $dunning = qq|<select name=next_dunning_id_$i>$form->{selectdunning}</select>|;
-
-
- $column_data{dunning_description} = qq|<td><input type=hidden name=inv_id_$i size=2 value="$ref->{id}"><input type=hidden name=customer_id_$i size=2 value="$ref->{customer_id}">$ref->{dunning_level}: $dunning</td>|;
- my $active = "checked";
- $column_data{active} =
- qq|<td><input type=checkbox name=active_$i value=1 $active></td>|;
- my $email = "checked";
- $column_data{email} =
- qq|<td><input type=checkbox name=email_$i value=1 $email></td>|;
- $column_data{next_duedate} = qq|<td><input type=hidden name=next_duedate_$i size=6 value="$ref->{next_duedate}">$ref->{next_duedate}</td>|;
+ foreach my $row (@{ $form->{DUNNINGS} }) {
+ $row->{DUNNING_CONFIG} = [ map +{ %{ $_ } }, @{ $form->{DUNNING_CONFIG} } ];
- $column_data{inv_duedate} = qq|<td><input type=hidden name=inv_duedate_$i size=6 value="$ref->{duedate}">$ref->{duedate}</td>|;
- $column_data{invdate} = qq|<td><input type=hidden name=invdate_$i size=6 value="$ref->{transdate}">$ref->{transdate}</td>|;
- $column_data{invnumber} = qq|<td><input type=hidden name=invnumber_$i size=6 value="$ref->{invnumber}">$ref->{invnumber}</td>|;
- $column_data{customername} = qq|<td><input type=hidden name=customername_$i size=6 value="$ref->{customername}">$ref->{customername}</td>|;
- $column_data{invamount} = qq|<td><input type=hidden name=invamount_$i size=6 value="$ref->{amount}">$ref->{amount}</td>|;
- $column_data{fee} = qq|<td><input type=hidden name=fee_$i size=5 value="$ref->{fee}">$ref->{fee}</td>|;
- $column_data{interest} = qq|<td><input type=hidden name=interest_$i size=4 value="$ref->{interest}">$ref->{interest}</td>|;
-
-
-
- map { print "$column_data{$_}\n" } @column_index;
-
- print qq|
- </tr>
-|;
- }
-
- $form->{rowcount} = $i;
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>|;
-&print_options;
-print qq|
-<br>
-<form method=post action=$form->{script}>
-
-<input name=callback type=hidden value="$form->{callback}">
-<input name=rowcount type=hidden value="$form->{rowcount}">
-<input name=nextsub type=hidden value="$form->{nextsub}">
-<input name=groupinvoices type=hidden value="$form->{groupinvoices}">
-
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>|;
-#print qq|
-# <input type="submit" name="action" value="|
-# . $locale->text('Continue') . qq|">|;
-print qq|
-<input type="hidden" name="action">
-<input type="submit" name="dummy" value="|
- . $locale->text('Continue') . qq|" onclick="this.disabled=true; this.value='| . $locale->text("The dunning process started") . qq|'; document.Form.action.value='| . $locale->text('Continue') . qq|'; document.Form.submit()">|;
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
+ if ($row->{next_dunning_config_id}) {
+ map { $_->{SELECTED} = $_->{id} == $row->{next_dunning_config_id} } @{ $row->{DUNNING_CONFIG } };
+ }
+ map { $row->{$_} = $form->format_amount(\%myconfig, $row->{$_} * 1, -2) } qw(amount fee interest);
}
- print qq|
+ $form->get_lists('printers' => 'printers',
+ 'languages' => 'languages');
- </form>
+ $form->{type} = 'dunning';
+ $form->{rowcount} = scalar @{ $form->{DUNNINGS} };
+ $form->{jsscript} = 1;
+ $form->{callback} ||= build_std_url("action=show_invoices", qw(login password customer invnumber ordnumber groupinvoices minamount dunning_level notes));
- </body>
- </html>
-|;
+ $form->{PRINT_OPTIONS} = print_options({ 'inline' => 1,
+ 'no_queue' => 1,
+ 'no_postscript' => 1,
+ 'no_html' => 1,
+ 'no_opendocument' => 1, });
+ $form->header();
+ print $form->parse_html_template("dunning/show_invoices");
$lxdebug->leave_sub();
-
}
sub save {
}
DN->save_config(\%myconfig, \%$form);
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $form->{snumbers} = qq|dunning_id_| . $form->{"dunning_id"};
+ $form->{addition} = "SAVED FOR DUNNING";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
$form->redirect($locale->text('Dunning Process Config saved!'));
$lxdebug->leave_sub();
my $active=1;
my @rows = ();
undef($form->{DUNNING_PDFS});
+
if ($form->{groupinvoices}) {
- while ($active) {
- $lastcustomer = 0;
- $form->{inv_ids} = "";
- $active = 0;
- @rows = ();
- for my $i (1 .. $form->{rowcount}) {
- $form->{"active_$i"} *= 1;
- $lastcustomer = $form->{"customer_id_$i"} unless ($lastcustomer);
- if ($form->{"active_$i"} && ($form->{"customer_id_$i"} == $lastcustomer)) {
- if ($form->{inv_ids}) {
- $form->{inv_ids} .= qq|,$form->{"inv_id_$i"}|;
- } else {
- $form->{inv_ids} = qq|($form->{"inv_id_$i"}|;
- }
- $form->{"active_$i"} = 0;
- $form->{"customer_id_$i"} = 0;
- push(@rows, $i);
- } elsif ($form->{"active_$i"}) {
- $active = 1;
- } else {
- $form->{"customer_id_$i"} = 0;
- }
- }
- if ($form->{inv_ids} ne "") {
- $form->{inv_ids} .= ")";
- DN->save_dunning(\%myconfig, \%$form, \@rows, $userspath,$spool, $sendmail);
+ my %dunnings_for;
+
+ for my $i (1 .. $form->{rowcount}) {
+ next unless ($form->{"active_$i"});
+
+ $dunnings_for{$form->{"customer_id_$i"}} ||= {};
+ my $dunning_levels = $dunnings_for{$form->{"customer_id_$i"}};
+
+ $dunning_levels->{$form->{"next_dunning_config_id_$i"}} ||= [];
+ my $level = $dunning_levels->{$form->{"next_dunning_config_id_$i"}};
+
+ push @{ $level }, { "row" => $i,
+ "invoice_id" => $form->{"inv_id_$i"},
+ "customer_id" => $form->{"customer_id_$i"},
+ "next_dunning_config_id" => $form->{"next_dunning_config_id_$i"},
+ "email" => $form->{"email_$i"}, };
+ }
+
+ foreach my $levels (values %dunnings_for) {
+ foreach my $level (values %{ $levels }) {
+ next unless scalar @{ $level };
+
+ DN->save_dunning(\%myconfig, $form, $level, $userspath, $spool, $sendmail);
}
}
+
} else {
for my $i (1 .. $form->{rowcount}) {
- if ($form->{"active_$i"}) {
- @rows = ();
- $form->{inv_ids} = qq|($form->{"inv_id_$i"})|;
- push(@rows, $i);
- DN->save_dunning(\%myconfig, \%$form, \@rows, $userspath,$spool, $sendmail);
- }
+ next unless $form->{"active_$i"};
+
+ my $level = [ { "row" => $i,
+ "invoice_id" => $form->{"inv_id_$i"},
+ "customer_id" => $form->{"customer_id_$i"},
+ "next_dunning_config_id" => $form->{"next_dunning_config_id_$i"},
+ "email" => $form->{"email_$i"}, } ];
+ DN->save_dunning(\%myconfig, $form, $level, $userspath, $spool, $sendmail);
}
}
+
if($form->{DUNNING_PDFS}) {
- DN->melt_pdfs(\%myconfig, \%$form,$spool);
+ DN->melt_pdfs(\%myconfig, $form, $form->{copies});
+ }
+
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $form->{snumbers} = qq|dunning_id_| . $form->{"dunning_id"};
+ $form->{addition} = "DUNNING STARTED";
+ $form->save_history($form->dbconnect(\%myconfig));
}
+ # /saving the history
- $form->redirect($locale->text('Dunning Process started for selected invoices!'));
+ if ($form->{media} eq 'printer') {
+ delete $form->{callback};
+ $form->redirect($locale->text('Dunning Process started for selected invoices!'));
+ }
$lxdebug->leave_sub();
}
-
+
sub set_email {
$lxdebug->enter_sub();
-
- my $callback = "$form->{script}?action=set_email&";
- map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" }
- (qw(login path password name input_subject input_body input_attachment email_subject email_body email_attachment), grep({ /^[fl]_/ } keys %$form)));
-
- if ($form->{email_attachment}) {
- $form->{email_attachment} = "checked";
- }
$form->{"title"} = $locale->text("Set eMail text");
$form->header();
print($form->parse_html_template("dunning/set_email"));
sub search {
$lxdebug->enter_sub();
- # setup customer selection
- $form->all_vc(\%myconfig, "customer", "AR");
+
+ $form->get_lists("customers" => "ALL_CUSTOMERS",
+ "departments" => "ALL_DEPARTMENTS");
DN->get_config(\%myconfig, \%$form);
- if (@{ $form->{all_customer} }) {
- map { $customer .= "<option>$_->{name}--$_->{id}\n" }
- @{ $form->{all_customer} };
- $customer = qq|<select name=customer><option>\n$customer</select>|;
- } else {
- $customer = qq|<input name=customer size=35>|;
- }
+ $form->{SHOW_CUSTOMER_DDBOX} = scalar @{ $form->{ALL_CUSTOMERS} } <= $myconfig{vclimit};
+ $form->{SHOW_DEPARTMENT_DDBOX} = scalar @{ $form->{ALL_CUSTOMERS} };
+ $form->{SHOW_DUNNING_LEVELS} = scalar @{ $form->{DUNNING} };
- # dunning levels
- if (@{ $form->{DUNNING} }) {
- $form->{selectdunning_level} = "<option></option\n";
- map {
- $form->{selectdunning_level} .=
- "<option value=$_->{id}>$_->{dunning_description}</option>\n"
- } (@{ $form->{DUNNING} });
- }
- $dunning_level = qq|
- <tr>
- <th align=right nowrap>| . $locale->text('Next Dunning Level') . qq|</th>
- <td colspan=3><select name=dunning_level>$form->{selectdunning_level}</select></td>
- </tr>
- | if $form->{selectdunning_level};
-
- # departments
- if (@{ $form->{all_departments} }) {
- $form->{selectdepartment} = "<option>\n";
- map {
- $form->{selectdepartment} .=
- "<option>$_->{description}--$_->{id}\n"
- } (@{ $form->{all_departments} });
- }
- $department = qq|
- <tr>
- <th align=right nowrap>| . $locale->text('Department') . qq|</th>
- <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
- </tr>
- | if $form->{selectdepartment};
- $form->{title} = $locale->text('Search Dunning');
- $form->{nextsub} = "show_dunning";
-
- # use JavaScript Calendar or not
- $form->{jsscript} = $jscalendar;
- $jsscript = "";
- if ($form->{jsscript}) {
-
- # with JavaScript Calendar
- $button1 = qq|
- <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
- <input type=button name=transdatefrom id="trigger1" value=|
- . $locale->text('button') . qq|></td>
- |;
- $button2 = qq|
- <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
- <input type=button name=transdateto id="trigger2" value=|
- . $locale->text('button') . qq|></td>
- |;
- $button3 = qq|
- <td><input name=dunningfrom id=dunningfrom size=11 title="$myconfig{dateformat}">
- <input type=button name=dunningfrom id="trigger3" value=|
- . $locale->text('button') . qq|></td>
- |;
- $button4 = qq|
- <td><input name=dunningto id=dunningto size=11 title="$myconfig{dateformat}">
- <input type=button name=dunningto id="trigger4" value=|
- . $locale->text('button') . qq|></td>
- |;
-
- #write Trigger
- $jsscript =
- Form->write_trigger(\%myconfig, "4", "transdatefrom", "BR", "trigger1", "transdateto", "BR", "trigger2", "dunningfrom", "BR", "trigger3", "dunningto", "BR", "trigger4");
- } else {
+ $form->{jsscript} = 1;
+ $form->{title} = $locale->text('Search Dunning');
+ $form->{fokus} = "search.customer";
- # without JavaScript Calendar
- $button1 =
- qq|<td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
- $button2 =
- qq|<td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
- $button1 =
- qq|<td><input name=dunningfrom id=dunningfrom size=11 title="$myconfig{dateformat}"></td>|;
- $button1 =
- qq|<td><input name=dunningfrom id=dunningto size=11 title="$myconfig{dateformat}"></td>|;
- }
+ $form->header();
- $form->{fokus} = "search.customer";
- $form->header;
- print qq|
-<body onLoad="fokus()">
-
-<form method=post name="search" action=$form->{script}>
-
-<table width=100%>
- <tr><th class=listtop>$form->{title}</th></tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align=right>| . $locale->text('Customer') . qq|</th>
- <td colspan=3>$customer</td>
- </tr>
- $dunning_level
- $department
- <tr>
- <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
- <td colspan=3><input name=invnumber size=20></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
- <td colspan=3><input name=ordnumber size=20></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Notes') . qq|</th>
- <td colspan=3><input name=notes size=40></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Invdate from') . qq|</th>
- $button1
- <th align=right nowrap>| . $locale->text('To') . qq|</th>
- $button2
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Dunning Date from') . qq|</th>
- $button3
- <th align=right nowrap>| . $locale->text('To') . qq|</th>
- $button4
- </tr>
-
- <input type=hidden name=sort value=transdate>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align=right nowrap>| . $locale->text('Show old dunnings') . qq|</th>
- <td><input type=checkbox value=1 name=showold></td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-<input type=hidden name=nextsub value=$form->{nextsub}>
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>
-
-<br>
-<input class=submit type=submit name=action value="|
- . $locale->text('Continue') . qq|">
-
-</form>
-
-</body>
-
-$jsscript
-
-</html>
-|;
+ $form->{onload} = qq|focus()|
+ . qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|
+ . qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
+
+ print $form->parse_html_template("dunning/search");
$lxdebug->leave_sub();
sub show_dunning {
$lxdebug->enter_sub();
+ my @filter_field_list = qw(customer_id customer dunning_level department_id invnumber ordnumber
+ transdatefrom transdateto dunningfrom dunningto notes showold);
+
DN->get_dunning(\%myconfig, \%$form);
- $form->{title} = $locale->text('Dunning overview');
-
-
-
-
-
- $form->{callback} =
- "$form->{script}?action=show_dunning&path=$form->{path}&login=$form->{login}&password=$form->{password}&customer=$form->{customer}&invnumber=$form->{invnumber}&ordnumber=$form->{ordnumber}&transdatefrom=$form->{transdatefrom}&transdateto=$form->{transdateto}&dunningfrom=$form->{dunningfrom}&dunningto=$form->{dunningto}¬es=$form->{notes}&showold=$form->{showold}&dunning_level=$form->{dunning_level}"
- unless $form->{callback};
-
- @column_index = qw(dunning_description customername invnumber invdate inv_duedate invamount dunning_date next_duedate fee interest );
-
- $column_header{dunning_description} =
- qq|<th class=listheading>|
- . $locale->text('Dunning Level')
- . qq|</th>|;
- $column_header{customername} =
- qq|<th class=listheading>|
- . $locale->text('Customername')
- . qq|</th>|;
- $column_header{invnumber} =
- qq|<th class=listheading>|
- . $locale->text('Invnumber')
- . qq|</th>|;
- $column_header{inv_duedate} =
- qq|<th class=listheading>|
- . $locale->text('Invoice Duedate')
- . qq|</th>|;
- $column_header{dunning_date} =
- qq|<th class=listheading>|
- . $locale->text('Dunning Date')
- . qq|</th>|;
- $column_header{next_duedate} =
- qq|<th class=listheading>|
- . $locale->text('Dunning Duedate')
- . qq|</th>|;
- $column_header{invdate} =
- qq|<th class=listheading>|
- . $locale->text('Invdate')
- . qq|</th>|;
- $column_header{invamount} =
- qq|<th class=listheading>|
- . $locale->text('Amount')
- . qq|</th>|;
- $column_header{fee} =
- qq|<th class=listheading>|
- . $locale->text('Total Fees')
- . qq|</th>|;
- $column_header{interest} =
- qq|<th class=listheading>|
- . $locale->text('Total Interest')
- . qq|</th>|;
-
- $form->header;
-
-
- print qq|
-<body>
-<script type="text/javascript" src="js/common.js"></script>
-<script type="text/javascript" src="js/dunning.js"></script>
-<form method=post action=$form->{script}>
-
-
-<table width=100%>
- <tr>
- <th class=listtop colspan=9>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>|;
- map { print "$column_header{$_}\n" } @column_index;
-
- print qq|
- </tr>
-|;
+
+ if (!$form->{callback}) {
+ $form->{callback} = build_std_url("action=show_dunning", @filter_field_list);
+ }
+
+ $form->get_lists('printers' => 'printers',
+ 'languages' => 'languages');
+
+ $form->{type} = 'dunning';
+ $form->{PRINT_OPTIONS} = print_options({ 'inline' => 1,
+ 'no_queue' => 1,
+ 'no_postscript' => 1,
+ 'no_html' => 1,
+ 'no_opendocument' => 1, });
+ $form->{title} = $locale->text('Dunning overview');
+
+ my $report = SL::ReportGenerator->new(\%myconfig, $form);
+
+ $report->set_options('std_column_visibility' => 1,
+ 'title' => $form->{title});
+ $report->set_export_options('show_dunning', @filter_field_list);
+
+ $report->set_columns(
+ 'checkbox' => { 'text' => '', 'visible' => 'HTML' },
+ 'dunning_description' => { 'text' => $locale->text('Dunning Level') },
+ 'customername' => { 'text' => $locale->text('Customername') },
+ 'invnumber' => { 'text' => $locale->text('Invnumber') },
+ 'transdate' => { 'text' => $locale->text('Invdate') },
+ 'duedate' => { 'text' => $locale->text('Invoice Duedate') },
+ 'amount' => { 'text' => $locale->text('Amount') },
+ 'dunning_date' => { 'text' => $locale->text('Dunning Date') },
+ 'dunning_duedate' => { 'text' => $locale->text('Dunning Duedate') },
+ 'fee' => { 'text' => $locale->text('Total Fees') },
+ 'interest' => { 'text' => $locale->text('Interest') },
+ );
+
+ $report->set_column_order(qw(checkbox dunning_description customername invnumber transdate
+ duedate amount dunning_date dunning_duedate fee interest));
+
+ my $edit_url = build_std_url('script=is.pl', 'action=edit', 'callback') . '&id=';
+ my $print_url = build_std_url('action=print_dunning', 'format=pdf', 'media=screen') . '&dunning_id=';
+
+ my %alignment = map { $_ => 'right' } qw(transdate duedate amount dunning_date dunning_duedate fee interest);
+
+ my ($current_dunning_rows, $previous_dunning_id, $first_row_for_dunning);
+
+ $current_dunning_rows = [];
+ $first_row_for_dunning = 1;
+ $form->{rowcount} = scalar @{ $form->{DUNNINGS} };
+
my $i = 0;
- foreach $ref (@{ $form->{DUNNINGS} }) {
+ foreach $ref (@{ $form->{DUNNINGS} }) {
$i++;
- my $j = $i % 2;
- print qq|
- <tr valign=top class=listrow$j>
-|;
+ if ($previous_dunning_id != $ref->{dunning_id}) {
+ $report->add_data($current_dunning_rows) if (scalar @{ $current_dunning_rows });
+ $current_dunning_rows = [];
+ $first_row_for_dunning = 1;
+ }
-
+ my $row = { };
+ foreach my $column (keys %{ $ref }) {
+ $row->{$column} = {
+ 'data' => $first_row_for_dunning || (($column ne 'dunning_description') && ($column ne 'customername')) ? $ref->{$column} : '',
- $dunning = qq|<select name=next_dunning_id_$i>$form->{selectdunning}</select>|;
+ 'align' => $alignment{$column},
+ 'link' => ($column eq 'invnumber' ? $edit_url . E($ref->{id}) :
+ $column eq 'dunning_description' ? $print_url . E($ref->{dunning_id}) : ''),
+ };
+ }
- $column_data{dunning_description} = qq|<td>$ref->{dunning_description}</td>|;
- my $active = "checked";
- $column_data{dunning_date} = qq|<td>$ref->{dunning_date}</td>|;
- $column_data{next_duedate} = qq|<td>$ref->{dunning_duedate}</td>|;
+ $row->{checkbox} = !$first_row_for_dunning ? { } : {
+ 'raw_data' => $cgi->hidden('-name' => "dunning_id_$i", '-value' => $ref->{dunning_id})
+ . $cgi->checkbox('-name' => "selected_$i", '-value' => 1, '-label' => ''),
+ 'valign' => 'center',
+ 'align' => 'center',
+ };
- $column_data{inv_duedate} = qq|<td>$ref->{duedate}</td>|;
- $column_data{invdate} = qq|<td>$ref->{transdate}</td>|;
- $column_data{invnumber} = qq|<td><a href=ar.pl?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$form->{callback}>$ref->{invnumber}</a></td>|;
- $column_data{customername} = qq|<td>$ref->{customername}</td>|;
- $column_data{invamount} = qq|<td>$ref->{amount}</td>|;
- $column_data{fee} = qq|<td>$ref->{fee}</td>|;
- $column_data{interest} = qq|<td>$ref->{interest}</td>|;
+ push @{ $current_dunning_rows }, $row;
+ $previous_dunning_id = $ref->{dunning_id};
+ $first_row_for_dunning = 0;
+ }
+ $report->add_data($current_dunning_rows) if (scalar @{ $current_dunning_rows });
- map { print "$column_data{$_}\n" } @column_index;
+ $report->set_options('raw_top_info_text' => $form->parse_html_template('dunning/show_dunning_top'),
+ 'raw_bottom_info_text' => $form->parse_html_template('dunning/show_dunning_bottom'),
+ 'output_format' => 'HTML',
+ 'attachment_basename' => $locale->text('dunning_list') . strftime('_%Y%m%d', localtime time),
+ );
- print qq|
- </tr>
-|;
- }
+ $report->set_options_from_form();
- $form->{rowcount} = $i;
+ $report->generate_with_headers();
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
+ $lxdebug->leave_sub();
-<br>
-<form method=post action=$form->{script}>
+}
-<input name=callback type=hidden value="$form->{callback}">
-<input name=rowcount type=hidden value="$form->{rowcount}">
-<input name=nextsub type=hidden value="$form->{nextsub}">
+sub print_dunning {
+ $lxdebug->enter_sub();
+ $form->{rowcount} = 1;
+ $form->{selected_1} = 1;
+ $form->{dunning_id_1} = $form->{dunning_id};
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>
-|;
+ print_multiple();
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
+ $lxdebug->leave_sub();
+}
+
+sub print_multiple {
+ $lxdebug->enter_sub();
+
+ $form->{title} = $locale->text('Print dunnings');
+
+ my @dunning_ids = map { $form->{"dunning_id_$_"} } grep { $form->{"selected_$_"} } (1..$form->{rowcount});
+
+ if (!scalar @dunning_ids) {
+ $form->error($locale->text('No dunnings have been selected for printing.'));
}
- print qq|
+ $form->{DUNNING_PDFS} = [];
+
+ foreach my $dunning_id (@dunning_ids) {
+ DN->print_invoice_for_fees(\%myconfig, $form, $dunning_id);
+ DN->print_dunning(\%myconfig, $form, $dunning_id);
+ }
- </form>
+ if (scalar @{ $form->{DUNNING_PDFS} }) {
+ $form->{dunning_id} = strftime("%Y%m%d", localtime time);
+ DN->melt_pdfs(\%myconfig, $form, $form->{copies});
- </body>
- </html>
-|;
+ if ($form->{media} eq 'printer') {
+ $form->header();
+ $form->info($locale->text('The dunnings have been printed.'));
+ }
+ } else {
+ $form->redirect($locale->text('Could not print dunning.'));
+ }
$lxdebug->leave_sub();
-
}
-# end of main
+# end of main
--- /dev/null
+#======================================================================
+# LX-Office ERP
+#
+#======================================================================
+#
+# Saving and loading drafts
+#
+#======================================================================
+
+use YAML;
+
+use SL::Drafts;
+
+require "bin/mozilla/common.pl";
+
+sub save_draft {
+ $lxdebug->enter_sub();
+
+ if (!$form->{draft_id} && !$form->{draft_description}) {
+ restore_form($form->{SAVED_FORM}, 1) if ($form->{SAVED_FORM});
+ delete $form->{SAVED_FORM};
+
+ $form->{SAVED_FORM} = save_form();
+ $form->{remove_draft} = 1;
+
+ $form->header();
+ print($form->parse_html_template("drafts/save_new"));
+
+ return $lxdebug->leave_sub();
+ }
+
+ my ($draft_id, $draft_description) = ($form->{draft_id}, $form->{draft_description});
+
+ restore_form($form->{SAVED_FORM}, 1);
+ delete $form->{SAVED_FORM};
+
+ Drafts->save(\%myconfig, $form, $draft_id, $draft_description);
+
+ $form->{saved_message} = $locale->text("Draft saved.");
+
+ update();
+
+ $lxdebug->leave_sub();
+}
+
+sub remove_draft {
+ $lxdebug->enter_sub();
+
+ Drafts->remove(\%myconfig, $form, $form->{draft_id}) if ($form->{draft_id});
+
+ delete @{$form}{qw(draft_id draft_description)};
+
+ $lxdebug->leave_sub();
+}
+
+sub load_draft_maybe {
+ $lxdebug->enter_sub();
+
+ $lxdebug->leave_sub() and return 0 if ($form->{DONT_LOAD_DRAFT});
+
+ my ($draft_nextsub) = @_;
+
+ my @drafts = Drafts->list(\%myconfig, $form);
+
+ $lxdebug->leave_sub() and return 0 unless (@drafts);
+
+ $draft_nextsub = "add" unless ($draft_nextsub);
+
+ delete $form->{action};
+ my $saved_form = save_form();
+
+ $form->header();
+ print($form->parse_html_template("drafts/load",
+ { "DRAFTS" => \@drafts,
+ "SAVED_FORM" => $saved_form,
+ "draft_nextsub" => $draft_nextsub }));
+
+ $lxdebug->leave_sub();
+
+ return 1;
+}
+
+sub dont_load_draft {
+ $lxdebug->enter_sub();
+
+ my $draft_nextsub = $form->{draft_nextsub} || "add";
+
+ restore_form($form->{SAVED_FORM}, 1);
+ delete $form->{SAVED_FORM};
+
+ $form->{DONT_LOAD_DRAFT} = 1;
+
+ call_sub($draft_nextsub);
+
+ $lxdebug->leave_sub();
+}
+
+sub load_draft {
+ $lxdebug->enter_sub();
+
+ my ($old_form, $id, $description) = Drafts->load(\%myconfig, $form, $form->{id});
+
+ if ($old_form) {
+ $old_form = YAML::Load($old_form);
+
+ @{$form}{keys %{ $old_form } } = @{$old_form}{keys %{ $old_form } };
+
+ $form->{draft_id} = $id;
+ $form->{draft_description} = $description;
+ $form->{remove_draft} = 'checked';
+ }
+
+ update();
+
+ $lxdebug->leave_sub();
+}
+
+sub delete_drafts {
+ $lxdebug->enter_sub();
+
+ my @ids;
+ foreach (keys %{$form}) {
+ push @ids, $1 if (/^checked_(.*)/ && $form->{$_});
+ }
+ Drafts->remove(\%myconfig, $form, @ids) if (@ids);
+
+ restore_form($form->{SAVED_FORM}, 1);
+ delete $form->{SAVED_FORM};
+
+ add();
+
+ $lxdebug->leave_sub();
+}
+
+sub draft_action_dispatcher {
+ $lxdebug->enter_sub();
+
+ if ($form->{draft_action} eq $locale->text("Skip")) {
+ dont_load_draft();
+
+ } elsif ($form->{draft_action} eq $locale->text("Delete drafts")) {
+ delete_drafts();
+ }
+
+ $lxdebug->leave_sub();
+}
+
+1;
#
#======================================================================
+use POSIX qw(strftime);
+
use SL::GL;
+use SL::IS;
use SL::PE;
+use SL::ReportGenerator;
-require "$form->{path}/arap.pl";
+require "bin/mozilla/arap.pl";
+require "bin/mozilla/common.pl";
+require "bin/mozilla/reportgenerator.pl";
1;
$form->{title} = "Add";
$form->{callback} =
- "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=add&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
# we use this only to set a default date
GL->transaction(\%myconfig, \%$form);
- map {
- $chart .=
- "<option value=\"$_->{accno}--$_->{tax_id}\">$_->{accno}--$_->{description}</option>"
- } @{ $form->{chart} };
map {
$tax .=
qq|<option value="$_->{id}--$_->{rate}">$_->{taxdescription} |
. ($_->{rate} * 100) . qq| %|
} @{ $form->{TAX} };
- $form->{chart} = $chart;
- $form->{chartinit} = $chart;
$form->{rowcount} = 2;
- $form->{debitchart} = $chart;
- $form->{creditchart} = $chart;
- $form->{taxchart} = $tax;
-
$form->{debit} = 0;
$form->{credit} = 0;
$form->{tax} = 0;
} (@{ $form->{all_departments} });
}
+ $form->{show_details} = $myconfig{show_form_details} unless defined $form->{show_details};
+
&display_form(1);
$lxdebug->leave_sub();
}
-sub edit {
+sub prepare_transaction {
$lxdebug->enter_sub();
GL->transaction(\%myconfig, \%$form);
- map {
- $chart .=
- "<option value=\"$_->{accno}--$_->{tax_id}\">$_->{accno}--$_->{description}</option>"
- } @{ $form->{chart} };
map {
$tax .=
. ($_->{rate} * 100) . qq| %|
} @{ $form->{TAX} };
- $form->{chart} = $chart;
-
- $form->{taxchart} = $tax;
-
$form->{amount} = $form->format_amount(\%myconfig, $form->{amount}, 2);
# departments
my $tax = 0;
my $taxaccno = "";
foreach $ref (@{ $form->{GL} }) {
- $form->{"projectnumber_$i"} = "$ref->{projectnumber}--$ref->{project_id}";
-
$j = $i - 1;
if ($tax && ($ref->{accno} eq $taxaccno)) {
$form->{"tax_$j"} = abs($ref->{amount});
$form->{"credit_$j"} += $form->{"tax_$j"};
}
}
+ $form->{"project_id_$j"} = $ref->{project_id};
+
} else {
$form->{"accno_$i"} = "$ref->{accno}--$ref->{tax_id}";
for (qw(fx_transaction source memo)) { $form->{"${_}_$i"} = $ref->{$_} }
$form->{"credit_$i"} = $ref->{amount};
}
$form->{"taxchart_$i"} = "0--0.00";
+ $form->{"project_id_$i"} = $ref->{project_id};
$i++;
}
if ($ref->{taxaccno} && !$tax) {
$taxaccno = "";
$tax = 0;
}
-
}
$form->{rowcount} = $i;
($form->datetonum($form->{transdate}, \%myconfig) <=
$form->datetonum($form->{closedto}, \%myconfig));
+ $lxdebug->leave_sub();
+}
+
+sub edit {
+ $lxdebug->enter_sub();
+
+ prepare_transaction();
+
$form->{title} = "Edit";
- &form_header;
- &display_rows;
- &form_footer;
- $lxdebug->leave_sub();
+ $form->{show_details} = $myconfig{show_form_details} unless defined $form->{show_details};
+
+ form_header();
+ display_rows();
+ form_footer();
+ $lxdebug->leave_sub();
}
+
sub search {
$lxdebug->enter_sub();
- $form->{title} = $locale->text('Buchungsjournal');
+ $form->{title} = $locale->text('Journal');
$form->all_departments(\%myconfig);
</tr>
| if $form->{selectdepartment};
+ $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
+ "all" => 1 });
+
+ my %project_labels = ();
+ my @project_values = ("");
+ foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
+ push(@project_values, $item->{"id"});
+ $project_labels{$item->{"id"}} = $item->{"projectnumber"};
+ }
+
+ my $projectnumber =
+ NTI($cgi->popup_menu('-name' => "project_id",
+ '-values' => \@project_values,
+ '-labels' => \%project_labels));
+
# use JavaScript Calendar or not
- $form->{jsscript} = $jscalendar;
+ $form->{jsscript} = 1;
$jsscript = "";
if ($form->{jsscript}) {
# with JavaScript Calendar
$button1 = qq|
- <td><input name=datefrom id=datefrom size=11 title="$myconfig{dateformat}">
+ <td><input name=datefrom id=datefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
<input type=button name=datefrom id="trigger1" value=|
. $locale->text('button') . qq|></td>
|;
$button2 = qq|
- <td><input name=dateto id=dateto size=11 title="$myconfig{dateformat}">
+ <td><input name=dateto id=dateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
<input type=button name=dateto id="trigger2" value=|
. $locale->text('button') . qq|></td>
|;
# without JavaScript Calendar
$button1 =
- qq|<td><input name=datefrom id=datefrom size=11 title="$myconfig{dateformat}"></td>|;
+ qq|<td><input name=datefrom id=datefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|;
$button2 =
- qq|<td><input name=dateto id=dateto size=11 title="$myconfig{dateformat}"></td>|;
+ qq|<td><input name=dateto id=dateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|;
}
-
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
$form->header;
-
+ $onload = qq|focus()|;
+ $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
+ $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
print qq|
-<body>
+<body onLoad="$onload">
<form method=post action=$form->{script}>
<th align=right>| . $locale->text('Notes') . qq|</th>
<td colspan=3><input name=notes size=40></td>
</tr>
+ <tr>
+ <th align=right>| . $locale->text('Project Number') . qq|</th>
+ <td colspan=3>$projectnumber</td>
+ </tr>
<tr>
<th align=right>| . $locale->text('From') . qq|</th>
$button1
<td>| . $locale->text('Source') . qq|</td>
<td align=right><input name="l_accno" class=checkbox type=checkbox value=Y checked></td>
<td>| . $locale->text('Account') . qq|</td>
- <td align=right><input name="l_gifi_accno" class=checkbox type=checkbox value=Y></td>
- <td>| . $locale->text('GIFI') . qq|</td>
</tr>
<tr>
<td align=right><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
<td>| . $locale->text('Subtotal') . qq|</td>
+ <td align=right><input name="l_projectnumbers" class=checkbox type=checkbox value=Y></td>
+ <td>| . $locale->text('Project Number') . qq|</td>
</tr>
</table>
</tr>
<input type=hidden name=nextsub value=generate_report>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
$lxdebug->leave_sub();
}
-sub generate_report {
+sub create_subtotal_row {
$lxdebug->enter_sub();
- $form->{sort} = "transdate" unless $form->{sort};
+ my ($totals, $columns, $column_alignment, $subtotal_columns, $class) = @_;
- GL->all_transactions(\%myconfig, \%$form);
+ my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => $column_alignment->{$_}, } } @{ $columns } };
+
+ map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, 2) } @{ $subtotal_columns };
+
+ map { $totals->{$_} = 0 } @{ $subtotal_columns };
- $callback =
- "$form->{script}?action=generate_report&path=$form->{path}&login=$form->{login}&password=$form->{password}";
+ $lxdebug->leave_sub();
- $href = $callback;
+ return $row;
+}
- %acctype = ('A' => $locale->text('Asset'),
- 'C' => $locale->text('Contra'),
- 'L' => $locale->text('Liability'),
- 'Q' => $locale->text('Equity'),
- 'I' => $locale->text('Revenue'),
- 'E' => $locale->text('Expense'),);
+sub generate_report {
+ $lxdebug->enter_sub();
- $form->{title} = $locale->text('General Ledger');
+ $form->{sort} ||= "transdate";
- $ml = ($form->{ml} =~ /(A|E|Q)/) ? -1 : 1;
+ GL->all_transactions(\%myconfig, \%$form);
- unless ($form->{category} eq 'X') {
+ my %acctype = ('A' => $locale->text('Asset'),
+ 'C' => $locale->text('Contra'),
+ 'L' => $locale->text('Liability'),
+ 'Q' => $locale->text('Equity'),
+ 'I' => $locale->text('Revenue'),
+ 'E' => $locale->text('Expense'),);
+
+ $form->{title} = $locale->text('Journal');
+ if ($form->{category} ne 'X') {
$form->{title} .= " : " . $locale->text($acctype{ $form->{category} });
}
+
+ $form->{landscape} = 1;
+
+ my $ml = ($form->{ml} =~ /(A|E|Q)/) ? -1 : 1;
+
+ my @columns = qw(
+ transdate id reference description
+ notes source debit debit_accno
+ credit credit_accno debit_tax debit_tax_accno
+ credit_tax credit_tax_accno projectnumbers balance
+ );
+
+ my @hidden_variables = qw(accno source reference department description notes project_id datefrom dateto category l_subtotal);
+ push @hidden_variables, map { "l_${_}" } @columns;
+
+ my (@options, $date_option);
if ($form->{accno}) {
- $href .= "&accno=" . $form->escape($form->{accno});
- $callback .= "&accno=" . $form->escape($form->{accno}, 1);
- $option =
- $locale->text('Account')
- . " : $form->{accno} $form->{account_description}";
- }
- if ($form->{gifi_accno}) {
- $href .= "&gifi_accno=" . $form->escape($form->{gifi_accno});
- $callback .= "&gifi_accno=" . $form->escape($form->{gifi_accno}, 1);
- $option .= "\n<br>" if $option;
- $option .=
- $locale->text('GIFI')
- . " : $form->{gifi_accno} $form->{gifi_account_description}";
+ push @options, $locale->text('Account') . " : $form->{accno} $form->{account_description}";
}
if ($form->{source}) {
- $href .= "&source=" . $form->escape($form->{source});
- $callback .= "&source=" . $form->escape($form->{source}, 1);
- $option .= "\n<br>" if $option;
- $option .= $locale->text('Source') . " : $form->{source}";
+ push @options, $locale->text('Source') . " : $form->{source}";
}
if ($form->{reference}) {
- $href .= "&reference=" . $form->escape($form->{reference});
- $callback .= "&reference=" . $form->escape($form->{reference}, 1);
- $option .= "\n<br>" if $option;
- $option .= $locale->text('Reference') . " : $form->{reference}";
+ push @options, $locale->text('Reference') . " : $form->{reference}";
}
if ($form->{department}) {
- $href .= "&department=" . $form->escape($form->{department});
- $callback .= "&department=" . $form->escape($form->{department}, 1);
- ($department) = split /--/, $form->{department};
- $option .= "\n<br>" if $option;
- $option .= $locale->text('Department') . " : $department";
+ my ($department) = split /--/, $form->{department};
+ push @options, $locale->text('Department') . " : $department";
}
-
if ($form->{description}) {
- $href .= "&description=" . $form->escape($form->{description});
- $callback .= "&description=" . $form->escape($form->{description}, 1);
- $option .= "\n<br>" if $option;
- $option .= $locale->text('Description') . " : $form->{description}";
+ push @options, $locale->text('Description') . " : $form->{description}";
}
if ($form->{notes}) {
- $href .= "¬es=" . $form->escape($form->{notes});
- $callback .= "¬es=" . $form->escape($form->{notes}, 1);
- $option .= "\n<br>" if $option;
- $option .= $locale->text('Notes') . " : $form->{notes}";
+ push @options, $locale->text('Notes') . " : $form->{notes}";
}
-
if ($form->{datefrom}) {
- $href .= "&datefrom=$form->{datefrom}";
- $callback .= "&datefrom=$form->{datefrom}";
- $option .= "\n<br>" if $option;
- $option .=
- $locale->text('From') . " "
- . $locale->date(\%myconfig, $form->{datefrom}, 1);
+ $date_option = $locale->text('From') . " " . $locale->date(\%myconfig, $form->{datefrom}, 1);
}
if ($form->{dateto}) {
- $href .= "&dateto=$form->{dateto}";
- $callback .= "&dateto=$form->{dateto}";
if ($form->{datefrom}) {
- $option .= " ";
- } else {
- $option .= "\n<br>" if $option;
+ $date_option .= " ";
}
- $option .=
- $locale->text('Bis') . " "
- . $locale->date(\%myconfig, $form->{dateto}, 1);
+ $date_option .= $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{dateto}, 1);
}
-
- @columns = $form->sort_columns(
- qw(transdate id reference description notes source debit debit_accno credit credit_accno debit_tax debit_tax_accno credit_tax credit_tax_accno accno gifi_accno)
+ push @options, $date_option if $date_option;
+
+ my $callback = build_std_url('action=generate_report', @hidden_variables);
+
+ $form->{l_credit_accno} = 'Y';
+ $form->{l_debit_accno} = 'Y';
+ $form->{l_credit_tax} = 'Y';
+ $form->{l_debit_tax} = 'Y';
+ $form->{l_credit_tax_accno} = 'Y';
+ $form->{l_debit_tax_accno} = 'Y';
+ $form->{l_balance} = $form->{accno} ? 'Y' : '';
+
+ my %column_defs = (
+ 'id' => { 'text' => $locale->text('ID'), },
+ 'transdate' => { 'text' => $locale->text('Date'), },
+ 'reference' => { 'text' => $locale->text('Reference'), },
+ 'source' => { 'text' => $locale->text('Source'), },
+ 'description' => { 'text' => $locale->text('Description'), },
+ 'notes' => { 'text' => $locale->text('Notes'), },
+ 'debit' => { 'text' => $locale->text('Debit'), },
+ 'debit_accno' => { 'text' => $locale->text('Debit Account'), },
+ 'credit' => { 'text' => $locale->text('Credit'), },
+ 'credit_accno' => { 'text' => $locale->text('Credit Account'), },
+ 'debit_tax' => { 'text' => $locale->text('Debit Tax'), },
+ 'debit_tax_accno' => { 'text' => $locale->text('Debit Tax Account'), },
+ 'credit_tax' => { 'text' => $locale->text('Credit Tax'), },
+ 'credit_tax_accno' => { 'text' => $locale->text('Credit Tax Account'), },
+ 'balance' => { 'text' => $locale->text('Balance'), },
+ 'projectnumbers' => { 'text' => $locale->text('Project Numbers'), },
);
- if ($form->{accno} || $form->{gifi_accno}) {
- @columns = grep !/(accno|gifi_accno)/, @columns;
- push @columns, "balance";
- $form->{l_balance} = "Y";
-
- }
-
- $form->{l_credit_accno} = "Y";
- $form->{l_debit_accno} = "Y";
- $form->{l_credit_tax} = "Y";
- $form->{l_debit_tax} = "Y";
- $form->{l_credit_tax_accno} = "Y";
- $form->{l_debit_tax_accno} = "Y";
- $form->{l_accno} = "N";
- foreach $item (@columns) {
- if ($form->{"l_$item"} eq "Y") {
- push @column_index, $item;
-
- # add column to href and callback
- $callback .= "&l_$item=Y";
- $href .= "&l_$item=Y";
- }
- }
-
- if ($form->{l_subtotal} eq 'Y') {
- $callback .= "&l_subtotal=Y";
- $href .= "&l_subtotal=Y";
- }
-
- $callback .= "&category=$form->{category}";
- $href .= "&category=$form->{category}";
-
- $column_header{id} =
- "<th><a class=listheading href=$href&sort=id>"
- . $locale->text('ID')
- . "</a></th>";
- $column_header{transdate} =
- "<th><a class=listheading href=$href&sort=transdate>"
- . $locale->text('Date')
- . "</a></th>";
- $column_header{reference} =
- "<th><a class=listheading href=$href&sort=reference>"
- . $locale->text('Reference')
- . "</a></th>";
- $column_header{source} =
- "<th><a class=listheading href=$href&sort=source>"
- . $locale->text('Source')
- . "</a></th>";
- $column_header{description} =
- "<th><a class=listheading href=$href&sort=description>"
- . $locale->text('Description')
- . "</a></th>";
- $column_header{notes} =
- "<th class=listheading>" . $locale->text('Notes') . "</th>";
- $column_header{debit} =
- "<th class=listheading>" . $locale->text('Debit') . "</th>";
- $column_header{debit_accno} =
- "<th><a class=listheading href=$href&sort=accno>"
- . $locale->text('Debit Account')
- . "</a></th>";
- $column_header{credit} =
- "<th class=listheading>" . $locale->text('Credit') . "</th>";
- $column_header{credit_accno} =
- "<th><a class=listheading href=$href&sort=accno>"
- . $locale->text('Credit Account')
- . "</a></th>";
- $column_header{debit_tax} =
- "<th><a class=listheading href=$href&sort=accno>"
- . $locale->text('Debit Tax')
- . "</a></th>";
- $column_header{debit_tax_accno} =
- "<th><a class=listheading href=$href&sort=accno>"
- . $locale->text('Debit Tax Account')
- . "</a></th>";
- $column_header{credit_tax} =
- "<th><a class=listheading href=$href&sort=accno>"
- . $locale->text('Credit Tax')
- . "</a></th>";
- $column_header{credit_tax_accno} =
- "<th><a class=listheading href=$href&sort=accno>"
- . $locale->text('Credit Tax Account')
- . "</a></th>";
- $column_header{gifi_accno} =
- "<th><a class=listheading href=$href&sort=gifi_accno>"
- . $locale->text('GIFI')
- . "</a></th>";
- $column_header{balance} = "<th>" . $locale->text('Balance') . "</th>";
+ map { $column_defs{$_}->{link} = $callback . "&sort=${_}" } qw(id transdate reference source description);
+ map { $column_defs{$_}->{link} = $callback . "&sort=accno" } qw(debit_accno credit_accno debit_tax_accno credit_tax_accno debit_tax credit_tax);
+ map { $column_defs{$_}->{visible} = $form->{"l_${_}"} ? 1 : 0 } @columns;
+ map { $column_defs{$_}->{visible} = 0 } qw(debit_accno credit_accno debit_tax_accno credit_tax_accno) if $form->{accno};
- $form->{landscape} = 1;
+ my %column_alignment;
+ map { $column_alignment{$_} = 'right' } qw(balance id debit credit debit_tax credit_tax);
+ map { $column_alignment{$_} = 'center' } qw(transdate reference description source notes debit_accno credit_accno debit_tax_accno credit_tax_accno);
- $form->header;
+ my $report = SL::ReportGenerator->new(\%myconfig, $form);
- print qq|
-<body>
+ $report->set_columns(%column_defs);
+ $report->set_column_order(@columns);
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>$option</td>
- </tr>
- <tr>
- <td>
- <table width=100%>
- <thead>
- <tr class=listheading>
-|;
+ $report->set_export_options('generate_report', @hidden_variables);
- map { print "$column_header{$_}\n" } @column_index;
+ $report->set_sort_indicator($form->{sort}, 1);
- print "
- </tr>
- </thead>
- </tfoot>
- <tbody>
-";
+ $report->set_options('top_info_text' => join("\n", @options),
+ 'output_format' => 'HTML',
+ 'title' => $form->{title},
+ 'attachment_basename' => $locale->text('general_ledger_list') . strftime('_%Y%m%d', localtime time),
+ );
+ $report->set_options_from_form();
# add sort to callback
- $form->{callback} = "$callback&sort=$form->{sort}";
- $callback = $form->escape($form->{callback});
+ $form->{callback} = "$callback&sort=" . E($form->{sort});
- # initial item for subtotals
- if (@{ $form->{GL} }) {
- $sameitem = $form->{GL}->[0]->{ $form->{sort} };
- }
+ $form->{balance} *= $ml;
- if (($form->{accno} || $form->{gifi_accno}) && $form->{balance}) {
+ if ($form->{accno} && $form->{balance}) {
+ my $row = {
+ 'balance' => {
+ 'data' => $form->format_amount(\%myconfig, $form->{balance}, 2),
+ 'align' => 'right',
+ },
+ };
- map { $column_data{$_} = "<td> </td>" } @column_index;
- $column_data{balance} =
- "<td align=right>"
- . $form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)
- . "</td>";
+ $report->add_data($row);
+ }
- $i++;
- $i %= 2;
- print qq|
- <tr class=listrow$i>
-|;
- map { print "$column_data{$_}\n" } @column_index;
+ my @totals_columns = qw(debit credit debit_tax credit_tax);
+ my %subtotals = map { $_ => 0 } @totals_columns;
+ my %totals = map { $_ => 0 } @totals_columns;
+ my $idx = 0;
- print qq|
- </tr>
-|;
- }
- $form->{balance} *= $ml;
foreach $ref (@{ $form->{GL} }) {
$form->{balance} *= $ml;
- # if item ne sort print subtotal
- if ($form->{l_subtotal} eq 'Y') {
- if ($sameitem ne $ref->{ $form->{sort} }) {
- &gl_subtotal;
- }
- }
+ my %rows;
- #foreach $key (sort keys(%{ $ref->{amount} })) {
- # $form->{balance} += $ref->{amount}{$key};
- #}
-
- $debit = "";
- foreach $key (sort keys(%{ $ref->{debit} })) {
- $subtotaldebit += $ref->{debit}{$key};
- $totaldebit += $ref->{debit}{$key};
- if ($key == 0) {
- $debit = $form->format_amount(\%myconfig, $ref->{debit}{$key}, 2, 0);
- } else {
- $debit .=
- "<br>" . $form->format_amount(\%myconfig, $ref->{debit}{$key}, 2, 0);
+ foreach my $key (qw(debit credit debit_tax credit_tax)) {
+ $rows{$key} = [];
+ foreach my $idx (sort keys(%{ $ref->{$key} })) {
+ my $value = $ref->{$key}->{$idx};
+ $subtotals{$key} += $value;
+ $totals{$key} += $value;
+ $form->{balance} = abs($form->{balance}) - abs($value);
+ push @{ $rows{$key} }, $form->format_amount(\%myconfig, $value, 2);
}
- $form->{balance} = abs($form->{balance}) - abs($ref->{debit}{$key});
}
- $credit = "";
- foreach $key (sort keys(%{ $ref->{credit} })) {
- $subtotalcredit += $ref->{credit}{$key};
- $totalcredit += $ref->{credit}{$key};
- if ($key == 0) {
- $credit = $form->format_amount(\%myconfig, $ref->{credit}{$key}, 2, 0);
- } else {
- $credit .= "<br>"
- . $form->format_amount(\%myconfig, $ref->{credit}{$key}, 2, 0);
- }
- $form->{balance} = abs($form->{balance}) - abs($ref->{credit}{$key});
+ foreach my $key (qw(debit_accno credit_accno debit_tax_accno credit_tax_accno ac_transdate)) {
+ my $col = $key eq 'ac_transdate' ? 'transdate' : $key;
+ $rows{$col} = [ map { $ref->{$key}->{$_} } sort keys(%{ $ref->{$key} }) ];
}
- $debittax = "";
- foreach $key (sort keys(%{ $ref->{debit_tax} })) {
- $subtotaldebittax += $ref->{debit_tax}{$key};
- $totaldebittax += $ref->{debit_tax}{$key};
- if ($key == 0) {
- $debittax =
- $form->format_amount(\%myconfig, $ref->{debit_tax}{$key}, 2, 0);
- } else {
- $debittax .= "<br>"
- . $form->format_amount(\%myconfig, $ref->{debit_tax}{$key}, 2, 0);
- }
- $form->{balance} = abs($form->{balance}) - abs($ref->{debit_tax}{$key});
- }
+ my $row = { };
+ map { $row->{$_} = { 'data' => '', 'align' => $column_alignment{$_} } } @columns;
- $credittax = "";
- foreach $key (sort keys(%{ $ref->{credit_tax} })) {
- $subtotalcredittax += $ref->{credit_tax}{$key};
- $totalcredittax += $ref->{credit_tax}{$key};
- if ($key == 0) {
- $credittax =
- $form->format_amount(\%myconfig, $ref->{credit_tax}{$key}, 2, 0);
- } else {
- $credittax .= "<br>"
- . $form->format_amount(\%myconfig, $ref->{credit_tax}{$key}, 2, 0);
- }
- $form->{balance} = abs($form->{balance}) - abs($ref->{credit_tax}{$key});
- }
+ $row->{balance}->{data} = $form->format_amount(\%myconfig, $form->{balance}, 2);
+ $row->{projectnumbers}->{data} = join ", ", sort { lc($a) cmp lc($b) } keys %{ $ref->{projectnumbers} };
- $debitaccno = "";
- $debittaxkey = "";
- $taxaccno = "";
- foreach $key (sort keys(%{ $ref->{debit_accno} })) {
- if ($key == 0) {
- $debitaccno =
- "<a href=$href&accno=$ref->{debit_accno}{$key}&callback=$callback>$ref->{debit_accno}{$key}</a>";
- } else {
- $debitaccno .=
- "<br><a href=$href&accno=$ref->{debit_accno}{$key}&callback=$callback>$ref->{debit_accno}{$key}</a>";
- }
+ map { $row->{$_}->{data} = $ref->{$_} } qw(id reference description source notes);
+
+ map { $row->{$_}->{data} = \@{ $rows{$_} }; } qw(transdate debit credit debit_accno credit_accno debit_tax_accno credit_tax_accno);
- # if ($ref->{debit_taxkey}{$key} eq $debittaxkey) {
- # $ref->{debit_tax_accno}{$key} = $taxaccno;
- # }
- $taxaccno = $ref->{debit_tax_accno}{$key};
- $debittaxkey = $ref->{debit_taxkey}{$key};
+ foreach my $col (qw(debit_accno credit_accno debit_tax_accno credit_tax_accno)) {
+ $row->{$col}->{link} = [ map { "${callback}&accno=" . E($_) } @{ $rows{$col} } ];
}
- $creditaccno = "";
- $credittaxkey = "";
- $taxaccno = "";
- foreach $key (sort keys(%{ $ref->{credit_accno} })) {
- if ($key == 0) {
- $creditaccno =
- "<a href=$href&accno=$ref->{credit_accno}{$key}&callback=$callback>$ref->{credit_accno}{$key}</a>";
- } else {
- $creditaccno .=
- "<br><a href=$href&accno=$ref->{credit_accno}{$key}&callback=$callback>$ref->{credit_accno}{$key}</a>";
- }
+ map { $row->{$_}->{data} = \@{ $rows{$_} } if ($ref->{"${_}_accno"} ne "") } qw(debit_tax credit_tax);
- # if ($ref->{credit_taxkey}{$key} eq $credittaxkey) {
- # $ref->{credit_tax_accno}{$key} = $taxaccno;
- # }
- $taxaccno = $ref->{credit_tax_accno}{$key};
- $credittaxkey = $ref->{credit_taxkey}{$key};
- }
+ $row->{reference}->{link} = build_std_url("script=$ref->{module}.pl", 'action=edit', 'id=' . E($ref->{id}), 'callback');
- $debittaxaccno = "";
- foreach $key (sort keys(%{ $ref->{debit_tax_accno} })) {
- if ($key == 0) {
- $debittaxaccno =
- "<a href=$href&accno=$ref->{debit_tax_accno}{$key}&callback=$callback>$ref->{debit_tax_accno}{$key}</a>";
- } else {
- $debittaxaccno .=
- "<br><a href=$href&accno=$ref->{debit_tax_accno}{$key}&callback=$callback>$ref->{debit_tax_accno}{$key}</a>";
- }
- }
+ my $row_set = [ $row ];
- $credittaxaccno = "";
- foreach $key (sort keys(%{ $ref->{credit_tax_accno} })) {
- if ($key == 0) {
- $credittaxaccno =
- "<a href=$href&accno=$ref->{credit_tax_accno}{$key}&callback=$callback>$ref->{credit_tax_accno}{$key}</a>";
- } else {
- $credittaxaccno .=
- "<br><a href=$href&accno=$ref->{credit_tax_accno}{$key}&callback=$callback>$ref->{credit_tax_accno}{$key}</a>";
- }
+ if (($form->{l_subtotal} eq 'Y')
+ && (($idx == (scalar @{ $form->{GL} } - 1))
+ || ($ref->{ $form->{sort} } ne $form->{GL}->[$idx + 1]->{ $form->{sort} }))) {
+ push @{ $row_set }, create_subtotal_row(\%subtotals, \@columns, \%column_alignment, [ qw(debit credit) ], 'listsubtotal');
}
- # $ref->{debit} = $form->format_amount(\%myconfig, $ref->{debit}, 2, " ");
- # $ref->{credit} = $form->format_amount(\%myconfig, $ref->{credit}, 2, " ");
-
- $column_data{id} = "<td align=right> $ref->{id} </td>";
- $column_data{transdate} =
- "<td align=center> $ref->{transdate} </td>";
- $column_data{reference} =
- "<td align=center><a href=$ref->{module}.pl?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{reference}</td>";
- $column_data{description} =
- "<td align=center>$ref->{description} </td>";
- $column_data{source} = "<td align=center>$ref->{source} </td>";
- $column_data{notes} = "<td align=center>$ref->{notes} </td>";
- $column_data{debit} = "<td align=right>$debit</td>";
- $column_data{debit_accno} = "<td align=center>$debitaccno</td>";
- $column_data{credit} = "<td align=right>$credit</td>";
- $column_data{credit_accno} = "<td align=center>$creditaccno</td>";
- $column_data{debit_tax} =
- ($ref->{debit_tax_accno} ne "")
- ? "<td align=right>$debittax</td>"
- : "<td></td>";
- $column_data{debit_tax_accno} = "<td align=center>$debittaxaccno</td>";
- $column_data{gifi_accno} =
- "<td><a href=$href&gifi_accno=$ref->{gifi_accno}&callback=$callback>$ref->{gifi_accno}</a> </td>";
- $column_data{credit_tax} =
- ($ref->{credit_tax_accno} ne "")
- ? "<td align=right>$credittax</td>"
- : "<td></td>";
- $column_data{credit_tax_accno} = "<td align=center>$credittaxaccno</td>";
- $column_data{gifi_accno} =
- "<td><a href=$href&gifi_accno=$ref->{gifi_accno}&callback=$callback>$ref->{gifi_accno}</a> </td>";
- $column_data{balance} =
- "<td align=right>"
- . $form->format_amount(\%myconfig, $form->{balance}, 2, 0) . "</td>";
-
- $i++;
- $i %= 2;
- print "
- <tr class=listrow$i>";
- map { print "$column_data{$_}\n" } @column_index;
- print "</tr>";
+ $report->add_data($row_set);
+ $idx++;
}
- &gl_subtotal if ($form->{l_subtotal} eq 'Y');
-
- map { $column_data{$_} = "<td> </td>" } @column_index;
-
- $column_data{debit} =
- "<th align=right class=listtotal>"
- . $form->format_amount(\%myconfig, $totaldebit, 2, " ") . "</th>";
- $column_data{credit} =
- "<th align=right class=listtotal>"
- . $form->format_amount(\%myconfig, $totalcredit, 2, " ") . "</th>";
- $column_data{debit_tax} =
- "<th align=right class=listtotal>"
- . $form->format_amount(\%myconfig, $totaldebittax, 2, " ") . "</th>";
- $column_data{credit_tax} =
- "<th align=right class=listtotal>"
- . $form->format_amount(\%myconfig, $totalcredittax, 2, " ") . "</th>";
- $column_data{balance} =
- "<th align=right class=listtotal>"
- . $form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0) . "</th>";
+ $report->add_separator();
- print qq|
- <tr class=listtotal>
-|;
+ # = 0 for balanced ledger
+ my $balanced_ledger = $totals{debit} + $totals{debit_tax} - $totals{credit} - $totals{credit_tax};
- map { print "$column_data{$_}\n" } @column_index;
-
- print qq|
- </tr>
- </tbody>
- </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=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>
+ my $row = create_subtotal_row(\%totals, \@columns, \%column_alignment, [ qw(debit credit debit_tax credit_tax) ], 'listtotal');
+ $row->{balance} = {
+ 'data' => $form->format_amount(\%myconfig, $form->{balance} * $ml, 2),
+ 'align' => 'right',
+ 'class' => 'listtotal',
+ };
+ $report->add_data($row);
-<input class=submit type=submit name=action value="|
- . $locale->text('GL Transaction') . qq|">
-<input class=submit type=submit name=action value="|
- . $locale->text('AR Transaction') . qq|">
-<input class=submit type=submit name=action value="|
- . $locale->text('AP Transaction') . qq|">
-<input class=submit type=submit name=action value="|
- . $locale->text('Sales Invoice') . qq|">
-<input class=submit type=submit name=action value="|
- . $locale->text('Vendor Invoice') . qq|">|;
+ my $raw_bottom_info_text;
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
+ if (!$form->{accno} && (abs($balanced_ledger) > 0.001)) {
+ $raw_bottom_info_text .=
+ '<p><span class="unbalanced_ledger">'
+ . $locale->text('Unbalanced Ledger')
+ . ': '
+ . $form->format_amount(\%myconfig, $balanced_ledger, 3)
+ . '</span></p> ';
}
- print qq|
-
-</form>
-
-</body>
-</html>
-|;
- $lxdebug->leave_sub();
-
-}
-
-sub gl_subtotal {
- $lxdebug->enter_sub();
+ $raw_bottom_info_text .= $form->parse_html_template('gl/generate_report_bottom');
- $subtotaldebit =
- $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
- $subtotalcredit =
- $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
+ $report->set_options('raw_bottom_info_text' => $raw_bottom_info_text);
- map { $column_data{$_} = "<td> </td>" }
- qw(transdate id reference source description accno);
- $column_data{debit} = "<th align=right>$subtotaldebit</td>";
- $column_data{credit} = "<th align=right>$subtotalcredit</td>";
+ $report->generate_with_headers();
- print "<tr class=listsubtotal>";
- map { print "$column_data{$_}\n" } @column_index;
- print "</tr>";
-
- $subtotaldebit = 0;
- $subtotalcredit = 0;
-
- $sameitem = $ref->{ $form->{sort} };
$lxdebug->leave_sub();
-
}
sub update {
$lxdebug->enter_sub();
- if ($form->{transdate} ne $form->{oldtransdate}) {
- if ($form->{selectprojectnumber}) {
- $form->all_projects(\%myconfig, undef, $form->{transdate});
- if (@{ $form->{all_project} }) {
- $form->{selectprojectnumber} = "<option>\n";
- for (@{ $form->{all_project} }) {
- $form->{selectprojectnumber} .=
- qq|<option value="$_->{projectnumber}--$_->{id}">$_->{projectnumber}\n|;
- }
- $form->{selectprojectnumber} =
- $form->escape($form->{selectprojectnumber}, 1);
- }
- }
- $form->{oldtransdate} = $form->{transdate};
- }
+ $form->{oldtransdate} = $form->{transdate};
my @a = ();
my $count = 0;
my ($init) = @_;
$lxdebug->enter_sub();
- $form->{selectprojectnumber} = $form->unescape($form->{selectprojectnumber})
- if $form->{selectprojectnumber};
-
+ $form->{debit_1} = 0 if !$form->{"debit_1"};
$form->{totaldebit} = 0;
$form->{totalcredit} = 0;
- my $chart = $form->{chart};
- $chart = $form->unquote($chart);
- $form->{taxchart} = $form->unquote($form->{taxchart});
- $taxchart = $form->{taxchart};
+
+ my @old_project_ids = ();
+ map({ push(@old_project_ids, $form->{"project_id_$_"})
+ if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
+
+ $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
+ "all" => 0,
+ "old_id" => \@old_project_ids },
+ "charts" => { "key" => "ALL_CHARTS",
+ "transdate" => $form->{transdate} },
+ "taxcharts" => "ALL_TAXCHARTS");
+
+ my %project_labels = ();
+ my @project_values = ("");
+ foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
+ push(@project_values, $item->{"id"});
+ $project_labels{$item->{"id"}} = $item->{"projectnumber"};
+ }
+
+ my %chart_labels = ();
+ my @chart_values = ();
+ my %charts = ();
+ my $taxchart_init;
+ foreach my $item (@{ $form->{ALL_CHARTS} }) {
+ my $key = Q($item->{accno}) . "--" . Q($item->{tax_id});
+ $taxchart_init = $item->{taxkey_id} unless (@chart_values);
+ push(@chart_values, $key);
+ $chart_labels{$key} = H($item->{accno}) . "--" . H($item->{description});
+ $charts{$item->{accno}} = $item;
+ }
+
+ my %taxchart_labels = ();
+ my @taxchart_values = ();
+ my %taxcharts = ();
+ foreach my $item (@{ $form->{ALL_TAXCHARTS} }) {
+ my $key = Q($item->{id}) . "--" . Q($item->{rate});
+ $taxchart_init = $key if ($taxchart_init eq $item->{taxkey});
+ push(@taxchart_values, $key);
+ $taxchart_labels{$key} = H($item->{taxdescription}) . " " .
+ H($item->{rate} * 100) . ' %';
+ $taxcharts{$item->{id}} = $item;
+ }
+
for $i (1 .. $form->{rowcount}) {
$source = qq|
- <td><input name="source_$i" value="$form->{"source_$i"}" size="16" tabindex=|
- . ($i + 11 + (($i - 1) * 8)) . qq|></td>|;
+ <td><input name="source_$i" value="$form->{"source_$i"}" size="16"></td>|;
$memo = qq|
- <td><input name="memo_$i" value="$form->{"memo_$i"}" size="16" tabindex=|
- . ($i + 12 + (($i - 1) * 8)) . qq|></td>|;
+ <td><input name="memo_$i" value="$form->{"memo_$i"}" size="16"></td>|;
+
+ my $selected_accno_full;
+ my ($accno_row) = split(/--/, $form->{"accno_$i"});
+ my $item = $charts{$accno_row};
+ $selected_accno_full = "$item->{accno}--$item->{tax_id}";
+
+ my $selected_taxchart = $form->{"taxchart_$i"};
+ my ($selected_accno, $selected_tax_id) = split(/--/, $selected_accno_full);
+ my ($previous_accno, $previous_tax_id) = split(/--/, $form->{"previous_accno_$i"});
+
+ if ($previous_accno &&
+ ($previous_accno eq $selected_accno) &&
+ ($previous_tax_id ne $selected_tax_id)) {
+ my $item = $taxcharts{$selected_tax_id};
+ $selected_taxchart = "$item->{id}--$item->{rate}";
+ }
+
+ $selected_accno = '' if ($init);
+ $selected_taxchart = $taxchart_init unless ($selected_taxchart ne "");
+
+ $accno = qq|<td>| .
+ NTI($cgi->popup_menu('-name' => "accno_$i",
+ '-id' => "accno_$i",
+ '-onChange' => "setTaxkey(this, $i)",
+ '-style' => 'width:200px',
+ '-values' => \@chart_values,
+ '-labels' => \%chart_labels,
+ '-default' => $selected_accno_full))
+ . $cgi->hidden('-name' => "previous_accno_$i",
+ '-default' => $selected_accno_full)
+ . qq|</td>|;
+ $tax = qq|<td>| .
+ NTI($cgi->popup_menu('-name' => "taxchart_$i",
+ '-id' => "taxchart_$i",
+ '-style' => 'width:200px',
+ '-values' => \@taxchart_values,
+ '-labels' => \%taxchart_labels,
+ '-default' => $selected_taxchart))
+ . qq|</td>|;
if ($init) {
- $accno = qq|
- <td><select name="accno_$i" onChange="setTaxkey(this, $i)" style="width:200px" tabindex=|
- . ($i + 5 + (($i - 1) * 8)) . qq|>$form->{chartinit}</select></td>|;
- $tax =
- qq|<td><select id="taxchart_$i" name="taxchart_$i" style="width:200px" tabindex=|
- . ($i + 10 + (($i - 1) * 8))
- . qq|>$form->{taxchart}</select></td>|;
-
- # if ($form->{selectprojectnumber}) {
- # $project = qq|
- # <td><select name="projectnumber_$i">$form->{selectprojectnumber}</select></td>|;
- # }
$korrektur =
- qq|<td><input type="checkbox" name="korrektur_$i" value="1" tabindex=|
- . ($i + 9 + (($i - 1) * 8))
- . qq|></td>|;
+ qq|<td><input type="checkbox" name="korrektur_$i" value="1"></td>|;
if ($form->{transfer}) {
$fx_transaction = qq|
<td><input name="fx_transaction_$i" class=checkbox type=checkbox value=1></td>
}
if ($i < $form->{rowcount}) {
-
- $accno = $chart;
- $chart_selected = $form->{"accno_$i"};
- $accno =~
- s/value=\"$chart_selected\"/value=\"$chart_selected\" selected/;
- $accno =
- qq|<td><select name="accno_$i" onChange="setTaxkey(this, $i)" style="width:200px" tabindex=|
- . ($i + 5 + (($i - 1) * 8))
- . qq|>$accno</select></td>|;
- $tax = $taxchart;
- $tax_selected = $form->{"taxchart_$i"};
- print(STDERR "TAX_SELCTED $tax_selected\n");
- $tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/;
- $tax =
- qq|<td><select id="taxchart_$i" name="taxchart_$i" tabindex=|
- . ($i + 10 + (($i - 1) * 8))
- . qq|>$tax</select></td>|;
-
- # if ($form->{selectprojectnumber}) {
- # $form->{"projectnumber_$i"} = ""
- # if $form->{selectprojectnumber} !~ /$form->{"projectnumber_$i"}/;
- #
- # $project = $form->{"projectnumber_$i"};
- # $project =~ s/--.*//;
- # $project = qq|<td>$project</td>|;
- # }
-
if ($form->{transfer}) {
$checked = ($form->{"fx_transaction_$i"}) ? "1" : "";
$x = ($checked) ? "x" : "";
}
$checked = ($form->{"korrektur_$i"}) ? "checked" : "";
$korrektur =
- qq|<td><input type="checkbox" name="korrektur_$i" value="1" $checked tabindex=|
- . ($i + 9 + (($i - 1) * 8))
- . qq|></td>|;
+ qq|<td><input type="checkbox" name="korrektur_$i" value="1" $checked></td>|;
$form->hide_form("accno_$i");
} else {
-
- $accno = qq|
- <td><select name="accno_$i" onChange="setTaxkey(this, $i)" style="width:300px" tabindex=|
- . ($i + 5 + (($i - 1) * 8)) . qq|>$chart</select></td>|;
- $tax = qq|
- <td><select id="taxchart_$i" name="taxchart_$i" tabindex=|
- . ($i + 10 + (($i - 1) * 8)) . qq|>$taxchart</select></td>|;
-
- # if ($form->{selectprojectnumber}) {
- # $project = qq|
- # <td><select name="projectnumber_$i">$form->{selectprojectnumber}</select></td>|;
- # }
$korrektur =
- qq|<td><input type="checkbox" name="korrektur_$i" value="1" tabindex=|
- . ($i + 9 + (($i - 1) * 8))
- . qq|></td>|;
+ qq|<td><input type="checkbox" name="korrektur_$i" value="1"></td>|;
if ($form->{transfer}) {
$fx_transaction = qq|
<td><input name="fx_transaction_$i" class=checkbox type=checkbox value=1></td>
}
}
+ my $projectnumber =
+ NTI($cgi->popup_menu('-name' => "project_id_$i",
+ '-values' => \@project_values,
+ '-labels' => \%project_labels,
+ '-default' => $form->{"project_id_$i"} ));
+
+ my $copy2credit = 'onkeyup="copy_debit_to_credit()"' if $i == 1;
+
print qq|<tr valign=top>
$accno
$fx_transaction
- <td><input name="debit_$i" size=8 value="$form->{"debit_$i"}" accesskey=$i tabindex=|
- . ($i + 6 + (($i - 1) * 8)) . qq| $debitreadonly></td>
- <td><input name="credit_$i" size=8 value="$form->{"credit_$i"}" tabindex=|
- . ($i + 7 + (($i - 1) * 8)) . qq| $creditreadonly></td>
- <td><input name="tax_$i" size=6 value="$form->{"tax_$i"}" tabindex=|
- . ($i + 8 + (($i - 1) * 8)) . qq|></td>
+ <td><input name="debit_$i" size="8" value="$form->{"debit_$i"}" accesskey=$i $copy2credit $debitreadonly></td>
+ <td><input name="credit_$i" size=8 value="$form->{"credit_$i"}" $creditreadonly></td>
+ <td><input name="tax_$i" size=6 value="$form->{"tax_$i"}"></td>
$korrektur
- $tax
+ $tax|;
+
+ if ($form->{show_details}) {
+ print qq|
$source
$memo
+ <td>$projectnumber</td>
+|;
+ }
+ print qq|
</tr>
-
- |;
+|;
}
$form->hide_form(qw(rowcount selectaccno));
- # print qq|
- # <input type=hidden name=selectprojectnumber value="|
- # . $form->escape($form->{selectprojectnumber}, 1) . qq|">|;
$lxdebug->leave_sub();
}
$form->{title} = $locale->text("$title General Ledger Transaction");
$readonly = ($form->{id}) ? "readonly" : "";
+ $show_details_checked = "checked" if $form->{show_details};
+
# $locale->text('Add General Ledger Transaction')
# $locale->text('Edit General Ledger Transaction')
map { $form->{$_} =~ s/\"/"/g }
qw(reference description chart taxchart);
+
$form->{javascript} = qq|<script type="text/javascript">
<!--
function setTaxkey(accno, row) {
}
}
};
+
+ function copy_debit_to_credit() {
+ var txt = document.getElementsByName('debit_1')[0].value;
+ document.getElementsByName('credit_2')[0].value = txt;
+ };
+
//-->
</script>|;
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/show_form_details.js"></script>|;
$form->{selectdepartment} =~ s/ selected//;
$form->{selectdepartment} =~
qq|<textarea name=description rows=$rows cols=50 wrap=soft $readonly >$form->{description}</textarea>|;
} else {
$description =
- qq|<input name=description size=50 value="$form->{description}" tabindex="3" $readonly>|;
+ qq|<input name=description size=50 value="$form->{description}" $readonly>|;
}
$taxincluded = ($form->{taxincluded}) ? "checked" : "";
}
# use JavaScript Calendar or not
- $form->{jsscript} = $jscalendar;
+ $form->{jsscript} = 1;
$jsscript = "";
if ($form->{jsscript}) {
# with JavaScript Calendar
$button1 = qq|
- <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" tabindex="2" $readonly>
+ <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" $readonly onBlur=\"check_right_date_format(this)\">
<input type=button name=transdate id="trigger1" value=|
. $locale->text('button') . qq|></td>
|;
# without JavaScript Calendar
$button1 =
- qq|<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" tabindex="2" $readonly></td>|;
+ qq|<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" $readonly onBlur=\"check_right_date_format(this)\"></td>|;
}
+ $form->{previous_id} ||= "--";
+ $form->{previous_gldate} ||= "--";
+
$form->header;
print qq|
<body onLoad="fokus()">
<form method=post name="gl" action=$form->{script}>
+|;
-<input name=id type=hidden value=$form->{id}>
+ $form->hide_form(qw(id closedto locked storno storno_id previous_id previous_gldate));
-<input type=hidden name=closedto value=$form->{closedto}>
-<input type=hidden name=locked value=$form->{locked}>
+ print qq|
<input type=hidden name=title value="$title">
-<input type=hidden name=taxchart value="$form->{taxchart}">
-<input type=hidden name=chart value="$form->{chart}">
<table width=100%>
<tr>
<td>
<table width=100%>
+ <tr>
+ <td colspan="6" align="left">|
+ . $locale->text("Previous transnumber text")
+ . " $form->{previous_id} "
+ . $locale->text("Previous transdate text")
+ . " $form->{previous_gldate}"
+ . qq|</td>
+ </tr>
<tr>
- <th align=left>| . $locale->text('Reference') . qq|</th>
- <td><input name=reference size=20 value="$form->{reference}" tabindex="1" $readonly></td>
+ <th align=right>| . $locale->text('Reference') . qq|</th>
+ <td><input name=reference size=20 value="$form->{reference}" $readonly></td>
<td align=left>
<table>
<tr>
<table>
<tr>
<th align=right width=50%>| . $locale->text('Buchungsdatum') . qq|</th>
- <td align=left><input name=gldate size=11 title="$myconfig{dateformat}" value=$form->{gldate} $readonly></td>
+ <td align=left><input name=gldate size=11 title="$myconfig{dateformat}" value=$form->{gldate} $readonly onBlur=\"check_right_date_format(this)\"></td>
</tr>
</table>
</td>
if ($form->{id}) {
print qq|
<tr>
- <th align=left width=1%>| . $locale->text('Description') . qq|</th>
+ <th align=right width=1%>| . $locale->text('Description') . qq|</th>
<td width=1%>$description</td>
<td>
<table>
<tr>
<th align=left>| . $locale->text('MwSt. inkl.') . qq|</th>
- <td><input type=checkbox name=taxincluded value=1 tabindex="5" $taxincluded></td>
+ <td><input type=checkbox name=taxincluded value=1 $taxincluded></td>
</tr>
</table>
</td>
<table width=100%>
<tr>
<th align=right width=50%>| . $locale->text('Mitarbeiter') . qq|</th>
- <td align=left><input name=employee size=11 value=$form->{employee} $readonly></td>
+ <td align=left><input name=employee size=20 value="| . H($form->{employee}) . qq|" readonly></td>
</tr>
</table>
</td>
<table>
<tr>
<th align=left>| . $locale->text('MwSt. inkl.') . qq|</th>
- <td><input type=checkbox name=taxincluded value=1 tabindex="5" $taxincluded></td>
+ <td><input type=checkbox name=taxincluded value=1 $taxincluded></td>
</tr>
</table>
</td>
</tr>|;
}
+
+ print qq|<tr>
+ <td width="1%" align="right" nowrap>| . $locale->text('Show details') . qq|</td>
+ <td width="1%"><input type="checkbox" onclick="show_form_details();" name="show_details" value="1" $show_details_checked></td>
+ </tr>|;
+
print qq|
<tr>
<td colspan=4>
<th class=listheading style="width:5%">|
. $locale->text('Korrektur') . qq|</th>
<th class=listheading style="width:10%">|
- . $locale->text('Taxkey') . qq|</th>
- <th class=listheading style="width:20%">|
- . $locale->text('Source') . qq|</th>
+ . $locale->text('Taxkey') . qq|</th>|;
+
+ if ($form->{show_details}) {
+ print qq|
+ <th class=listheading style="width:20%">| . $locale->text('Source') . qq|</th>
<th class=listheading style="width:20%">| . $locale->text('Memo') . qq|</th>
- $project
+ <th class=listheading style="width:20%">| . $locale->text('Project Number') . qq|</th>
+|;
+ }
+
+ print qq|
</tr>
$jsscript
$radieren = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
map {
- $form->{$_} =
- $form->format_amount(\%myconfig, $form->{$_}, 2, " ")
+ $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, 2, " ")
} qw(totaldebit totalcredit);
print qq|
<td></td>
<th align=right class=listtotal> $form->{totaldebit}</th>
<th align=right class=listtotal> $form->{totalcredit}</th>
- <td colspan=5></td>
+ <td colspan=6></td>
</tr>
</table>
</td>
</tr>
</table>
-<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->{id}) {
- print qq|<input class=submit type=submit name=action value="|
- . $locale->text('Storno') . qq|">|;
-
- # Löschen und ändern von Buchungen nicht mehr möglich (GoB) nur am selben Tag möglich
+ if (!$form->{storno}) {
+ print qq|<input class=submit type=submit name=action value="| . $locale->text('Storno') . qq|">|;
+ }
+ # Löschen und Ändern von Buchungen nicht mehr möglich (GoB) nur am selben Tag möglich
if (!$form->{locked} && $radieren) {
print qq|
- <input class=submit type=submit name=action value="|
- . $locale->text('Post') . qq|" accesskey="b">
- <input class=submit type=submit name=action value="|
- . $locale->text('Delete') . qq|">|;
+ <input class=submit type=submit name=action value="| . $locale->text('Post') . qq|" accesskey="b">
+ <input class=submit type=submit name=action value="| . $locale->text('Delete') . qq|">|;
}
- # if ($transdate > $closedto) {
- # print qq|
- # <input class=submit type=submit name=action value="|.$locale->text('Post as new').qq|">|;
- # }
} else {
if ($transdate > $closedto) {
- print qq|<input class=submit type=submit name=action value="|
- . $locale->text('Update') . qq|">
- <input class=submit type=submit name=action value="|
- . $locale->text('Post') . qq|">|;
+ print qq|
+ <input class=submit type=submit name=action id=update_button value="| . $locale->text('Update') . qq|">
+ <input class=submit type=submit name=action value="| . $locale->text('Post') . qq|">|;
}
}
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
print "
</form>
<form method=post action=$form->{script}>
|;
- map { $form->{$_} =~ s/\"/"/g } qw(reference description chart taxchart);
+ map { $form->{$_} =~ s/\"/"/g } qw(reference description);
delete $form->{header};
sub yes {
$lxdebug->enter_sub();
-
- $form->redirect($locale->text('Transaction deleted!'))
- if (GL->delete_transaction(\%myconfig, \%$form));
+ if (GL->delete_transaction(\%myconfig, \%$form)){
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
+ $form->{addition} = "DELETED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
+ $form->redirect($locale->text('Transaction deleted!'))
+ }
$form->error($locale->text('Cannot delete transaction!'));
$lxdebug->leave_sub();
}
-sub post {
+sub post_transaction {
$lxdebug->enter_sub();
# check if there is something in reference and date
$transdate = $form->datetonum($form->{transdate}, \%myconfig);
$closedto = $form->datetonum($form->{closedto}, \%myconfig);
- # check project
- &check_project;
-
my @a = ();
my $count = 0;
my $debittax = 0;
$creditlock = 0;
$debitlock = 0;
- my @flds =
- qw(accno debit credit projectnumber fx_transaction source memo tax taxchart);
- if ($form->{storno}) {
- for my $i (1 .. $form->{rowcount}) {
- unless (($form->{"debit_$i"} eq "") && ($form->{"credit_$i"} eq "")) {
- if ($form->{"debit_$i"} ne "") {
- $form->{"credit_$i"} = $form->{"debit_$i"};
- $form->{"debit_$i"} = "";
- } elsif ($form->{"credit_$i"} ne "") {
- $form->{"debit_$i"} = $form->{"credit_$i"};
- $form->{"credit_$i"} = "";
- }
- }
- }
- }
+ my @flds = qw(accno debit credit projectnumber fx_transaction source memo tax taxchart);
for my $i (1 .. $form->{rowcount}) {
+ next if $form->{"debit_$i"} eq "" && $form->{"credit_$i"} eq "";
- unless (($form->{"debit_$i"} eq "") && ($form->{"credit_$i"} eq "")) {
- for (qw(debit credit tax)) {
- $form->{"${_}_$i"} =
- $form->parse_amount(\%myconfig, $form->{"${_}_$i"});
- }
+ for (qw(debit credit tax)) {
+ $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"});
+ }
- push @a, {};
- $debitcredit = ($form->{"debit_$i"} == 0) ? "0" : "1";
+ push @a, {};
+ $debitcredit = ($form->{"debit_$i"} == 0) ? "0" : "1";
- if ($debitcredit) {
- $debitcount++;
- } else {
- $creditcount++;
- }
+ if ($debitcredit) {
+ $debitcount++;
+ } else {
+ $creditcount++;
+ }
- if (($debitcount >= 2) && ($creditcount == 2)) {
- $form->{"credit_$i"} = 0;
- $form->{"tax_$i"} = 0;
- $creditcount--;
- $creditlock = 1;
- }
- if (($creditcount >= 2) && ($debitcount == 2)) {
- $form->{"debit_$i"} = 0;
- $form->{"tax_$i"} = 0;
- $debitcount--;
- $debitlock = 1;
- }
- if (($creditcount == 1) && ($debitcount == 2)) {
- $creditlock = 1;
- }
- if (($creditcount == 2) && ($debitcount == 1)) {
- $debitlock = 1;
- }
- if ($debitcredit && $credittax) {
- $form->{"taxchart_$i"} = "0--0.00";
- }
- if (!$debitcredit && $debittax) {
- $form->{"taxchart_$i"} = "0--0.00";
- }
- $amount =
- ($form->{"debit_$i"} == 0)
- ? $form->{"credit_$i"}
- : $form->{"debit_$i"};
- $j = $#a;
- if (($debitcredit && $credittax) || (!$debitcredit && $debittax)) {
- $form->{"taxchart_$i"} = "0--0.00";
- $form->{"tax_$i"} = 0;
- }
- if (!$form->{"korrektur_$i"}) {
- ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
- if ($taxkey > 1) {
+ if (($debitcount >= 2) && ($creditcount == 2)) {
+ $form->{"credit_$i"} = 0;
+ $form->{"tax_$i"} = 0;
+ $creditcount--;
+ $creditlock = 1;
+ }
+ if (($creditcount >= 2) && ($debitcount == 2)) {
+ $form->{"debit_$i"} = 0;
+ $form->{"tax_$i"} = 0;
+ $debitcount--;
+ $debitlock = 1;
+ }
+ if (($creditcount == 1) && ($debitcount == 2)) {
+ $creditlock = 1;
+ }
+ if (($creditcount == 2) && ($debitcount == 1)) {
+ $debitlock = 1;
+ }
+ if ($debitcredit && $credittax) {
+ $form->{"taxchart_$i"} = "0--0.00";
+ }
+ if (!$debitcredit && $debittax) {
+ $form->{"taxchart_$i"} = "0--0.00";
+ }
+ $amount = ($form->{"debit_$i"} == 0)
+ ? $form->{"credit_$i"}
+ : $form->{"debit_$i"};
+ $j = $#a;
+ if (($debitcredit && $credittax) || (!$debitcredit && $debittax)) {
+ $form->{"taxchart_$i"} = "0--0.00";
+ $form->{"tax_$i"} = 0;
+ }
+ if (!$form->{"korrektur_$i"}) {
+ ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
+ if ($taxkey > 1) {
+ if ($debitcredit) {
+ $debittax = 1;
+ } else {
+ $credittax = 1;
+ }
+ if ($form->{taxincluded}) {
+ $form->{"tax_$i"} = $amount / ($rate + 1) * $rate;
if ($debitcredit) {
- $debittax = 1;
+ $form->{"debit_$i"} = $form->{"debit_$i"} - $form->{"tax_$i"};
} else {
- $credittax = 1;
+ $form->{"credit_$i"} = $form->{"credit_$i"} - $form->{"tax_$i"};
}
- if ($form->{taxincluded}) {
- $form->{"tax_$i"} = $amount / ($rate + 1) * $rate;
- if ($debitcredit) {
- $form->{"debit_$i"} = $form->{"debit_$i"} - $form->{"tax_$i"};
- } else {
- $form->{"credit_$i"} = $form->{"credit_$i"} - $form->{"tax_$i"};
- }
- } else {
- $form->{"tax_$i"} = $amount * $rate;
- }
- } else {
- $form->{"tax_$i"} = 0;
- }
- } elsif ($form->{taxincluded}) {
- if ($debitcredit) {
- $form->{"debit_$i"} = $form->{"debit_$i"} - $form->{"tax_$i"};
} else {
- $form->{"credit_$i"} = $form->{"credit_$i"} - $form->{"tax_$i"};
+ $form->{"tax_$i"} = $amount * $rate;
}
+ } else {
+ $form->{"tax_$i"} = 0;
+ }
+ } elsif ($form->{taxincluded}) {
+ if ($debitcredit) {
+ $form->{"debit_$i"} = $form->{"debit_$i"} - $form->{"tax_$i"};
+ } else {
+ $form->{"credit_$i"} = $form->{"credit_$i"} - $form->{"tax_$i"};
}
-
- for (@flds) { $a[$j]->{$_} = $form->{"${_}_$i"} }
- $count++;
}
+
+ for (@flds) { $a[$j]->{$_} = $form->{"${_}_$i"} }
+ $count++;
}
for $i (1 .. $count) {
$cr = $form->{"credit_$i"};
$tax = $form->{"tax_$i"};
if ($dr && $cr) {
- $form->error(
- $locale->text(
- 'Cannot post transaction with a debit and credit entry for the same account!'
- ));
- }
- if ($form->{taxincluded}) {
- if ($dr) {
- $debit += $dr + $tax;
- }
- if ($cr) {
- $credit += $cr + $tax;
- }
- $taxtotal += $tax;
- } else {
- if ($dr) {
- $debit += $dr + $tax;
- }
- if ($cr) {
- $credit += $cr + $tax;
- }
+ $form->error($locale->text('Cannot post transaction with a debit and credit entry for the same account!'));
}
+ $debit += $dr + $tax if $dr;
+ $credit += $cr + $tax if $cr;
+ $taxtotal += $tax if $form->{taxincluded}
}
- if (!$taxtotal) {
- $form->{taxincluded} = 0;
- }
+
+ $form->{taxincluded} = 0 if !$taxtotal;
# this is just for the wise guys
$form->error($locale->text('Cannot post transaction for a closed period!'))
if ($form->round_amount($debit, 2) != $form->round_amount($credit, 2)) {
$form->error($locale->text('Out of balance transaction!'));
}
+
+ if ($form->round_amount($debit, 2) + $form->round_amount($credit, 2) == 0) {
+ $form->error($locale->text('Empty transaction!'));
+ }
+
if (($errno = GL->post_transaction(\%myconfig, \%$form)) <= -1) {
$errno *= -1;
$err[1] = $locale->text('Cannot have a value in both Debit and Credit!');
$form->error($err[$errno]);
}
undef($form->{callback});
- $form->redirect("Buchung gespeichert. Buchungsnummer = " . $form->{id});
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
+ $form->{addition} = "SAVED";
+ $form->{what_done} = $locale->text("Buchungsnummer") . " = " . $form->{id};
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
+
$lxdebug->leave_sub();
+}
+
+sub post {
+ $lxdebug->enter_sub();
+
+ $form->{title} = $locale->text("$form->{title} General Ledger Transaction");
+ $form->{storno} = 0;
+ post_transaction();
+
+ $form->{callback} = build_std_url("action=add", "show_details");
+ $form->redirect($form->{callback});
+
+ $lxdebug->leave_sub();
}
sub post_as_new {
sub storno {
$lxdebug->enter_sub();
- $form->{id} = 0;
- $form->{storno} = 1;
- &post;
- $lxdebug->leave_sub();
+ # don't cancel cancelled transactions
+ if (IS->has_storno(\%myconfig, $form, 'gl')) {
+ $form->{title} = $locale->text("Cancel Accounts Receivables Transaction");
+ $form->error($locale->text("Transaction has already been cancelled!"));
+ }
+ GL->storno($form, \%myconfig, $form->{id});
+
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $form->{snumbers} = "ordnumber_$form->{ordnumber}";
+ $form->{addition} = "STORNO";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
+
+ $form->redirect(sprintf $locale->text("Transaction %d cancelled."), $form->{storno_id});
+
+ $lxdebug->leave_sub();
}
#======================================================================
#$locale->text('ea');
+use POSIX qw(strftime);
+
use SL::IC;
+use SL::ReportGenerator;
#use SL::PE;
-require "$form->{path}/io.pl";
+# use strict;
+#use warnings;
+
+# global imports
+our ($form, $locale, %myconfig, $lxdebug);
+
+require "bin/mozilla/io.pl";
+require "bin/mozilla/common.pl";
+require "bin/mozilla/reportgenerator.pl";
1;
$form->{title} = $locale->text('Add ' . ucfirst $form->{item});
$form->{callback} =
- "$form->{script}?action=add&item=$form->{item}&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=add&item=$form->{item}&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
$form->{"unit_changeable"} = 1;
sub search {
$lxdebug->enter_sub();
+ my ($button1, $button2, $onhand, $makemodel, $serialnumber, $l_serialnumber, $toplevel, $bought);
+
$form->{title} = (ucfirst $form->{searchitems}) . "s";
$form->{title} = $locale->text($form->{title});
# $locale->text('Services')
# use JavaScript Calendar or not
- $form->{jsscript} = $jscalendar;
- $jsscript = "";
+ $form->{jsscript} = 1;
+ my $jsscript = "";
if ($form->{jsscript}) {
# with JavaScript Calendar
<tr>
<th align=right nowrap>| . $locale->text('Part Number') . qq|</th>
<td><input name=partnumber size=20></td>
+ <th align=right nowrap>| . $locale->text('EAN') . qq|</th>
+ <td><input name=ean size=20></td>
</tr>
<tr>
<th align=right nowrap>|
<input type=hidden name=nextsub value=generate_report>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
$lxdebug->leave_sub();
} #end search()
-
sub search_update_prices {
$lxdebug->enter_sub();
+ my ($onhand, $makemodel, $serialnumber, $l_serialnumber, $toplevel, $bought);
+
$form->{title} = $locale->text('Update prices');
IC->get_pricegroups(\%myconfig, \%$form);
# use JavaScript Calendar or not
-# $form->{jsscript} = $jscalendar;
+# $form->{jsscript} = 1;
# $jsscript = "";
# if ($form->{jsscript}) {
#
<td><input name="listprice_type" class=radio type=radio value=percent checked>/<input name="listprice_type" class=radio type=radio value=absolut></td>
</tr>
|;
- for $i (1 .. $form->{price_rows}) {
+ for my $i (1 .. $form->{price_rows}) {
print qq|
<tr>
<td width=50%><input type=hidden name="pricegroup_$i" size=30 value="$form->{"pricegroup_$i"}">$form->{"pricegroup_$i"}</td>
<input type=hidden name=nextsub value=confirm_price_update>
<input type=hidden name=price_rows value=$form->{price_rows}>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
# delete action variable
map { delete $form->{$_} } qw(action header);
- foreach $key (keys %$form) {
+ foreach my $key (keys %$form) {
$form->{$key} =~ s/\"/"/g;
print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
}
sub choice {
$lxdebug->enter_sub();
+ our ($j, $lastndx);
+ my ($totop100);
+
$form->{title} = $locale->text('Top 100 hinzufuegen');
$form->header;
print qq|
<table>
<tr class=listheading>
- <th class=listheading nowrap>|
- . $locale->text('Part Number') . qq|</th>
- <th class=listheading nowrap>|
- . $locale->text('Part Description') . qq|</th>
+ <th class=listheading nowrap>| . $locale->text('Part Number') . qq|</th>
+ <th class=listheading nowrap>| . $locale->text('Part Description') . qq|</th>
</tr>
<tr valign=top>
<td><input type=text name=partnumber size=20 value=></td>
print qq|
-<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 name=extras type=hidden value=$form->{extras}>|;
+ my ($partnumber, $description, $unit, $sellprice, $soldtotal);
# if choice set data
if ($form->{ndx}) {
- for ($i = 0; $i < $form->{ndxs_counter}; $i++) {
+ for (my $i = 0; $i < $form->{ndxs_counter}; $i++) {
# prepeare data
$partnumber = $form->{"totop100_partnumber_$j"};
# set data for next page
if (($form->{ndxs_counter}) > 0) {
- for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
+ for (my $i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
$partnumber = $form->{"totop100_partnumber_$i"};
$description = $form->{"totop100_description_$i"};
$unit = $form->{"totop100_unit_$i"};
sub list {
$lxdebug->enter_sub();
- # get parts for
- if (($form->{partnumber} eq "") and ($form->{description} eq "")) {
- IC->get_parts(\%myconfig, \%$form, "");
- } else {
- if ((!($form->{partnumber} eq "")) and ($form->{description} eq "")) {
- IC->get_parts(\%myconfig, \%$form, "partnumber");
- } else {
- if (($form->{partnumber} eq "") and (!($form->{description} eq ""))) {
- IC->get_parts(\%myconfig, \%$form, "description");
- } else {
- IC->get_parts(\%myconfig, \%$form, "all");
- } #fi
- } #fi
- } #fi
+ our ($lastndx);
+ our ($partnumber, $description, $unit, $sellprice, $soldtotal);
+
+ my @sortorders = ("", "partnumber", "description", "all");
+ my $sortorder = $sortorders[($form->{description} ? 2 : 0) + ($form->{partnumber} ? 1 : 0)];
+ IC->get_parts(\%myconfig, \%$form, $sortorder);
$form->{title} = $locale->text('Top 100 hinzufuegen');
<br>
-<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 name=ndxs_counter type=hidden value=$form->{ndxs_counter}>|;
- $totop100 = "";
+ my $totop100 = "";
if (($form->{ndxs_counter}) > 0) {
for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
- $j1 = $form->{"totop100_partnumber_$i"};
- $j2 = $form->{"totop100_description_$i"};
- $j3 = $form->{"totop100_unit_$i"};
- $j4 = $form->{"totop100_sellprice_$i"};
- $j5 = $form->{"totop100_soldtotal_$i"};
-
- $partnumber = $j1;
- $description = $j2;
- $unit = $j3;
- $sellprice = $j4;
- $soldtotal = $j5;
+
+ $partnumber = $form->{"totop100_partnumber_$i"};
+ $description = $form->{"totop100_description_$i"};
+ $unit = $form->{"totop100_unit_$i"};
+ $sellprice = $form->{"totop100_sellprice_$i"};
+ $soldtotal = $form->{"totop100_soldtotal_$i"};
$totop100 .= qq|
<input type=hidden name=totop100_partnumber_$i value=$form->{"totop100_partnumber_$i"}>
if ($form->{ndxs_counter} > 0) {
- $index = $form->{ndx};
-
- $j1 = $form->{"new_partnumber_$index"};
- $form->{"totop100_partnumber_$form->{ndxs_counter}"} = $j1;
- $j2 = $form->{"new_description_$index"};
- $form->{"totop100_description_$form->{ndxs_counter}"} = $j2;
- $j3 = $form->{"new_unit_$index"};
- $form->{"totop100_unit_$form->{ndxs_counter}"} = $j3;
- $j4 = $form->{"new_sellprice_$index"};
- $form->{"totop100_sellprice_$form->{ndxs_counter}"} = $j4;
- $j5 = $form->{"new_soldtotal_$index"};
- $form->{"totop100_soldtotal_$form->{ndxs_counter}"} = $j5;
+ my $index = $form->{ndx};
+
+ $form->{"totop100_partnumber_$form->{ndxs_counter}"} = $form->{"new_partnumber_$index"};
+ $form->{"totop100_description_$form->{ndxs_counter}"} = $form->{"new_description_$index"};
+ $form->{"totop100_unit_$form->{ndxs_counter}"} = $form->{"new_unit_$index"};
+ $form->{"totop100_sellprice_$form->{ndxs_counter}"} = $form->{"new_sellprice_$index"};
+ $form->{"totop100_soldtotal_$form->{ndxs_counter}"} = $form->{"new_soldtotal_$index"};
} #fi
} #fi
&addtop100();
sub addtop100 {
$lxdebug->enter_sub();
+ my ($revers, $lastsort, $callback, $option, $description, $sameitem,
+ $partnumber, $unit, $sellprice, $soldtotal, $totop100, $onhand, $align);
+ my (@column_index, %column_header, %column_data);
+ my ($totalsellprice, $totallastcost, $totallistprice, $subtotalonhand, $subtotalsellprice, $subtotallastcost, $subtotallistprice);
+
$form->{top100} = "top100";
$form->{l_soldtotal} = "Y";
$form->{soldtotal} = "soldtotal";
$form->{sort} = "soldtotal";
$form->{l_qty} = "N";
- $callback .= "&form->{top100}=$form->{top100}";
$form->{l_linetotal} = "";
$form->{revers} = 1;
$form->{number} = "position";
$form->{l_number} = "Y";
- my $totop100 = "";
+ $totop100 = "";
$form->{title} = $locale->text('Top 100');
} #fi
$callback =
- "$form->{script}?action=top100&path=$form->{path}&login=$form->{login}&password=$form->{password}&searchitems=$form->{searchitems}&itemstatus=$form->{itemstatus}&bom=$form->{bom}&l_linetotal=$form->{l_linetotal}&title="
+ "$form->{script}?action=top100&login=$form->{login}&password=$form->{password}&searchitems=$form->{searchitems}&itemstatus=$form->{itemstatus}&bom=$form->{bom}&l_linetotal=$form->{l_linetotal}&title="
. $form->escape($form->{title}, 1);
# if we have a serialnumber limit search
$callback .= "&partnumber=$form->{partnumber}";
$option .= $locale->text('Part Number') . qq| : $form->{partnumber}<br>|;
}
+ if ($form->{ean}) {
+ $callback .= "&partnumber=$form->{ean}";
+ $option .= $locale->text('EAN') . qq| : $form->{ean}<br>|;
+ }
if ($form->{partsgroup}) {
$callback .= "&partsgroup=$form->{partsgroup}";
$option .= $locale->text('Group') . qq| : $form->{partsgroup}<br>|;
$option .= $locale->text('soldtotal') . qq| : $form->{soldtotal}<br>|;
}
- @columns = $form->sort_columns(
- qw(number partnumber description partsgroup bin onhand rop unit listprice linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost priceupdate weight image drawing microfiche invnumber ordnumber quonumber name serialnumber soldtotal)
+ my @columns = $form->sort_columns(
+ qw(number partnumber ean description partsgroup bin onhand rop unit listprice linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost priceupdate weight image drawing microfiche invnumber ordnumber quonumber name serialnumber soldtotal)
);
if ($form->{l_linetotal}) {
$form->{l_lastcost} = ""
if ($form->{searchitems} eq 'assembly' && !$form->{bom});
- foreach $item (@columns) {
+ foreach my $item (@columns) {
if ($form->{"l_$item"} eq "Y") {
push @column_index, $item;
. qq|</a></th>|;
$form->header;
- $colspan = $#column_index + 1;
+ my $colspan = $#column_index + 1;
print qq|
<body>
# insert numbers for top100
my $j = 0;
- foreach $ref (@{ $form->{parts} }) {
+ foreach my $ref (@{ $form->{parts} }) {
$j++;
$ref->{number} = $j;
}
# if avaible -> insert choice here
if (($form->{ndxs_counter}) > 0) {
- for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
+ for (my $i = 1; ($i < $form->{ndxs_counter} + 1); $i++) {
$partnumber = $form->{"totop100_partnumber_$i"};
$description = $form->{"totop100_description_$i"};
$unit = $form->{"totop100_unit_$i"};
} #rof
} #fi
# build data for columns
- foreach $ref (@{ $form->{parts} }) {
+ foreach my $ref (@{ $form->{parts} }) {
+ my $i = 0;
if ($form->{l_subtotal} eq 'Y' && !$ref->{assemblyitem}) {
if ($sameitem ne $ref->{ $form->{sort} }) {
$column_data{number} =
"<td align=right>"
- . $form->format_amount(\%myconfig, $ref->{number}, '', " ")
+ . $form->format_amount(\%myconfig, $ref->{number})
. "</td>";
$column_data{partnumber} =
"<td align=$align>$ref->{partnumber} </a></td>";
$column_data{onhand} =
"<td align=right>"
- . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
+ . $form->format_amount(\%myconfig, $ref->{onhand})
. "</td>";
$column_data{sellprice} =
"<td align=right>"
- . $form->format_amount(\%myconfig, $ref->{sellprice}, 2, " ")
+ . $form->format_amount(\%myconfig, $ref->{sellprice})
. "</td>";
$column_data{listprice} =
"<td align=right>"
- . $form->format_amount(\%myconfig, $ref->{listprice}, 2, " ")
+ . $form->format_amount(\%myconfig, $ref->{listprice})
. "</td>";
$column_data{lastcost} =
"<td align=right>"
- . $form->format_amount(\%myconfig, $ref->{lastcost}, 2, " ")
+ . $form->format_amount(\%myconfig, $ref->{lastcost})
. "</td>";
$column_data{linetotalsellprice} = "<td align=right>"
- . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice},
- 2, " ")
+ . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice}, 2)
. "</td>";
$column_data{linetotallastcost} = "<td align=right>"
- . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost},
- 2, " ")
+ . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost}, 2)
. "</td>";
$column_data{linetotallistprice} = "<td align=right>"
- . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice},
- 2, " ")
+ . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice}, 2)
. "</td>";
if (!$ref->{assemblyitem}) {
$column_data{rop} =
"<td align=right>"
- . $form->format_amount(\%myconfig, $ref->{rop}, '', " ") . "</td>";
+ . $form->format_amount(\%myconfig, $ref->{rop}) . "</td>";
$column_data{weight} =
"<td align=right>"
- . $form->format_amount(\%myconfig, $ref->{weight}, '', " ")
+ . $form->format_amount(\%myconfig, $ref->{weight})
. "</td>";
$column_data{unit} = "<td>$ref->{unit} </td>";
$column_data{bin} = "<td>$ref->{bin} </td>";
$column_data{invnumber} =
($ref->{module} ne 'oe')
- ? "<td><a href=$ref->{module}.pl?action=edit&type=invoice&id=$ref->{trans_id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber}</a></td>"
+ ? "<td><a href=$ref->{module}.pl?action=edit&type=invoice&id=$ref->{trans_id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber}</a></td>"
: "<td>$ref->{invnumber}</td>";
$column_data{ordnumber} =
($ref->{module} eq 'oe')
- ? "<td><a href=$ref->{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{ordnumber}</a></td>"
+ ? "<td><a href=$ref->{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{ordnumber}</a></td>"
: "<td>$ref->{ordnumber}</td>";
$column_data{quonumber} =
($ref->{module} eq 'oe' && !$ref->{ordnumber})
- ? "<td><a href=$ref->{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{quonumber}</a></td>"
+ ? "<td><a href=$ref->{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{quonumber}</a></td>"
: "<td>$ref->{quonumber}</td>";
$column_data{name} = "<td>$ref->{name}</td>";
map { $column_data{$_} = "<td> </td>" } @column_index;
$column_data{linetotalsellprice} =
"<th class=listtotal align=right>"
- . $form->format_amount(\%myconfig, $totalsellprice, 2, " ")
+ . $form->format_amount(\%myconfig, $totalsellprice, 2)
. "</th>";
$column_data{linetotallastcost} =
"<th class=listtotal align=right>"
- . $form->format_amount(\%myconfig, $totallastcost, 2, " ")
+ . $form->format_amount(\%myconfig, $totallastcost, 2)
. "</th>";
$column_data{linetotallistprice} =
"<th class=listtotal align=right>"
- . $form->format_amount(\%myconfig, $totallistprice, 2, " ")
+ . $form->format_amount(\%myconfig, $totallistprice, 2)
. "</th>";
print "<tr class=listtotal>";
<form method=post action=$form->{script}>
-<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 type=hidden name=ndxs_counter value="$form->{ndxs_counter}">
<input class=submit type=submit name=action value="|
- . $locale->text('choice') . qq|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
+ . $locale->text('choice') . qq|">
- print qq|
</form>
</body>
$lxdebug->leave_sub();
} # end addtop100
+#
+# Report for Wares.
+# Warning, deep magic ahead.
+# This function parses the requested details, sanity checks them, and converts them into a format thats usable for IC->all_parts
+#
+# flags coming from the form:
+# hardcoded:
+# searchitems=part revers=0 lastsort=''
+#
+# filter:
+# partnumber ean description partsgroup serialnumber make model drawing microfiche
+# transdatefrom transdateto
+#
+# radio:
+# itemstatus = active | onhand | short | obsolete | orphaned
+# action = continue | top100
+#
+# checkboxes:
+# bought sold onorder ordered rfq quoted
+# l_partnumber l_description l_serialnumber l_unit l_listprice l_sellprice l_lastcost
+# l_linetotal l_priceupdate l_bin l_rop l_weight l_image l_drawing l_microfiche
+# l_partsgroup l_subtotal l_soldtotal l_deliverydate
+#
+# hiddens:
+# nextsub login password revers lastsort sort ndxs_counter
+#
sub generate_report {
$lxdebug->enter_sub();
- $revers = $form->{revers};
- $lastsort = $form->{lastsort};
+ my ($revers, $lastsort, $description);
+
+ $form->{title} = (ucfirst $form->{searchitems}) . "s";
+ $form->{title} = $locale->text($form->{title});
+
+ my $revers = $form->{revers};
+ my $lastsort = $form->{lastsort};
+ # sorting and direction of sorting
+ # ToDO: change this to the simpler field+direction method
if (($form->{lastsort} eq "") && ($form->{sort} eq undef)) {
$form->{revers} = 0;
$form->{lastsort} = "partnumber";
$form->{sort} = "partnumber";
} else {
-
- # switch between backward sorting of tables
if ($form->{lastsort} eq $form->{sort}) {
- if ($form->{revers} == 0) {
- $form->{revers} = 1;
- } else {
- $form->{revers} = 0;
- } #fi
+ $form->{revers} = 1 - $form->{revers};
} else {
- $form->{revers} == 0;
+ $form->{revers} = 0;
$form->{lastsort} = $form->{sort};
} #fi
} #fi
- $callback =
- "$form->{script}?action=generate_report&path=$form->{path}&login=$form->{login}&password=$form->{password}&searchitems=$form->{searchitems}&itemstatus=$form->{itemstatus}&bom=$form->{bom}&l_linetotal=$form->{l_linetotal}&title="
- . $form->escape($form->{title}, 1);
+ # special case if we have a serialnumber limit search
+ # serialnumbers are only given in invoices and orders,
+ # so they can only pop up in bought, sold, rfq, and quoted stuff
+ $form->{no_sn_joins} = 'Y' if ( !$form->{bought} && !$form->{sold}
+ && !$form->{rfq} && !$form->{quoted}
+ && ($form->{l_serialnumber} || $form->{serialnumber}));
+
+ # special case for any checkbox of bought | sold | onorder | ordered | rfq | quoted.
+ # if any of these are ticked the behavior changes slightly for lastcost
+ # since all those are aggregation checks for the legder tables this is an internal switch
+ # refered to as ledgerchecks
+ $form->{ledgerchecks} = 'Y' if ( $form->{bought} || $form->{sold} || $form->{onorder}
+ || $form->{ordered} || $form->{rfq} || $form->{quoted});
+
+ # if something should be aktivated if something else is active, enter it here
+ my %dependencies = (
+ onhand => [ qw(l_onhand) ],
+ short => [ qw(l_onhand) ],
+ onorder => [ qw(l_ordnumber) ],
+ ordered => [ qw(l_ordnumber) ],
+ rfq => [ qw(l_quonumber) ],
+ quoted => [ qw(l_quonumber) ],
+ bought => [ qw(l_invnumber) ],
+ sold => [ qw(l_invnumber) ],
+ ledgerchecks => [ qw(l_name) ],
+ serialnumber => [ qw(l_serialnumber) ],
+ no_sn_joins => [ qw(bought sold) ],
+ );
- # if we have a serialnumber limit search
- if ($form->{serialnumber} || $form->{l_serialnumber}) {
- $form->{l_serialnumber} = "Y";
- unless ( $form->{bought}
- || $form->{sold}
- || $form->{rfq}
- || $form->{quoted}) {
- $form->{bought} = $form->{sold} = 1;
- }
- }
+ # these strings get displayed at the top of the results to indicate the user which switches were used
+ my %optiontexts = (
+ active => $locale->text('Active'),
+ obsolete => $locale->text('Obsolete'),
+ orphaned => $locale->text('Orphaned'),
+ onhand => $locale->text('On Hand'),
+ short => $locale->text('Short'),
+ onorder => $locale->text('On Order'),
+ ordered => $locale->text('Ordered'),
+ rfq => $locale->text('RFQ'),
+ quoted => $locale->text('Quoted'),
+ bought => $locale->text('Bought'),
+ sold => $locale->text('Sold'),
+ transdatefrom => $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1),
+ transdateto => $locale->text('To (time)') . " " . $locale->date(\%myconfig, $form->{transdateto}, 1),
+ partnumber => $locale->text('Part Number') . ": '$form->{partnumber}'",
+ partsgroup => $locale->text('Group') . ": '$form->{partsgroup}'",
+ serialnumber => $locale->text('Serial Number') . ": '$form->{serialnumber}'",
+ description => $locale->text('Part Description') . ": '$form->{description}'",
+ make => $locale->text('Make') . ": '$form->{make}'",
+ model => $locale->text('Model') . ": '$form->{model}'",
+ drawing => $locale->text('Drawing') . ": '$form->{drawing}'",
+ microfiche => $locale->text('Microfiche') . ": '$form->{microfiche}'",
+ l_soldtotal => $locale->text('soldtotal'),
+ );
- IC->all_parts(\%myconfig, \%$form);
+ my @itemstatus_keys = qw(active obsolete orphaned onhand short);
+ my @callback_keys = qw(onorder ordered rfq quoted bought sold partnumber partsgroup serialnumber description make model
+ drawing microfiche l_soldtotal l_deliverydate transdatefrom transdateto ean);
- if ($form->{itemstatus} eq 'active') {
- $option .= $locale->text('Active') . " : ";
- }
- if ($form->{itemstatus} eq 'obsolete') {
- $option .= $locale->text('Obsolete') . " : ";
- }
- if ($form->{itemstatus} eq 'orphaned') {
- $option .= $locale->text('Orphaned') . " : ";
- }
- if ($form->{itemstatus} eq 'onhand') {
- $option .= $locale->text('On Hand') . " : ";
- $form->{l_onhand} = "Y";
- }
- if ($form->{itemstatus} eq 'short') {
- $option .= $locale->text('Short') . " : ";
- $form->{l_onhand} = "Y";
- }
- if ($form->{onorder}) {
- $form->{l_ordnumber} = "Y";
- $callback .= "&onorder=$form->{onorder}";
- $option .= $locale->text('On Order') . " : ";
- }
- if ($form->{ordered}) {
- $form->{l_ordnumber} = "Y";
- $callback .= "&ordered=$form->{ordered}";
- $option .= $locale->text('Ordered') . " : ";
- }
- if ($form->{rfq}) {
- $form->{l_quonumber} = "Y";
- $callback .= "&rfq=$form->{rfq}";
- $option .= $locale->text('RFQ') . " : ";
- }
- if ($form->{quoted}) {
- $form->{l_quonumber} = "Y";
- $callback .= ""ed=$form->{quoted}";
- $option .= $locale->text('Quoted') . " : ";
- }
- if ($form->{bought}) {
- $form->{l_invnumber} = "Y";
- $callback .= "&bought=$form->{bought}";
- $option .= $locale->text('Bought') . " : ";
+ # calculate dependencies
+ for (@itemstatus_keys, @callback_keys) {
+ next if ($form->{itemstatus} ne $_ && !$form->{$_});
+ map { $form->{$_} = 'Y' } @{ $dependencies{$_} } if $dependencies{$_};
}
- if ($form->{sold}) {
- $form->{l_invnumber} = "Y";
- $callback .= "&sold=$form->{sold}";
- $option .= $locale->text('Sold') . " : ";
- }
- if ( $form->{bought}
- || $form->{sold}
- || $form->{onorder}
- || $form->{ordered}
- || $form->{rfq}
- || $form->{quoted}) {
- $form->{l_lastcost} = "";
- $form->{l_name} = "Y";
- if ($form->{transdatefrom}) {
- $callback .= "&transdatefrom=$form->{transdatefrom}";
- $option .= "\n<br>"
- . $locale->text('From')
- . " "
- . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
- }
- if ($form->{transdateto}) {
- $callback .= "&transdateto=$form->{transdateto}";
- $option .= "\n<br>"
- . $locale->text('To (time)')
- . " "
- . $locale->date(\%myconfig, $form->{transdateto}, 1);
- }
+ # generate callback and optionstrings
+ my @options;
+ for my $key (@itemstatus_keys, @callback_keys) {
+ next if ($form->{itemstatus} ne $key && !$form->{$key});
+ push @options, $optiontexts{$key};
}
- $option .= "<br>";
+ IC->all_parts(\%myconfig, \%$form);
+
+ # special case for lastcost
+ $form->{l_lastcost} = "" if $form->{ledgerchecks};
- if ($form->{partnumber}) {
- $callback .= "&partnumber=$form->{partnumber}";
- $option .= $locale->text('Part Number') . qq| : $form->{partnumber}<br>|;
- }
- if ($form->{partsgroup}) {
- $callback .= "&partsgroup=$form->{partsgroup}";
- $option .= $locale->text('Group') . qq| : $form->{partsgroup}<br>|;
- }
- if ($form->{serialnumber}) {
- $callback .= "&serialnumber=$form->{serialnumber}";
- $option .=
- $locale->text('Serial Number') . qq| : $form->{serialnumber}<br>|;
- }
if ($form->{description}) {
- $callback .= "&description=$form->{description}";
$description = $form->{description};
- $description =~ s/
-/<br>/g;
- $option .=
- $locale->text('Part Description') . qq| : $form->{description}<br>|;
- }
- if ($form->{make}) {
- $callback .= "&make=$form->{make}";
- $option .= $locale->text('Make') . qq| : $form->{make}<br>|;
- }
- if ($form->{model}) {
- $callback .= "&model=$form->{model}";
- $option .= $locale->text('Model') . qq| : $form->{model}<br>|;
- }
- if ($form->{drawing}) {
- $callback .= "&drawing=$form->{drawing}";
- $option .= $locale->text('Drawing') . qq| : $form->{drawing}<br>|;
- }
- if ($form->{microfiche}) {
- $callback .= "µfiche=$form->{microfiche}";
- $option .= $locale->text('Microfiche') . qq| : $form->{microfiche}<br>|;
- }
-
- # table soldtotal aktive
- if ($form->{l_soldtotal}) {
- $callback .= "&soldtotal=$form->{soldtotal}";
- $option .= $locale->text('soldtotal') . qq| : $form->{soldtotal}<br>|;
+ $description =~ s/\n/<br>/g;
}
- if ($form->{l_deliverydate}) {
- $callback .= "&deliverydate=$form->{deliverydate}";
- }
-
- @columns = $form->sort_columns(
- qw(partnumber description partsgroup bin onhand rop unit listprice linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost priceupdate weight image drawing microfiche invnumber ordnumber quonumber name serialnumber soldtotal deliverydate)
- );
-
if ($form->{l_linetotal}) {
$form->{l_onhand} = "Y";
$form->{l_linetotalsellprice} = "Y" if $form->{l_sellprice};
}
}
- $form->{l_lastcost} = ""
- if ($form->{searchitems} eq 'assembly' && !$form->{bom});
+ $form->{l_lastcost} = "" if ($form->{searchitems} eq 'assembly' && !$form->{bom});
+
+ my @columns =
+ qw(partnumber description partsgroup bin onhand rop unit listprice linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost
+ priceupdate weight image drawing microfiche invnumber ordnumber quonumber name serialnumber soldtotal deliverydate);
+
+ my %column_defs = (
+ 'bin' => { 'text' => $locale->text('Bin'), },
+ 'deliverydate' => { 'text' => $locale->text('deliverydate'), },
+ 'description' => { 'text' => $locale->text('Part Description'), },
+ 'drawing' => { 'text' => $locale->text('Drawing'), },
+ 'image' => { 'text' => $locale->text('Image'), },
+ 'invnumber' => { 'text' => $locale->text('Invoice Number'), },
+ 'lastcost' => { 'text' => $locale->text('Last Cost'), },
+ 'linetotallastcost' => { 'text' => $locale->text('Extended'), },
+ 'linetotallistprice' => { 'text' => $locale->text('Extended'), },
+ 'linetotalsellprice' => { 'text' => $locale->text('Extended'), },
+ 'listprice' => { 'text' => $locale->text('List Price'), },
+ 'microfiche' => { 'text' => $locale->text('Microfiche'), },
+ 'name' => { 'text' => $locale->text('Name'), },
+ 'onhand' => { 'text' => $locale->text('Qty'), },
+ 'ordnumber' => { 'text' => $locale->text('Order Number'), },
+ 'partnumber' => { 'text' => $locale->text('Part Number'), },
+ 'partsgroup' => { 'text' => $locale->text('Group'), },
+ 'priceupdate' => { 'text' => $locale->text('Updated'), },
+ 'quonumber' => { 'text' => $locale->text('Quotation'), },
+ 'rop' => { 'text' => $locale->text('ROP'), },
+ 'sellprice' => { 'text' => $locale->text('Sell Price'), },
+ 'serialnumber' => { 'text' => $locale->text('Serial Number'), },
+ 'soldtotal' => { 'text' => $locale->text('soldtotal'), },
+ 'unit' => { 'text' => $locale->text('Unit'), },
+ 'weight' => { 'text' => $locale->text('Weight'), },
+ );
- foreach $item (@columns) {
- if ($form->{"l_$item"} eq "Y") {
- push @column_index, $item;
+ map { $column_defs{$_}->{visible} = $form->{"l_$_"} ? 1 : 0 } @columns;
+ map { $column_defs{$_}->{align} = 'right' } qw(onhand sellprice listprice lastcost linetotalsellprice linetotallastcost linetotallistprice rop weight soldtotal);
- # add column to callback
- $callback .= "&l_$item=Y";
- }
- }
+ my @hidden_variables = (qw(l_subtotal l_linetotal searchitems itemstatus bom), @itemstatus_keys, @callback_keys, map { "l_$_" } @columns);
+ my $callback = build_std_url('action=generate_report', grep { $form->{$_} } @hidden_variables);
- if ($form->{l_subtotal} eq 'Y') {
- $callback .= "&l_subtotal=Y";
+ my @sort_full = qw(partnumber description onhand soldtotal deliverydate);
+ my @sort_no_revers = qw(partsgroup bin priceupdate invnumber ordnumber quonumber name image drawing serialnumber);
+
+ foreach my $col (@sort_full) {
+ $column_defs{$col}->{link} = join '&', $callback, "sort=$col", map { "$_=" . E($form->{$_}) } qw(revers lastsort);
}
- $column_header{partnumber} =
- qq|<th nowrap><a class=listheading href=$callback&sort=partnumber&revers=$form->{revers}&lastsort=$form->{lastsort}>|
- . $locale->text('Part Number')
- . qq|</a></th>|;
- $column_header{description} =
- qq|<th nowrap><a class=listheading href=$callback&sort=description&revers=$form->{revers}&lastsort=$form->{lastsort}>|
- . $locale->text('Part Description')
- . qq|</a></th>|;
- $column_header{partsgroup} =
- qq|<th nowrap><a class=listheading href=$callback&sort=partsgroup>|
- . $locale->text('Group')
- . qq|</a></th>|;
- $column_header{bin} =
- qq|<th><a class=listheading href=$callback&sort=bin>|
- . $locale->text('Bin')
- . qq|</a></th>|;
- $column_header{priceupdate} =
- qq|<th nowrap><a class=listheading href=$callback&sort=priceupdate>|
- . $locale->text('Updated')
- . qq|</a></th>|;
- $column_header{onhand} =
- qq|<th nowrap><a class=listheading href=$callback&sort=onhand&revers=$form->{revers}&lastsort=$form->{lastsort}>|
- . $locale->text('Qty')
- . qq|</th>|;
- $column_header{unit} =
- qq|<th class=listheading nowrap>| . $locale->text('Unit') . qq|</th>|;
- $column_header{listprice} =
- qq|<th class=listheading nowrap>|
- . $locale->text('List Price')
- . qq|</th>|;
- $column_header{lastcost} =
- qq|<th class=listheading nowrap>| . $locale->text('Last Cost') . qq|</th>|;
- $column_header{rop} =
- qq|<th class=listheading nowrap>| . $locale->text('ROP') . qq|</th>|;
- $column_header{weight} =
- qq|<th class=listheading nowrap>| . $locale->text('Weight') . qq|</th>|;
+ map { $column_defs{$_}->{link} = "${callback}&sort=$_" } @sort_no_revers;
- $column_header{invnumber} =
- qq|<th nowrap><a class=listheading href=$callback&sort=invnumber>|
- . $locale->text('Invoice Number')
- . qq|</a></th>|;
- $column_header{ordnumber} =
- qq|<th nowrap><a class=listheading href=$callback&sort=ordnumber>|
- . $locale->text('Order Number')
- . qq|</a></th>|;
- $column_header{quonumber} =
- qq|<th nowrap><a class=listheading href=$callback&sort=quonumber>|
- . $locale->text('Quotation')
- . qq|</a></th>|;
+ # add order to callback
+ $form->{callback} = join '&', ($callback, map { "${_}=" . E($form->{$_}) } qw(sort revers));
- $column_header{name} =
- qq|<th nowrap><a class=listheading href=$callback&sort=name>|
- . $locale->text('Name')
- . qq|</a></th>|;
+ my $report = SL::ReportGenerator->new(\%myconfig, $form);
- $column_header{sellprice} =
- qq|<th class=listheading nowrap>|
- . $locale->text('Sell Price')
- . qq|</th>|;
- $column_header{linetotalsellprice} =
- qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
- $column_header{linetotallastcost} =
- qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
- $column_header{linetotallistprice} =
- qq|<th class=listheading nowrap>| . $locale->text('Extended') . qq|</th>|;
+ my %attachment_basenames = (
+ 'part' => $locale->text('part_list'),
+ 'service' => $locale->text('service_list'),
+ 'assembly' => $locale->text('assembly_list'),
+ );
- $column_header{image} =
- qq|<th class=listheading nowrap>| . $locale->text('Image') . qq|</a></th>|;
- $column_header{drawing} =
- qq|<th nowrap><a class=listheading href=$callback&sort=drawing>|
- . $locale->text('Drawing')
- . qq|</a></th>|;
- $column_header{microfiche} =
- qq|<th nowrap><a class=listheading href=$callback&sort=microfiche>|
- . $locale->text('Microfiche')
- . qq|</a></th>|;
-
- $column_header{serialnumber} =
- qq|<th nowrap><a class=listheading href=$callback&sort=serialnumber>|
- . $locale->text('Serial Number')
- . qq|</a></th>|;
- $column_header{soldtotal} =
- qq|<th nowrap><a class=listheading href=$callback&sort=soldtotal&revers=$form->{revers}&lastsort=$form->{lastsort}>|
- . $locale->text('soldtotal')
- . qq|</a></th>|;
-
- $column_header{deliverydate} =
- qq|<th nowrap><a class=listheading href=$callback&sort=deliverydate&revers=$form->{revers}&lastsort=$form->{lastsort}>|
- . $locale->text('deliverydate')
- . qq|</a></th>|;
-
- $form->header;
- $colspan = $#column_index + 1;
-
- print qq|
-<body>
-
-<table width=100%>
- <tr>
- <th class=listtop colspan=$colspan>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
-
- <tr><td colspan=$colspan>$option</td></tr>
-
- <tr class=listheading>
-|;
-
- map { print "\n$column_header{$_}" } @column_index;
-
- print qq|
- </tr>
- |;
+ $report->set_options('top_info_text' => $locale->text('Options') . ': ' . join(', ', grep $_, @options),
+ 'raw_bottom_info_text' => $form->parse_html_template2('ic/generate_report_bottom'),
+ 'output_format' => 'HTML',
+ 'title' => $form->{title},
+ 'attachment_basename' => $attachment_basenames{$form->{searchitems}} . strftime('_%Y%m%d', localtime time),
+ );
+ $report->set_options_from_form();
- # add order to callback
- $form->{callback} = $callback .= "&sort=$form->{sort}";
+ $report->set_columns(%column_defs);
+ $report->set_column_order(@columns);
- # escape callback for href
- $callback = $form->escape($callback);
+ $report->set_export_options('generate_report', @hidden_variables, qw(sort revers));
- if (@{ $form->{parts} }) {
- $sameitem = $form->{parts}->[0]->{ $form->{sort} };
- }
+ $report->set_sort_indicator($form->{sort}, $form->{revers} ? 0 : 1);
- foreach $ref (@{ $form->{parts} }) {
+ my @subtotal_columns = qw(sellprice listprice lastcost);
+ my %subtotals = map { $_ => 0 } ('onhand', @subtotal_columns);
+ my %totals = map { $_ => 0 } @subtotal_columns;
+ my $idx = 0;
+ my $same_item = $form->{parts}->[0]->{ $form->{sort} } if (scalar @{ $form->{parts} });
- if ($form->{l_subtotal} eq 'Y' && !$ref->{assemblyitem}) {
- if ($sameitem ne $ref->{ $form->{sort} }) {
- &parts_subtotal;
- $sameitem = $ref->{ $form->{sort} };
- }
- }
+ foreach my $ref (@{ $form->{parts} }) {
+ my $row = { map { $_ => { 'data' => $ref->{$_} } } @columns };
- $ref->{exchangerate} = 1 unless $ref->{exchangerate};
- $ref->{sellprice} *= $ref->{exchangerate};
- $ref->{listprice} *= $ref->{exchangerate};
- $ref->{lastcost} *= $ref->{exchangerate};
+ $ref->{exchangerate} = 1 unless $ref->{exchangerate};
+ $ref->{sellprice} *= $ref->{exchangerate};
+ $ref->{listprice} *= $ref->{exchangerate};
+ $ref->{lastcost} *= $ref->{exchangerate};
# use this for assemblies
- $onhand = $ref->{onhand};
+ my $onhand = $ref->{onhand};
- $align = "left";
if ($ref->{assemblyitem}) {
- $align = "right";
- $onhand = 0 if ($form->{sold});
+ $row->{partnumber}->{align} = 'right';
+ $row->{onhand}->{data} = 0;
+ $onhand = 0 if ($form->{sold});
}
- $ref->{description} =~ s/
-/<br>/g;
-
- $column_data{partnumber} =
- "<td align=$align><a href=$form->{script}?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{partnumber} </a></td>";
- $column_data{description} = "<td><a href=$form->{script}?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description} </a></td>";
- $column_data{partsgroup} = "<td>$ref->{partsgroup} </td>";
+ my $edit_link = build_std_url('action=edit', 'id=' . E($ref->{id}), 'callback');
+ $row->{partnumber}->{link} = $edit_link;
+ $row->{description}->{link} = $edit_link;
- $column_data{onhand} =
- "<td align=right>"
- . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
- . "</td>";
- $column_data{sellprice} =
- "<td align=right>"
- . $form->format_amount(\%myconfig, $ref->{sellprice}, 2, " ")
- . "</td>";
- $column_data{listprice} =
- "<td align=right>"
- . $form->format_amount(\%myconfig, $ref->{listprice}, 2, " ")
- . "</td>";
- $column_data{lastcost} =
- "<td align=right>"
- . $form->format_amount(\%myconfig, $ref->{lastcost}, 2, " ")
- . "</td>";
+ foreach (qw(sellprice listprice lastcost)) {
+ $row->{$_}->{data} = $form->format_amount(\%myconfig, $ref->{$_}, -2);
+ $row->{"linetotal$_"}->{data} = $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{$_}, 2);
+ }
- $column_data{linetotalsellprice} = "<td align=right>"
- . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice},
- 2, " ")
- . "</td>";
- $column_data{linetotallastcost} = "<td align=right>"
- . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost},
- 2, " ")
- . "</td>";
- $column_data{linetotallistprice} = "<td align=right>"
- . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice},
- 2, " ")
- . "</td>";
+ map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $ref->{$_}); } qw(onhand rop weight soldtotal);
if (!$ref->{assemblyitem}) {
- $totalsellprice += $onhand * $ref->{sellprice};
- $totallastcost += $onhand * $ref->{lastcost};
- $totallistprice += $onhand * $ref->{listprice};
+ foreach my $col (@subtotal_columns) {
+ $totals{$col} += $onhand * $ref->{$col};
+ $subtotals{$col} += $onhand * $ref->{$col};
+ }
- $subtotalonhand += $onhand;
- $subtotalsellprice += $onhand * $ref->{sellprice};
- $subtotallastcost += $onhand * $ref->{lastcost};
- $subtotallistprice += $onhand * $ref->{listprice};
+ $subtotals{onhand} += $onhand;
}
- $column_data{rop} =
- "<td align=right>"
- . $form->format_amount(\%myconfig, $ref->{rop}, '', " ") . "</td>";
- $column_data{weight} =
- "<td align=right>"
- . $form->format_amount(\%myconfig, $ref->{weight}, '', " ")
- . "</td>";
- $column_data{unit} = "<td>$ref->{unit} </td>";
- $column_data{bin} = "<td>$ref->{bin} </td>";
- $column_data{priceupdate} = "<td>$ref->{priceupdate} </td>";
-
- $column_data{invnumber} =
- ($ref->{module} ne 'oe')
- ? "<td><a href=$ref->{module}.pl?action=edit&type=invoice&id=$ref->{trans_id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber}</a></td>"
- : "<td>$ref->{invnumber}</td>";
- $column_data{ordnumber} =
- ($ref->{module} eq 'oe')
- ? "<td><a href=$ref->{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{ordnumber}</a></td>"
- : "<td>$ref->{ordnumber}</td>";
- $column_data{quonumber} =
- ($ref->{module} eq 'oe' && !$ref->{ordnumber})
- ? "<td><a href=$ref->{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{quonumber}</a></td>"
- : "<td>$ref->{quonumber}</td>";
+ if ($ref->{module} eq 'oe') {
+ my $edit_oe_link = build_std_url("script=oe.pl", 'action=edit', 'type=' . E($ref->{type}), 'id=' . E($ref->{trans_id}), 'callback');
+ $row->{ordnumber}->{link} = $edit_oe_link;
+ $row->{quonumber}->{link} = $edit_oe_link if (!$ref->{ordnumber});
- $column_data{name} = "<td>$ref->{name}</td>";
+ } else {
+ $row->{invnumber}->{link} = build_std_url("script=$ref->{module}.pl", 'action=edit', 'type=invoice', 'id=' . E($ref->{trans_id}), 'callback');
+ }
- $column_data{image} =
- ($ref->{image})
- ? "<td><a href=$ref->{image}><img src=$ref->{image} height=32 border=0></a></td>"
- : "<td> </td>";
- $column_data{drawing} =
- ($ref->{drawing})
- ? "<td><a href=$ref->{drawing}>$ref->{drawing}</a></td>"
- : "<td> </td>";
- $column_data{microfiche} =
- ($ref->{microfiche})
- ? "<td><a href=$ref->{microfiche}>$ref->{microfiche}</a></td>"
- : "<td> </td>";
+ if ($ref->{image} && (lc $report->{options}->{output_format} eq 'html')) {
+ $row->{image}->{data} = '';
+ $row->{image}->{raw_data} = '<a href="' . H($ref->{image}) . '"><img src="' . H($ref->{image}) . '" height="32" border="0"></a>';
+ }
+ map { $row->{$_}->{link} = $ref->{$_} } qw(drawing microfiche);
- $column_data{serialnumber} = "<td>$ref->{serialnumber}</td>";
+ $report->add_data($row);
- $column_data{soldtotal} =
- "<td align=right>"
- . $form->format_amount(\%myconfig, $ref->{soldtotal}, '', " ")
- . "</td>";
+ my $next_ref = $form->{parts}->[$idx + 1];
- $column_data{deliverydate} = "<td>$ref->{deliverydate}</td>";
+ if (($form->{l_subtotal} eq 'Y') &&
+ (!$next_ref ||
+ (!$next_ref->{assemblyitem} && ($same_item ne $next_ref->{ $form->{sort} })))) {
+ my $row = { map { $_ => { 'class' => 'listsubtotal', } } @columns };
- $i++;
- $i %= 2;
- print "<tr class=listrow$i>";
+ if (($form->{searchitems} ne 'assembly') || !$form->{bom}) {
+ $row->{onhand}->{data} = $form->format_amount(\%myconfig, $subtotals{onhand});
+ }
- map { print "\n$column_data{$_}" } @column_index;
+ map { $row->{"linetotal$_"}->{data} = $form->format_amount(\%myconfig, $subtotals{$_}, 2) } @subtotal_columns;
+ map { $subtotals{$_} = 0 } ('onhand', @subtotal_columns);
- print qq|
- </tr>
-|;
+ $report->add_data($row);
- }
+ $same_item = $next_ref->{ $form->{sort} };
+ }
- if ($form->{l_subtotal} eq 'Y') {
- &parts_subtotal;
+ $idx++;
}
if ($form->{"l_linetotal"}) {
- map { $column_data{$_} = "<td> </td>" } @column_index;
- $column_data{linetotalsellprice} =
- "<th class=listtotal align=right>"
- . $form->format_amount(\%myconfig, $totalsellprice, 2, " ")
- . "</th>";
- $column_data{linetotallastcost} =
- "<th class=listtotal align=right>"
- . $form->format_amount(\%myconfig, $totallastcost, 2, " ")
- . "</th>";
- $column_data{linetotallistprice} =
- "<th class=listtotal align=right>"
- . $form->format_amount(\%myconfig, $totallistprice, 2, " ")
- . "</th>";
+ my $row = { map { $_ => { 'class' => 'listtotal', } } @columns };
- print "<tr class=listtotal>";
+ map { $row->{"linetotal$_"}->{data} = $form->format_amount(\%myconfig, $totals{$_}, 2) } @subtotal_columns;
- map { print "\n$column_data{$_}" } @column_index;
-
- print qq|</tr>
- |;
+ $report->add_separator();
+ $report->add_data($row);
}
- print qq|
- <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
-</table>
-
-|;
-
- print qq|
-
-<br>
-
-<form method=post action=$form->{script}>
-
-<input name=callback type=hidden value="$form->{callback}">
-
-<input type=hidden name=item value=$form->{searchitems}>
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>|;
-
- print qq|
- <input class=submit type=submit name=action value="|
- . $locale->text('Add') . qq|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
- </form>
-
-</body>
-</html>
-|;
+ $report->generate_with_headers();
$lxdebug->leave_sub();
} #end generate_report
sub parts_subtotal {
$lxdebug->enter_sub();
+
+ # imports
+ our (%column_data, @column_index);
+ our ($subtotalonhand, $totalsellprice, $totallastcost, $totallistprice, $subtotalsellprice, $subtotallastcost, $subtotallistprice);
map { $column_data{$_} = "<td> </td>" } @column_index;
$subtotalonhand = 0 if ($form->{searchitems} eq 'assembly' && $form->{bom});
$column_data{onhand} =
"<th class=listsubtotal align=right>"
- . $form->format_amount(\%myconfig, $subtotalonhand, '', " ")
+ . $form->format_amount(\%myconfig, $subtotalonhand)
. "</th>";
$column_data{linetotalsellprice} =
"<th class=listsubtotal align=right>"
- . $form->format_amount(\%myconfig, $subtotalsellprice, 2, " ")
+ . $form->format_amount(\%myconfig, $subtotalsellprice, 2)
. "</th>";
$column_data{linetotallistprice} =
"<th class=listsubtotal align=right>"
- . $form->format_amount(\%myconfig, $subtotallistprice, 2, " ")
+ . $form->format_amount(\%myconfig, $subtotallistprice, 2)
. "</th>";
$column_data{linetotallastcost} =
"<th class=listsubtotal align=right>"
- . $form->format_amount(\%myconfig, $subtotallastcost, 2, " ")
+ . $form->format_amount(\%myconfig, $subtotallastcost, 2)
. "</th>";
$subtotalonhand = 0;
sub edit {
$lxdebug->enter_sub();
-
+ # show history button
+ $form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
+ #/show hhistory button
IC->get_part(\%myconfig, \%$form);
$form->{"original_partnumber"} = $form->{"partnumber"};
IC->create_links("IC", \%myconfig, \%$form);
# currencies
- map { $form->{selectcurrency} .= "<option>$_\n" } split /:/,
- $form->{currencies};
+ map({ $form->{selectcurrency} .= "<option>$_\n" }
+ split(/:/, $form->{currencies}));
# parts and assemblies have the same links
- $item = $form->{item};
+ my $item = $form->{item};
if ($form->{item} eq 'assembly') {
$item = 'part';
}
# build the popup menus
$form->{taxaccounts} = "";
- foreach $key (keys %{ $form->{IC_links} }) {
- foreach $ref (@{ $form->{IC_links}{$key} }) {
+ foreach my $key (keys %{ $form->{IC_links} }) {
+ foreach my $ref (@{ $form->{IC_links}{$key} }) {
# if this is a tax field
if ($key =~ /IC_tax/) {
if ($form->{item} eq 'assembly') {
- foreach $i (1 .. $form->{assembly_rows}) {
+ foreach my $i (1 .. $form->{assembly_rows}) {
if ($form->{"partsgroup_id_$i"}) {
$form->{"partsgroup_$i"} =
qq|$form->{"partsgroup_$i"}--$form->{"partsgroup_id_$i"}|;
sub form_header {
$lxdebug->enter_sub();
- my $dec = '';
+ my ($payment, $rows, $notes, $description, $ean, $buchungsgruppe, $partsgroup, $group, $tax, $lastcost, $eur, $linkaccounts, $weight, $n, $rop, $bin, $vegv);
+ my ($notdiscountableok, $notdiscountable);
+ my ($formula, $formula_label, $imagelinks, $obsolete, $shopok, $shop);
- #decimalplaces for listprice
- ($dec) = ($form->{listprice} =~ /\.(\d+)/);
- $dec = length $dec;
- my $decimalplaces = ($dec == 2) ? $dec : 2;
- $form->{listprice} =
- $form->format_amount(\%myconfig, $form->{listprice}, $decimalplaces);
- #decimalplaces for sellprice and gv
- ($dec) = ($form->{sellprice} =~ /\.(\d+)/);
- $dec = length $dec;
- my $decimalplaces = ($dec == 2) ? $dec : 2;
-
- map {
- $form->{$_} =
- $form->format_amount(\%myconfig, $form->{$_}, $decimalplaces)
- } qw(sellprice gv);
-
- ($dec) = ($form->{lastcost} =~ /\.(\d+)/);
- $dec = length $dec;
- my $decimalplaces = ($dec == 2) ? $dec : 2;
-
- $form->{lastcost} =
- $form->format_amount(\%myconfig, $form->{lastcost}, $decimalplaces);
+ map({ $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, -2) }
+ qw(sellprice listprice lastcost gv));
map { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}) }
qw(weight rop stock);
- foreach $item (qw(partnumber description unit notes)) {
+ foreach my $item (qw(partnumber description unit notes)) {
$form->{$item} =~ s/\"/"/g;
}
$payment = qq|<option value=""></option>|;
- foreach $item (@{ $form->{payment_terms} }) {
+ foreach my $item (@{ $form->{payment_terms} }) {
if ($form->{payment_id} eq $item->{id}) {
$payment .= qq|<option value="$item->{id}" selected>$item->{description}</option>|;
} else {
}
$notes =
- qq|<textarea name=notes rows=$rows cols=50 wrap=soft>$form->{notes}</textarea>|;
+ qq|<textarea name=notes rows=$rows cols=45 wrap=soft>$form->{notes}</textarea>|;
if (($rows = $form->numtextrows($form->{description}, 40)) > 1) {
$description =
qq|<textarea name="description" rows=$rows cols=40 wrap=soft>$form->{description}</textarea>|;
qq|<input name=description size=40 value="$form->{description}">|;
}
- foreach $item (split / /, $form->{taxaccounts}) {
+ $ean = qq|<input name=ean size=40 value="$form->{ean}">|;
+
+ foreach my $item (split / /, $form->{taxaccounts}) {
$form->{"IC_tax_$item"} = ($form->{"IC_tax_$item"}) ? "checked" : "";
}
IC->retrieve_buchungsgruppen(\%myconfig, $form);
if (@{ $form->{BUCHUNGSGRUPPEN} }) {
- foreach $item (@{ $form->{BUCHUNGSGRUPPEN} }) {
+ foreach my $item (@{ $form->{BUCHUNGSGRUPPEN} }) {
if ($item->{id} == $form->{buchungsgruppen_id}) {
$form->{selectbuchungsgruppe} .=
"<option value=$item->{id} selected>$item->{description}\n";
# set option
- foreach $item (qw(IC IC_income IC_expense)) {
+ foreach my $item (qw(IC IC_income IC_expense)) {
if ($form->{$item}) {
if ($form->{id} && $form->{orphaned}) {
$form->{"select$item"} =~ s/ selected//;
}
# tax fields
- foreach $item (split / /, $form->{taxaccounts}) {
+ foreach my $item (split / /, $form->{taxaccounts}) {
$tax .= qq|
<input class=checkbox type=checkbox name="IC_tax_$item" value=1 $form->{"IC_tax_$item"}> <b>$form->{"IC_tax_${item}_description"}</b>
<br><input type=hidden name=IC_tax_${item}_description value="$form->{"IC_tax_${item}_description"}">
</tr>
<tr>
<th align="right" nowrap="true">|
- . $locale->text('Geschäftsvolumen') . qq|</th>
+ . $locale->text('Business Volume') . qq|</th>
<td><input name=gv size=10 value=$form->{gv}></td>
</tr>
|;
</tr>
|;
- $formel =
- qq|<ilayer><layer onmouseover="this.T_STICKY=true;this.T_STATIC=true;return escape('| . $locale->text('The formula needs the following syntax:<br>For regular article:<br>Variablename= Variable Unit;<br>Variablename2= Variable2 Unit2;<br>...<br>###<br>Variable + ( Variable2 / Variable )<br><b>Please be beware of the spaces in the formula</b><br>') . qq|')"><textarea name=formel rows=4 cols=40 wrap=soft>$form->{formel}</textarea></layer><ilayer>|;
+ $formula =
+ qq|<ilayer><layer onmouseover="this.T_STICKY=true;this.T_STATIC=true;return escape('| . $locale->text('The formula needs the following syntax:<br>For regular article:<br>Variablename= Variable Unit;<br>Variablename2= Variable2 Unit2;<br>...<br>###<br>Variable + ( Variable2 / Variable )<br><b>Please be beware of the spaces in the formula</b><br>') . qq|')"><textarea name=formel rows=4 cols=30 wrap=soft>$form->{formel}</textarea></layer><ilayer>|;
+
+ $formula_label = $locale->text('Formula');
+
$imagelinks = qq|
<tr>
<td>
# type=submit $locale->text('Edit Service')
# type=submit $locale->text('Edit Assembly')
# use JavaScript Calendar or not
- $form->{jsscript} = $jscalendar;
+ my ($jsscript, $button1);
+ $form->{jsscript} = 1;
$jsscript = "";
if ($form->{jsscript}) {
</td>
<tr>
<th align="left">| . $locale->text('Notes') . qq|</th>
- <th align="left">| . $locale->text('Formula') . qq|</th>
+ <th align="left">$formula_label</th>
</tr>
<tr>
<td>
$notes
</td>
<td>
- $formel
+ $formula
</td>
</tr>
<tr>
- <td colspan=2>
+ <th align="left"></th>
+ <th align="left">| . $locale->text('EAN-Code') . qq|</th>
+ </tr>
+ <tr>
+ <td>
<button type="button" onclick="parts_language_selection_window('language_values')">| . $locale->text('Set Language Values') . qq|</button>
</td>
+ <td>
+ $ean
+ </td>
</tr>
<tr>
<td colspan=2>
}
print qq|
- <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 type=hidden name=callback value="$form->{callback}">
if (!$form->{previousform}) {
if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
+ require "bin/mozilla/menu.pl";
&menubar;
}
}
-
+# button for saving history
+ if($form->{id} ne "") {
+ print qq|
+ <input type=button class=submit onclick=set_history_window(|
+ . $form->{id}
+ . qq|); name=history id=history value=|
+ . $locale->text('history')
+ . qq|>|;
+ }
+# /button for saving history
print qq|
</form>
+
<script type="text/javascript" src="js/wz_tooltip.js"></script>
</body>
sub makemodel_row {
$lxdebug->enter_sub();
my ($numrows) = @_;
-
- $form->{"make_$i"} =~ s/\"/"/g;
- $form->{"model_$i"} =~ s/\"/"/g;
-
+
print qq|
<tr>
<td>
</tr>
|;
- for $i (1 .. $numrows) {
+ for my $i (1 .. $numrows) {
+ $form->{"make_$i"} =~ s/\"/"/g;
+ $form->{"model_$i"} =~ s/\"/"/g;
print qq|
<tr>
<td width=50%><input name="make_$i" size=30 value="$form->{"make_$i"}"></td>
sub assembly_row {
$lxdebug->enter_sub();
my ($numrows) = @_;
+ my (@column_index, %column_data, %column_header);
+ my ($nochange, $callback, $previousform, $linetotal, $href);
+
+ our ($deliverydate); # ToDO: cjeck if this indeed comes from global context
@column_index =
qw(runningnumber qty unit bom partnumber description partsgroup total);
$previousform = "";
# save form variables in a previousform variable
- foreach $key (sort keys %$form) {
+ foreach my $key (sort keys %$form) {
# escape ampersands
$form->{$key} =~ s/&/%26/g;
</tr>
|;
- for $i (1 .. $numrows) {
+ for my $i (1 .. $numrows) {
$form->{"partnumber_$i"} =~ s/\"/"/g;
$linetotal =
} else {
$href =
- qq|$form->{script}?action=edit&id=$form->{"id_$i"}&path=$form->{path}&login=$form->{login}&password=$form->{password}&rowcount=$i&previousform=$previousform|;
+ qq|$form->{script}?action=edit&id=$form->{"id_$i"}&login=$form->{login}&password=$form->{password}&rowcount=$i&previousform=$previousform|;
$column_data{partnumber} =
qq|<td><input type=hidden name="partnumber_$i" value="$form->{"partnumber_$i"}"><a href=$href>$form->{"partnumber_$i"}</a></td>|;
$column_data{runningnumber} =
$lxdebug->enter_sub();
if ($form->{item} eq "assembly") {
- $i = $form->{assembly_rows};
+ my $i = $form->{assembly_rows};
# if last row is empty check the form otherwise retrieve item
if ( ($form->{"partnumber_$i"} eq "")
IC->assembly_item(\%myconfig, \%$form);
- $rows = scalar @{ $form->{item_list} };
+ my $rows = scalar @{ $form->{item_list} };
if ($rows) {
$form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
}
}
- }
- if ($form->{item} eq "part") {
+ } elsif (($form->{item} eq 'part') || ($form->{item} eq 'service')) {
&check_form;
}
- if ($form->{item} eq 'service') {
- map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
- qw(sellprice listprice);
- &form_header;
- &price_row;
- &form_footer;
- }
-
$lxdebug->leave_sub();
}
sub save {
$lxdebug->enter_sub();
+ my ($parts_id, %newform, $previousform, $amount, $callback);
+
# check if there is a part number - commented out, cause there is an automatic allocation of numbers
# $form->isblank("partnumber", $locale->text(ucfirst $form->{item}." Part Number missing!"));
$locale->text(
"Inventory quantity must be zero before you can set this $form->{item} obsolete!"
))
- if ($form->{onhand});
+ if ($form->{onhand} * 1);
}
if (!$form->{buchungsgruppen_id}) {
# $locale->text('Assembly Number missing!')
# save part
- $lxdebug->message(LXDebug::DEBUG1,
- "ic.pl: sellprice in save = $form->{sellprice}\n");
- $rc = IC->save(\%myconfig, \%$form);
- if ($rc == 3) {
+ $lxdebug->message($LXDebug::DEBUG1, "ic.pl: sellprice in save = $form->{sellprice}\n");
+ if (IC->save(\%myconfig, \%$form) == 3) {
$form->error($locale->text('Partnumber not unique!'));
}
+ # saving the history
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|partnumber_| . $form->{partnumber};
+ $form->{addition} = "SAVED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
$parts_id = $form->{id};
+ my $i;
# load previous variables
if ($form->{previousform}) {
map { delete $form->{$_} } keys %newform;
# now take it apart and restore original values
- foreach $item (split /&/, $previousform) {
- ($key, $value) = split /=/, $item, 2;
+ foreach my $item (split /&/, $previousform) {
+ my ($key, $value) = split /=/, $item, 2;
$value =~ s/%26/&/g;
$form->{$key} = $value;
}
if ($form->{exchangerate} != 0) {
$form->{"sellprice_$i"} /= $form->{exchangerate};
}
- $lxdebug->message(LXDebug::DEBUG1,
- qq|sellprice_$i in previousform 2 = |
- . $form->{"sellprice_$i"} . qq|\n|);
+ $lxdebug->message($LXDebug::DEBUG1, qq|sellprice_$i in previousform 2 = | . $form->{"sellprice_$i"} . qq|\n|);
map { $form->{"taxaccounts_$i"} .= "$_ " } split / /,
$newform{taxaccount};
chop $form->{"taxaccounts_$i"};
- foreach $item (qw(description rate taxnumber)) {
- $index = $form->{"taxaccounts_$i"} . "_$item";
+ foreach my $item (qw(description rate taxnumber)) {
+ my $index = $form->{"taxaccounts_$i"} . "_$item";
$form->{$index} = $newform{$index};
}
$form->{makemodel_rows}--;
# put callback together
- foreach $key (keys %$form) {
+ foreach my $key (keys %$form) {
# do single escape for Apache 2.0
- $value = $form->escape($form->{$key}, 1);
+ my $value = $form->escape($form->{$key}, 1);
$callback .= qq|&$key=$value|;
}
$form->{callback} = $callback;
}
- $lxdebug->message(LXDebug::DEBUG1,
- qq|ic.pl: sellprice_$i nach sub save = |
- . $form->{"sellprice_$i"} . qq|\n|);
+ $lxdebug->message($LXDebug::DEBUG1, qq|ic.pl: sellprice_$i nach sub save = | . $form->{"sellprice_$i"} . qq|\n|);
# redirect
$form->redirect;
sub save_as_new {
$lxdebug->enter_sub();
+ # saving the history
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|partnumber_| . $form->{partnumber};
+ $form->{addition} = "SAVED AS NEW";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
$form->{id} = 0;
if ($form->{"original_partnumber"} &&
($form->{"partnumber"} eq $form->{"original_partnumber"})) {
$form->{partnumber} = "";
}
&save;
-
$lxdebug->leave_sub();
}
sub delete {
$lxdebug->enter_sub();
-
- $rc = IC->delete(\%myconfig, \%$form);
+ # saving the history
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|partnumber_| . $form->{partnumber};
+ $form->{addition} = "DELETED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
+ my $rc = IC->delete(\%myconfig, \%$form);
# redirect
$form->redirect($locale->text('Item deleted!')) if ($rc > 0);
$lxdebug->leave_sub();
}
-sub stock_assembly {
- $lxdebug->enter_sub();
-
- $form->{title} = $locale->text('Stock Assembly');
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<table width="100%">
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr valign=top>
- <td>
- <table>
- <tr>
- <th align="right" nowrap="true">|
- . $locale->text('Part Number') . qq|</th>
- <td><input name=partnumber size=20></td>
- <td> </td>
- </tr>
- <tr>
- <th align="right" nowrap="true">|
- . $locale->text('Part Description') . qq|</th>
- <td><input name=description size=40></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr><td><hr size=3 noshade></td></tr>
-</table>
-
-<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 type=hidden name=nextsub value=list_assemblies>
-
-<br>
-<input class=submit type=submit name=action value="|
- . $locale->text('Continue') . qq|">
-</form>
-
-</body>
-</html>
-|;
-
- $lxdebug->leave_sub();
-}
-
-sub list_assemblies {
- $lxdebug->enter_sub();
-
- IC->retrieve_assemblies(\%myconfig, \%$form);
-
- $column_header{partnumber} =
- qq|<th class=listheading>| . $locale->text('Part Number') . qq|</th>|;
- $column_header{description} =
- qq|<th class=listheading>| . $locale->text('Part Description') . qq|</th>|;
- $column_header{bin} =
- qq|<th class=listheading>| . $locale->text('Bin') . qq|</th>|;
- $column_header{onhand} =
- qq|<th class=listheading>| . $locale->text('Qty') . qq|</th>|;
- $column_header{rop} =
- qq|<th class=listheading>| . $locale->text('ROP') . qq|</th>|;
- $column_header{stock} =
- qq|<th class=listheading>| . $locale->text('Add') . qq|</th>|;
-
- @column_index = (qw(partnumber description bin onhand rop stock));
-
- $form->{title} = $locale->text('Stock Assembly');
-
- $form->{callback} =
- "$form->{script}?action=stock_assembly&path=$form->{path}&login=$form->{login}&password=$form->{password}";
-
- $form->header;
-
- $colspan = $#column_index + 1;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<table width=100%>
- <tr>
- <th class=listtop colspan=$colspan>$form->{title}</th>
- </tr>
- <tr size=5></tr>
- <tr class=listheading>|;
-
- map { print "\n$column_header{$_}" } @column_index;
-
- print qq|
- </tr>
-|;
-
- $i = 1;
- foreach $ref (@{ $form->{assembly_items} }) {
-
- map { $ref->{$_} =~ s/\"/"/g } qw(partnumber description);
-
- $column_data{partnumber} = qq|<td width=20%>$ref->{partnumber}</td>|;
- $column_data{description} =
- qq|<td width=50%>$ref->{description} </td>|;
- $column_data{bin} = qq|<td>$ref->{bin} </td>|;
- $column_data{onhand} =
- qq|<td align=right>|
- . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
- . qq|</td>|;
- $column_data{rop} =
- qq|<td align=right>|
- . $form->format_amount(\%myconfig, $ref->{rop}, '', " ")
- . qq|</td>|;
- $column_data{stock} = qq|<td width=10%><input name="qty_$i" size=10></td>|;
-
- $j++;
- $j %= 2;
- print
- qq|<tr class=listrow$j><input name="id_$i" type=hidden value=$ref->{id}>\n|;
-
- map { print "\n$column_data{$_}" } @column_index;
-
- print qq|
- </tr>
-|;
-
- $i++;
-
- }
-
- $i--;
- print qq|
- <tr>
- <td colspan=6><hr size=3 noshade>
- </tr>
-</table>
-<input name=rowcount type=hidden value="$i">
-
-<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 name=callback type=hidden value="$form->{callback}">
-
-<input type=hidden name=nextsub value=restock_assemblies>
-
-<br>
-<input class=submit type=submit name=action value="|
- . $locale->text('Continue') . qq|">
-
-</form>
-
-</body>
-</html>
-|;
-
- $lxdebug->leave_sub();
-}
-
-sub restock_assemblies {
- $lxdebug->enter_sub();
-
- $form->redirect($locale->text('Assemblies restocked!'))
- if (IC->restock_assemblies(\%myconfig, \%$form));
- $form->error($locale->text('Cannot stock assemblies!'));
-
- $lxdebug->leave_sub();
-}
-
sub price_row {
$lxdebug->enter_sub();
<th class="listheading">| . $locale->text('Preis') . qq|</th>
</tr>
|;
- for $i (1 .. $numrows) {
+ for my $i (1 .. $numrows) {
print qq|
<tr>
<td width=50%><input type=hidden name="pricegroup_$i" size=30 value="$form->{"pricegroup_$i"}">$form->{"pricegroup_$i"}</td>
$lxdebug->leave_sub();
}
-
sub parts_language_selection {
$lxdebug->enter_sub();
+ our ($onload);
my $languages = IC->retrieve_languages(\%myconfig, $form);
my $callback = "$form->{script}?action=parts_language_selection&";
map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" }
- (qw(login path password name input_name), grep({ /^[fl]_/ } keys %$form)));
+ (qw(login password name input_name), grep({ /^[fl]_/ } keys %$form)));
my @header_sort = qw(name longdescription);
my %header_title = ( "name" => $locale->text("Name"),
$lxdebug->leave_sub();
}
-sub continue { &{ $form->{nextsub} } }
+sub continue { call_sub($form->{"nextsub"}); }
--- /dev/null
+use SL::InstallationCheck;
+
+sub verify_installation {
+ my $script = $0;
+ $script =~ s|.*/||;
+
+ return unless ($form{"action"} && ($script eq "login.pl"));
+
+ my @missing_modules = SL::InstallationCheck::test_all_modules();
+ return if (scalar(@missing_modules) == 0);
+
+ use SL::Locale;
+ my $locale = new Locale($language, "installationcheck");
+
+ print(qq|content-type: text/html
+
+<html>
+ <head>
+ <link rel="stylesheet" href="css/lx-office-erp.css" type="text/css"
+ title="Lx-Office stylesheet">
+ <title>| . $locale->text("One or more Perl modules missing") . qq|</title>
+ </head>
+ <body>
+
+ <h1>| . $locale->text("One or more Perl modules missing") . qq|</h1>
+
+ <p>| . $locale->text("At least one Perl module that Lx-Office ERP " .
+ "requires for running is not installed on your " .
+ "system.") .
+ " " .
+ $locale->text("Please install the below listed modules or ask your " .
+ "system administrator to.") .
+ " " .
+ $locale->text("You cannot continue before all required modules are " .
+ "installed.") . qq|</p>
+
+ <p>
+ <table>
+ <tr>
+ <th class="listheading">| . $locale->text("Module name") . qq|</th>
+ <th class="listheading">| . $locale->text("Module home page") . qq|</th>
+ </tr>
+
+|);
+
+ my $odd = 1;
+ foreach my $module (@missing_modules) {
+ print(qq|
+ <tr class="listrow${odd}">
+ <td><code>$module->{name}</code></td>
+ <td><a href="$module->{url}">$module->{url}</a></td>
+ </tr>|);
+ $odd = 1 - $odd;
+ }
+
+ print(qq|
+ </table>
+ </p>
+
+ <p>| . $locale->text("There are usually three ways to install " .
+ "Perl modules.") .
+ " " .
+ $locale->text("The preferred one is to install packages provided by " .
+ "your operating system distribution (e.g. Debian or " .
+ "RPM packages).") . qq|</p>
+
+ <p>| . $locale->text("The second way is to use Perl's CPAN module and let " .
+ "it download and install the module for you.") .
+ " " .
+ $locale->text("Here's an example command line:") . qq|</p>
+
+ <p><code>perl -MCPAN -e "install CGI::Ajax"</code></p>
+
+ <p>| . $locale->text("The third way is to download the module from the " .
+ "above mentioned URL and to install the module " .
+ "manually following the installations instructions " .
+ "contained in the source archive.") . qq|</p>
+
+ </body>
+</html>
+|);
+ exit(0);
+}
+
+1;
#
#######################################################################
+use SL::Common;
use SL::CT;
use SL::IC;
use CGI::Ajax;
use CGI;
-require "$form->{path}/common.pl";
+require "bin/mozilla/common.pl";
# any custom scripts for this one
-if (-f "$form->{path}/custom_io.pl") {
- eval { require "$form->{path}/custom_io.pl"; };
+if (-f "bin/mozilla/custom_io.pl") {
+ eval { require "bin/mozilla/custom_io.pl"; };
}
-if (-f "$form->{path}/$form->{login}_io.pl") {
- eval { require "$form->{path}/$form->{login}_io.pl"; };
+if (-f "bin/mozilla/$form->{login}_io.pl") {
+ eval { require "bin/mozilla/$form->{login}_io.pl"; };
}
1;
$lxdebug->enter_sub();
my $numrows = shift;
+ my $is_sales =
+ (substr($form->{type}, 0, 6) eq "sales_")
+ || (($form->{type} eq "invoice") && ($form->{script} eq "is.pl"))
+ || ($form->{type} eq 'credit_note');
+
if ($lizenzen && $form->{vc} eq "customer") {
if ($form->{type} =~ /sales_order/) {
@column_index = (runningnumber, partnumber, description, ship, qty);
my $colspan = $#column_index + 1;
$form->{invsubtotal} = 0;
- map { $form->{"${_}_base"} = 0 } (split / /, $form->{taxaccounts});
+ map { $form->{"${_}_base"} = 0 } (split(/ /, $form->{taxaccounts}));
########################################
# Eintrag fuer Version 2.2.0 geaendert #
# neue Optik im Rechnungsformular #
########################################
$column_data{runningnumber} =
- qq|<th align=left nowrap width=5 class=listheading>|
+ qq|<th align="left" nowrap width="5" class="listheading">|
. $locale->text('No.')
. qq|</th>|;
$column_data{partnumber} =
- qq|<th align=left nowrap width=12 class=listheading>|
+ qq|<th align="left" nowrap width="12" class="listheading">|
. $locale->text('Number')
. qq|</th>|;
$column_data{description} =
- qq|<th align=left nowrap width=30 class=listheading>|
+ qq|<th align="left" nowrap width="30" class="listheading">|
. $locale->text('Part Description')
. qq|</th>|;
- $column_data{ship} =
- qq|<th align=left nowrap width=5 class=listheading>|
- . $locale->text('Ship')
- . qq|</th>|;
+ if ($form->{"type"} eq "purchase_order") {
+ $column_data{ship} =
+ qq|<th align="left" nowrap width="5" class="listheading">|
+ . $locale->text('Ship rcvd')
+ . qq|</th>|;
+ } else {
+ $column_data{ship} =
+ qq|<th align="left" nowrap width="5" class="listheading">|
+ . $locale->text('Ship')
+ . qq|</th>|;
+ }
$column_data{qty} =
- qq|<th align=left nowrap width=5 class=listheading>|
+ qq|<th align="left" nowrap width="5" class="listheading">|
. $locale->text('Qty')
. qq|</th>|;
$column_data{unit} =
- qq|<th align=left nowrap width=5 class=listheading>|
+ qq|<th align="left" nowrap width="5" class="listheading">|
. $locale->text('Unit')
. qq|</th>|;
$column_data{license} =
- qq|<th align=left nowrap width=10 class=listheading>|
+ qq|<th align="left" nowrap width="10" class="listheading">|
. $locale->text('License')
. qq|</th>|;
$column_data{serialnr} =
- qq|<th align=left nowrap width=10 class=listheading>|
+ qq|<th align="left" nowrap width="10" class="listheading">|
. $locale->text('Serial No.')
. qq|</th>|;
$column_data{projectnr} =
- qq|<th align=left nowrap width=10 class=listheading>|
+ qq|<th align="left" nowrap width="10" class="listheading">|
. $locale->text('Project')
. qq|</th>|;
$column_data{sellprice} =
- qq|<th align=left nowrap width=15 class=listheading>|
+ qq|<th align="left" nowrap width="15" class="listheading">|
. $locale->text('Price')
. qq|</th>|;
$column_data{sellprice_pg} =
- qq|<th align=left nowrap width=15 class=listheading>|
+ qq|<th align="left" nowrap width="15" class="listheading">|
. $locale->text('Pricegroup')
. qq|</th>|;
$column_data{discount} =
- qq|<th align=left class=listheading>|
+ qq|<th align="left" class="listheading">|
. $locale->text('Discount')
. qq|</th>|;
$column_data{linetotal} =
- qq|<th align=left nowrap width=10 class=listheading>|
+ qq|<th align="left" nowrap width="10" class="listheading">|
. $locale->text('Extended')
. qq|</th>|;
$column_data{bin} =
- qq|<th align=left nowrap width=10 class=listheading>|
+ qq|<th align="left" nowrap width="10" class="listheading">|
. $locale->text('Bin')
. qq|</th>|;
############## ENDE Neueintrag ##################
print qq|
<tr>
- <td>
- <input type="hidden" name="show_details" value="$form->{show_details}">
+ <td>| . $cgi->hidden("-name" => "show_details", "-value" => $form->{show_details}) . qq|
<input type="checkbox" id="cb_show_details" onclick="show_form_details($show_details_new);" $show_details_checked>
<label for="cb_show_details">| . $locale->text("Show details") . qq|</label><br>
- <table width=100%>
- <tr class=listheading>|;
+ <table width="100%">
+ <tr class="listheading">|;
map { print "\n$column_data{$_}" } @column_index;
$delvar = 'reqdate';
}
+ $form->{marge_total} = 0;
+ $form->{sellprice_total} = 0;
+ $form->{lastcost_total} = 0;
+ my %projectnumber_labels = ();
+ my @projectnumber_values = ("");
+ foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
+ push(@projectnumber_values, $item->{"id"});
+ $projectnumber_labels{$item->{"id"}} = $item->{"projectnumber"};
+ }
+
for $i (1 .. $numrows) {
# undo formatting
$form->{"unit_old_$i"} = $form->{"unit_$i"};
}
-
-
# Die zuletzt ausgewaehlte mit der aktuell ausgewaehlten Einheit
# vergleichen und bei Unterschied den Preis entsprechend umrechnen.
$form->{"selected_unit_$i"} = $form->{"unit_$i"} unless ($form->{"selected_unit_$i"});
$linetotal =
$form->round_amount($form->{"sellprice_$i"} - $discount, $decimalplaces);
$linetotal = $form->round_amount($linetotal * $form->{"qty_$i"}, 2);
+ my $real_sellprice = $form->{"sellprice_$i"} - $discount;
+
+ # marge calculations
+ my ($marge_font_start, $marge_font_end);
+
+ $form->{"lastcost_$i"} *= 1;
+
+ if ($real_sellprice && ($form->{"qty_$i"} * 1)) {
+ $form->{"marge_percent_$i"} = ($real_sellprice - $form->{"lastcost_$i"}) * 100 / $real_sellprice;
+ $myconfig{"marge_percent_warn"} = 15 unless (defined($myconfig{"marge_percent_warn"}));
+
+ if ($form->{"id_$i"} &&
+ ($form->{"marge_percent_$i"} < (1 * $myconfig{"marge_percent_warn"}))) {
+ $marge_font_start = "<font color=\"#ff0000\">";
+ $marge_font_end = "</font>";
+ }
+
+ } else {
+ $form->{"marge_percent_$i"} = 0;
+ }
+
+ my $marge_adjust_credit_note = $form->{type} eq 'credit_note' ? -1 : 1;
+ $form->{"marge_absolut_$i"} = ($real_sellprice - $form->{"lastcost_$i"}) * $form->{"qty_$i"} * $marge_adjust_credit_note;
+ $form->{"marge_total"} += $form->{"marge_absolut_$i"};
+ $form->{"lastcost_total"} += $form->{"lastcost_$i"} * $form->{"qty_$i"};
+ $form->{"sellprice_total"} += $real_sellprice * $form->{"qty_$i"};
+
+ map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) } qw(marge_absolut marge_percent);
# convert " to "
map { $form->{"${_}_$i"} =~ s/\"/"/g }
# neue Optik im Rechnungsformular #
########################################
$column_data{runningnumber} =
- qq|<td><input name="runningnumber_$i" size=5 value=$i></td>|; # HuT
+ qq|<td><input name="runningnumber_$i" size="5" value="$i"></td>|; # HuT
############## ENDE Neueintrag ##################
$column_data{partnumber} =
if (($rows = $form->numtextrows($form->{"description_$i"}, 30, 6)) > 1) {
$column_data{description} =
- qq|<td><textarea name="description_$i" rows=$rows cols=30 wrap=soft>$form->{"description_$i"}</textarea><button type="button" onclick="set_longdescription_window('longdescription_$i')">| . $locale->text('L') . qq|</button></td>|;
+ qq|<td><textarea name="description_$i" rows="$rows" cols="30" wrap="soft">| . H($form->{"description_$i"}) . qq|</textarea><button type="button" onclick="set_longdescription_window('longdescription_$i')">| . $locale->text('L') . qq|</button></td>|;
} else {
$column_data{description} =
- qq|<td><input name="description_$i" size=30 value="$form->{"description_$i"}"><button type="button" onclick="set_longdescription_window('longdescription_$i')">| . $locale->text('L') . qq|</button></td>|;
+ qq|<td><input name="description_$i" size="30" value="| . $form->quote($form->{"description_$i"}) . qq|"><button type="button" onclick="set_longdescription_window('longdescription_$i')">| . $locale->text('L') . qq|</button></td>|;
}
(my $qty_dec) = ($form->{"qty_$i"} =~ /\.(\d+)/);
$qty_dec = length $qty_dec;
$column_data{qty} =
- qq|<td align=right><input name="qty_$i" size=5 value=|
- . $form->format_amount(\%myconfig, $form->{"qty_$i"}, $qty_dec) .qq|>|;
+ qq|<td align="right"><input name="qty_$i" size="5" value="|
+ . $form->format_amount(\%myconfig, $form->{"qty_$i"}, $qty_dec) .qq|">|;
if ($form->{"formel_$i"}) {
- $column_data{qty} .= qq|<button type="button" onclick="calculate_qty_selection_window('qty_$i','alu_$i', 'formel_$i', $i)">| . $locale->text('*/') . qq|</button>
- <input type=hidden name="formel_$i" value="$form->{"formel_$i"}"><input type=hidden name="alu_$i" value="$form->{"alu_$i"}"></td>|;
+ $column_data{qty} .= qq|<button type="button" onclick="calculate_qty_selection_window('qty_$i','alu_$i', 'formel_$i', $i)">| . $locale->text('*/') . qq|</button>|
+ . $cgi->hidden("-name" => "formel_$i", "-value" => $form->{"formel_$i"}) . $cgi->hidden("-name" => "alu_$i", "-value" => $form->{"alu_$i"});
}
+ $column_data{qty} .= qq|</td>|;
$column_data{ship} =
- qq|<td align=right><input name="ship_$i" size=5 value=|
+ qq|<td align="right"><input name="ship_$i" size=5 value="|
. $form->format_amount(\%myconfig, $form->{"ship_$i"})
- . qq|></td>|;
+ . qq|"></td>|;
- my $is_part = $form->{"inventory_accno_$i"};
+ my $is_part = $form->{"inventory_accno_$i"};
+ my $is_assembly = $form->{"assembly_$i"};
my $is_assigned = $form->{"id_$i"};
my $this_unit = $form->{"unit_$i"};
if ($form->{"selected_unit_$i"} && $this_unit &&
}
$column_data{"unit"} = "<td>" .
- ($qty_readonly ? " " :
- AM->unit_select_html($is_part ? $dimension_units :
+ AM->unit_select_html($is_part || $is_assembly ? $dimension_units :
$is_assigned ? $service_units : $all_units,
"unit_$i", $this_unit,
- $is_assigned ? $form->{"unit_$i"} : undef))
+ $is_assigned ? $form->{"unit_$i"} : undef)
. "</td>";
# build in drop down list for pricesgroups
}
$column_data{sellprice_pg} =
- qq|<td align=right><select name="sellprice_pg_$i">$form->{"prices_$i"}</select></td>|;
+ qq|<td align="right"><select name="sellprice_pg_$i">$form->{"prices_$i"}</select></td>|;
$column_data{sellprice} =
- qq|<td><input name="sellprice_$i" size=10 value=$price_tmp></td>|;
+ qq|<td><input name="sellprice_$i" size="10" value="$price_tmp" onBlur=\"check_right_number_format(this)\"></td>|;
} else {
# for last row and report
$form->{"pricegroup_old_$i"} = $form->{"pricegroup_id_$i"};
$column_data{sellprice_pg} =
- qq|<td align=right><select name="sellprice_pg_$i">$prices</select></td>|;
+ qq|<td align="right"><select name="sellprice_pg_$i">$prices</select></td>|;
} else {
# for last row
- $column_data{sellprice_pg} = qq|<td align=right> </td>|;
- }
-
+ $column_data{sellprice_pg} = qq|<td align="right"> </td>|;
+ }
+
$column_data{sellprice} =
- qq|<td><input name="sellprice_$i" size=10 value=|
+ qq|<td><input name="sellprice_$i" size="10" onBlur=\"check_right_number_format(this)\" value="|
. $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
$decimalplaces)
- . qq|></td>|;
+ . qq|"></td>|;
}
$column_data{discount} =
- qq|<td align=right><input name="discount_$i" size=3 value=|
+ qq|<td align="right"><input name="discount_$i" size=3 value="|
. $form->format_amount(\%myconfig, $form->{"discount_$i"})
- . qq|></td>|;
+ . qq|"></td>|;
$column_data{linetotal} =
- qq|<td align=right>|
+ qq|<td align="right">|
. $form->format_amount(\%myconfig, $linetotal, 2)
. qq|</td>|;
$column_data{bin} = qq|<td>$form->{"bin_$i"}</td>|;
my $j = $i % 2;
print qq|
- <tr valign=top class=listrow$j>|;
+ <tr valign="top" class="listrow$j">|;
map { print "\n$column_data{$_}" } @column_index;
- print qq|
- </tr>
-
-<input type=hidden name="orderitems_id_$i" value=$form->{"orderitems_id_$i"}>
-<input type=hidden name="bo_$i" value=$form->{"bo_$i"}>
-
-<input type=hidden name="pricegroup_old_$i" value=$form->{"pricegroup_old_$i"}>
-<input type=hidden name="price_old_$i" value=$form->{"price_old_$i"}>
-<input type=hidden name="unit_old_$i" value="$form->{"selected_unit_$i"}">
-<input type=hidden name="price_new_$i" value=|
- . $form->format_amount(\%myconfig, $form->{"price_new_$i"}) . qq|>
-
-<input type=hidden name="id_$i" value=$form->{"id_$i"}>
-<input type=hidden name="inventory_accno_$i" value=$form->{"inventory_accno_$i"}>
-<input type=hidden name="bin_$i" value="$form->{"bin_$i"}">
-<input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">
-<input type=hidden name="partnotes_$i" value="$form->{"partnotes_$i"}">
-<input type=hidden name="income_accno_$i" value=$form->{"income_accno_$i"}>
-<input type=hidden name="expense_accno_$i" value=$form->{"expense_accno_$i"}>
-<input type=hidden name="listprice_$i" value="$form->{"listprice_$i"}">
-<input type=hidden name="assembly_$i" value="$form->{"assembly_$i"}">
-<input type=hidden name="taxaccounts_$i" value="$form->{"taxaccounts_$i"}">
-<input type=hidden name="ordnumber_$i" value="$form->{"ordnumber_$i"}">
-<input type=hidden name="transdate_$i" value="$form->{"transdate_$i"}">
-<input type=hidden name="cusordnumber_$i" value="$form->{"cusordnumber_$i"}">
-<input type=hidden name="longdescription_$i" value="$form->{"longdescription_$i"}">
-<input type=hidden name="basefactor_$i" value="$form->{"basefactor_$i"}">
-
-|;
+ print("</tr>\n" .
+ $cgi->hidden("-name" => "unit_old_$i",
+ "-value" => $form->{"selected_unit_$i"})
+ . "\n" .
+ $cgi->hidden("-name" => "price_new_$i",
+ "-value" => $form->format_amount(\%myconfig, $form->{"price_new_$i"}))
+ . "\n");
+ map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_}) . "\n"); }
+ ("orderitems_id_$i", "bo_$i", "pricegroup_old_$i", "price_old_$i",
+ "id_$i", "inventory_accno_$i", "bin_$i", "partsgroup_$i", "partnotes_$i",
+ "income_accno_$i", "expense_accno_$i", "listprice_$i", "assembly_$i",
+ "taxaccounts_$i", "ordnumber_$i", "transdate_$i", "cusordnumber_$i",
+ "longdescription_$i", "basefactor_$i", "marge_absolut_$i", "marge_percent_$i", "lastcost_$i"));
########################################
# Eintrag fuer Version 2.2.0 geaendert #
# print second row
print qq|
- <tr class=listrow$j $row_style_attr>
- <td colspan=$colspan>
+ <tr class="listrow$j" $row_style_attr>
+ <td colspan="$colspan">
|;
if ($lizenzen && $form->{type} eq "invoice" && $form->{vc} eq "customer") {
my $selected = $form->{"licensenumber_$i"};
$lizenzen_quoted = $form->{"lizenzen_$i"};
$lizenzen_quoted =~ s/\"/"/g;
print qq|
- <b>Lizenz\#</b> <select name="licensenumber_$i" size=1>
+ <b>Lizenz\#</b> <select name="licensenumber_$i" size="1">
$form->{"lizenzen_$i"}
</select>
- <input type=hidden name="lizenzen_$i" value="${lizenzen_quoted}">
+ <input type="hidden" name="lizenzen_$i" value="${lizenzen_quoted}">
|;
}
if ($form->{type} !~ /_quotation/) {
print qq|
- <b>$serialnumber</b> <input name="serialnumber_$i" size=15 value="$form->{"serialnumber_$i"}">|;
+ <b>$serialnumber</b> <input name="serialnumber_$i" size="15" value="$form->{"serialnumber_$i"}">|;
}
- print qq|
- <b>$projectnumber</b> <input name="projectnumber_$i" size=10 value="$form->{"projectnumber_$i"}">
- <input type=hidden name="oldprojectnumber_$i" value="$form->{"oldprojectnumber_$i"}">
- <input type=hidden name="project_id_$i" value="$form->{"project_id_$i"}">
-|;
+ print qq|<b>$projectnumber</b> | .
+ NTI($cgi->popup_menu('-name' => "project_id_$i",
+ '-values' => \@projectnumber_values,
+ '-labels' => \%projectnumber_labels,
+ '-default' => $form->{"project_id_$i"}));
+
if ($form->{type} eq 'invoice' or $form->{type} =~ /order/) {
my $reqdate_term =
($form->{type} eq 'invoice')
? 'deliverydate'
: 'reqdate'; # invoice uses a different term for the same thing.
print qq|
- <b>${$reqdate_term}</b> <input name="${reqdate_term}_$i" size=11 value="$form->{"${reqdate_term}_$i"}">
+ <b>${$reqdate_term}</b> <input name="${reqdate_term}_$i" size="11" onBlur="check_right_date_format(this)" value="$form->{"${reqdate_term}_$i"}">
|;
}
my $subtotalchecked = ($form->{"subtotal_$i"}) ? "checked" : "";
print qq|
<b>|.$locale->text('Subtotal').qq|</b> <input type="checkbox" name="subtotal_$i" value="1" "$subtotalchecked">
+|;
+
+ if ($form->{"id_$i"} && $is_sales) {
+ print qq|
+ ${marge_font_start}<b>| . $locale->text('Ertrag') . qq|</b> $form->{"marge_absolut_$i"} $form->{"marge_percent_$i"} % ${marge_font_end}
+ <b>| . $locale->text('LP') . qq|</b> | . $form->format_amount(\%myconfig, $form->{"listprice_$i"}, 2) . qq|
+ <b>| . $locale->text('EK') . qq|</b> | . $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, 2);
+ }
+
+ print qq|
</td>
</tr>
-
|;
############## ENDE Neueintrag ##################
map { $form->{"${_}_base"} += $linetotal }
- (split / /, $form->{"taxaccounts_$i"});
+ (split(/ /, $form->{"taxaccounts_$i"}));
$form->{invsubtotal} += $linetotal;
}
</tr>
|;
+ if (0 != ($form->{sellprice_total} * 1)) {
+ $form->{marge_percent} = ($form->{sellprice_total} - $form->{lastcost_total}) / $form->{sellprice_total} * 100;
+ }
+
$lxdebug->leave_sub();
}
$column_data{ndx} = qq|<th> </th>|;
$column_data{partnumber} =
- qq|<th class=listheading>| . $locale->text('Number') . qq|</th>|;
+ qq|<th class="listheading">| . $locale->text('Number') . qq|</th>|;
$column_data{description} =
- qq|<th class=listheading>| . $locale->text('Part Description') . qq|</th>|;
+ qq|<th class="listheading">| . $locale->text('Part Description') . qq|</th>|;
$column_data{sellprice} =
- qq|<th class=listheading>| . $locale->text('Price') . qq|</th>|;
+ qq|<th class="listheading">| . $locale->text('Price') . qq|</th>|;
$column_data{onhand} =
- qq|<th class=listheading>| . $locale->text('Qty') . qq|</th>|;
+ qq|<th class="listheading">| . $locale->text('Qty') . qq|</th>|;
$column_data{unit} =
- qq|<th class=listheading>| . $locale->text('Unit') . qq|</th>|;
+ qq|<th class="listheading">| . $locale->text('Unit') . qq|</th>|;
# list items with radio button on a form
$form->header;
$colspan = $#column_index + 1;
print qq|
-<body>
+ <body>
-<form method=post action=$form->{script}>
+<form method="post" action="$form->{script}">
-<table width=100%>
+<table width="100%">
<tr>
- <th class=listtop colspan=$colspan>$title</th>
+ <th class="listtop" colspan="$colspan">$title</th>
</tr>
<tr height="5"></tr>
- <tr class=listheading>|;
+ <tr class="listheading">|;
map { print "\n$column_data{$_}" } @column_index;
$ref->{"lizenzen"} .=
qq|<option value=\"$item->{"id"}\">$item->{"licensenumber"}</option>|;
}
- $ref->{"lizenzen"} .= qq|<option value=-1>Neue Lizenz</option>|;
+ $ref->{"lizenzen"} .= qq|<option value="-1">Neue Lizenz</option>|;
$ref->{"lizenzen"} =~ s/\"/"/g;
}
}
$ref->{sellprice} =
$form->round_amount($ref->{sellprice} * (1 - $form->{tradediscount}), 2);
$column_data{ndx} =
- qq|<td><input name=ndx class=radio type=radio value=$i $checked></td>|;
+ qq|<td><input name="ndx" class="radio" type="radio" value="$i" $checked></td>|;
$column_data{partnumber} =
- qq|<td><input name="new_partnumber_$i" type=hidden value="$ref->{partnumber}">$ref->{partnumber}</td>|;
+ qq|<td><input name="new_partnumber_$i" type="hidden" value="$ref->{partnumber}">$ref->{partnumber}</td>|;
$column_data{description} =
- qq|<td><input name="new_description_$i" type=hidden value="$ref->{description}">$ref->{description}</td>|;
+ qq|<td><input name="new_description_$i" type="hidden" value="$ref->{description}">$ref->{description}</td>|;
$column_data{sellprice} =
- qq|<td align=right><input name="new_sellprice_$i" type=hidden value=$ref->{sellprice}>|
+ qq|<td align="right"><input name="new_sellprice_$i" type="hidden" value="$ref->{sellprice}">|
. $form->format_amount(\%myconfig, $ref->{sellprice}, 2, " ")
. qq|</td>|;
$column_data{onhand} =
- qq|<td align=right><input name="new_onhand_$i" type=hidden value=$ref->{onhand}>|
+ qq|<td align="right"><input name="new_onhand_$i" type="hidden" value="$ref->{onhand}">|
. $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
. qq|</td>|;
$column_data{unit} =
map { print "\n$column_data{$_}" } @column_index;
- print qq|
-</tr>
-
-<input name="new_bin_$i" type=hidden value="$ref->{bin}">
-<input name="new_listprice_$i" type=hidden value=$ref->{listprice}>
-<input name="new_inventory_accno_$i" type=hidden value=$ref->{inventory_accno}>
-<input name="new_income_accno_$i" type=hidden value=$ref->{income_accno}>
-<input name="new_expense_accno_$i" type=hidden value=$ref->{expense_accno}>
-<input name="new_unit_$i" type=hidden value="$ref->{unit}">
-<input name="new_weight_$i" type=hidden value="$ref->{weight}">
-<input name="new_assembly_$i" type=hidden value="$ref->{assembly}">
-<input name="new_taxaccounts_$i" type=hidden value="$ref->{taxaccounts}">
-<input name="new_partsgroup_$i" type=hidden value="$ref->{partsgroup}">
-<input name="new_formel_$i" type=hidden value="$ref->{formel}">
-<input name="new_longdescription_$i" type=hidden value="$ref->{longdescription}">
-<input name="new_not_discountable_$i" type=hidden value="$ref->{not_discountable}">
-<input name="new_part_payment_id_$i" type=hidden value="$ref->{part_payment_id}">
-
-<input name="new_id_$i" type=hidden value=$ref->{id}>
+ print("</tr>\n");
-|;
- if ($lizenzen) {
- print qq|
-<input name="new_lizenzen_$i" type=hidden value="$ref->{lizenzen}">
-|;
- }
+ my @new_fields =
+ qw(bin listprice inventory_accno income_accno expense_accno unit weight
+ assembly taxaccounts partsgroup formel longdescription not_discountable
+ part_payment_id partnotes id lastcost);
+ push(@new_fields, "lizenzen") if ($lizenzen);
+ print join "\n", map { $cgi->hidden("-name" => "new_${_}_$i", "-value" => $ref->{$_}) } @new_fields;
+ print "\n";
}
print qq|
-<tr><td colspan=8><hr size=3 noshade></td></tr>
+<tr><td colspan="8"><hr size="3" noshade></td></tr>
</table>
-<input name=lastndx type=hidden value=$i>
+<input name="lastndx" type="hidden" value="$i">
|;
# save all other form variables
foreach $key (keys %${form}) {
$form->{$key} =~ s/\"/"/g;
- print qq|<input name=$key type=hidden value="$form->{$key}">\n|;
+ print qq|<input name="$key" type="hidden" value="$form->{$key}">\n|;
}
print qq|
-<input type=hidden name=nextsub value=item_selected>
+<input type="hidden" name="nextsub" value="item_selected">
<br>
-<input class=submit type=submit name=action value="|
+<input class="submit" type="submit" name="action" value="|
. $locale->text('Continue') . qq|">
</form>
$sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
map { $form->{"${_}_$i"} = $form->{"new_${_}_$j"} }
- qw(id partnumber description sellprice listprice inventory_accno income_accno expense_accno bin unit weight assembly taxaccounts partsgroup formel longdescription not_discountable);
+ qw(id partnumber description sellprice listprice inventory_accno
+ income_accno expense_accno bin unit weight assembly taxaccounts
+ partsgroup formel longdescription not_discountable partnotes lastcost);
if ($form->{"part_payment_id_$i"} ne "") {
$form->{payment_id} = $form->{"part_payment_id_$i"};
}
print qq|
<body>
-<h4 class=error>| . $locale->text('Item not on file!') . qq|
+<h4 class="error">| . $locale->text('Item not on file!') . qq|
<p>
| . $locale->text('What type of item is this?') . qq|</h4>
-<form method=post action=ic.pl>
+<form method="post" action="ic.pl">
<p>
- <input class=radio type=radio name=item value=part checked> |
+ <input class="radio" type="radio" name="item" value="part" checked> |
. $locale->text('Part') . qq|<br>
- <input class=radio type=radio name=item value=service> |
- . $locale->text('Service')
-
- . qq|
-<input type=hidden name=previousform value="$previousform">
-<input type=hidden name=partnumber value="$form->{"partnumber_$i"}">
-<input type=hidden name=description value="$form->{"description_$i"}">
-<input type=hidden name=rowcount value=$form->{rowcount}>
-<input type=hidden name=taxaccount2 value=$form->{taxaccounts}>
-<input type=hidden name=vc value=$form->{vc}>
-
-<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 type=hidden name=nextsub value=add>
+ <input class="radio" type="radio" name="item" value="service"> |
+ . $locale->text('Service');
+print $cgi->hidden("-name" => "previousform", "-value" => $previousform);
+map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); }
+ qw(rowcount vc login password));
+ map({ print($cgi->hidden("-name" => $_, "-value" => $form->{"$__$i"})); }
+ ("partnumber", "description"));
+print $cgi->hidden("-name" => "taxaccount2", "-value" => $form->{taxaccounts});
+
+print qq|
+<input type="hidden" name="nextsub" value="add">
<p>
-<input class=submit type=submit name=action value="|
+<input class="submit" type="submit" name="action" value="|
. $locale->text('Continue') . qq|">
</form>
relink_accounts();
+ my $new_rowcount = $form->{"rowcount"} * 1 + 1;
+ $form->{"project_id_${new_rowcount}"} = $form->{"globalproject_id"};
+
$form->language_payment(\%myconfig);
# if we have a display_form
if ($form->{display_form}) {
- &{"$form->{display_form}"};
+ call_sub($form->{"display_form"});
exit;
}
+ Common::webdav_folder($form) if ($webdav);
+
# if ( $form->{print_and_post}
# && $form->{second_run}
# && ($form->{action} eq "display_form")) {
my @a = ();
my $count = 0;
my @flds = (
- qw(id partnumber description qty ship sellprice unit discount inventory_accno income_accno expense_accno listprice taxaccounts bin assembly weight projectnumber project_id oldprojectnumber runningnumber serialnumber partsgroup payment_id not_discountable shop ve gv buchungsgruppen_id language_values sellprice_pg pricegroup_old price_old price_new unit_old ordnumber transdate longdescription basefactor)
+ qw(id partnumber description qty ship sellprice unit discount inventory_accno income_accno expense_accno listprice taxaccounts bin assembly weight projectnumber project_id oldprojectnumber runningnumber serialnumber partsgroup payment_id not_discountable shop ve gv buchungsgruppen_id language_values sellprice_pg pricegroup_old price_old price_new unit_old ordnumber transdate longdescription basefactor marge_absolut marge_percent lastcost )
);
$form->redo_rows(\@flds, \@a, $count, $form->{makemodel_rows});
$form->{makemodel_rows} = $count;
+ } elsif ($form->{item} eq 'service') {
+ map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(listprice sellprice lastcost);
+
} else {
# this section applies to invoices and orders
$amount = $sellprice * (1 - $discount / 100) * $qty;
map { $form->{"${_}_base"} += $amount }
- (split / /, $form->{"taxaccounts_$i"});
+ (split (/ /, $form->{"taxaccounts_$i"}));
$form->{oldinvtotal} += $amount;
}
map { $form->{oldinvtotal} += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
- split / /, $form->{taxaccounts}
+ split(/ /, $form->{taxaccounts})
if !$form->{taxincluded};
$form->{oldtotalpaid} = 0;
}
$form->{ordnumber} = $form->{invnumber};
+ $form->{old_employee_id} = $form->{employee_id};
+ $form->{old_salesman_id} = $form->{salesman_id};
+
map { delete $form->{$_} } qw(id printed emailed queued);
if ($form->{script} eq 'ir.pl' || $form->{type} eq 'request_quotation') {
$form->{title} = $locale->text('Add Purchase Order');
$form->{cp_id} *= 1;
- require "$form->{path}/$form->{script}";
+ require "bin/mozilla/$form->{script}";
+ my $script = $form->{"script"};
+ $script =~ s|.*/||;
+ $script =~ s|.pl$||;
+ $locale = new Locale($language, $script);
map { $form->{"select$_"} = "" } ($form->{vc}, currency);
$form->{rowcount}--;
- require "$form->{path}/$form->{script}";
+ require "bin/mozilla/$form->{script}";
map { $form->{"select$_"} = "" } ($form->{vc}, currency);
quotation();
}
-sub e_mail {
+sub edit_e_mail {
$lxdebug->enter_sub();
if ($form->{second_run}) {
$form->{print_and_post} = 0;
$form->{resubmit} = 0;
}
- if ($myconfig{role} eq 'admin') {
- $bcc = qq|
- <th align=right nowrap=true>| . $locale->text('Bcc') . qq|</th>
- <td><input name=bcc size=30 value="$form->{bcc}"></td>
-|;
- }
- if ($form->{formname} =~ /(pick|packing|bin)_list/) {
- $form->{email} = $form->{shiptoemail} if $form->{shiptoemail};
- }
+ $form->{email} = $form->{shiptoemail} if $form->{shiptoemail} && $form->{formname} =~ /(pick|packing|bin)_list/;
if ($form->{"cp_id"} && !$form->{"email"}) {
CT->get_contact(\%myconfig, $form);
$form->{"email"} = $form->{"cp_email"};
}
- $name = $form->{ $form->{vc} };
- $name =~ s/--.*//g;
- $title = $locale->text('E-mail') . " $name";
+ $title = $locale->text('E-mail') . " " . $form->get_formname_translation();
$form->{oldmedia} = $form->{media};
$form->{media} = "email";
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<table width=100%>
- <tr class=listtop>
- <th class=listtop>$title</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table width=100%>
- <tr>
- <th align=right nowrap>| . $locale->text('To') . qq|</th>
- <td><input name=email size=30 value="$form->{email}"></td>
- <th align=right nowrap>| . $locale->text('Cc') . qq|</th>
- <td><input name=cc size=30 value="$form->{cc}"></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Subject') . qq|</th>
- <td><input name=subject size=30 value="$form->{subject}"></td>
- $bcc
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td>
- <table width=100%>
- <tr>
- <th align=left nowrap>| . $locale->text('Message') . qq|</th>
- </tr>
- <tr>
- <td><textarea name=message rows=15 cols=60 wrap=soft>$form->{message}</textarea></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td>
-|;
+ my $attachment_filename = $form->generate_attachment_filename();
- &print_options;
-
- map { delete $form->{$_} }
- qw(action email cc bcc subject message formname sendmode format header override);
-
- # save all other variables
- foreach $key (keys %$form) {
- $form->{$key} =~ s/\"/"/g;
- print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
- }
-
- print qq|
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<input type=hidden name=nextsub value=send_email>
+ $form->{"fokus"} = $form->{"email"} ? "Form.subject" : "Form.email";
+ $form->header;
-<br>
-<input name=action class=submit type=submit value="|
- . $locale->text('Continue') . qq|">
-</form>
+ my (@dont_hide_key_list, %dont_hide_key, @hidden_keys);
+ @dont_hide_key_list = qw(action email cc bcc subject message formname sendmode format header override);
+ @dont_hide_key{@dont_hide_key_list} = (1) x @dont_hide_key_list;
+ @hidden_keys = grep { !$dont_hide_key{$_} } grep { !ref $form->{$_} } keys %$form;
-</body>
-</html>
-|;
+ print $form->parse_html_template('generic/edit_email',
+ { title => $title,
+ a_filename => $attachment_filename,
+ _print_options_ => print_options({ 'inline' => 1 }),
+ HIDDEN => [ map +{ name => $_, value => $form->{$_} }, @hidden_keys ],
+ SHOW_BCC => $myconfig{role} eq 'admin' });
$lxdebug->leave_sub();
}
sub send_email {
$lxdebug->enter_sub();
- $old_form = new Form;
+ my $callback = $form->{script} . "?action=edit";
+ map({ $callback .= "\&${_}=" . E($form->{$_}); }
+ qw(login password type id));
- map { $old_form->{$_} = $form->{$_} } keys %$form;
- $old_form->{media} = $form->{oldmedia};
+ print_form("return");
- &print_form($old_form);
+ Common->save_email_status(\%myconfig, $form);
+
+ $form->{callback} = $callback;
+ $form->redirect();
$lxdebug->leave_sub();
}
+# generate the printing options displayed at the bottom of oe and is forms.
+# this function will attempt to guess what type of form is displayed, and will generate according options
+#
+# about the coding:
+# this version builds the arrays of options pretty directly. if you have trouble understanding how,
+# the opthash function builds hashrefs which are then pieced together for the template arrays.
+# unneeded options are "undef"ed out, and then grepped out.
+#
+# the inline options is untested, but intended to be used later in metatemplating
sub print_options {
$lxdebug->enter_sub();
- $form->{sendmode} = "attachment";
- $form->{"format"} =
- $form->{"format"} ? $form->{"format"} :
- $myconfig{"template_format"} ? $myconfig{"template_format"} :
- "pdf";
+ my ($options) = @_;
+
+ $options ||= { };
- $form->{"copies"} =
- $form->{"copies"} ? $form->{"copies"} :
- $myconfig{"copies"} ? $myconfig{"copies"} :
- 3;
+ # names 3 parameters and returns a hashref, for use in templates
+ sub opthash { +{ value => shift, selected => shift, oname => shift } }
+ (@FORMNAME, @FORMNAME, @LANGUAGE_ID, @FORMAT, @SENDMODE, @MEDIA, @PRINTER_ID, @SELECTS) = ();
+
+ # note: "||"-selection is only correct for values where "0" is _not_ a correct entry
+ $form->{sendmode} = "attachment";
+ $form->{format} = $form->{format} || $myconfig{template_format} || "pdf";
+ $form->{copies} = $form->{copies} || $myconfig{copies} || 3;
+ $form->{media} = $form->{media} || $myconfig{default_media} || "screen";
+ $form->{printer_id} = defined $form->{printer_id} ? $form->{printer_id} :
+ defined $myconfig{default_printer_id} ? $myconfig{default_printer_id} : "";
$form->{PD}{ $form->{formname} } = "selected";
$form->{DF}{ $form->{format} } = "selected";
$form->{OP}{ $form->{media} } = "selected";
- $form->{SM}{ $form->{sendmode} } = "selected";
-
- if ($form->{type} eq 'purchase_order') {
- $type = qq|<select name=formname>
- <option value=purchase_order $form->{PD}{purchase_order}>|
- . $locale->text('Purchase Order') . qq|
- <option value=bin_list $form->{PD}{bin_list}>|
- . $locale->text('Bin List');
- }
-
- if ($form->{type} eq 'credit_note') {
- $type = qq|<select name=formname>
- <option value=credit_note $form->{PD}{credit_note}>|
- . $locale->text('Credit Note');
- }
-
- if ($form->{type} eq 'sales_order') {
- $type = qq|<select name=formname>
- <option value=sales_order $form->{PD}{sales_order}>|
- . $locale->text('Confirmation') . qq|
- <option value=proforma $form->{PD}{proforma}>|
- . $locale->text('Proforma Invoice') . qq|
- <option value=pick_list $form->{PD}{pick_list}>|
- . $locale->text('Pick List') . qq|
- <option value=packing_list $form->{PD}{packing_list}>|
- . $locale->text('Packing List');
- }
-
- if ($form->{type} =~ /_quotation$/) {
- $type = qq|<select name=formname>
- <option value="$`_quotation" $form->{PD}{"$`_quotation"}>|
- . $locale->text('Quotation');
- }
-
- if ($form->{type} eq 'invoice') {
- $type = qq|<select name=formname>
- <option value=invoice $form->{PD}{invoice}>|
- . $locale->text('Invoice') . qq|
- <option value=proforma $form->{PD}{proforma}>|
- . $locale->text('Proforma Invoice') . qq|
- <option value=packing_list $form->{PD}{packing_list}>|
- . $locale->text('Packing List');
- }
-
- if ($form->{type} eq 'invoice' && $form->{storno}) {
- $type = qq|<select name=formname>
- <option value=storno_invoice $form->{PD}{storno_invoice}>|
- . $locale->text('Storno Invoice') . qq|
- <option value=storno_packing_list $form->{PD}{storno_packing_list}>|
- . $locale->text('Storno Packing List');
- }
-
- if ($form->{type} eq 'credit_note') {
- $type = qq|<select name=formname>
- <option value=credit_note $form->{PD}{credit_note}>|
- . $locale->text('Credit Note');
- }
+ $form->{SM}{ $form->{formname} } = "selected";
+
+ push @FORMNAME, grep $_,
+ ($form->{type} eq 'purchase_order') ? (
+ opthash("purchase_order", $form->{PD}{purchase_order}, $locale->text('Purchase Order')),
+ opthash("bin_list", $form->{PD}{bin_list}, $locale->text('Bin List'))
+ ) : undef,
+ ($form->{type} eq 'credit_note') ?
+ opthash("credit_note", $form->{PD}{credit_note}, $locale->text('Credit Note')) : undef,
+ ($form->{type} eq 'sales_order') ? (
+ opthash("sales_order", $form->{PD}{sales_order}, $locale->text('Confirmation')),
+ opthash("proforma", $form->{PD}{proforma}, $locale->text('Proforma Invoice')),
+ opthash("pick_list", $form->{PD}{pick_list}, $locale->text('Pick List')),
+ opthash("packing_list", $form->{PD}{packing_list}, $locale->text('Packing List'))
+ ) : undef,
+ ($form->{type} =~ /_quotation$/) ?
+ opthash("$`_quotation", $form->{PD}{"$`_quotation"}, $locale->text('Quotation')) : undef,
+ ($form->{type} eq 'invoice') ? (
+ opthash("invoice", $form->{PD}{invoice}, $locale->text('Invoice')),
+ opthash("proforma", $form->{PD}{proforma}, $locale->text('Proforma Invoice')),
+ opthash("packing_list", $form->{PD}{packing_list}, $locale->text('Packing List'))
+ ) : undef,
+ ($form->{type} eq 'invoice' && $form->{storno}) ? (
+ opthash("storno_invoice", $form->{PD}{storno_invoice}, $locale->text('Storno Invoice')),
+ opthash("storno_packing_list", $form->{PD}{storno_packing_list}, $locale->text('Storno Packing List'))
+ ) : undef,
+ ($form->{type} eq 'credit_note') ?
+ opthash("credit_note", $form->{PD}{credit_note}, $locale->text('Credit Note')) : undef;
+
+ push @SENDMODE,
+ opthash("attachment", $form->{SM}{attachment}, $locale->text('Attachment')),
+ opthash("inline", $form->{SM}{inline}, $locale->text('In-line'))
+ if ($form->{media} eq 'email');
+
+ push @MEDIA, grep $_,
+ opthash("screen", $form->{OP}{screen}, $locale->text('Screen')),
+ (scalar @{ $form->{printers} } && $latex_templates) ?
+ opthash("printer", $form->{OP}{printer}, $locale->text('Printer')) : undef,
+ ($latex_templates && !$options->{no_queue}) ?
+ opthash("queue", $form->{OP}{queue}, $locale->text('Queue')) : undef
+ if ($form->{media} ne 'email');
+
+ push @FORMAT, grep $_,
+ ($opendocument_templates && $openofficeorg_writer_bin && $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)
+ && !$options->{no_opendocument_pdf}) ?
+ opthash("opendocument_pdf", $form->{DF}{"opendocument_pdf"}, $locale->text("PDF (OpenDocument/OASIS)")) : undef,
+ ($latex_templates) ?
+ opthash("pdf", $form->{DF}{pdf}, $locale->text('PDF')) : undef,
+ ($latex_templates && !$options->{no_postscript}) ?
+ opthash("postscript", $form->{DF}{postscript}, $locale->text('Postscript')) : undef,
+ (!$options->{no_html}) ?
+ opthash("html", $form->{DF}{html}, "HTML") : undef,
+ ($opendocument_templates && !$options->{no_opendocument}) ?
+ opthash("opendocument", $form->{DF}{opendocument}, $locale->text("OpenDocument/OASIS")) : undef;
+
+ push @LANGUAGE_ID,
+ map { opthash($_->{id}, ($_->{id} eq $form->{language} ? 'selected' : ''), $_->{description}) } +{}, @{ $form->{languages} }
+ if (ref $form->{languages} eq 'ARRAY');
+
+ push @PRINTER_ID,
+ map { opthash($_->{id}, ($_->{id} eq $form->{printer_id} ? 'selected' : ''), $_->{printer_description}) } +{}, @{ $form->{printers} }
+ if ((ref $form->{printers} eq 'ARRAY') && scalar @{ $form->{printers } });
+
+ @SELECTS = map { sname => lc $_, DATA => \@$_, show => scalar @$_ }, qw(FORMNAME LANGUAGE_ID FORMAT SENDMODE MEDIA PRINTER_ID);
+
+ my %dont_display_groupitems = (
+ 'dunning' => 1,
+ );
+
+ %template_vars = (
+ display_copies => scalar @{ $form->{printers} } && $latex_templates && $form->{media} ne 'email',
+ display_remove_draft => (!$form->{id} && $form->{draft_id}),
+ display_groupitems => !$dont_display_groupitems{$form->{type}},
+ groupitems_checked => $form->{groupitems} ? "checked" : '',
+ remove_draft_checked => $form->{remove_draft} ? "checked" : ''
+ );
- if ($form->{type} eq 'ship_order') {
- $type = qq|<select name=formname>
- <option value=pick_list $form->{PD}{pick_list}>|
- . $locale->text('Pick List') . qq|
- <option value=packing_list $form->{PD}{packing_list}>|
- . $locale->text('Packing List');
- }
+ my $print_options = $form->parse_html_template("generic/print_options", { SELECTS => \@SELECTS, %template_vars } );
- if ($form->{type} eq 'receive_order') {
- $type = qq|<select name=formname>
- <option value=bin_list $form->{PD}{bin_list}>|
- . $locale->text('Bin List');
- }
-
- if ($form->{media} eq 'email') {
- $media = qq|<select name=sendmode>
- <option value=attachment $form->{SM}{attachment}>|
- . $locale->text('Attachment') . qq|
- <option value=inline $form->{SM}{inline}>| . $locale->text('In-line');
+ if ($options->{inline}) {
+ $lxdebug->leave_sub() and return $print_options;
} else {
- $media = qq|<select name=media>
- <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
- if (scalar(keys (%{ $form->{printers} })) !=0 && $latex_templates) {
- $media .= qq|
- <option value=printer $form->{OP}{printer}>|
- . $locale->text('Printer');
- }
- if ($latex_templates) {
- $media .= qq|
- <option value=queue $form->{OP}{queue}>| . $locale->text('Queue');
- }
- }
-
- $format = qq|<select name=format>|;
- if ($opendocument_templates && $openofficeorg_writer_bin &&
- $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)) {
- $format .= qq|<option value=opendocument_pdf | .
- $form->{DF}{"opendocument_pdf"} . qq|>| .
- $locale->text("PDF (OpenDocument/OASIS)") . qq|</option>|;
- }
-
- if ($latex_templates) {
- $format .= qq|<option value=pdf $form->{DF}{pdf}>| .
- $locale->text('PDF') . qq|</option>|;
- }
-
- $format .= qq|<option value=html $form->{DF}{html}>HTML</option>|;
-
- if ($latex_templates) {
- $format .= qq|<option value=postscript $form->{DF}{postscript}>| .
- $locale->text('Postscript') . qq|</option>|;
- }
-
- if ($opendocument_templates) {
- $format .= qq|<option value=opendocument $form->{DF}{opendocument}>| .
- $locale->text("OpenDocument/OASIS") . qq|</option>|;
- }
- $format .= qq|</select>|;
-
- if (scalar(keys (%{ $form->{languages} })) !=0) {
- $language_select = qq|<select name=language_id>
- <option value=""></option>}|;
- foreach $item (@{ $form->{languages} }) {
- if ($form->{language_id} eq $item->{id}) {
- $language_select .= qq|<option value="$item->{id}" selected>$item->{description}</option>|;
- } else {
- $language_select .= qq|<option value="$item->{id}">$item->{description}</option>|;
- }
- }
- }
-
- if (scalar(keys (%{ $form->{printers} })) !=0) {
-
- $printer_select = qq|<select name=printer_id>
- <option value=""></option>|;
- foreach $item (@{ $form->{printers} }) {
- $printer_select .= qq|<option value="$item->{id}">$item->{printer_description}</option>|;
- }
- }
-
-
-
- print qq|
-<table width=100% cellspacing=0 cellpadding=0>
- <tr>
- <td>
- <table>
- <tr>
- <td>$type</select></td>|;
- if (scalar(keys (%{ $form->{languages} })) !=0) {
- print qq|
- <td>${language_select}</select></td>|;
- }
- print qq|
- <td>$format</select></td>
- <td>$media</select></td>|;
- if (scalar(keys (%{ $form->{printers} })) !=0) {
- print qq|
- <td>$printer_select</select></td>
-|;
- }
-
- if (scalar(keys (%{ $form->{printers} })) !=0 && $latex_templates && $form->{media} ne 'email') {
- print qq|
- <td>| . $locale->text('Copies') . qq|
- <input name=copies size=2 value=$form->{copies}></td>
-|;
- }
-
- $form->{groupitems} = "checked" if $form->{groupitems};
-
- print qq|
- <td>| . $locale->text('Group Items') . qq|</td>
- <td><input name=groupitems type=checkbox class=checkbox $form->{groupitems}></td>
- </tr>
- </table>
- </td>
- <td align=right>
- <table>
- <tr>
-|;
-
- if ($form->{printed} =~ /$form->{formname}/) {
- print qq|
- <th>\|| . $locale->text('Printed') . qq|\|</th>
-|;
+ print $print_options; $lxdebug->leave_sub();
}
-
- if ($form->{emailed} =~ /$form->{formname}/) {
- print qq|
- <th>\|| . $locale->text('E-mailed') . qq|\|</th>
-|;
- }
-
- if ($form->{queued} =~ /$form->{formname}/) {
- print qq|
- <th>\|| . $locale->text('Queued') . qq|\|</th>
-|;
- }
-
- print qq|
- </tr>
- </table>
- </td>
- </tr>
-</table>
-|;
-
- $lxdebug->leave_sub();
}
sub print {
$lxdebug->enter_sub();
+ if ($form->{print_nextsub}) {
+ call_sub($form->{print_nextsub});
+ $lxdebug->leave_sub();
+ return;
+ }
+
# if this goes to the printer pass through
if ($form->{media} eq 'printer' || $form->{media} eq 'queue') {
$form->error($locale->text('Select postscript or PDF!'))
$inv = "ord";
$due = "req";
$form->{"${inv}date"} = $form->{transdate};
- $form->{label} = $locale->text('Sales Order');
+ $form->{label} = $locale->text('Confirmation');
$numberfld = "sonumber";
$order = 1;
}
if (($form->{type} eq 'invoice') && ($form->{formname} eq 'proforma') ) {
$inv = "inv";
$due = "due";
- $form->{"${inv}date"} = $form->{transdate};
- $form->{"invdate"} = $form->{transdate};
+ $form->{"${inv}date"} = $form->{invdate};
$form->{label} = $locale->text('Proforma Invoice');
$numberfld = "sonumber";
$order = 0;
$inv = "quo";
$due = "req";
$form->{"${inv}date"} = $form->{transdate};
- $form->{"invdate"} = $form->{transdate};
+ $form->{"invdate"} = $form->{transdate};
$form->{label} = $locale->text('Proforma Invoice');
$numberfld = "sqnumber";
$order = 1;
$inv = "quo";
$due = "req";
$form->{"${inv}date"} = $form->{transdate};
- $form->{label} = $locale->text('Quotation');
+ $form->{label} = $locale->text('RFQ');
$numberfld = "rfqnumber";
$order = 1;
}
$form->isblank("email", $locale->text('E-mail address missing!'))
if ($form->{media} eq 'email');
$form->isblank("${inv}date",
- $locale->text($form->{label} . ' Date missing!'));
+ $locale->text($form->{label})
+ . ": "
+ . $locale->text(' Date missing!'));
# $locale->text('Invoice Number missing!')
# $locale->text('Invoice Date missing!')
# $locale->text('Quotation Date missing!')
# assign number
- if (!$form->{"${inv}number"} && !$form->{preview}) {
+ $form->{what_done} = $form->{formname};
+ if (!$form->{"${inv}number"} && !$form->{preview} && !$form->{id}) {
$form->{"${inv}number"} = $form->update_defaults(\%myconfig, $numberfld);
if ($form->{media} ne 'email') {
$form->{rowcount}--;
- &{"$display_form"};
+ call_sub($display_form);
+ # saving the history
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
+ $form->{addition} = "PRINTED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
exit;
}
}
$language_saved = $form->{language_id};
$payment_id_saved = $form->{payment_id};
+ $salesman_id_saved = $form->{salesman_id};
+ $cp_id_saved = $form->{cp_id};
- &{"$form->{vc}_details"};
+ call_sub("$form->{vc}_details");
$form->{language_id} = $language_saved;
$form->{payment_id} = $payment_id_saved;
$form->{"cc"} = $saved_cc if ($saved_cc);
$form->{"bcc"} = $saved_bcc if ($saved_bcc);
+ if (!$cp_id_saved) {
+ # No contact was selected. Delete all contact variables because
+ # IS->customer_details() and IR->vendor_details() get the default
+ # contact anyway.
+ map({ delete($form->{$_}); } grep(/^cp_/, keys(%{ $form })));
+ }
+
my ($language_tc, $output_numberformat, $output_dateformat, $output_longdates);
if ($form->{"language_id"}) {
($language_tc, $output_numberformat, $output_dateformat, $output_longdates) =
}
($form->{employee}) = split /--/, $form->{employee};
- ($form->{warehouse}, $form->{warehouse_id}) = split /--/, $form->{warehouse};
# create the form variables
if ($order) {
IS->invoice_details(\%myconfig, \%$form, $locale);
}
+ $form->get_salesman(\%myconfig, $salesman_id_saved);
+
if ($form->{shipto_id}) {
$form->get_shipto(\%myconfig);
}
$form->{templates} = "$myconfig{templates}";
+ delete $form->{printer_command};
+
$form->{language} = $form->get_template_language(\%myconfig);
- $form->{printer_code} = $form->get_printer_code(\%myconfig);
+
+ my $printer_code;
+ if ($form->{media} ne 'email') {
+ $printer_code = $form->get_printer_code(\%myconfig);
+ if ($printer_code ne "") {
+ $printer_code = "_" . $printer_code;
+ }
+ }
if ($form->{language} ne "") {
map({ $form->{"unit"}->[$_] =
reformat_numbers($output_numberformat, 2,
qw(invtotal ordtotal quototal subtotal linetotal
listprice sellprice netprice discount
- tax taxbase),
+ tax taxbase total paid),
grep({ /^linetotal_\d+$/ ||
/^listprice_\d+$/ ||
/^sellprice_\d+$/ ||
/^netprice_\d+$/ ||
/^taxbase_\d+$/ ||
/^discount_\d+$/ ||
+ /^paid_\d+$/ ||
+ /^subtotal_\d+$/ ||
+ /^total_\d+$/ ||
/^tax_\d+$/
} keys(%{$form})));
grep({ /^qty_\d+$/
} keys(%{$form})));
- if ($form->{printer_code} ne "") {
- $form->{printer_code} = "_" . $form->{printer_code};
- }
-
- $form->{IN} = "$form->{formname}$form->{language}$form->{printer_code}.html";
+ $form->{IN} = "$form->{formname}$form->{language}${printer_code}.html";
if ($form->{format} eq 'postscript') {
$form->{postscript} = 1;
$form->{IN} =~ s/html$/tex/;
$form->{"IN"} =~ s/html$/odt/;
}
+ delete $form->{OUT};
+
if ($form->{media} eq 'printer') {
$form->{OUT} = "| $form->{printer_command} &>/dev/null";
$form->{printed} .= " $form->{formname}";
$form->{subject} = qq|$form->{label} $form->{"${inv}number"}|
unless $form->{subject};
- $form->{OUT} = "$sendmail";
-
$form->{emailed} .= " $form->{formname}";
$form->{emailed} =~ s/^ //;
}
$emailed = $form->{emailed};
if ($form->{media} eq 'queue') {
- %queued = split / /, $form->{queued};
+ %queued = map { s|.*/|| } split / /, $form->{queued};
if ($filename = $queued{ $form->{formname} }) {
$form->{queued} =~ s/$form->{formname} $filename//;
}
$queued = $form->{queued};
+# saving the history
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
+ if($form->{media} =~ /printer/) {
+ $form->{addition} = "PRINTED";
+ }
+ elsif($form->{media} =~ /email/) {
+ $form->{addition} = "MAILED";
+ }
+ elsif($form->{media} =~ /queue/) {
+ $form->{addition} = "QUEUED";
+ }
+ elsif($form->{media} =~ /screen/) {
+ $form->{addition} = "SCREENED";
+ }
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
+
$form->parse_template(\%myconfig, $userspath);
$form->{callback} = "";
$form->update_status(\%myconfig)
if ($form->{media} eq 'queue' && $form->{id});
+ return $lxdebug->leave_sub() if ($old_form eq "return");
+
if ($old_form) {
$old_form->{"${inv}number"} = $form->{"${inv}number"};
} qw(paid exchangerate);
}
- &{"$display_form"};
+ call_sub($display_form);
exit;
}
$form->redirect(qq|$form->{label} $form->{"${inv}number"} $msg|);
}
if ($form->{printing}) {
- &{"$display_form"};
+ call_sub($display_form);
exit;
}
shiptocontact shiptophone shiptofax shiptoemail
shiptodepartment_1 shiptodepartment_2);
+ my @addr_vars =
+ (qw(name department_1 department_2 street zipcode city country
+ contact email phone fax));
+
# get details for name
- &{"$form->{vc}_details"}(@shipto_vars);
+ call_sub("$form->{vc}_details", @addr_vars);
$number =
($form->{vc} eq 'customer')
print qq|
<body>
-<form method=post action=$form->{script}>
+<form method="post" action="$form->{script}">
-<table width=100%>
+<table width="100%">
<tr>
<td>
<table>
- <tr class=listheading>
- <th class=listheading colspan=2 width=50%>|
+ <tr class="listheading">
+ <th class="listheading" colspan="2" width="50%">|
. $locale->text('Billing Address') . qq|</th>
- <th class=listheading width=50%>|
+ <th class="listheading" width="50%">|
. $locale->text('Shipping Address') . qq|</th>
</tr>
<tr height="5"></tr>
<tr>
- <th align=right nowrap>$number</th>
+ <th align="right" nowrap>$number</th>
<td>$form->{"$form->{vc}number"}</td>
</tr>
<tr>
- <th align=right nowrap>| . $locale->text('Company Name') . qq|</th>
+ <th align="right" nowrap>| . $locale->text('Company Name') . qq|</th>
<td>$form->{name}</td>
- <td><input name=shiptoname size=35 value="$form->{shiptoname}"></td>
+ <td><input name="shiptoname" size="35" value="$form->{shiptoname}"></td>
</tr>
<tr>
- <th align=right nowrap>| . $locale->text('Department') . qq|</th>
+ <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
<td>$form->{department_1}</td>
- <td><input name=shiptodepartment_1 size=35 value="$form->{shiptodepartment_1}"></td>
+ <td><input name="shiptodepartment_1" size="35" value="$form->{shiptodepartment_1}"></td>
</tr>
<tr>
- <th align=right nowrap> </th>
+ <th align="right" nowrap> </th>
<td>$form->{department_2}</td>
- <td><input name=shiptodepartment_2 size=35 value="$form->{shiptodepartment_2}"></td>
+ <td><input name="shiptodepartment_2" size="35" value="$form->{shiptodepartment_2}"></td>
</tr>
<tr>
- <th align=right nowrap>| . $locale->text('Street') . qq|</th>
+ <th align="right" nowrap>| . $locale->text('Street') . qq|</th>
<td>$form->{street}</td>
- <td><input name=shiptostreet size=35 value="$form->{shiptostreet}"></td>
+ <td><input name="shiptostreet" size="35" value="$form->{shiptostreet}"></td>
</tr>
<tr>
- <th align=right nowrap>| . $locale->text('Zipcode') . qq|</th>
+ <th align="right" nowrap>| . $locale->text('Zipcode') . qq|</th>
<td>$form->{zipcode}</td>
- <td><input name=shiptozipcode size=35 value="$form->{shiptozipcode}"></td>
+ <td><input name="shiptozipcode" size="35" value="$form->{shiptozipcode}"></td>
</tr>
<tr>
- <th align=right nowrap>| . $locale->text('City') . qq|</th>
+ <th align="right" nowrap>| . $locale->text('City') . qq|</th>
<td>$form->{city}</td>
- <td><input name=shiptocity size=35 value="$form->{shiptocity}"></td>
+ <td><input name="shiptocity" size="35" value="$form->{shiptocity}"></td>
</tr>
<tr>
- <th align=right nowrap>| . $locale->text('Country') . qq|</th>
+ <th align="right" nowrap>| . $locale->text('Country') . qq|</th>
<td>$form->{country}</td>
- <td><input name=shiptocountry size=35 value="$form->{shiptocountry}"></td>
+ <td><input name="shiptocountry" size="35" value="$form->{shiptocountry}"></td>
</tr>
<tr>
- <th align=right nowrap>| . $locale->text('Contact') . qq|</th>
+ <th align="right" nowrap>| . $locale->text('Contact') . qq|</th>
<td>$form->{contact}</td>
- <td><input name=shiptocontact size=35 value="$form->{shiptocontact}"></td>
+ <td><input name="shiptocontact" size="35" value="$form->{shiptocontact}"></td>
</tr>
<tr>
- <th align=right nowrap>| . $locale->text('Phone') . qq|</th>
- <td>$form->{"$form->{vc}phone"}</td>
- <td><input name=shiptophone size=20 value="$form->{shiptophone}"></td>
+ <th align="right" nowrap>| . $locale->text('Phone') . qq|</th>
+ <td>$form->{phone}</td>
+ <td><input name="shiptophone" size="20" value="$form->{shiptophone}"></td>
</tr>
<tr>
- <th align=right nowrap>| . $locale->text('Fax') . qq|</th>
- <td>$form->{"$form->{vc}fax"}</td>
- <td><input name=shiptofax size=20 value="$form->{shiptofax}"></td>
+ <th align="right" nowrap>| . $locale->text('Fax') . qq|</th>
+ <td>$form->{fax}</td>
+ <td><input name="shiptofax" size="20" value="$form->{shiptofax}"></td>
</tr>
<tr>
- <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
+ <th align="right" nowrap>| . $locale->text('E-mail') . qq|</th>
<td>$form->{email}</td>
- <td><input name=shiptoemail size=35 value="$form->{shiptoemail}"></td>
+ <td><input name="shiptoemail" size="35" value="$form->{shiptoemail}"></td>
</tr>
</table>
</td>
</tr>
</table>
+| . $cgi->hidden("-name" => "nextsub", "-value" => $nextsub);
+;
+
-<input type=hidden name=nextsub value=$nextsub>
-|;
# delete shipto
map({ delete $form->{$_} } (@shipto_vars, qw(header)));
foreach $key (keys %$form) {
$form->{$key} =~ s/\"/"/g;
- print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
+ print qq|<input type="hidden" name="$key" value="$form->{$key}">\n|;
}
print qq|
-<hr size=3 noshade>
+<hr size="3" noshade>
<br>
-<input class=submit type=submit name=action value="|
+<input class="submit" type="submit" name="action" value="|
. $locale->text('Continue') . qq|">
</form>
map { $form->{$_} = $form->escape($form->{$_}, 1) }
qw(partnumber description);
$form->{callback} =
- qq|$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=add&vc=$form->{db}&$form->{db}_id=$form->{id}&$form->{db}=$name&type=$form->{type}&customer=$customer&partnumber=$form->{partnumber}&description=$form->{description}&previousform="$previousform"&initial=1|;
+ qq|$form->{script}?login=$form->{login}&password=$form->{password}&action=add&vc=$form->{db}&$form->{db}_id=$form->{id}&$form->{db}=$name&type=$form->{type}&customer=$customer&partnumber=$form->{partnumber}&description=$form->{description}&previousform="$previousform"&initial=1|;
$form->redirect;
$lxdebug->leave_sub();
$lxdebug->leave_sub();
}
-
sub set_duedate {
$lxdebug->enter_sub();
#======================================================================
use SL::IR;
+use SL::IS;
use SL::PE;
-require "$form->{path}/io.pl";
-require "$form->{path}/arap.pl";
+require "bin/mozilla/io.pl";
+require "bin/mozilla/arap.pl";
+require "bin/mozilla/common.pl";
+require "bin/mozilla/drafts.pl";
1;
sub add {
$lxdebug->enter_sub();
+ $form->{"Watchdog::invdate,duedate,vendor,vendor_id"} = 1;
+
+ return $lxdebug->leave_sub() if (load_draft_maybe());
$form->{title} = $locale->text('Add Vendor Invoice');
sub edit {
$lxdebug->enter_sub();
-
+
+ # show history button
+ $form->{javascript} = qq|<script type=text/javascript src=js/show_history.js></script>|;
+ #/show hhistory button
+
$form->{title} = $locale->text('Edit Vendor Invoice');
&invoice_links;
$lxdebug->enter_sub();
# create links
- $form->{webdav} = $webdav;
-
- # set jscalendar
- $form->{jscalendar} = $jscalendar;
+ $form->{webdav} = $webdav;
+ $form->{jsscript} = 1;
$form->create_links("AP", \%myconfig, "vendor");
$form->{taxzone_id} = $taxzone_id;
}
- # currencies
- @curr = split(/:/, $form->{currencies});
- chomp $curr[0];
- $form->{defaultcurrency} = $curr[0];
-
map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
$form->{oldvendor} = "$form->{vendor}--$form->{vendor_id}";
- # vendors
- if (@{ $form->{all_vendor} }) {
- $form->{vendor} = "$form->{vendor}--$form->{vendor_id}";
- map { $form->{selectvendor} .= "<option>$_->{name}--$_->{id}\n" }
- (@{ $form->{all_vendor} });
- }
-
# departments
if ($form->{all_departments}) {
$form->{selectdepartment} = "<option>\n";
$lxdebug->enter_sub();
# set option selected
- foreach $item (qw(AP vendor currency department contact)) {
+ foreach $item (qw(AP vendor currency department)) {
$form->{"select$item"} =~ s/ selected//;
$form->{"select$item"} =~
s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
}
+ if ($form->{old_employee_id}) {
+ $form->{employee_id} = $form->{old_employee_id};
+ }
+ if ($form->{old_salesman_id}) {
+ $form->{salesman_id} = $form->{old_salesman_id};
+ }
+
+ $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
+
+
$form->{radier} =
($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
- #quote selectvendor Bug 133
- $form->{"selectvendor"} = $form->quote($form->{"selectvendor"});
-
$form->{exchangerate} =
$form->format_amount(\%myconfig, $form->{exchangerate});
$form->{creditremaining} =
$form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
- #build contacts
- if ($form->{all_contacts}) {
-
- $form->{selectcontact} = "";
- foreach $item (@{ $form->{all_contacts} }) {
- if ($form->{cp_id} == $item->{cp_id}) {
- $form->{selectcontact} .=
- "<option selected>$item->{cp_name}--$item->{cp_id}";
- } else {
- $form->{selectcontact} .= "<option>$item->{cp_name}--$item->{cp_id}";
- }
- }
- }
-
$exchangerate = "";
if ($form->{currency} ne $form->{defaultcurrency}) {
if ($form->{forex}) {
<input type=hidden name=forex value=$form->{forex}>
|;
+ my @old_project_ids = ($form->{"globalproject_id"});
+ map({ push(@old_project_ids, $form->{"project_id_$_"})
+ if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
+
+ $form->get_lists("contacts" => "ALL_CONTACTS",
+ "projects" => { "key" => "ALL_PROJECTS",
+ "all" => 0,
+ "old_id" => \@old_project_ids },
+ "taxzones" => "ALL_TAXZONES",
+ "employees" => "ALL_SALESMEN",
+ "currencies" => "ALL_CURRENCIES",
+ "vendors" => "ALL_VENDORS");
+
+ my %labels;
+ my @values = (undef);
+ foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
+ push(@values, $item->{"cp_id"});
+ $labels{$item->{"cp_id"}} = $item->{"cp_name"} .
+ ($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : "");
+ }
- if (@{ $form->{TAXZONE} }) {
- $form->{selecttaxzone} = "";
- foreach $item (@{ $form->{TAXZONE} }) {
- if ($item->{id} == $form->{taxzone_id}) {
- $form->{selecttaxzone} .=
- "<option value=$item->{id} selected>" . H($item->{description}) .
- "</option>";
- } else {
- $form->{selecttaxzone} .=
- "<option value=$item->{id}>" . H($item->{description}) . "</option>";
- }
-
- }
- } else {
- $form->{selecttaxzone} =~ s/ selected//g;
- if ($form->{taxzone_id} ne "") {
- $form->{selecttaxzone} =~ s/value=$form->{taxzone_id}/value=$form->{taxzone_id} selected/;
- }
+ my $contact;
+ if (scalar @values > 1) {
+ $contact = qq|
+ <tr>
+ <th align="right">| . $locale->text('Contact Person') . qq|</th>
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values, '-style' => 'width: 250px',
+ '-labels' => \%labels, '-default' => $form->{"cp_id"}))
+ . qq|
+ </td>
+ </tr>|;
}
- $taxzone = qq|
- <tr>
- <th align=right>| . $locale->text('Steuersatz') . qq|</th>
- <td><select name=taxzone_id>$form->{selecttaxzone}</select></td>
- <input type=hidden name=selecttaxzone value="$form->{selecttaxzone}">
- </tr>|;
+ %labels = ();
+ @values = ("");
+ foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{"id"}} = $item->{"projectnumber"};
+ }
+ my $globalprojectnumber =
+ NTI($cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values,
+ '-labels' => \%labels,
+ '-default' => $form->{"globalproject_id"}));
+
+ %labels = ();
+ @values = ();
+ my $i = 0;
+ foreach my $item (@{ $form->{"ALL_CURRENCIES"} }) {
+ push(@values, $item);
+ $labels{$item} = $item;
+ }
+
+ $form->{currency} = $form->{defaultcurrency} unless $form->{currency};
+ my $currencies;
+ if (scalar @values) {
+ $currencies = qq|
+ <tr>
+ <th align="right">| . $locale->text('Currency') . qq|</th>
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"},
+ '-values' => \@values, '-labels' => \%labels)) . qq|
+ </td>
+ </tr>|;
+ }
+ %labels = ();
+ @values = ();
+ my $i = 0;
+ foreach my $item (@{ $form->{"ALL_SALESMEN"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{"id"}} = $item->{"name"};
+ }
+ my $employees = qq|
+ <tr>
+ <th align="right">| . $locale->text('Employee') . qq|</th>
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'employee_id', '-default' => $form->{"employee_id"},
+ '-values' => \@values, '-labels' => \%labels)) . qq|
+ </td>
+ </tr>|;
+
+ %labels = ();
+ @values = ();
+ my $i = 0;
+ foreach my $item (@{ $form->{"ALL_VENDORS"} }) {
+ push(@values, $item->{name}.qq|--|.$item->{"id"});
+ $labels{$item->{name}.qq|--|.$item->{"id"}} = $item->{"name"};
+ }
+ $form->{selectvendor} = ($myconfig{vclimit} > scalar(@values));
+
+ my $vendors = qq|
+ <th align="right">| . $locale->text('Vendor') . qq|</th>
+ <td>| .
+ (($myconfig{vclimit} <= scalar(@values))
+ ? qq|<input type="text" value="| . H($form->{vendor}) . qq|" name="vendor">|
+ : (NTI($cgi->popup_menu('-name' => 'vendor', '-default' => $form->{oldvendor},
+ '-onChange' => 'document.getElementById(\'update_button\').click();',
+ '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')))) . qq|
+ <input type="button" value="?" onclick="show_vc_details('vendor')">
+ </td>|;
+
+ %labels = ();
+ @values = ();
+ foreach my $item (@{ $form->{"ALL_TAXZONES"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{"id"}} = $item->{"description"};
+ }
- $vendor =
- ($form->{selectvendor})
- ? qq|<select name=vendor>$form->{selectvendor}</select>\n<input type=hidden name="selectvendor" value="$form->{selectvendor}">|
- : qq|<input name=vendor value="$form->{vendor}" size=35>|;
+ if (!$form->{"id"}) {
+ $taxzone = qq|
+ <tr>
+ <th align="right">| . $locale->text('Steuersatz') . qq|</th>
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"},
+ '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')) . qq|
+ </td>
+ </tr>|;
- $contact =
- ($form->{selectcontact})
- ? qq|<select name=contact>$form->{selectcontact}</select>\n<input type=hidden name="selectcontact" value="$form->{selectcontact}">|
- : qq|<input name=contact value="$form->{contact}" size=35>|;
+ } else {
+ $taxzone = qq|
+ <tr>
+ <th align="right">| . $locale->text('Steuersatz') . qq|</th>
+ <td>
+ <input type="hidden" name="taxzone_id" value="| . H($form->{"taxzone_id"}) . qq|">
+ | . H($labels{$form->{"taxzone_id"}}) . qq|
+ </td>
+ </tr>|;
+ }
$department = qq|
<tr>
<th align="right" nowrap>| . $locale->text('Department') . qq|</th>
- <td colspan=3><select name=department>$form->{selectdepartment}</select>
- <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
+ <td colspan="3"><select name="department" style="width: 250px">$form->{selectdepartment}</select>
+ <input type="hidden" name="selectdepartment" value="$form->{selectdepartment}">
</td>
</tr>
| if $form->{selectdepartment};
$n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
# use JavaScript Calendar or not
- $form->{jsscript} = $form->{jscalendar};
+ $form->{jsscript} = 1;
$jsscript = "";
- if ($form->{jsscript}) {
-
- # with JavaScript Calendar
- $button1 = qq|
- <td><input name=invdate id=invdate size=11 title="$myconfig{dateformat}" value=$form->{invdate}></td>
- <td><input type=button name=invdate id="trigger1" value=|
- . $locale->text('button') . qq|></td>
- |;
- $button2 = qq|
- <td width="13"><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>
- <td width="4"><input type=button name=duedate id="trigger2" value=|
- . $locale->text('button') . qq|></td></td>
- |;
-
- #write Trigger
- $jsscript =
- Form->write_trigger(\%myconfig, "2", "invdate", "BL", "trigger1",
- "duedate", "BL", "trigger2");
- } else {
- # without JavaScript Calendar
- $button1 =
- qq|<td><input name=invdate size=11 title="$myconfig{dateformat}" value=$form->{invdate}></td>|;
- $button2 =
- qq|<td width="13"><input name=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>|;
- }
+ $button1 = qq|
+ <td><input name=invdate id=invdate size=11 title="$myconfig{dateformat}" value="$form->{invdate}" onBlur=\"check_right_date_format(this)\">
+ <input type=button name=invdate id="trigger1" value=|
+ . $locale->text('button') . qq|></td>
+ |;
+ $button2 = qq|
+ <td width="13"><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value="$form->{duedate}" onBlur=\"check_right_date_format(this)\">
+ <input type=button name=duedate id="trigger2" value=|
+ . $locale->text('button') . qq|></td></td>
+ |;
+
+ #write Trigger
+ $jsscript =
+ Form->write_trigger(\%myconfig, "2", "invdate", "BL", "trigger1",
+ "duedate", "BL", "trigger2");
+
+ $form->{"javascript"} .= qq|<script type="text/javascript" src="js/show_form_details.js"></script>|;
+ $form->{"javascript"} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/show_vc_details.js"></script>|;
+
+ $jsscript .=
+ $form->write_trigger(\%myconfig, 2,
+ "orddate", "BL", "trigger_orddate",
+ "quodate", "BL", "trigger_quodate");
$form->header;
-
+ $onload = qq|focus()|;
+ $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
+ $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
print qq|
-<body>
+<body onLoad="$onload">
<form method=post action=$form->{script}>
+|;
-<input type=hidden name=id value=$form->{id}>
-<input type=hidden name=title value="$form->{title}">
-<input type=hidden name=vc value="vendor">
-<input type=hidden name=type value=$form->{type}>
-<input type=hidden name=level value=$form->{level}>
+ $form->hide_form(qw(id title vc type level creditlimit creditremaining
+ closedto locked shippted storno storno_id
+ max_dunning_level dunning_amount));
-<input type=hidden name=creditlimit value=$form->{creditlimit}>
-<input type=hidden name=creditremaining value=$form->{creditremaining}>
+ print qq|<p>$form->{saved_message}</p>| if $form->{saved_message};
-<input type=hidden name=closedto value=$form->{closedto}>
-<input type=hidden name=locked value=$form->{locked}>
+ print qq|
-<input type=hidden name=shipped value=$form->{shipped}>
-<input type=hidden name=storno value=$form->{storno}>
-<input type=hidden name=storno_id value=$form->{storno_id}>
+<div class="listtop" width="100%">$form->{title}</div>
<table width=100%>
- <tr class=listtop>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
<tr>
- <td>
- <table width=100%>
- <tr valign=top>
- <td>
+ <td valign="top">
<table>
+ $vendors
+ <input type="hidden" name="vendor_id" value="$form->{vendor_id}">
+ <input type="hidden" name="oldvendor" value="$form->{oldvendor}">
+ <input type="hidden" name="selectvendor" value= "$form->{selectvendor}">
+ $contact
+ <tr>
+ <td align="right">| . $locale->text('Credit Limit') . qq|</td>
+ <td>$form->{creditlimit}; | . $locale->text('Remaining') . qq| <span class="plus$n">$form->{creditremaining}</span></td>
+ </tr>
<tr>
- <th align=right nowrap>| . $locale->text('Vendor') . qq|</th>
- <td colspan=3>$vendor</td>
-
- <th align=richt nowrap>|
- . $locale->text('Contact Person') . qq|</th>
- <td colspan=3>$contact</td>
-
- <input type=hidden name=vendor_id value=$form->{vendor_id}>
- <input type=hidden name=oldvendor value="$form->{oldvendor}">
-
- </tr>
- <tr>
- <td></td>
- <td colspan=3>
- <table>
- <tr>
- <th nowrap>| . $locale->text('Credit Limit') . qq|</th>
- <td>$form->{creditlimit}</td>
- <td width=20%></td>
- <th nowrap>| . $locale->text('Remaining') . qq|</th>
- <td class="plus$n">$form->{creditremaining}</td>
- </tr>
- </table>
- </td>
- <tr>
- <th align=right>| . $locale->text('Record in') . qq|</th>
- <td colspan=3><select name=AP>$form->{selectAP}</select></td>
- <input type=hidden name=selectAP value="$form->{selectAP}">
+ <th align="right">| . $locale->text('Record in') . qq|</th>
+ <td colspan="3"><select name="AP" style="width: 250px">$form->{selectAP}</select></td>
+ <input type="hidden" name="selectAP" value="$form->{selectAP}">
</tr>
$taxzone
$department
<tr>
- <th align=right nowrap>| . $locale->text('Currency') . qq|</th>
- <td><select name=currency>$form->{selectcurrency}</select></td>
+ $currencies
$exchangerate
</tr>
</table>
</td>
<td align=right>
<table>
- <tr>
+ $employees
+ <tr>
<th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
<td><input name=invnumber size=11 value="$form->{invnumber}"></td>
</tr>
<td><input name=ordnumber size=11 value="$form->{ordnumber}"></td>
<input type=hidden name=quonumber value="$form->{quonumber}">
</tr>
- </table>
+ <tr>
+ <th align="right" nowrap>| . $locale->text('Order Date') . qq|</th>
+ <td><input name="orddate" id="orddate" size="11" title="$myconfig{dateformat}" value="| . Q($form->{orddate}) . qq|" onBlur=\"check_right_date_format(this)\">
+ <input type="button" name="b_orddate" id="trigger_orddate" value="?"></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap>| . $locale->text('Quotation Date') . qq|</th>
+ <td><input name="quodate" id="quodate" size="11" title="$myconfig{dateformat}" value="| . Q($form->{quodate}) . qq|" onBlur=\"check_right_date_format(this)\">
+ <input type="button" name="b_quodate" id="trigger_quodate" value="?"></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap>| . $locale->text('Project Number') . qq|</th>
+ <td>$globalprojectnumber</td>
+ </tr>
+ </table>
</td>
</tr>
</table>
$jsscript
-<input type=hidden name=selectcurrency value="$form->{selectcurrency}">
-<input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
<input type=hidden name=fxgain_accno value=$form->{fxgain_accno}>
<input type=hidden name=fxloss_accno value=$form->{fxloss_accno}>
<input type=hidden name=webdav value=$webdav>
$tax .= qq|
<tr>
- <th align=right>$form->{"${item}_description"}</th>
+ <th align=right>$form->{"${item}_description"} |
+ . $form->{"${item}_rate"} * 100 .qq|%</th>
<td align=right>$form->{"${item}_total"}</td>
</tr>
|;
$tax .= qq|
<tr>
- <th align=right>Enthaltene $form->{"${item}_description"}</th>
+ <th align=right>Enthaltene $form->{"${item}_description"} |
+ . $form->{"${item}_rate"} * 100 .qq|%</th>
<td align=right>$form->{"${item}_total"}</td>
</tr>
<tr>
<table width=100%>
$subtotal
$tax
- <tr>0
+ <tr>
<th align=right>| . $locale->text('Total') . qq|</th>
<td align=right>$form->{invtotal}</td>
</tr>
<td align=left width=30%><b>Dateiname</b></td>
<td align=left width=70%><b>Webdavlink</b></td>
|;
- foreach $file (keys %{ $form->{WEBDAV} }) {
+ foreach $file (@{ $form->{WEBDAV} }) {
$webdav_list .= qq|
<tr>
- <td align=left>$file</td>
- <td align=left><a href="$form->{WEBDAV}{$file}">$form->{WEBDAV}{$file}</a></td>
+ <td align="left">$file->{name}</td>
+ <td align="left"><a href="$file->{link}">$file->{type}</a></td>
</tr>
|;
}
print $webdav_list;
}
print qq|
-<input type=hidden name=jscalendar value=$form->{jscalendar}>
-|;
- print qq|
<tr>
<td colspan=$colspan>
<table width=100%>
</tr>
|;
- my @triggers = ();
+ my @triggers = ();
+ my $totalpaid = 0;
+
$form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
for $i (1 .. $form->{paidaccounts}) {
$form->{"selectAP_paid_$i"} =~
s/option>\Q$form->{"AP_paid_$i"}\E/option selected>$form->{"AP_paid_$i"}/;
+ $totalpaid += $form->{"paid_$i"};
+
# format amounts
if ($form->{"paid_$i"}) {
$form->{"paid_$i"} =
|;
$column_data{"paid_$i"} =
- qq|<td align=center><input name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
+ qq|<td align=center><input name="paid_$i" size=11 value="$form->{"paid_$i"}" onBlur=\"check_right_number_format(this)\"></td>|;
$column_data{"exchangerate_$i"} = qq|<td align=center>$exchangerate</td>|;
$column_data{"AP_paid_$i"} =
qq|<td align=center><select name="AP_paid_$i">$form->{"selectAP_paid_$i"}</select></td>|;
$column_data{"datepaid_$i"} =
- qq|<td align=center><input name="datepaid_$i" size=11 title="$myconfig{dateformat}" value=$form->{"datepaid_$i"}>
+ qq|<td align=center><input name="datepaid_$i" id="datepaid_$i" size=11 title="$myconfig{dateformat}" value="$form->{"datepaid_$i"}" onBlur=\"check_right_date_format(this)\">
<input type="button" name="datepaid_$i" id="trigger_datepaid_$i" value="?"></td>|;
$column_data{"source_$i"} =
qq|<td align=center><input name="source_$i" size=11 value=$form->{"source_$i"}></td>|;
push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
}
+ my $paid_missing = $form->{oldinvtotal} - $totalpaid;
+
print qq|
+ <tr>
+ <td></td>
+ <td></td>
+ <td align="center">| . $locale->text('Total') . qq|</td>
+ <td align="center">| . H($form->format_amount(\%myconfig, $totalpaid, 2)) . qq|</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td align="center">| . $locale->text('Missing amount') . qq|</td>
+ <td align="center">| . H($form->format_amount(\%myconfig, $paid_missing, 2)) . qq|</td>
+ </tr>
+
<input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
<input type=hidden name=paidaccounts value=$form->{paidaccounts}>
<input type=hidden name=selectAP_paid value="$form->{selectAP_paid}">
$invdate = $form->datetonum($form->{invdate}, \%myconfig);
$closedto = $form->datetonum($form->{closedto}, \%myconfig);
+ print qq|<input class=submit type=submit name=action id=update_button value="|
+ . $locale->text('Update') . qq|">
+|;
+
if ($form->{id}) {
+ my $show_storno = !$form->{storno} && !IS->has_storno(\%myconfig, $form, "ap");
+
print qq|<input class=submit type=submit name=action value="|
. $locale->text('Post Payment') . qq|">
|;
print qq|<input class=submit type=submit name=action value="|
. $locale->text('Storno') . qq|">
-| unless ($form->{storno});
+| if ($show_storno);
if ($form->{radier}) {
print qq|
<input class=submit type=submit name=action value="|
print qq|<input class=submit type=submit name=action value="|
. $locale->text('Use As Template') . qq|">
|;
- } else {
- if ($invdate > $closedto) {
- print qq|<input class=submit type=submit name=action value="|
- . $locale->text('Update') . qq|">
- <input class=submit type=submit name=action value="|
- . $locale->text('Post') . qq|">|;
- }
- }
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
}
- print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
- qq|
-
-<input type=hidden name=rowcount value=$form->{rowcount}>
-
-<input name=callback type=hidden value="$form->{callback}">
+ if (!$form->{id} && ($invdate > $closedto)) {
+ print qq| <input class=submit type=submit name=action value="|
+ . $locale->text('Post') . qq|"> | .
+ NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'),
+ '-class' => 'submit'));
+ }
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>
+ print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers);
+ $form->hide_form(qw(rowcount callback draft_id draft_description login password));
-</form>
+ # button for saving history
+ if($form->{id} ne "") {
+ print qq|
+ <input type="button" class="submit" onclick="set_history_window(|
+ . Q($form->{id})
+ . qq|);" name="history" id="history" value="|
+ . $locale->text('history')
+ . qq|">|;
+ }
+ # /button for saving history
+ # mark_as_paid button
+ if($form->{id} ne "") {
+ print qq| <input type="submit" class="submit" name="action" value="|
+ . $locale->text('mark as paid') . qq|">|;
+ }
+ # /mark_as_paid button
+print qq|</form>
</body>
</html>
$lxdebug->leave_sub();
}
+sub mark_as_paid {
+ $lxdebug->enter_sub();
+ &mark_as_paid_common(\%myconfig,"ap");
+ $lxdebug->leave_sub();
+}
+
sub update {
$lxdebug->enter_sub();
&check_name(vendor);
- &check_project;
-
$form->{exchangerate} = $exchangerate
if (
$form->{forex} = (
}
$i = $form->{rowcount};
- $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
+ $exchangerate = ($form->{exchangerate} * 1) ? $form->{exchangerate} * 1 : 1;
if ( ($form->{"partnumber_$i"} eq "")
&& ($form->{"description_$i"} eq "")
$form->error($locale->text('Cannot storno storno invoice!'));
}
+ if (IS->has_storno(\%myconfig, $form, "ap")) {
+ $form->error($locale->text("Invoice has already been storno'd!"));
+ }
+
+ my $employee_id = $form->{employee_id};
+ invoice_links();
+ prepare_invoice();
+ relink_accounts();
+
+ # Payments must not be recorded for the new storno invoice.
+ $form->{paidaccounts} = 0;
+ map { my $key = $_; delete $form->{$key} if grep { $key =~ /^$_/ } qw(datepaid_ source_ memo_ paid_ exchangerate_ AR_paid_) } keys %{ $form };
+
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
+ $form->{addition} = "CANCELED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
+
$form->{storno_id} = $form->{id};
$form->{storno} = 1;
$form->{id} = "";
$form->{invnumber} = "Storno zu " . $form->{invnumber};
-
- &post();
+ $form->{rowcount}++;
+ $form->{employee_id} = $employee_id;
+ post();
$lxdebug->leave_sub();
}
sub post_payment {
$lxdebug->enter_sub();
+
+ $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
for $i (1 .. $form->{paidaccounts}) {
if ($form->{"paid_$i"}) {
$datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
($form->{AP}) = split /--/, $form->{AP};
($form->{AP_paid}) = split /--/, $form->{AP_paid};
- $form->redirect($locale->text(' Payment posted!'))
- if (IR->post_payment(\%myconfig, \%$form));
- $form->error($locale->text('Cannot post payment!'));
+ if (IR->post_payment(\%myconfig, \%$form)){
+ if (!exists $form->{addition} && $form->{id} ne "") {
+ # saving the history
+ $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
+ $form->{addition} = "PAYMENT POSTED";
+ $form->{what_done} = $form->{currency} . qq| | . $form->{paid} . qq| | . $locale->text("POSTED");
+ $form->save_history($form->dbconnect(\%myconfig));
+ # /saving the history
+ }
+
+ $form->redirect($locale->text('Payment posted!'));
+ }
+ $form->error($locale->text('Cannot post payment!'));
$lxdebug->leave_sub();
}
sub post {
$lxdebug->enter_sub();
+ $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
+
$form->isblank("invdate", $locale->text('Invoice Date missing!'));
$form->isblank("vendor", $locale->text('Vendor missing!'));
+ $form->{invnumber} =~ s/^\s*//g;
+ $form->{invnumber} =~ s/\s*$//g;
+
# if the vendor changed get new values
if (&check_name(vendor)) {
&update;
($form->{AP}) = split /--/, $form->{AP};
($form->{AP_paid}) = split /--/, $form->{AP_paid};
+ $form->{storno} = 0;
$form->{id} = 0 if $form->{postasnew};
relink_accounts();
- $form->redirect( $locale->text('Invoice')
+ if (IR->post_invoice(\%myconfig, \%$form)){
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
+ $form->{addition} = "POSTED";
+ #$form->{what_done} = $locale->text("Rechnungsnummer") . qq| | . $form->{invnumber};
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
+ remove_draft() if $form->{remove_draft};
+ $form->redirect( $locale->text('Invoice')
. " $form->{invnumber} "
- . $locale->text('posted!'))
- if (IR->post_invoice(\%myconfig, \%$form));
+ . $locale->text('posted!'));
+ }
$form->error($locale->text('Cannot post invoice!'));
$lxdebug->leave_sub();
$lxdebug->enter_sub();
$form->header;
-
print qq|
<body>
sub yes {
$lxdebug->enter_sub();
-
- $form->redirect($locale->text('Invoice deleted!'))
- if (IR->delete_invoice(\%myconfig, \%$form));
+ if (IR->delete_invoice(\%myconfig, \%$form)) {
+ # saving the history
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
+ $form->{addition} = "DELETED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
+ $form->redirect($locale->text('Invoice deleted!'));
+ }
$form->error($locale->text('Cannot delete invoice!'));
$lxdebug->leave_sub();
use SL::PE;
use Data::Dumper;
-require "$form->{path}/io.pl";
-require "$form->{path}/arap.pl";
+require "bin/mozilla/io.pl";
+require "bin/mozilla/arap.pl";
+require "bin/mozilla/drafts.pl";
1;
sub add {
$lxdebug->enter_sub();
-
+
+ return $lxdebug->leave_sub() if (load_draft_maybe());
+
if ($form->{type} eq "credit_note") {
$form->{title} = $locale->text('Add Credit Note');
$form->{callback} =
- "$form->{script}?action=add&type=$form->{type}&login=$form->{login}&path=$form->{path}&password=$form->{password}"
+ "$form->{script}?action=add&type=$form->{type}&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
$form{jsscript} = "date";
sub edit {
$lxdebug->enter_sub();
+ # show history button
+ $form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
+ #/show hhistory button
if ($myconfig{acs} =~ "AR--Add Sales Invoice" || $myconfig{acs} =~ "AR--AR")
{
if ($form->{all_customer}) {
unless ($form->{customer_id}) {
$form->{customer_id} = $form->{all_customer}->[0]->{id};
+ $form->{salesman_id} = $form->{all_customer}->[0]->{salesman_id};
}
}
$form->{shipto_id} = $shipto_id;
}
- # currencies
- @curr = split(/:/, $form->{currencies});
- chomp $curr[0];
- $form->{defaultcurrency} = $curr[0];
-
- map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
-
$form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
- if (@{ $form->{all_customer} }) {
- $form->{customer} = "$form->{customer}--$form->{customer_id}";
- map { $form->{selectcustomer} .= "<option>$_->{name}--$_->{id}\n" }
- (@{ $form->{all_customer} });
- }
-
# departments
if ($form->{all_departments}) {
$form->{selectdepartment} = "<option>\n";
map {
$form->{selectdepartment} .=
- "<option>$_->{description}--$_->{id}\n"
+ "<option>$_->{description}--$_->{id}</option>\n"
} (@{ $form->{all_departments} });
}
$form->{employee} = "$form->{employee}--$form->{employee_id}";
- # sales staff
- if ($form->{all_employees}) {
- $form->{selectemployee} = "";
- map { $form->{selectemployee} .= "<option>$_->{name}--$_->{id}\n" }
- (@{ $form->{all_employees} });
- }
-
# forex
$form->{forex} = $form->{exchangerate};
$exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
foreach $key (keys %{ $form->{AR_links} }) {
foreach $ref (@{ $form->{AR_links}{$key} }) {
- $form->{"select$key"} .= "<option>$ref->{accno}--$ref->{description}\n";
+ $form->{"select$key"} .=
+"<option>$ref->{accno}--$ref->{description}</option>\n";
}
if ($key eq "AR_paid") {
if ($form->{type} eq "credit_note") {
$form->{type} = "credit_note";
$form->{formname} = "credit_note";
- $form->{media} = "screen";
} else {
$form->{type} = "invoice";
$form->{formname} = "invoice";
- $form->{media} = "screen";
}
if ($form->{id}) {
sub form_header {
$lxdebug->enter_sub();
+ if ($form->{old_employee_id}) {
+ $form->{employee_id} = $form->{old_employee_id};
+ }
+ if ($form->{old_salesman_id}) {
+ $form->{salesman_id} = $form->{old_salesman_id};
+ }
+
if ($edit) {
if ($form->{type} eq "credit_note") {
$form->{title} = $locale->text('Edit Credit Note');
-
+
if ($form->{storno}) {
$form->{title} = $locale->text('Edit Storno Credit Note');
}
} else {
$form->{title} = $locale->text('Edit Sales Invoice');
-
+
if ($form->{storno}) {
$form->{title} = $locale->text('Edit Storno Invoice');
}
}
}
-
+ $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
$form->{radier} =
($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
}
my $set_duedate_url =
- "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=set_duedate";
+ "$form->{script}?login=$form->{login}&password=$form->{password}&action=set_duedate";
my $pjx = new CGI::Ajax( 'set_duedate' => $set_duedate_url );
push(@ { $form->{AJAX} }, $pjx);
- if (@{ $form->{TAXZONE} }) {
- $form->{selecttaxzone} = "";
- foreach $item (@{ $form->{TAXZONE} }) {
- if ($item->{id} == $form->{taxzone_id}) {
- $form->{selecttaxzone} .=
- "<option value=$item->{id} selected>" . H($item->{description}) .
- "</option>";
- } else {
- $form->{selecttaxzone} .=
- "<option value=$item->{id}>" . H($item->{description}) . "</option>";
- }
+ my @old_project_ids = ($form->{"globalproject_id"});
+ map({ push(@old_project_ids, $form->{"project_id_$_"})
+ if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
+
+ $form->get_lists("contacts" => "ALL_CONTACTS",
+ "shipto" => "ALL_SHIPTO",
+ "projects" => { "key" => "ALL_PROJECTS",
+ "all" => 0,
+ "old_id" => \@old_project_ids },
+ "employees" => "ALL_SALESMEN",
+ "taxzones" => "ALL_TAXZONES",
+ "currencies" => "ALL_CURRENCIES",
+ "customers" => "ALL_CUSTOMERS");
+
+ my %labels;
+ my @values = (undef);
+ foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
+ push(@values, $item->{"cp_id"});
+ $labels{$item->{"cp_id"}} = $item->{"cp_name"} .
+ ($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : "");
+ }
+ my $contact;
+ if (scalar @values > 1) {
+ $contact = qq|
+ <tr>
+ <th align="right">| . $locale->text('Contact Person') . qq|</th>
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values, '-style' => 'width: 250px',
+ '-labels' => \%labels, '-default' => $form->{"cp_id"}))
+ . qq|
+ </td>
+ </tr>|;
+ }
- }
- } else {
- $form->{selecttaxzone} =~ s/ selected//g;
- if ($form->{taxzone_id} ne "") {
- $form->{selecttaxzone} =~ s/value=$form->{taxzone_id}/value=$form->{taxzone_id} selected/;
- }
+ %labels = ();
+ @values = ();
+ foreach my $item (@{ $form->{"ALL_SALESMEN"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{id}} = $item->{name} ne "" ? $item->{name} : $item->{login};
}
- $taxzone = qq|
- <tr>
- <th align=right>| . $locale->text('Steuersatz') . qq|</th>
- <td><select name=taxzone_id>$form->{selecttaxzone}</select></td>
- <input type=hidden name=selecttaxzone value="$form->{selecttaxzone}">
- </tr>|;
+ my $employees = qq|
+ <tr>
+ <th align="right">| . $locale->text('Employee') . qq|</th>
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'employee_id', '-default' => $form->{"employee_id"},
+ '-values' => \@values, '-labels' => \%labels)) . qq|
+ </td>
+ </tr>|;
+
+
+ %labels = ();
+ @values = ();
+ foreach my $item (@{ $form->{"ALL_CUSTOMERS"} }) {
+ push(@values, $item->{name}.qq|--|.$item->{"id"});
+ $labels{$item->{name}.qq|--|.$item->{"id"}} = $item->{"name"};
+ }
+ $form->{selectcustomer} = ($myconfig{vclimit} > scalar(@values));
+
+ my $customers = qq|
+ <th align="right">| . $locale->text('Customer') . qq|</th>
+ <td>| .
+ (($myconfig{vclimit} <= scalar(@values))
+ ? qq|<input type="text" value="| . H($form->{customer}) . qq|" name="customer">|
+ : (NTI($cgi->popup_menu('-name' => 'customer', '-default' => $form->{oldcustomer},
+ '-onChange' => 'document.getElementById(\'update_button\').click();',
+ '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')))) . qq|
+ <input type="button" value="?" onclick="show_vc_details('customer')">
+ </td>|;
+
+ %labels = ();
+ @values = ("");
+ foreach my $item (@{ $form->{"ALL_SHIPTO"} }) {
+ push(@values, $item->{"shipto_id"});
+ $labels{$item->{"shipto_id"}} = join "; ", grep { $_ } map { $item->{"shipto${_}" } } qw(name department_1 street city);
+ }
- if (@{ $form->{SHIPTO} }) {
- $form->{selectshipto} = "<option value=0></option>";
- foreach $item (@{ $form->{SHIPTO} }) {
- if ($item->{shipto_id} == $form->{shipto_id}) {
- $form->{selectshipto} .=
- "<option value=$item->{shipto_id} selected>$item->{shiptoname} $item->{shiptodepartment_1}</option>";
- } else {
- $form->{selectshipto} .=
- "<option value=$item->{shipto_id}>$item->{shiptoname} $item->{shiptodepartment}</option>";
- }
+ my $shipto;
+ if (scalar @values > 1) {
+ $shipto = qq|
+ <tr>
+ <th align="right">| . $locale->text('Shipping Address') . qq|</th>
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values, '-style' => 'width: 250px',
+ '-labels' => \%labels, '-default' => $form->{"shipto_id"}))
+ . qq|</td>|;
+ }
- }
- } else {
- $form->{selectshipto} = $form->unquote($form->{selectshipto});
- $form->{selectshipto} =~ s/ selected//g;
- if ($form->{shipto_id} ne "") {
- $form->{selectshipto} =~ s/value=$form->{shipto_id}/value=$form->{shipto_id} selected/;
- }
+ %labels = ();
+ @values = ();
+ foreach my $item (@{ $form->{"ALL_CURRENCIES"} }) {
+ push(@values, $item);
+ $labels{$item} = $item;
}
- $shipto = qq|
- <th align=right>| . $locale->text('Shipping Address') . qq|</th>
- <td><select name=shipto_id style="width:200px;">$form->{selectshipto}</select></td>|;
- $form->{selectshipto} = $form->quote($form->{selectshipto});
- $shipto .= qq| <input type=hidden name=selectshipto value="$form->{selectshipto}">|;
+ $form->{currency} = $form->{defaultcurrency} unless $form->{currency};
+ my $currencies;
+ if (scalar @values) {
+ $currencies = qq|
+ <tr>
+ <th align="right">| . $locale->text('Currency') . qq|</th>
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"},
+ '-values' => \@values, '-labels' => \%labels)) . qq|
+ </td>
+ </tr>|;
+ }
+
+ %labels = ();
+ @values = ("");
+ foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{"id"}} = $item->{"projectnumber"};
+ }
+ my $globalprojectnumber =
+ NTI($cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values,
+ '-labels' => \%labels,
+ '-default' => $form->{"globalproject_id"}));
+
+ %labels = ();
+ @values = ();
+ foreach my $item (@{ $form->{ALL_SALESMEN} }) {
+ push(@values, $item->{id});
+ $labels{$item->{id}} = $item->{name} ne "" ? $item->{name} : $item->{login};
+ }
+
+ $salesman =
+ qq|<tr>
+ <th align="right">| . $locale->text('Salesman') . qq|</th>
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{salesman_id} ? $form->{salesman_id} : $form->{employee_id},
+ '-values' => \@values, '-labels' => \%labels))
+ . qq|</td>
+ </tr>|;
+
+ %labels = ();
+ @values = ();
+ foreach my $item (@{ $form->{"ALL_TAXZONES"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{"id"}} = $item->{"description"};
+ }
+ if (!$form->{"id"}) {
+ $taxzone = qq|
+ <tr>
+ <th align="right">| . $locale->text('Steuersatz') . qq|</th>
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"},
+ '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px',)) . qq|
+ </td>
+ </tr>|;
+ } else {
+ $taxzone = qq|
+ <tr>
+ <th align="right">| . $locale->text('Steuersatz') . qq|</th>
+ <td>
+ <input type="hidden" name="taxzone_id" value="| . H($form->{"taxzone_id"}) . qq|">
+ | . H($labels{$form->{"taxzone_id"}}) . qq|
+ </td>
+ </tr>|;
+ }
# set option selected
foreach $item (qw(AR customer currency department employee)) {
s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
}
- #quote customer Bug 133
- $form->{selectcustomer} = $form->quote($form->{selectcustomer});
-
- #build contacts
- if ($form->{all_contacts}) {
-
- $form->{selectcontact} = "<option></option>";
- foreach $item (@{ $form->{all_contacts} }) {
- my $department = ($item->{cp_abteilung}) ? "--$item->{cp_abteilung}" : "";
- if ($form->{cp_id} == $item->{cp_id}) {
- $form->{selectcontact} .=
- "<option value=$item->{cp_id} selected>$item->{cp_name}$department</option>";
- } else {
- $form->{selectcontact} .= "<option value=$item->{cp_id}>$item->{cp_name}$department</option>";
- }
- }
- } else {
- $form->{selectcontact} =~ s/ selected//g;
- if ($form->{cp_id} ne "") {
- $form->{selectcontact} =~ s/value=$form->{cp_id}/value=$form->{cp_id} selected/;
- }
- }
-
-
if (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) {
$creditwarning = 1;
} else {
$creditwarning = 0;
}
- #else {$form->{all_contacts} = 0;}
-
$form->{exchangerate} =
$form->format_amount(\%myconfig, $form->{exchangerate});
if ($form->{currency} ne $form->{defaultcurrency}) {
if ($form->{forex}) {
$exchangerate .=
- qq|<th align=right>|
+ qq|<th align="right">|
. $locale->text('Exchangerate')
- . qq|</th><td>$form->{exchangerate}<input type=hidden name=exchangerate value=$form->{exchangerate}></td>|;
+ . qq|</th><td>$form->{exchangerate}<input type="hidden" name="exchangerate" value="$form->{exchangerate}"></td>|;
} else {
$exchangerate .=
- qq|<th align=right>|
+ qq|<th align="right">|
. $locale->text('Exchangerate')
- . qq|</th><td><input name=exchangerate size=10 value=$form->{exchangerate}></td>|;
+ . qq|</th><td><input name="exchangerate" size="10" value="$form->{exchangerate}"></td>|;
}
}
$exchangerate .= qq|
-<input type=hidden name=forex value=$form->{forex}>
+<input type="hidden" name="forex" value="$form->{forex}">
|;
- $customer =
- ($form->{selectcustomer})
- ? qq|<select name=customer>$form->{selectcustomer}</select>\n<input type=hidden name="selectcustomer" value="$form->{selectcustomer}">|
- : qq|<input name=customer value="$form->{customer}" size=35>|;
-
- #sk
- $contact =
- ($form->{selectcontact})
- ? qq|<select name=cp_id>$form->{selectcontact}</select>\n<input type=hidden name="selectcontact" value="$form->{selectcontact}">|
- : qq|<input name=contact value="$form->{contact}" size=35>|;
-
$department = qq|
<tr>
<th align="right" nowrap>| . $locale->text('Department') . qq|</th>
- <td colspan=3><select name=department>$form->{selectdepartment}</select>
- <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
+ <td colspan="3"><select name="department" style="width: 250px">$form->{selectdepartment}</select>
+ <input type="hidden" name="selectdepartment" value="$form->{selectdepartment}">
</td>
</tr>
| if $form->{selectdepartment};
if ($form->{business}) {
$business = qq|
<tr>
- <th align=right>| . $locale->text('Business') . qq|</th>
- <td>$form->{business}</td>
- <th align=right>| . $locale->text('Trade Discount') . qq|</th>
- <td>|
+ <th align="right">| . $locale->text('Customer type') . qq|</th>
+ <td>$form->{business}; | . $locale->text('Trade Discount') . qq| |
. $form->format_amount(\%myconfig, $form->{tradediscount} * 100)
. qq| %</td>
- </tr>
+ </tr>
|;
}
if ($form->{max_dunning_level}) {
$dunning = qq|
- <tr>
- <td colspan=4>
- <table>
- <tr>
- <th align=right>| . $locale->text('Max. Dunning Level') . qq|:</th>
- <td><b>$form->{max_dunning_level}</b></td>
- <th align=right>| . $locale->text('Dunning Amount') . qq|:</th>
- <td><b>|
- . $form->format_amount(\%myconfig, $form->{dunning_amount},2)
- . qq|</b></td>
- </tr>
- </table>
- </td>
- </tr>
+ <tr>
+ <th align="right">| . $locale->text('Max. Dunning Level') . qq|:</th>
+ <td>
+ <b>$form->{max_dunning_level}</b>;
+ | . $locale->text('Dunning Amount') . qq|: <b>|
+ . $form->format_amount(\%myconfig, $form->{dunning_amount},2)
+ . qq|</b>
+ </td>
+ </tr>
|;
}
$form->{fokus} = "invoice.customer";
# use JavaScript Calendar or not
- $form->{jsscript} = $jscalendar;
+ $form->{jsscript} = 1;
$jsscript = "";
if ($form->{type} eq "credit_note") {
- if ($form->{jsscript}) {
-
- # with JavaScript Calendar
- $button1 = qq|
- <td><input name=invdate id=invdate size=11 title="$myconfig{dateformat}" value=$form->{invdate}></td>
- <td><input type=button name=invdate id="trigger1" value=|
- . $locale->text('button') . qq|></td>
- |;
-
- #write Trigger
- $jsscript =
- Form->write_trigger(\%myconfig, "1",
- "invdate", "BL",
- "trigger1");
- } else {
-
- # without JavaScript Calendar
- $button1 =
- qq|<td><input name=invdate size=11 title="$myconfig{dateformat}" value=$form->{invdate}></td>|;
- $button2 =
- qq|<td width="13"><input name=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>|;
- }
+ $button1 = qq|
+ <td><input name="invdate" id="invdate" size="11" title="$myconfig{dateformat}" value="$form->{invdate}" onBlur=\"check_right_date_format(this)\">
+ <input type="button" name="invdate" id="trigger1" value="|
+ . $locale->text('button') . qq|"></td>|;
+
+ #write Trigger
+ $jsscript =
+ Form->write_trigger(\%myconfig, "1",
+ "invdate", "BL",
+ "trigger1");
} else {
- if ($form->{jsscript}) {
-
- # with JavaScript Calendar
- $button1 = qq|
- <td><input name=invdate id=invdate size=11 title="$myconfig{dateformat}" value=$form->{invdate}></td>
- <td><input type=button name=invdate id="trigger1" value=|
- . $locale->text('button') . qq|></td>
- |;
- $button2 = qq|
- <td width="13"><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>
- <td width="4"><input type=button name=duedate id="trigger2" value=|
- . $locale->text('button') . qq|></td></td>
- |;
- $button3 = qq|
- <td width="13"><input name=deliverydate id=deliverydate size=11 title="$myconfig{dateformat}" value=$form->{deliverydate}></td>
- <td width="4"><input type=button name=deliverydate id="trigger3" value=|
- . $locale->text('button') . qq|></td></td>
+ $button1 = qq|
+ <td><input name="invdate" id="invdate" size="11" title="$myconfig{dateformat}" value="$form->{invdate}" onBlur=\"check_right_date_format(this)\">
+ <input type="button" name="invdate" id="trigger1" value="|
+ . $locale->text('button') . qq|"></td>
|;
-
- #write Trigger
- $jsscript =
- Form->write_trigger(\%myconfig, "3",
- "invdate", "BL",
- "trigger1", "duedate",
- "BL", "trigger2",
- "deliverydate", "BL",
- "trigger3");
- } else {
-
- # without JavaScript Calendar
- $button1 =
- qq|<td><input name=invdate size=11 title="$myconfig{dateformat}" value=$form->{invdate}></td>|;
- $button2 =
- qq|<td width="13"><input name=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>|;
- }
+ $button2 = qq|
+ <td width="13"><input name="duedate" id="duedate" size="11" title="$myconfig{dateformat}" value="$form->{duedate}" onBlur=\"check_right_date_format(this)\">
+ <input type="button" name="duedate" id="trigger2" value="|
+ . $locale->text('button') . qq|"></td></td>
+ |;
+ $button3 = qq|
+ <td width="13"><input name="deliverydate" id="deliverydate" size="11" title="$myconfig{dateformat}" value="$form->{deliverydate}" onBlur=\"check_right_date_format(this)\">
+ <input type="button" name="deliverydate" id="trigger3" value="|
+ . $locale->text('button') . qq|"></td></td>
+ |;
+
+ #write Trigger
+ $jsscript =
+ Form->write_trigger(\%myconfig, "3",
+ "invdate", "BL",
+ "trigger1", "duedate",
+ "BL", "trigger2",
+ "deliverydate", "BL",
+ "trigger3");
}
+
if ($form->{resubmit} && ($form->{format} eq "html")) {
$onload =
qq|window.open('about:blank','Beleg'); document.invoice.target = 'Beleg';document.invoice.submit()|;
} elsif ($form->{resubmit}) {
$onload = qq|document.invoice.submit()|;
} else {
- $onload = "fokus()";
+ $onload = "focus()";
}
-
+ $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
+ $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
$credittext = $locale->text('Credit Limit exceeded!!!');
if ($creditwarning) {
$onload = qq|alert('$credittext')|;
}
- $form->{"javascript"} .= qq|<script type="text/javascript" src="js/show_form_details.js">|;
+ $form->{"javascript"} .= qq|<script type="text/javascript" src="js/show_form_details.js"></script>|;
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/show_vc_details.js"></script>|;
+ $jsscript .=
+ $form->write_trigger(\%myconfig, 2,
+ "orddate", "BL", "trigger_orddate",
+ "quodate", "BL", "trigger_quodate");
+ # show history button js
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/show_history.js"></script>|;
+ #/show history button js
$form->header;
print qq|
<script type="text/javascript" src="js/vendor_selection.js"></script>
<script type="text/javascript" src="js/calculate_qty.js"></script>
-<form method=post name="invoice" action=$form->{script}>
-
-
-<input type=hidden name=id value=$form->{id}>
-<input type=hidden name=action value=$form->{action}>
+<form method="post" name="invoice" action="$form->{script}">
+| ;
-<input type=hidden name=type value=$form->{type}>
-<input type=hidden name=media value=$form->{media}>
-<input type=hidden name=format value=$form->{format}>
+ $form->hide_form(qw(id action type media format queued printed emailed title vc discount
+ creditlimit creditremaining tradediscount business closedto locked shipped storno storno_id
+ max_dunning_level dunning_amount));
+ print qq|<p>$form->{saved_message}</p>| if $form->{saved_message};
-<input type=hidden name=queued value="$form->{queued}">
-<input type=hidden name=printed value="$form->{printed}">
-<input type=hidden name=emailed value="$form->{emailed}">
-
-<input type=hidden name=title value="$form->{title}">
-<input type=hidden name=vc value=$form->{vc}>
-
-<input type=hidden name=discount value=$form->{discount}>
-<input type=hidden name=creditlimit value=$form->{creditlimit}>
-<input type=hidden name=creditremaining value=$form->{creditremaining}>
-
-<input type=hidden name=tradediscount value=$form->{tradediscount}>
-<input type=hidden name=business value=$form->{business}>
-
-<input type=hidden name=closedto value=$form->{closedto}>
-<input type=hidden name=locked value=$form->{locked}>
-
-<input type=hidden name=shipped value=$form->{shipped}>
-<input type=hidden name=lizenzen value=$lizenzen>
-<input type=hidden name=storno value=$form->{storno}>
-<input type=hidden name=storno_id value=$form->{storno_id}>
+ print qq|
+<input type="hidden" name="lizenzen" value="$lizenzen">
+<div class="listtop" width="100%">$form->{title}</div>
-<table width=100%>
- <tr class=listtop>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
+<table width="100%">
<tr>
- <td>
- <table width=100%>
- <tr valign=top>
- <td>
- <table>
- <tr>
- <th align=right nowrap>| . $locale->text('Customer') . qq|</th>
- <td colspan=3>$customer</td>
- <input type=hidden name=customer_klass value=$form->{customer_klass}>
- <input type=hidden name=customer_id value=$form->{customer_id}>
- <input type=hidden name=oldcustomer value="$form->{oldcustomer}">
- <th align=richt nowrap>|
- . $locale->text('Contact Person') . qq|</th>
- <td colspan=3>$contact</td>
- </tr>
- <tr>
- <td></td>
- <td colspan=3>
- <table>
- <tr>
- <th nowrap>| . $locale->text('Credit Limit') . qq|</th>
- <td>$form->{creditlimit}</td>
- <td width=20%></td>
- <th nowrap>| . $locale->text('Remaining') . qq|</th>
- <td class="plus$n">$form->{creditremaining}</td>
- </tr>
- </table>
- </td>
- $shipto
- </tr>
- $business
- $dunning
+ <td valign="top">
+ <table>
+ <tr>
+ $customers
+ <input type="hidden" name="customer_klass" value="$form->{customer_klass}">
+ <input type="hidden" name="customer_id" value="$form->{customer_id}">
+ <input type="hidden" name="oldcustomer" value="$form->{oldcustomer}">
+ <input type="hidden" name="selectcustomer" value="$form->{selectcustomer}">
+ </tr>
+ $contact
+ $shipto
+ <tr>
+ <td align="right">| . $locale->text('Credit Limit') . qq|</td>
+ <td>$form->{creditlimit}; | . $locale->text('Remaining') . qq| <span class="plus$n">$form->{creditremaining}</span></td>
+ </tr>
+ $dunning
+ $business
<tr>
- <th align=right nowrap>| . $locale->text('Record in') . qq|</th>
- <td colspan=3><select name=AR style="width:280px;">$form->{selectAR}</select></td>
- <input type=hidden name=selectAR value="$form->{selectAR}">
+ <th align="right" nowrap>| . $locale->text('Record in') . qq|</th>
+ <td colspan="3"><select name="AR" style="width:250px;">$form->{selectAR}</select></td>
+ <input type="hidden" name="selectAR" value="$form->{selectAR}">
</tr>
$taxzone
$department
<tr>
- <th align=right nowrap>| . $locale->text('Currency') . qq|</th>
- <td><select name=currency>$form->{selectcurrency}</select></td>
- <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
- <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
- <input type=hidden name=fxgain_accno value=$form->{fxgain_accno}>
- <input type=hidden name=fxloss_accno value=$form->{fxloss_accno}>
+ $currencies
+ <input type="hidden" name="fxgain_accno" value="$form->{fxgain_accno}">
+ <input type="hidden" name="fxloss_accno" value="$form->{fxloss_accno}">
$exchangerate
</tr>
<tr>
- <th align=right nowrap>| . $locale->text('Shipping Point') . qq|</th>
- <td colspan=3><input name=shippingpoint size=35 value="$form->{shippingpoint}"></td>
- </tr>
+ <th align="right" nowrap>| . $locale->text('Shipping Point') . qq|</th>
+ <td colspan="3"> | .
+ $cgi->textfield("-name" => "shippingpoint", "-size" => 35, "-value" => $form->{shippingpoint}) .
+ qq|</tr>
<tr>
- <th align=right nowrap>| . $locale->text('Ship via') . qq|</th>
- <td colspan=3><input name=shipvia size=35 value="$form->{shipvia}"></td>
- </tr>|;
+ <th align="right" nowrap>| . $locale->text('Ship via') . qq|</th>
+ <td colspan="3"><input name="shipvia" size="35" value="$form->{shipvia}"></td>
+ </tr>
+ <tr>
+ <th align="right">| . $locale->text('Transaction description') . qq|</th>
+ <td colspan="3">| . $cgi->textfield("-name" => "transaction_description", "-size" => 35, "-value" => $form->{transaction_description}) . qq|</td>
+ </tr>|;
# <tr>
# <td colspan=4>
# <table>
# </tr>
print qq| </table>
</td>
- <td align=right>
+ <td align="right" valign="top">
<table>
- <tr>
- <th align=right nowrap>| . $locale->text('Salesperson') . qq|</th>
- <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
- <input type=hidden name=selectemployee value="$form->{selectemployee}">
- <td></td>
- </tr>|;
+ $employees
+ $salesman
+|;
if ($form->{type} eq "credit_note") {
print qq| <tr>
- <th align=right nowrap>| . $locale->text('Credit Note Number') . qq|</th>
- <td><input name=invnumber size=11 value="$form->{invnumber}"></td>
+ <th align="right" nowrap>| . $locale->text('Credit Note Number') . qq|</th>
+ <td><input name="invnumber" size="11" value="$form->{invnumber}"></td>
</tr>
<tr>
- <th align=right>| . $locale->text('Credit Note Date') . qq|</th>
+ <th align="right">| . $locale->text('Credit Note Date') . qq|</th>
$button1
</tr>|;
} else {
print qq| <tr>
- <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
- <td><input name=invnumber size=11 value="$form->{invnumber}"></td>
+ <th align="right" nowrap>| . $locale->text('Invoice Number') . qq|</th>
+ <td><input name="invnumber" size="11" value="$form->{invnumber}"></td>
</tr>
<tr>
- <th align=right>| . $locale->text('Invoice Date') . qq|</th>
+ <th align="right">| . $locale->text('Invoice Date') . qq|</th>
$button1
</tr>
<tr>
- <th align=right>| . $locale->text('Due Date') . qq|</th>
+ <th align="right">| . $locale->text('Due Date') . qq|</th>
$button2
</tr>
<tr>
- <th align=right>| . $locale->text('Delivery Date') . qq|</th>
+ <th align="right">| . $locale->text('Delivery Date') . qq|</th>
$button3
</tr>|;
}
print qq| <tr>
- <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
- <td><input name=ordnumber size=11 value="$form->{ordnumber}"></td>
+ <th align="right" nowrap>| . $locale->text('Order Number') . qq|</th>
+ <td><input name="ordnumber" size="11" value="$form->{ordnumber}"></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap>| . $locale->text('Order Date') . qq|</th>
+ <td><input name="orddate" id="orddate" size="11" title="$myconfig{dateformat}" value="| . Q($form->{orddate}) . qq|" onBlur=\"check_right_date_format(this)\">
+ <input type="button" name="b_orddate" id="trigger_orddate" value="?"></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap>| . $locale->text('Quotation Number') . qq|</th>
+ <td><input name="quonumber" size="11" value="$form->{quonumber}"></td>
</tr>
+ <tr>
+ <th align="right" nowrap>| . $locale->text('Quotation Date') . qq|</th>
+ <td><input name="quodate" id="quodate" size="11" title="$myconfig{dateformat}" value="| . Q($form->{quodate}) . qq|" onBlur=\"check_right_date_format(this)\">
+ <input type="button" name="b_quodate" id="trigger_quodate" value="?"></td>
+ </tr>
<tr>
- <th align=right nowrap>| . $locale->text('Quotation Number') . qq|</th>
- <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
+ <th align="right" nowrap>| . $locale->text('Customer Order Number') . qq|</th>
+ <td><input name="cusordnumber" size="11" value="$form->{cusordnumber}"></td>
</tr>
<tr>
- <th align=right nowrap>| . $locale->text('Customer Order Number') . qq|</th>
- <td><input name=cusordnumber size=11 value="$form->{cusordnumber}"></td>
+ <th align="right" nowrap>| . $locale->text('Project Number') . qq|</th>
+ <td>$globalprojectnumber</td>
</tr>
</table>
</td>
<td>
</td>
</tr>
-
+| .
$jsscript
-
+. qq|
<!-- shipto are in hidden variables -->
-
-<input type=hidden name=shiptoname value="$form->{shiptoname}">
-<input type=hidden name=shiptostreet value="$form->{shiptostreet}">
-<input type=hidden name=shiptozipcode value="$form->{shiptozipcode}">
-<input type=hidden name=shiptocity value="$form->{shiptocity}">
-<input type=hidden name=shiptocountry value="$form->{shiptocountry}">
-<input type=hidden name=shiptocontact value="$form->{shiptocontact}">
-<input type=hidden name=shiptophone value="$form->{shiptophone}">
-<input type=hidden name=shiptofax value="$form->{shiptofax}">
-<input type=hidden name=shiptoemail value="$form->{shiptoemail}">
-
-<!-- email variables -->
-<input type=hidden name=message value="$form->{message}">
-<input type=hidden name=email value="$form->{email}">
-<input type=hidden name=subject value="$form->{subject}">
-<input type=hidden name=cc value="$form->{cc}">
-<input type=hidden name=bcc value="$form->{bcc}">
-<input type=hidden name=webdav value=$webdav>
-<input type=hidden name=taxaccounts value="$form->{taxaccounts}">
-|;
-
- foreach $item (split / /, $form->{taxaccounts}) {
- print qq|
-<input type=hidden name="${item}_rate" value="$form->{"${item}_rate"}">
-<input type=hidden name="${item}_description" value="$form->{"${item}_description"}">
-<input type=hidden name="${item}_taxnumber" value="$form->{"${item}_taxnumber"}">
-|;
+| ;
+map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); }
+ qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax shiptoemail shiptodepartment_1 shiptodepartment_2));
+print qq|<!-- email variables --> |;
+map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); }
+ qw(message email subject cc bcc taxaccounts));
+print qq|<input type="hidden" name="webdav" value="| . $webdav . qq|">|;
+
+ foreach $item (split(/ /, $form->{taxaccounts})) {
+ map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); }
+ ("${item}_rate", "${item}_description", "${item}_taxnumber"));
}
$lxdebug->leave_sub();
}
}
$rows = ($rows > $introws) ? $rows : $introws;
$notes =
- qq|<textarea name=notes rows=$rows cols=26 wrap=soft>$form->{notes}</textarea>|;
+ qq|<textarea name="notes" rows="$rows" cols="26" wrap="soft">$form->{notes}</textarea>|;
$intnotes =
- qq|<textarea name=intnotes rows=$rows cols=35 wrap=soft>$form->{intnotes}</textarea>|;
+ qq|<textarea name="intnotes" rows="$rows" cols="35" wrap="soft">$form->{intnotes}</textarea>|;
- $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
+ $form->{taxincluded} = ($form->{taxincluded} ? "checked" : "");
$taxincluded = "";
if ($form->{taxaccounts}) {
$taxincluded = qq|
- <input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}> <b>|
+ <input name="taxincluded" class="checkbox" type="checkbox" $form->{taxincluded}> <b>|
. $locale->text('Tax Included') . qq|</b><br><br>|;
}
$tax .= qq|
<tr>
- <th align=right>$form->{"${item}_description"}</th>
- <td align=right>$form->{"${item}_total"}</td>
+ <th align="right">$form->{"${item}_description"} |
+ . $form->{"${item}_rate"} * 100 .qq|%</th>
+ <td align="right">$form->{"${item}_total"}</td>
</tr>
|;
}
$subtotal = qq|
<tr>
- <th align=right>| . $locale->text('Subtotal') . qq|</th>
- <td align=right>$form->{invsubtotal}</td>
+ <th align="right">| . $locale->text('Subtotal') . qq|</th>
+ <td align="right">$form->{invsubtotal}</td>
</tr>
|;
$tax .= qq|
<tr>
- <th align=right>Enthaltene $form->{"${item}_description"}</th>
- <td align=right>$form->{"${item}_total"}</td>
+ <th align="right">Enthaltene $form->{"${item}_description"} |
+ . $form->{"${item}_rate"} * 100 .qq|%</th>
+ <td align="right">$form->{"${item}_total"}</td>
</tr>
<tr>
- <th align=right>Nettobetrag</th>
- <td align=right>$form->{"${item}_netto"}</td>
+ <th align="right">Nettobetrag</th>
+ <td align="right">$form->{"${item}_netto"}</td>
</tr>
|;
}
print qq|
<tr>
<td>
- <table width=100%>
- <tr valign=bottom>
+ <table width="100%">
+ <tr valign="bottom">
<td>
<table>
<tr>
- <th align=left>| . $locale->text('Notes') . qq|</th>
- <th align=left>| . $locale->text('Internal Notes') . qq|</th>
- <th align=right>| . $locale->text('Payment Terms') . qq|</th>
+ <th align="left">| . $locale->text('Notes') . qq|</th>
+ <th align="left">| . $locale->text('Internal Notes') . qq|</th>
+ <th align="right">| . $locale->text('Payment Terms') . qq|</th>
</tr>
- <tr valign=top>
+ <tr valign="top">
<td>$notes</td>
<td>$intnotes</td>
- <td><select name=payment_id onChange="set_duedate(['payment_id__' + this.value],['duedate'])">$payment
+ <td><select name="payment_id" onChange="if (this.value) set_duedate(['payment_id__' + this.value],['duedate'])">$payment
</select></td>
</tr>
</table>
</td>
- <td align=right width=100%>
+ <td>
+ <table>
+ <tr>
+ <th align=left>| . $locale->text('Ertrag') . qq|</th>
+ <td>| . $form->format_amount(\%myconfig, $form->{marge_total}, 2, 0) . qq|</td>
+ </tr>
+ <tr>
+ <th align=left>| . $locale->text('Ertrag prozentual') . qq|</th>
+ <td>| . $form->format_amount(\%myconfig, $form->{marge_percent}, 2, 0) . qq| %</td>
+ </tr>
+ <input type=hidden name="marge_total" value="$form->{"marge_total"}">
+ <input type=hidden name="marge_percent" value="$form->{"marge_percent"}">
+ </table>
+ </td>
+ <td align="right">
$taxincluded
- <table width=100%>
+ <table>
$subtotal
$tax
<tr>
- <th align=right>| . $locale->text('Total') . qq|</th>
- <td align=right>$form->{invtotal}</td>
+ <th align="right">| . $locale->text('Total') . qq|</th>
+ <td align="right">$form->{invtotal}</td>
</tr>
</table>
</td>
if ($webdav) {
$webdav_list = qq|
<tr>
- <td><hr size=3 noshade></td>
+ <td><hr size="3" noshade></td>
</tr>
<tr>
- <th class=listtop align=left>Dokumente im Webdav-Repository</th>
+ <th class="listtop" align="left">Dokumente im Webdav-Repository</th>
</tr>
- <table width=100%>
- <td align=left width=30%><b>Dateiname</b></td>
- <td align=left width=70%><b>Webdavlink</b></td>
+ <table width="100%">
+ <td align="left" width="30%"><b>Dateiname</b></td>
+ <td align="left" width="70%"><b>Webdavlink</b></td>
|;
- foreach $file (keys %{ $form->{WEBDAV} }) {
+ foreach $file (@{ $form->{WEBDAV} }) {
$webdav_list .= qq|
<tr>
- <td align=left>$file</td>
- <td align=left><a href="$form->{WEBDAV}{$file}">$form->{WEBDAV}{$file}</a></td>
+ <td align="left">$file->{name}</td>
+ <td align="left"><a href="$file->{link}">$file->{type}</a></td>
</tr>
|;
}
print qq|
<tr>
<td>
- <table width=100%>
- <tr class=listheading>
- <th colspan=6 class=listheading>|
+ <table width="100%">
+ <tr class="listheading">
+ <th colspan="6" class="listheading">|
. $locale->text('Payments') . qq|</th>
</tr>
|;
print qq|
<tr>
<td>
- <table width=100%>
- <tr class=listheading>
- <th colspan=6 class=listheading>|
+ <table width="100%">
+ <tr class="listheading">
+ <th colspan="6" class="listheading">|
. $locale->text('Incoming Payments') . qq|</th>
</tr>
|;
</tr>
";
- my @triggers = ();
+ my @triggers = ();
+ my $totalpaid = 0;
$form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
for $i (1 .. $form->{paidaccounts}) {
$form->{"exchangerate_$i"} =
$form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
+ if ($form->{"exchangerate_$i"} == 0) {
+ $form->{"exchangerate_$i"} = "";
+ }
$exchangerate = qq| |;
if ($form->{currency} ne $form->{defaultcurrency}) {
if ($form->{"forex_$i"}) {
- $exchangerate =
- qq|<input type=hidden name="exchangerate_$i" value=$form->{"exchangerate_$i"}>$form->{"exchangerate_$i"}|;
+ $exchangerate = qq|<input type="hidden" name="exchangerate_$i" value="$form->{"exchangerate_$i"}">$form->{"exchangerate_$i"}|;
} else {
- $exchangerate =
- qq|<input name="exchangerate_$i" size=10 value=$form->{"exchangerate_$i"}>|;
+ $exchangerate = qq|<input name="exchangerate_$i" size="10" value="$form->{"exchangerate_$i"}">|;
}
}
- $exchangerate .= qq|
-<input type=hidden name="forex_$i" value=$form->{"forex_$i"}>
-|;
+ $exchangerate .= qq|<input type="hidden" name="forex_$i" value="$form->{"forex_$i"}">|;
$column_data{"paid_$i"} =
- qq|<td align=center><input name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
- $column_data{"exchangerate_$i"} = qq|<td align=center>$exchangerate</td>|;
+ qq|<td align="center"><input name="paid_$i" size="11" value="$form->{"paid_$i"}" onBlur=\"check_right_number_format(this)\"></td>|;
+ $column_data{"exchangerate_$i"} = qq|<td align="center">$exchangerate</td>|;
$column_data{"AR_paid_$i"} =
- qq|<td align=center><select name="AR_paid_$i">$form->{"selectAR_paid_$i"}</select></td>|;
+ qq|<td align="center"><select name="AR_paid_$i">$form->{"selectAR_paid_$i"}</select></td>|;
$column_data{"datepaid_$i"} =
- qq|<td align=center><input id="datepaid_$i" name="datepaid_$i" size=11 title="$myconfig{dateformat}" value=$form->{"datepaid_$i"}>
+ qq|<td align="center"><input id="datepaid_$i" name="datepaid_$i" size="11" title="$myconfig{dateformat}" value="$form->{"datepaid_$i"}" onBlur=\"check_right_date_format(this)\">
<input type="button" name="datepaid_$i" id="trigger_datepaid_$i" value="?"></td>|;
$column_data{"source_$i"} =
- qq|<td align=center><input name="source_$i" size=11 value="$form->{"source_$i"}"></td>|;
+ qq|<td align=center><input name="source_$i" size="11" value="$form->{"source_$i"}"></td>|;
$column_data{"memo_$i"} =
- qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></td>|;
+ qq|<td align="center"><input name="memo_$i" size="11" value="$form->{"memo_$i"}"></td>|;
map { print qq|$column_data{"${_}_$i"}\n| } @column_index;
print "
push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
}
+ my $paid_missing = $form->{oldinvtotal} - $totalpaid;
+
print qq|
-<input type=hidden name=paidaccounts value=$form->{paidaccounts}>
-<input type=hidden name=selectAR_paid value="$form->{selectAR_paid}">
-<input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
-<input type=hidden name=oldtotalpaid value=$totalpaid>
+ <tr>
+ <td></td>
+ <td></td>
+ <td align="center">| . $locale->text('Total') . qq|</td>
+ <td align="center">| . H($form->format_amount(\%myconfig, $totalpaid, 2)) . qq|</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td align="center">| . $locale->text('Missing amount') . qq|</td>
+ <td align="center">| . H($form->format_amount(\%myconfig, $paid_missing, 2)) . qq|</td>
+ </tr>
+|;
+
+ map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } qw(paidaccounts selectAR_paid oldinvtotal));
+ print qq|<input type="hidden" name="oldtotalpaid" value="$totalpaid">
</table>
</td>
</tr>
<tr>
- <td><hr size=3 noshade></td>
+ <td><hr size="3" noshade></td>
</tr>
<tr>
<td>
|;
- &print_options;
+ print_options();
print qq|
</td>
$closedto = $form->datetonum($form->{closedto}, \%myconfig);
if ($form->{id}) {
+ my $show_storno = !$form->{storno} && !IS->has_storno(\%myconfig, $form, "ar");
+
print qq|
- <input class=submit type=submit accesskey="u" name=action id=update_button value="|
+ <input class="submit" type="submit" accesskey="u" name="action" id="update_button" value="|
. $locale->text('Update') . qq|">
- <input class=submit type=submit name=action value="|
+ <input class="submit" type="submit" name="action" value="|
. $locale->text('Ship to') . qq|">
- <input class=submit type=submit name=action value="|
+ <input class="submit" type="submit" name="action" value="|
. $locale->text('Print') . qq|">
- <input class=submit type=submit name=action value="|
- . $locale->text('E-mail') . qq|">|;
- print qq|<input class=submit type=submit name=action value="|
- . $locale->text('Storno') . qq|">| unless ($form->{storno});
- print qq|<input class=submit type=submit name=action value="|
+ <input class="submit" type="submit" name="action" value="|
+ . $locale->text('E-mail') . qq|"> |;
+ print qq|<input class="submit" type="submit" name="action" value="|
+ . $locale->text('Storno') . qq|"> | if ($show_storno);
+ print qq|<input class="submit" type="submit" name="action" value="|
. $locale->text('Post Payment') . qq|">
|;
- print qq|<input class=submit type=submit name=action value="|
+ print qq|<input class="submit" type="submit" name="action" value="|
. $locale->text('Use As Template') . qq|">
|;
if ($form->{id} && !($form->{type} eq "credit_note")) {
print qq|
- <input class=submit type=submit name=action value="|
+ <input class="submit" type="submit" name="action" value="|
. $locale->text('Credit Note') . qq|">
|;
}
if ($form->{radier}) {
print qq|
- <input class=submit type=submit name=action value="|
+ <input class="submit" type="submit" name="action" value="|
. $locale->text('Delete') . qq|">
|;
}
if ($invdate > $closedto) {
print qq|
- <input class=submit type=submit name=action value="|
+ <input class="submit" type="submit" name="action" value="|
. $locale->text('Order') . qq|">
|;
}
} else {
if ($invdate > $closedto) {
- print qq|<input class=submit type=submit name=action id=update_button value="|
+ print qq|<input class="submit" type="submit" name="action" id="update_button" value="|
. $locale->text('Update') . qq|">
- <input class=submit type=submit name=action value="|
+ <input class="submit" type="submit" name="action" value="|
. $locale->text('Ship to') . qq|">
- <input class=submit type=submit name=action value="|
+ <input class="submit" type="submit" name="action" value="|
. $locale->text('Preview') . qq|">
- <input class=submit type=submit name=action value="|
+ <input class="submit" type="submit" name="action" value="|
. $locale->text('E-mail') . qq|">
- <input class=submit type=submit name=action value="|
+ <input class="submit" type="submit" name="action" value="|
. $locale->text('Print and Post') . qq|">
- <input class=submit type=submit name=action value="|
- . $locale->text('Post') . qq|">|;
+ <input class="submit" type="submit" name="action" value="|
+ . $locale->text('Post') . qq|"> | .
+ NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'),
+ '-class' => 'submit'));
}
}
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
+ # button for saving history
+ if($form->{id} ne "") {
+ print qq|
+ <input type="button" class="submit" onclick="set_history_window(|
+ . Q($form->{id})
+ . qq|);" name="history" id="history" value="|
+ . $locale->text('history')
+ . qq|"> |;
}
-
+ # /button for saving history
+
+ # mark_as_paid button
+ if($form->{id} ne "") {
+ print qq|<input type="submit" class="submit" name="action" value="|
+ . $locale->text('mark as paid') . qq|">|;
+ }
+ # /mark_as_paid button
print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
qq|
-<input type=hidden name=rowcount value=$form->{rowcount}>
-
-<input name=callback type=hidden value="$form->{callback}">
-
-<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 type="hidden" name="rowcount" value="$form->{rowcount}">
+| .
+$cgi->hidden("-name" => "callback", "-value" => $form->{callback})
+. $cgi->hidden('-name' => 'draft_id', '-default' => [$form->{draft_id}])
+. $cgi->hidden('-name' => 'draft_description', '-default' => [$form->{draft_description}]);
+map({ print $cgi->hidden("-name" => $_ , "-value" => $form->{$_});} qw(login password));
+print qq|
</form>
</body>
$lxdebug->leave_sub();
}
+sub mark_as_paid {
+ $lxdebug->enter_sub();
+ &mark_as_paid_common(\%myconfig,"ar");
+ $lxdebug->leave_sub();
+}
+
sub update {
$lxdebug->enter_sub();
$form->{print_and_post} = 0;
}
+
+ if($form->{taxincluded}) {
+ $taxincluded = "checked";
+ }
$form->{update} = 1;
&check_name(customer);
- &check_project;
+ if(!$form->{taxincluded}) {
+ $form->{taxincluded} = $taxincluded;
+ }
+
$form->{exchangerate} = $exchangerate
if (
}
$lxdebug->leave_sub();
}
+
sub post_payment {
$lxdebug->enter_sub();
+
+ $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
for $i (1 .. $form->{paidaccounts}) {
if ($form->{"paid_$i"}) {
$datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
($form->{AR}) = split /--/, $form->{AR};
($form->{AR_paid}) = split /--/, $form->{AR_paid};
relink_accounts();
- $form->redirect($locale->text(' Payment posted!'))
+ $form->redirect($locale->text('Payment posted!'))
if (IS->post_payment(\%myconfig, \%$form));
$form->error($locale->text('Cannot post payment!'));
sub post {
$lxdebug->enter_sub();
+
+ $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
$form->isblank("invdate", $locale->text('Invoice Date missing!'));
$form->isblank("customer", $locale->text('Customer missing!'));
+ $form->{invnumber} =~ s/^\s*//g;
+ $form->{invnumber} =~ s/\s*$//g;
+
# if oldcustomer ne customer redo form
if (&check_name(customer)) {
&update;
}
}
- ($form->{AR}) = split /--/, $form->{AR};
- ($form->{AR_paid}) = split /--/, $form->{AR_paid};
+ ($form->{AR}) = split /--/, $form->{AR};
+ ($form->{AR_paid}) = split /--/, $form->{AR_paid};
+ $form->{storno} ||= 0;
$form->{label} = $locale->text('Invoice');
$form->{id} = 0 if $form->{postasnew};
# get new invnumber in sequence if no invnumber is given or if posasnew was requested
- if (!$form->{invnumber} || $form->{postasnew}) {
+ if ($form->{postasnew}) {
if ($form->{type} eq "credit_note") {
- $form->{invnumber} = $form->update_defaults(\%myconfig, "cnnumber");
+ undef($form->{cnnumber});
} else {
- $form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber");
+ undef($form->{invnumber});
}
}
+
relink_accounts();
- if ($print_post) {
- if (!(IS->post_invoice(\%myconfig, \%$form))) {
- $form->error($locale->text('Cannot post invoice!'));
- }
- } else {
- $form->redirect(
- $form->{label} . " $form->{invnumber} " . $locale->text('posted!'))
- if (IS->post_invoice(\%myconfig, \%$form));
- $form->error($locale->text('Cannot post invoice!'));
+ $form->error($locale->text('Cannot post invoice!'))
+ unless IS->post_invoice(\%myconfig, \%$form);
+ remove_draft() if $form->{remove_draft};
+
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
+ $form->{addition} = $print_post ? "PRINTED AND POSTED" :
+ $form->{storno} ? "STORNO" :
+ "POSTED";
+ $form->save_history($form->dbconnect(\%myconfig));
}
+ $form->redirect( $form->{label} . " $form->{invnumber} " . $locale->text('posted!'))
+ unless $print_post;
+
$lxdebug->leave_sub();
}
$form->error($locale->text('Cannot storno storno invoice!'));
}
+ if (IS->has_storno(\%myconfig, $form, "ar")) {
+ $form->error($locale->text("Invoice has already been storno'd!"));
+ }
+
+ map({ my $key = $_; delete($form->{$key})
+ unless (grep({ $key eq $_ } qw(login password id stylesheet type))); }
+ keys(%{ $form }));
+
+ invoice_links();
+ prepare_invoice();
+ relink_accounts();
+
+ # Payments must not be recorded for the new storno invoice.
+ $form->{paidaccounts} = 0;
+ map { my $key = $_; delete $form->{$key} if grep { $key =~ /^$_/ } qw(datepaid_ source_ memo_ paid_ exchangerate_ AR_paid_) } keys %{ $form };
+
$form->{storno_id} = $form->{id};
$form->{storno} = 1;
$form->{id} = "";
$form->{invnumber} = "Storno zu " . $form->{invnumber};
+ $form->{rowcount}++;
- &post();
+ post();
$lxdebug->leave_sub();
-
}
sub preview {
$form->{preview} = 1;
$old_form = new Form;
for (keys %$form) { $old_form->{$_} = $form->{$_} }
- $old_form->{rowcount}++;
&print_form($old_form);
$lxdebug->leave_sub();
print qq|
<body>
-<form method=post action=$form->{script}>
+<form method="post" action="$form->{script}">
|;
# delete action variable
foreach $key (keys %$form) {
$form->{$key} =~ s/\"/"/g;
- print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
+ print qq|<input type="hidden" name="$key" value="$form->{$key}">\n|;
}
print qq|
-<h2 class=confirm>| . $locale->text('Confirm!') . qq|</h2>
+<h2 class="confirm">| . $locale->text('Confirm!') . qq|</h2>
<h4>|
. $locale->text('Are you sure you want to delete Invoice Number')
</h4>
<p>
-<input name=action class=submit type=submit value="|
+<input name="action" class="submit" type="submit" value="|
. $locale->text('Yes') . qq|">
</form>
|;
$form->{script} = 'is.pl';
$script = "is";
$buysell = 'buy';
-
+
# bo creates the id, reset it
map { delete $form->{$_} }
sub yes {
$lxdebug->enter_sub();
-
- $form->redirect($locale->text('Invoice deleted!'))
- if (IS->delete_invoice(\%myconfig, \%$form, $spool));
+ if (IS->delete_invoice(\%myconfig, \%$form, $spool)) {
+ # saving the history
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
+ $form->{addition} = "DELETED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
+ $form->redirect($locale->text('Invoice deleted!'));
+ }
$form->error($locale->text('Cannot delete invoice!'));
$lxdebug->leave_sub();
}
+
+sub e_mail {
+ $lxdebug->enter_sub();
+
+ if (!$form->{id}) {
+ $print_post = 1;
+
+ my $saved_form = save_form();
+
+ post();
+
+ my %saved_vars;
+ map({ $saved_vars{$_} = $form->{$_}; } qw(id invnumber));
+ restore_form($saved_form);
+ map({ $form->{$_} = $saved_vars{$_}; } qw(id invnumber));
+ }
+
+ edit_e_mail();
+
+ $lxdebug->leave_sub();
+}
}
$login =
"[" . $login
- . " - <a href=\"login.pl?path="
- . $form->{"path"}
- . "&password="
+ . " - <a href=\"login.pl?password="
. $form->{"password"}
. "&action=logout\" target=\"_top\">"
. $locale->text('Logout')
. $Jahr . " - ";
#$zeit="<div id='Uhr'>".$Stunden.":".$Minuten.":".$Sekunden."</div>";
-$zeit = "<div id='Uhr'>" . $Stunden . ":" . $Minuten . "</div>";
+my $zeit = "<div id='Uhr'>" . $Stunden . ":" . $Minuten . "</div>";
print qq|
<script type="text/javascript">
#
print qq|
-<body bgcolor="#ffffff" text="#ffffff" link="#ffffff" vlink="#ffffff" alink="#ffffff" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
+<body bgcolor="#ffffff" text="#ffffff" link="#ffffff" vlink="#ffffff" alink="#ffffff" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" style="background-image: url('image/fade.png'); background-repeat:repeat-x;">
<table border="0" width="100%" background="image/bg_titel.gif" cellpadding="0" cellspacing="0">
<tr>
- <td style="color:white; font-family:verdana,arial,sans-serif; font-size: 12px;"> [<a href="JavaScript:top.main_window.print()">drucken</a>]</td>
+ <td style="color:white; font-family:verdana,arial,sans-serif; font-size: 12px;"> [<a href="JavaScript:top.main_window.print()">| . $locale->text('drucken') . qq|</a>]</td>
<td align="right" style="vertical-align:middle; color:white; font-family:verdana,arial,sans-serif; font-size: 12px;" nowrap>|
. $login . $datum . qq| <script>writeclock()</script>
</td>
use SL::IS;
use SL::LICENSES;
+require "bin/mozilla/common.pl";
+
sub quot {
$lxdebug->enter_sub();
$_[0] =~ s/\"/\"/g;
sub form_footer {
$lxdebug->enter_sub();
- my @items = ("path", "login", "password", "old_callback", "previousform");
+ my @items = qw(login password old_callback previousform);
push(@items, @{ $form->{"hidden"} });
map({
print("<input type=hidden name=$_ value=\"" . quot($form->{$_}) . "\">\n"
sub continue {
$lxdebug->enter_sub();
- &{ $form->{nextsub} };
+ call_sub($form->{"nextsub"});
$lxdebug->leave_sub();
}
LICENSES->search(\%myconfig, $form);
$callback = "";
- foreach (
- ("db", "path", "login", "password",
- "partnumber", "description", "customer_name", "all",
- "expiring_in", "show_expired")
- ) {
- $callback .= "\&${_}=" . $form->escape($form->{$_}, 1);
- }
+ map { $callback .= "\&${_}=" . $form->escape($form->{$_}, 1) }
+ qw(db login password partnumber description customer_name all expiring_in show_expired);
$details = $form->{"script"} . "?action=details" . $callback . "\&id=";
$invdetails = "is.pl?action=edit" . $callback . "\&id=";
$callback = $form->{"script"} . "?action=do_search" . $callback;
use SL::User;
use SL::Form;
+require "bin/mozilla/common.pl";
+
$form = new Form;
$locale = new Locale $language, "login";
# customization
-if (-f "$form->{path}/custom_$form->{script}") {
- eval { require "$form->{path}/custom_$form->{script}"; };
+if (-f "bin/mozilla/custom_$form->{script}") {
+ eval { require "bin/mozilla/custom_$form->{script}"; };
$form->error($@) if ($@);
}
# per login customization
-if (-f "$form->{path}/$form->{login}_$form->{script}") {
- eval { require "$form->{path}/$form->{login}_$form->{script}"; };
+if (-f "bin/mozilla/$form->{login}_$form->{script}") {
+ eval { require "bin/mozilla/$form->{login}_$form->{script}"; };
$form->error($@) if ($@);
}
if ($form->{action}) {
$form->{titlebar} .= " - $myconfig{name} - $myconfig{dbname}";
- &{ $locale->findsub($form->{action}) };
+ call_sub($locale->findsub($form->{action}));
} else {
&login_screen;
}
<th align=right>| . $locale->text('Password') . qq|</th>
<td><input class=login type=password name=password size=30 tabindex="2"></td>
</tr>
- <input type=hidden name=path value=$form->{path}>
</table>
<br>
# made it this far, execute the menu
if ($user->{menustyle} eq "v3") {
$form->{callback} =
- "menuv3.pl?login=$form->{login}&password=$form->{password}&path=$form->{path}&action=display";
+ "menuv3.pl?login=$form->{login}&password=$form->{password}&action=display";
} elsif ($user->{menustyle} eq "neu") {
$form->{callback} =
- "menunew.pl?login=$form->{login}&password=$form->{password}&path=$form->{path}&action=display";
+ "menunew.pl?login=$form->{login}&password=$form->{password}&action=display";
} else {
$form->{callback} =
- "menu.pl?login=$form->{login}&password=$form->{password}&path=$form->{path}&action=display";
+ "menu.pl?login=$form->{login}&password=$form->{password}&action=display";
}
$form->redirect;
unlink "$userspath/$form->{login}.conf";
# remove the callback to display the message
- $form->{callback} = "login.pl?path=$form->{path}&action=&login=";
+ $form->{callback} = "login.pl?action=&login=";
$form->redirect($locale->text('You are logged out!'));
$lxdebug->leave_sub();
$myconfig{address} =~ s/\\n/<br>/g;
$myconfig{dbhost} = $locale->text('localhost') unless $myconfig{dbhost};
- map { $form->{$_} = $myconfig{$_} } qw(charset stylesheet);
+ $form->{stylesheet} = $myconfig{stylesheet};
$form->{title} = $locale->text('About');
print qq|
<frameset rows="28px,*" cols="*" framespacing="0" frameborder="0">
- <frame src="kopf.pl?login=$form->{login}&password=$form->{password}&path=$form->{path}" name="kopf" scrolling="NO">
+ <frame src="kopf.pl?login=$form->{login}&password=$form->{password}" name="kopf" scrolling="NO">
<frameset cols="$framesize,*" framespacing="0" frameborder="0" border="0" >
- <frame src="$form->{script}?login=$form->{login}&password=$form->{password}&action=acc_menu&path=$form->{path}" name="acc_menu" scrolling="auto" noresize marginwidth="0">
- <frame src="login.pl?login=$form->{login}&password=$form->{password}&action=company_logo&path=$form->{path}" name="main_window" scrolling="auto">
+ <frame src="$form->{script}?login=$form->{login}&password=$form->{password}&action=acc_menu" name="acc_menu" scrolling="auto" noresize marginwidth="0">
+ <frame src="login.pl?login=$form->{login}&password=$form->{password}&action=company_logo" name="main_window" scrolling="auto">
</frameset>
<noframes>
You need a browser that can read frames to see this page.
$mainlevel = $form->{level};
$mainlevel =~ s/$mainlevel--//g;
my $menu = new Menu "$menufile";
- $menu = new Menu "custom_$menufile" if (-f "custom_$menufile");
- $menu = new Menu "$form->{login}_$menufile"
- if (-f "$form->{login}_$menufile");
$form->{title} = $locale->text('Accounting Menu');
# than 20 chars and store it in an array.
# use this array later instead of the -ed label
@chunks = ();
- my ($i,$l) =(-1, 20);
+ my ($i,$l) = (-1, 20);
map {
- $l += length $_;
- if ($l < 20) { $chunks[$i] .= " $_";
- } else { $l =length $_; $chunks[++$i] = $_; }
+ if (($l += length $_) < 20) {
+ $chunks[$i] .= " $_";
+ } else {
+ $l = length $_;
+ $chunks[++$i] = $_;
+ }
} split / /, $label;
- map { $chunks[$_] =~ s/ / / } 0..$#chunks;
+ map { s/ / / } @chunks;
# end multi line
$label =~ s/ / /g;
} else {
my $ml_ = $form->escape($ml);
print
- qq|<tr><td class="bg" height="22" align="left" valign="middle" ><img src="image/$item.png" style="vertical-align:middle"> <a href="menu.pl?path=bin/mozilla&action=acc_menu&level=$ml_&login=$form->{login}&password=$form->{password}" class="nohover">$label</a> </td></tr>\n|;
+ qq|<tr><td class="bg" height="22" align="left" valign="middle" ><img src="image/$item.png" style="vertical-align:middle"> <a href="menu.pl?action=acc_menu&level=$ml_&login=$form->{login}&password=$form->{password}" class="nohover">$label</a> </td></tr>\n|;
§ion_menu($menu, $item);
#print qq|<br>\n|;
&acc_menu;
print qq|
-<iframe id="win1" src="login.pl?login=$form->{login}&password=$form->{password}&action=company_logo&path=$form->{path}" width="100%" height="93%" name="main_window" style="position: absolute; border:0px;">
+<iframe id="win1" src="login.pl?login=$form->{login}&password=$form->{password}&action=company_logo" width="100%" height="93%" name="main_window" style="position: absolute; border:0px;">
<p>Ihr Browser kann leider keine eingebetteten Frames anzeigen.
</p>
</iframe>
sub clock_line {
- $login = "["
+ $fensterlink="menunew.pl?login=$form->{login}&password=$form->{password}&action=display";
+ $fenster = "["."<a href=\"$fensterlink\" target=\"_blank\">neues Fenster</a>]";
+
+ $login = "[Nutzer "
. $form->{login}
- . " - <a href=\"login.pl?path="
- . $form->{"path"}
- . "&password="
+ . " - <a href=\"login.pl?password="
. $form->{"password"}
. "&action=logout\" target=\"_top\">"
. $locale->text('Logout')
print qq|
<script type="text/javascript">
<!--
-var clockid=new Array()
-var clockidoutside=new Array()
-var i_clock=-1
-var thistime= new Date()
-var hours= | . $Stunden . qq|;
-var minutes= | . $Minuten . qq|;
-var seconds= | . $Sekunden . qq|;
-if (eval(hours) <10) {hours="0"+hours}
-if (eval(minutes) < 10) {minutes="0"+minutes}
-if (seconds < 10) {seconds="0"+seconds}
-//var thistime = hours+":"+minutes+":"+seconds
-var thistime = hours+":"+minutes
-
-function writeclock() {
- i_clock++
- if (document.all \|\| document.getElementById \|\| document.layers) {
- clockid[i_clock]="clock"+i_clock
- document.write("<font family=arial size=2><span id='"+clockid[i_clock]+"' style='position:relative'>"+thistime+"</span></font>")
- }
-}
-
function clockon() {
- thistime= new Date()
- hours=thistime.getHours()
- minutes=thistime.getMinutes()
- seconds=thistime.getSeconds()
- if (eval(hours) <10) {hours="0"+hours}
- if (eval(minutes) < 10) {minutes="0"+minutes}
- if (seconds < 10) {seconds="0"+seconds}
- //thistime = hours+":"+minutes+":"+seconds
- thistime = hours+":"+minutes
-
- if (document.all) {
- for (i=0;i<=clockid.length-1;i++) {
- var thisclock=eval(clockid[i])
- thisclock.innerHTML=thistime
- }
- }
-
- if (document.getElementById) {
- for (i=0;i<=clockid.length-1;i++) {
- document.getElementById(clockid[i]).innerHTML=thistime
- }
- }
- var timer=setTimeout("clockon()",60000)
+ var now = new Date();
+ var h = now.getHours();
+ var m = now.getMinutes();
+ document.getElementById('clock_id').innerHTML = (h<10?'0'+h:h)+":"+(m<10?'0'+m:m);
+ var timer=setTimeout("clockon()", 10000);
}
-//window.onload=clockon
+window.onload=clockon
//-->
</script>
<table border="0" width="100%" background="image/bg_titel.gif" cellpadding="0" cellspacing="0">
- <tr>
- <td style="color:white; font-family:verdana,arial,sans-serif; font-size: 12px;"> [<a href="JavaScript:top.main_window.print()">drucken</a>]</td>
- <td align="right" style="vertical-align:middle; color:white; font-family:verdana,arial,sans-serif; font-size: 12px;" nowrap>|
- . $login . $datum . qq| <script>writeclock()</script>
- </td>
- </tr>
+ <tr>
+ <td style="color:white; font-family:verdana,arial,sans-serif; font-size: 12px;"> $fenster [<a href="JavaScript:top.main_window.print()">drucken</a>]</td>
+ <td align="right" style="vertical-align:middle; color:white; font-family:verdana,arial,sans-serif; font-size: 12px;" nowrap>
+ $login $datum <span id='clock_id' style='position:relative'></span>
+ </td>
+ </tr>
</table>
|;
}
$mainlevel = $form->{level};
$mainlevel =~ s/$mainlevel--//g;
my $menu = new Menu "$menufile";
- $menu = new Menu "custom_$menufile" if (-f "custom_$menufile");
- $menu = new Menu "$form->{login}_$menufile"
- if (-f "$form->{login}_$menufile");
$| = 1;
print qq|
+<style>
+<!--
+
+.itemBorder {
+ border: 1px solid black
+}
+
+.itemText {
+ text-decoration: none;
+ color: #000000;
+ font: 12px Arial, Helvetica
+}
+
+.rootItemText {
+ text-decoration: none;
+ color: #ffffff;
+ font: 12px Arial, Helvetica
+}
+
+.menu {
+ color:#ffffff;
+ background:url(image/bg_css_menu.png) repeat bottom;
+ border:1px solid;
+ border-color:#ccc #888 #555 #bbb;
+}
+
+-->
+</style>
+
<script type="text/javascript">
<!--
var isDOM = (document.getElementById ? true : false);
if (borderClass) str += 'class="' + borderClass + '" "';
str += 'onMouseOver="popOver(' + currMenu + ',' + currItem + ')" onMouseOut="popOut(' + currMenu + ',' + currItem + ')">';
str += '<table width="' + (w - 8) + '" border="0" cellspacing="0" cellpadding="' + (!isNS4 && borderClass ? 3 : 0) + '">';
- str +='<tr><td style="cursor:crosshair;" align="left" height="' + (h - 7) + '" onClick=\\'go("' + href + '","' + frame + '")\\'>' + text + '</a></td>';
+ str +='<tr><td class="' + textClass + '" style="cursor:pointer;" align="left" height="' + (h - 7) + '" onClick=\\'go("' + href + '","' + frame + '")\\'>' + text + '</a></td>';
if (target > 0) {
menu[target][0].parentMenu = currMenu;
menu[target][0].parentItem = currItem;
}
}
var menu = new Array();
-var defOver = '#AAAAFF', defBack = '#8888DD';
+var defOver = '#cccccc';
+var defBack = '#dddddd';
var defLength = 22;
menu[0] = new Array();
-menu[0][0] = new Menu(false, '', 5, 18, 19, '#AAAAFF', '#AAAAFF', '', 'itemText');
+menu[0][0] = new Menu(false, '', 5, 18, 19, '#cccccc', '', '', 'rootItemText');
|;
- #
§ion_menu($menu);
print qq|
}
// End -->
</script>
-<style>
-<!--
-.itemBorder { border: 1px solid black }
-.itemText { text-decoration: none; color: #FFFFFF; font: 12px Arial, Helvetica }
-
--->
-</style>
-
-<!--body bgcolor="#AAAAff" text="#ffffff" link="#ffffff" vlink="#ffffff" alink="#ffffff" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0"-->
<BODY scrolling="no" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" style="margin: 0" onLoad="writeMenus(); clockon();" onResize="if (isNS4) nsResizeHandler()">
-<!--BODY marginwidth="0" marginheight="0" style="margin: 0" onLoad="writeMenus()" onResize="if (isNS4) nsResizeHandler()"-->
-<table bgcolor="#AAAAFF" width="100%" border="0" cellpadding="0" cellspacing="0">
+<table class="menu" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td height="21"><font size="1"> </font></td></tr></table>
+
|;
print qq|
} else {
if ($menu->{$item}{module}) {
- #Untermenüpunkte
+ #Untermenüpunkte
$target = $menu->{$item}{target};
$uri = $menu->menuitemNew(\%myconfig, \%$form, $item, $level);
print
qq|menu[$pm][0] = new Menu(true, '>', 0, 20, 180, defOver, defBack, 'itemBorder', 'itemText');\n|;
- #print qq|<tr><td class="bg" height="22" align="left" valign="middle" ><img src="image/$item.png" style="vertical-align:middle"> <a href="menu.pl?path=bin/mozilla&action=acc_menu&level=$ml_&login=$form->{login}&password=$form->{password}" class="nohover">$label</a> </td></tr>\n|;
+ #print qq|<tr><td class="bg" height="22" align="left" valign="middle" ><img src="image/$item.png" style="vertical-align:middle"> <a href="menu.pl?action=acc_menu&level=$ml_&login=$form->{login}&password=$form->{password}" class="nohover">$label</a> </td></tr>\n|;
§ion_menu($menu, $item);
#print qq|<br>\n|;
# end of main
sub display {
- $form->header(qq|<link rel="stylesheet" href="css/menuv3.css?id=| .
- int(rand(100000)) . qq|" type="text/css">|);
+ $form->header(qq|<link rel="stylesheet" href="css/menuv3.css?id=" type="text/css">|);
- print(qq|<body>\n|);
+ $form->{date} = clock_line();
+ $form->{menu} = acc_menu();
- clock_line();
-
- print qq|
-
-<div id="menu">
-
-| . acc_menu() . qq|
-
-</div>
-
-<div style="clear: both;"></div>
-
-<iframe id="win1" src="login.pl?login=$form->{login}&password=$form->{password}&action=company_logo&path=$form->{path}" width="100%" height="93%" name="main_window" style="position: absolute; border: 0px; z-index: 99; ">
-<p>Ihr Browser kann leider keine eingebetteten Frames anzeigen.
-</p>
-</iframe>
-</body>
-</html>
-
-|;
+ print $form->parse_html_template("menu/menuv3");
}
sub clock_line {
-
- $login = "["
- . $form->{login}
- . " - <a href=\"login.pl?path="
- . $form->{"path"}
- . "&password="
- . $form->{"password"}
- . "&action=logout\" target=\"_top\">"
- . $locale->text('Logout')
- . "</a>] ";
my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat,
$Jahr, $Wochentag, $Jahrestag, $Sommerzeit)
= localtime(time);
- my $CTIME_String = localtime(time);
$Monat += 1;
$Jahrestag += 1;
$Monat = $Monat < 10 ? $Monat = "0" . $Monat : $Monat;
"April", "Mai", "Juni", "Juli",
"August", "September", "Oktober", "November",
"Dezember");
- $datum =
+ return
$Wochentage[$Wochentag] . ", der "
. $Monatstag . "."
. $Monat . "."
. $Jahr . " - ";
-
- #$zeit="<div id='Uhr'>".$Stunden.":".$Minuten.":".$Sekunden."</div>";
- $zeit = "<div id='Uhr'>" . $Stunden . ":" . $Minuten . "</div>";
- print qq|
-<script type="text/javascript">
-<!--
-var clockid=new Array()
-var clockidoutside=new Array()
-var i_clock=-1
-var thistime= new Date()
-var hours= | . $Stunden . qq|;
-var minutes= | . $Minuten . qq|;
-var seconds= | . $Sekunden . qq|;
-if (eval(hours) <10) {hours="0"+hours}
-if (eval(minutes) < 10) {minutes="0"+minutes}
-if (seconds < 10) {seconds="0"+seconds}
-//var thistime = hours+":"+minutes+":"+seconds
-var thistime = hours+":"+minutes
-
-function writeclock() {
- i_clock++
- if (document.all \|\| document.getElementById \|\| document.layers) {
- clockid[i_clock]="clock"+i_clock
- document.write("<font family=arial size=2><span id='"+clockid[i_clock]+"' style='position:relative'>"+thistime+"</span></font>")
- }
-}
-
-function clockon() {
- thistime= new Date()
- hours=thistime.getHours()
- minutes=thistime.getMinutes()
- seconds=thistime.getSeconds()
- if (eval(hours) <10) {hours="0"+hours}
- if (eval(minutes) < 10) {minutes="0"+minutes}
- if (seconds < 10) {seconds="0"+seconds}
- //thistime = hours+":"+minutes+":"+seconds
- thistime = hours+":"+minutes
-
- if (document.all) {
- for (i=0;i<=clockid.length-1;i++) {
- var thisclock=eval(clockid[i])
- thisclock.innerHTML=thistime
- }
- }
-
- if (document.getElementById) {
- for (i=0;i<=clockid.length-1;i++) {
- document.getElementById(clockid[i]).innerHTML=thistime
- }
- }
- var timer=setTimeout("clockon()",60000)
-}
-//window.onload=clockon
-//-->
-</script>
-<table border="0" width="100%" background="image/bg_titel.gif" cellpadding="0" cellspacing="0">
- <tr>
- <td style="color:white; font-family:verdana,arial,sans-serif; font-size: 12px;"> [<a href="JavaScript:top.main_window.print()">drucken</a>]</td>
- <td align="right" style="vertical-align:middle; color:white; font-family:verdana,arial,sans-serif; font-size: 12px;" nowrap>|
- . $login . $datum . qq| <script>writeclock()</script>
- </td>
- </tr>
-</table>
-|;
}
sub acc_menu {
$mainlevel = $form->{level};
$mainlevel =~ s/$mainlevel--//g;
my $menu = new Menu "$menufile";
- $menu = new Menu "custom_$menufile" if (-f "custom_$menufile");
- $menu = new Menu "$form->{login}_$menufile"
- if (-f "$form->{login}_$menufile");
$| = 1;
return print_menu($menu);
}
-sub my_length {
- my ($s) = @_;
- my $len = 0;
- my $i;
- my $skip = 0;
-
- for ($i = 0; $i < length($s); $i++) {
- my $c = substr($s, $i, 1);
- if ($skip && ($c eq ";")) {
- $skip = 0;
- } elsif ($skip) {
- next;
- } elsif ($c eq "&") {
- $skip = 1;
- $len++;
- } else {
- $len++;
- }
- }
-
- return $len;
-}
-
sub print_menu {
my ($menu, $parent, $depth) = @_;
my $html;
my $menu_title = $locale->text($item);
my $menu_text = $menu_title;
- $menu_text =~ s/ /<br>/ if ($parent && (my_length($menu_text) >= 17));
-
my $target = "main_window";
$target = $menu_item->{"target"} if ($menu_item->{"target"});
if ($menu_item->{"submenu"} || !defined($menu_item->{"module"}) ||
($menu_item->{"module"} eq "menu.pl")) {
- my $h = print_menu($menu, "${parent}${item}", $depth * 1 + 1);
+ my $h = print_menu($menu, "${parent}${item}", $depth * 1 + 1)."\n";
if (!$parent) {
- $html .= qq|<ul><li><h2>${menu_text}</h2><ul>${h}</ul></li></ul>|;
+ $html .= qq|<ul><li><h2>${menu_text}</h2><ul>${h}</ul></li></ul>\n|;
} else {
- $html .= qq|<li><div class="x">${menu_text}</div><ul>${h}</ul></li>|;
+ $html .= qq|<li><div class="x">${menu_text}</div><ul>${h}</ul></li>\n|;
}
} else {
$html .= qq|<li>|;
$html .= $menu->menuitem_v3(\%myconfig, $form, "${parent}$item",
{ "title" => $menu_title,
"target" => $target });
- $html .= qq|${menu_text}</a></li>|;
+ $html .= qq|${menu_text}</a></li>\n|;
}
}
# Order entry module
# Quotation module
#======================================================================
-use Data::Dumper;
+
+use POSIX qw(strftime);
use SL::OE;
use SL::IR;
use SL::IS;
use SL::PE;
+use SL::ReportGenerator;
-require "$form->{path}/io.pl";
-require "$form->{path}/arap.pl";
+require "bin/mozilla/io.pl";
+require "bin/mozilla/arap.pl";
+require "bin/mozilla/reportgenerator.pl";
1;
set_headings("add");
$form->{callback} =
- "$form->{script}?action=add&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&path=$form->{path}&password=$form->{password}"
+ "$form->{script}?action=add&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
&order_links;
sub edit {
$lxdebug->enter_sub();
+ # show history button
+ $form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
+ #/show hhistory button
$form->{simple_save} = 0;
set_headings("edit");
# editing without stuff to edit? try adding it first
- if ($form->{rowcount}) {
- map { $id++ if $form->{"id_$_"} } (1 .. $form->{rowcount});
+ if ($form->{rowcount} && !$form->{print_and_save}) {
+ map { $id++ if $form->{"multi_id_$_"} } (1 .. $form->{rowcount});
if (!$id) {
# reset rowcount
undef $form->{rowcount};
&add;
+ $lxdebug->leave_sub();
return;
}
- } else {
- if (!$form->{id}) {
- &add;
- return;
- }
+ } elsif (!$form->{id}) {
+ &add;
+ $lxdebug->leave_sub();
+ return;
}
if ($form->{print_and_save}) {
sub order_links {
$lxdebug->enter_sub();
-
# get customer/vendor
$form->all_vc(\%myconfig, $form->{vc},
($form->{vc} eq 'customer') ? "AR" : "AP");
# retrieve order/quotation
- $form->{webdav} = $webdav;
- # set jscalendar
- $form->{jscalendar} = $jscalendar;
+ $form->{webdav} = $webdav;
+ $form->{jsscript} = 1;
+
+ my $editing = $form->{id};
OE->retrieve(\%myconfig, \%$form);
$taxzone_id = $form->{taxzone_id};
}
+ $salesman_id = $form->{salesman_id} if ($editing);
+
# if multiple rowcounts (== collective order) then check if the
# there were more than one customer (in that case OE::retrieve removes
$intnotes = $form->{intnotes};
# get customer / vendor
- if ($form->{type} =~ /(purchase_order|request_quotation|receive_order)/) {
+ if ($form->{type} =~ /(purchase_order|request_quotation)/) {
IR->get_vendor(\%myconfig, \%$form);
#quote all_vendor Bug 133
}
}
- if ($form->{type} =~ /(sales|ship)_(order|quotation)/) {
+ if ($form->{type} =~ /sales_(order|quotation)/) {
IS->get_customer(\%myconfig, \%$form);
#quote all_vendor Bug 133
}
$form->{cp_id} = $cp_id;
+
if ($payment_id) {
$form->{payment_id} = $payment_id;
}
if ($taxzone_id) {
$form->{taxzone_id} = $taxzone_id;
}
- $form->{intnotes} = $intnotes;
+ $form->{intnotes} = $intnotes if $intnotes;
($form->{ $form->{vc} }) = split /--/, $form->{ $form->{vc} };
$form->{"old$form->{vc}"} =
qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
if (@{ $form->{"all_$form->{vc}"} }) {
$form->{ $form->{vc} } =
qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
- map { $form->{"select$form->{vc}"} .= "<option>$_->{name}--$_->{id}\n" }
+ map { $form->{"select$form->{vc}"} .=
+"<option>$_->{name}--$_->{id}</option>\n" }
(@{ $form->{"all_$form->{vc}"} });
}
- # currencies
- @curr = split(/:/, $form->{currencies});
- chomp $curr[0];
- $form->{defaultcurrency} = $curr[0];
- $form->{currency} = $form->{defaultcurrency} unless $form->{currency};
-
- map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
-
$form->{taxincluded} = $taxincluded if ($form->{id});
# departments
map {
$form->{selectdepartment} .=
- "<option>$_->{description}--$_->{id}\n"
+ "<option>$_->{description}--$_->{id}</option>\n"
} (@{ $form->{all_departments} });
}
$form->{employee} = "$form->{employee}--$form->{employee_id}";
- # sales staff
- if (@{ $form->{all_employees} }) {
- $form->{selectemployee} = "";
- map { $form->{selectemployee} .= "<option>$_->{name}--$_->{id}\n" }
- (@{ $form->{all_employees} });
- }
-
# forex
$form->{forex} = $form->{exchangerate};
+ $form->{salesman_id} = $salesman_id if ($editing);
+
$lxdebug->leave_sub();
}
sub prepare_order {
$lxdebug->enter_sub();
- $form->{media} = "screen";
$form->{formname} = $form->{type} unless $form->{formname};
my $i = 0;
sub form_header {
$lxdebug->enter_sub();
- $checkedopen = ($form->{closed}) ? "" : "checked";
- $checkedclosed = ($form->{closed}) ? "checked" : "";
+ my $checkedclosed = $form->{"closed"} ? "checked" : "";
+ my $checkeddelivered = $form->{"delivered"} ? "checked" : "";
+
+ if ($form->{old_employee_id}) {
+ $form->{employee_id} = $form->{old_employee_id};
+ }
+ if ($form->{old_salesman_id}) {
+ $form->{salesman_id} = $form->{old_salesman_id};
+ }
+
+ $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
+
+
+ if ($form->{old_employee_id}) {
+ $form->{employee_id} = $form->{old_employee_id};
+ }
+ if ($form->{old_salesman_id}) {
+ $form->{salesman_id} = $form->{old_salesman_id};
+ }
map { $form->{$_} =~ s/\"/"/g }
qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname
shiptophone shiptofax shiptodepartment_1 shiptodepartment_2);
# use JavaScript Calendar or not
- $form->{jsscript} = $form->{jscalendar};
+ $form->{jsscript} = 1;
$jsscript = "";
- $payment = qq|<option value=""></option>|;
- foreach $item (@{ $form->{payment_terms} }) {
- if ($form->{payment_id} eq $item->{id}) {
- $payment .= qq|<option value="$item->{id}" selected>$item->{description}</option>|;
- } else {
- $payment .= qq|<option value="$item->{id}">$item->{description}</option>|;
- }
- }
- if ($form->{jsscript}) {
-
- # with JavaScript Calendar
- $button1 = qq|
- <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>
- <td><input type=button name=transdate id="trigger1" value=|
- . $locale->text('button') . qq|></td>
- |;
- $button2 = qq|
- <td width="13"><input name=reqdate id=reqdate size=11 title="$myconfig{dateformat}" value=$form->{reqdate}></td>
- <td width="4"><input type=button name=reqdate name=reqdate id="trigger2" value=|
- . $locale->text('button') . qq|></td>
- |;
-
- #write Trigger
- $jsscript =
- Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1",
- "reqdate", "BL", "trigger2");
+ $button1 = qq|
+ <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" onBlur=\"check_right_date_format(this)\">
+ <input type=button name=transdate id="trigger1" value=|
+ . $locale->text('button') . qq|></td>
+ |;
+ $button2 = qq|
+ <td width="13"><input name=reqdate id=reqdate size=11 title="$myconfig{dateformat}" value="$form->{reqdate}" onBlur=\"check_right_date_format(this)\">
+ <input type=button name=reqdate name=reqdate id="trigger2" value=|
+ . $locale->text('button') . qq|></td>
+ |;
- } else {
+ #write Trigger
+ $jsscript =
+ Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1",
+ "reqdate", "BL", "trigger2");
+
+ my @tmp;
- # without JavaScript Calendar
- $button1 = qq|
- <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>|;
- $button2 = qq|
- <td width="13"><input name=reqdate id=reqdate size=11 title="$myconfig{dateformat}" value=$form->{reqdate}></td>|;
+ if (($form->{"type"} eq "sales_order") ||
+ ($form->{"type"} eq "purchase_order")) {
+ push(@tmp, qq|
+ <input name="delivered" id="delivered" type="checkbox" class="checkbox" value="1" $checkeddelivered>
+ <label for="delivered">| . $locale->text('Delivered') . qq|</label>|);
}
if ($form->{id}) {
- $openclosed = qq|
+ push(@tmp, qq|
+ <input name="closed" id="closed" type="checkbox" class="checkbox" value="1" $checkedclosed>
+ <label for="closed">| . $locale->text('Closed') . qq|</label>|);
+ }
+
+ if (@tmp) {
+ $openclosed .= qq|
<tr>
- <td colspan=2 align=center>
- <table>
- <tr>
- <th nowrap><input name=closed type=radio class=radio value=0 $checkedopen> |
- . $locale->text('Open') . qq|</th>
- <th nowrap><input name=closed type=radio class=radio value=1 $checkedclosed> |
- . $locale->text('Closed') . qq|</th>
- </tr>
- </table>
- </td>
+ <td colspan=| . (2 * scalar(@tmp)) . qq| align=center>| . join("\n", @tmp) . qq|
+ </td>
</tr>
|;
}
# set option selected
- foreach $item ($form->{vc}, currency, department, employee) {
+ foreach $item ($form->{vc}, currency, department, ($form->{vc} eq "customer" ? customer : vendor)) {
$form->{"select$item"} =~ s/ selected//;
$form->{"select$item"} =~
s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
#quote select[customer|vendor] Bug 133
$form->{"select$form->{vc}"} = $form->quote($form->{"select$form->{vc}"});
- #build contacts
- if ($form->{all_contacts}) {
-
- $form->{selectcontact} = "<option></option>";
- foreach $item (@{ $form->{all_contacts} }) {
- my $department = ($item->{cp_abteilung}) ? "--$item->{cp_abteilung}" : "";
- if ($form->{cp_id} == $item->{cp_id}) {
- $form->{selectcontact} .=
- "<option value=$item->{cp_id} selected>$item->{cp_name}$department</option>";
- } else {
- $form->{selectcontact} .= "<option value=$item->{cp_id}>$item->{cp_name}$department</option>";
- }
- }
- } else {
- $form->{selectcontact} =~ s/ selected//g;
- if ($form->{cp_id} ne "") {
- $form->{selectcontact} =~ s/value=$form->{cp_id}/value=$form->{cp_id} selected/;
+ #substitute \n and \r to \s (bug 543)
+ $form->{"select$form->{vc}"} =~ s/[\n\r]/ /g;
+
+ my @old_project_ids = ($form->{"globalproject_id"});
+ map({ push(@old_project_ids, $form->{"project_id_$_"})
+ if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
+
+ my $vc = $form->{vc} eq "customer" ? "customers" : "vendors";
+ $form->get_lists("contacts" => "ALL_CONTACTS",
+ "shipto" => "ALL_SHIPTO",
+ "projects" => { "key" => "ALL_PROJECTS",
+ "all" => 0,
+ "old_id" => \@old_project_ids },
+ "employees" => "ALL_EMPLOYEES",
+ "salesmen" => "ALL_SALESMEN",
+ "taxzones" => "ALL_TAXZONES",
+ "payments" => "ALL_PAYMENTS",
+ "currencies" => "ALL_CURRENCIES",
+ $vc => "ALL_" . uc($vc));
+
+ my %labels;
+ my @values = (undef);
+ foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
+ push(@values, $item->{"cp_id"});
+ $labels{$item->{"cp_id"}} = $item->{"cp_name"} .
+ ($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : "");
+ }
+
+ my $contact;
+ if (scalar @values > 1) {
+ $contact = qq|
+ <tr>
+ <th align="right">| . $locale->text('Contact Person') . qq|</th>
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values, '-style' => 'width: 250px',
+ '-labels' => \%labels, '-default' => $form->{"cp_id"}))
+ . qq|
+ </td>
+ </tr>|;
+ }
+
+ %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};
+ }
+
+ $vc = qq|
+ <input type="hidden" name="$form->{vc}_id" value="| . H($form->{"$form->{vc}_id"}) . qq|">
+ <input type="hidden" name="old$form->{vc}" value="| . H($form->{"old$form->{vc}"}) . qq|">
+ <th align="right">| . $locale->text(ucfirst($form->{vc})) . qq|</th>
+ <td>| .
+ (($myconfig{vclimit} <= scalar(@values))
+ ? qq|<input type="text" value="| . H(($form->{"old$form->{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, '-style' => 'width: 250px')))) . qq|
+ <input type="button" value="?" onclick="show_vc_details('$form->{vc}')">
+ </td><input type=hidden name="select$form->{vc}" value="| .
+ Q($form->{"select$form->{vc}"}) . qq|">|;
+
+ %labels = ();
+ @values = ("");
+ foreach my $item (@{ $form->{"ALL_PAYMENTS"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{"id"}} = $item->{"description"};
+ }
+
+ $payments = qq|
+ <th align="right">| . $locale->text('Payment Terms') . qq|</th>
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'payment_id', '-values' => \@values, '-style' => 'width: 250px',
+ '-labels' => \%labels, '-default' => $form->{payment_id}))
+ . qq|</td>|;
+
+ %labels = ();
+ @values = ("");
+ foreach my $item (@{ $form->{"ALL_SHIPTO"} }) {
+ push(@values, $item->{"shipto_id"});
+ $labels{$item->{"shipto_id"}} = join "; ", grep { $_ } map { $item->{"shipto${_}" } } qw(name department_1 street city);
+ }
+
+ my $shipto;
+ if (scalar @values > 1) {
+ $shipto = qq|
+ <tr>
+ <th align="right">| . $locale->text('Shipping Address') . qq|</th>
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values, '-style' => 'width: 250px',
+ '-labels' => \%labels, '-default' => $form->{"shipto_id"}))
+ . qq|</td>|;
+ }
+
+ %labels = ();
+ @values = ("");
+ foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{"id"}} = $item->{"projectnumber"};
+ }
+ my $globalprojectnumber =
+ NTI($cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values,
+ '-labels' => \%labels,
+ '-default' => $form->{"globalproject_id"}));
+
+ my $salesmen = "";
+ %labels = ();
+ @values = ();
+ if ($form->{type} =~ /^sales_/) {
+ foreach my $item (@{ $form->{"ALL_SALESMEN"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{"id"}} = ($item->{"name"} ne "" ? $item->{"name"} : $item->{"login"});
}
- }
-
-
- if (@{ $form->{SHIPTO} }) {
- $form->{selectshipto} = "<option value=0></option>";
- foreach $item (@{ $form->{SHIPTO} }) {
- if ($item->{shipto_id} == $form->{shipto_id}) {
- $form->{selectshipto} .=
- "<option value=$item->{shipto_id} selected>$item->{shiptoname} $item->{shiptodepartment_1}</option>";
- } else {
- $form->{selectshipto} .=
- "<option value=$item->{shipto_id}>$item->{shiptoname} $item->{shiptodepartment}</option>";
- }
+ $salesmen =
+ qq|<tr>
+ <th align="right">| . $locale->text('Salesman') . qq|</th>
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{"salesman_id"} ? $form->{"salesman_id"} : $form->{"employee_id"},
+ '-values' => \@values, '-labels' => \%labels))
+ . qq|</td>
+ </tr>|;
+ }
+
+ %labels = ();
+ @values = ();
+ foreach my $item (@{ $form->{"ALL_EMPLOYEES"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{"id"}} = $item->{"name"} ne "" ? $item->{"name"} : $item->{"login"};
+ }
+
+ my $employee = qq|
+ <tr>
+ <th align="right">| . $locale->text('Employee') . qq|</th>
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'employee_id', '-default' => $form->{"employee_id"},
+ '-values' => \@values, '-labels' => \%labels)) . qq|
+ </td>
+ </tr>|;
- }
- } else {
- $form->{selectshipto} = $form->unquote($form->{selectshipto});
- $form->{selectshipto} =~ s/ selected//g;
- if ($form->{shipto_id} ne "") {
- $form->{selectshipto} =~ s/value=$form->{shipto_id}/value=$form->{shipto_id} selected/;
- }
+ %labels = ();
+ @values = ();
+ foreach my $item (@{ $form->{"ALL_TAXZONES"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{"id"}} = $item->{"description"};
}
- $shipto = qq|
- <th align=right>| . $locale->text('Shipping Address') . qq|</th>
- <td><select name=shipto_id style="width:200px;">$form->{selectshipto}</select></td>|;
- $form->{selectshipto} = $form->quote($form->{selectshipto});
- $shipto .= qq| <input type=hidden name=selectshipto value="$form->{selectshipto}">|;
-
+ $taxzone = qq|
+ <tr>
+ <th align="right">| . $locale->text('Steuersatz') . qq|</th>
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"},
+ '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')) . qq|
+ </td>
+ </tr>|;
+ %labels = ();
+ @values = ();
+ my $i = 0;
+ foreach my $item (@{ $form->{"ALL_CURRENCIES"} }) {
+ push(@values, $item);
+ $labels{$item} = $item;
+ }
+
+ $form->{currency} = $form->{defaultcurrency} unless $form->{currency};
+ my $currencies;
+ if (scalar @values) {
+ $currencies = qq|
+ <tr>
+ <th align="right">| . $locale->text('Currency') . qq|</th>
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"},
+ '-values' => \@values, '-labels' => \%labels)) . qq|
+ </td>
+ </tr>|;
+ }
$form->{exchangerate} =
$form->format_amount(\%myconfig, $form->{exchangerate});
+ if (!$form->{exchangerate}) {
+ $form->{exchangerate} = "";
+ }
+
if (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) {
$creditwarning = 1;
} else {
$form->{creditremaining} =
$form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
- $contact =
- ($form->{selectcontact})
- ? qq|<select name=cp_id>$form->{selectcontact}</select>\n<input type=hidden name="selectcontact" value="$form->{selectcontact}">|
- : qq|<input name=contact value="$form->{contact}" size=35>|;
-
$exchangerate = qq|
<input type=hidden name=forex value=$form->{forex}>
|;
}
}
- $vclabel = ucfirst $form->{vc};
- $vclabel = $locale->text($vclabel);
-
- $terms = qq|<input name=terms size="3" maxlength="3" value="| .
- $form->quote($form->{terms}) . qq|">|;
-
if ($form->{business}) {
$business = qq|
<tr>
- <th align=right>| . $locale->text('Business') . qq|</th>
- <td>$form->{business}</td>
- <th align=right>| . $locale->text('Trade Discount') . qq|</th>
- <td>|
+ <th align="right">| . ($form->{vc} eq "customer" ? $locale->text('Customer type') : $locale->text('Vendor type')) . qq|</th>
+ <td>$form->{business}; | . $locale->text('Trade Discount') . qq| |
. $form->format_amount(\%myconfig, $form->{tradediscount} * 100)
. qq| %</td>
- </tr>
+ </tr>
|;
}
if ($form->{max_dunning_level}) {
$dunning = qq|
- <tr>
- <td colspan=4>
- <table>
- <tr>
- <th align=right>| . $locale->text('Max. Dunning Level') . qq|:</th>
- <td><b>$form->{max_dunning_level}</b></td>
- <th align=right>| . $locale->text('Dunning Amount') . qq|:</th>
- <td><b>|
- . $form->format_amount(\%myconfig, $form->{dunning_amount},2)
- . qq|</b></td>
- </tr>
- </table>
- </td>
- </tr>
+ <tr>
+ <th align="right">| . $locale->text('Max. Dunning Level') . qq|:</th>
+ <td>
+ <b>$form->{max_dunning_level}</b>;
+ | . $locale->text('Dunning Amount') . qq|: <b>|
+ . $form->format_amount(\%myconfig, $form->{dunning_amount},2)
+ . qq|</b>
+ </td>
+ </tr>
|;
}
- if (@{ $form->{TAXZONE} }) {
- $form->{selecttaxzone} = "";
- foreach $item (@{ $form->{TAXZONE} }) {
- if ($item->{id} == $form->{taxzone_id}) {
- $form->{selecttaxzone} .=
- "<option value=$item->{id} selected>" . H($item->{description}) .
- "</option>";
- } else {
- $form->{selecttaxzone} .=
- "<option value=$item->{id}>" . H($item->{description}) . "</option>";
- }
-
- }
- } else {
- $form->{selecttaxzone} =~ s/ selected//g;
- if ($form->{taxzone_id} ne "") {
- $form->{selecttaxzone} =~ s/value=$form->{taxzone_id}>/value=$form->{taxzone_id} selected>/;
- }
- }
-
- $taxzone = qq|
- <tr>
- <th align=right>| . $locale->text('Steuersatz') . qq|</th>
- <td><select name=taxzone_id>$form->{selecttaxzone}</select></td>
- <input type=hidden name=selecttaxzone value="$form->{selecttaxzone}">
- </tr>|;
-
-
if ($form->{type} !~ /_quotation$/) {
$ordnumber = qq|
<tr>
$n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
$creditremaining = qq|
- <tr>
- <td></td>
- <td colspan=3>
- <table>
- <tr>
- <th nowrap>| . $locale->text('Credit Limit') . qq|</th>
- <td>$form->{creditlimit}</td>
- <td width=20%></td>
- <th nowrap>| . $locale->text('Remaining') . qq|</th>
- <td class="plus$n" nowrap>$form->{creditremaining}</td>
- </tr>
- </table>
- </td>
- $shipto
+ $shipto
+ <tr>
+ <td align="right">| . $locale->text('Credit Limit') . qq|</td>
+ <td>$form->{creditlimit}; | . $locale->text('Remaining') . qq| <span class="plus$n">$form->{creditremaining}</span></td>
+ </tr>
</tr>
|;
} else {
</tr>
|;
- $terms = "";
}
$ordnumber .= qq|
</tr>|;
}
- $vc =
- ($form->{"select$form->{vc}"})
- ? qq|<select name=$form->{vc}>$form->{"select$form->{vc}"}</select>\n<input type=hidden name="select$form->{vc}" value="$form->{"select$form->{vc}"}">|
- : qq|<input name=$form->{vc} value="$form->{$form->{vc}}" size=35>|;
-
$department = qq|
<tr>
<th align="right" nowrap>| . $locale->text('Department') . qq|</th>
- <td colspan=3><select name=department>$form->{selectdepartment}</select>
+ <td colspan=3><select name=department style="width: 250px">$form->{selectdepartment}</select>
<input type=hidden name=selectdepartment value="$form->{selectdepartment}">
</td>
- </tr>
-| if $form->{selectdepartment};
-
- $employee = qq|
- <input type=hidden name=employee value="$form->{employee}">
-|;
+ </tr> | if $form->{selectdepartment};
if ($form->{type} eq 'sales_order') {
if ($form->{selectemployee}) {
- $employee = qq|
- <input type=hidden name=customer_klass value=$form->{customer_klass}>
- <tr>
- <th align=right nowrap>| . $locale->text('Salesperson') . qq|</th>
- <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
- <input type=hidden name=selectemployee value="$form->{selectemployee}">
- <td></td>
- </tr>
-|;
+ $employee .= qq|
+ <input type="hidden" name="customer_klass" value="$form->{customer_klass}">|;
}
} else {
- $employee = qq|
- <input type=hidden name=customer_klass value=$form->{customer_klass}>
- <tr>
- <th align=right nowrap>| . $locale->text('Employee') . qq|</th>
- <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
- <input type=hidden name=selectemployee value="$form->{selectemployee}">
- <td></td>
- </tr>
-|;
+ $employee .= qq|
+ <input type="hidden" name="customer_klass" value="$form->{customer_klass}">|;
}
if ($form->{resubmit} && ($form->{format} eq "html")) {
$onload =
} elsif ($form->{resubmit}) {
$onload = qq|document.oe.submit()|;
} else {
- $onload = "fokus()";
+ $onload = "focus()";
}
$credittext = $locale->text('Credit Limit exceeded!!!');
if ($creditwarning) {
$onload = qq|alert('$credittext')|;
}
-
- $form->{"javascript"} .= qq|<script type="text/javascript" src="js/show_form_details.js">|;
+
+ $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
+ $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
+
+ $form->{"javascript"} .= qq|<script type="text/javascript" src="js/show_form_details.js"></script>|;
+ # show history button js
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/show_history.js"></script>|;
+ #/show history button js
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/show_vc_details.js"></script>|;
$form->header;
<body onLoad="$onload">
<form method=post name=oe action=$form->{script}>
+
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/delivery_customer_selection.js"></script>
<script type="text/javascript" src="js/vendor_selection.js"></script>
<script type="text/javascript" src="js/calculate_qty.js"></script>
+|;
-<input type=hidden name=id value=$form->{id}>
-<input type=hidden name=action value=$form->{action}>
-
-<input type=hidden name=type value=$form->{type}>
-<input type=hidden name=formname value=$form->{formname}>
-<input type=hidden name=media value=$form->{media}>
-<input type=hidden name=format value=$form->{format}>
-<input type=hidden name=proforma value=$form->{proforma}>
-
-<input type=hidden name=queued value="$form->{queued}">
-<input type=hidden name=printed value="$form->{printed}">
-<input type=hidden name=emailed value="$form->{emailed}">
-
-<input type=hidden name=vc value=$form->{vc}>
-
-<input type=hidden name=title value="$form->{title}">
-
-<input type=hidden name=discount value=$form->{discount}>
-<input type=hidden name=creditlimit value=$form->{creditlimit}>
-<input type=hidden name=creditremaining value=$form->{creditremaining}>
+ $form->hide_form(qw(id action type vc formname media format proforma queued printed emailed
+ title discount creditlimit creditremaining tradediscount business
+ max_dunning_level dunning_amount));
-<input type=hidden name=tradediscount value=$form->{tradediscount}>
-<input type=hidden name=business value=$form->{business}>
-<input type=hidden name=webdav value=$webdav>
+ print qq|
<table width=100%>
<tr class=listtop>
<td>
<table width=100%>
<tr>
- <th align=right>$vclabel</th>
- <td colspan=3>$vc</td>
- <input type=hidden name=$form->{vc}_id value=$form->{"$form->{vc}_id"}>
- <input type=hidden name="old$form->{vc}" value="$form->{"old$form->{vc}"}">
- <th align=richt nowrap>|
- . $locale->text('Contact Person') . qq|</th>
- <td colspan=3>$contact</td>
- </tr>
+ $vc
+ $contact
$creditremaining
$business
$dunning
$taxzone
$department
<tr>
- <th align=right>| . $locale->text('Currency') . qq|</th>
- <td><select name=currency>$form->{selectcurrency}</select></td>
- <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
- <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
+ $currencies
$exchangerate
</tr>
<tr>
<tr>
<th align=right>| . $locale->text('Ship via') . qq|</th>
<td colspan=3><input name=shipvia size=35 value="$form->{shipvia}"></td>
- </tr>|;
+ </tr>
+ <tr>
+ <th align="right">| . $locale->text('Transaction description') . qq|</th>
+ <td colspan="3"><input name="transaction_description" size="35" value="| . H($form->{transaction_description}) . qq|"></td>
+ </tr>|;
# <tr>
# <td colspan=4>
# <table>
<table>
$openclosed
$employee
+ $salesmen
$ordnumber
- $terms
+ <tr>
+ <th width="70%" align="right" nowrap>| . $locale->text('Project Number') . qq|</th>
+ <td>$globalprojectnumber</td>
+ </tr>
</table>
</td>
</tr>
$tax .= qq|
<tr>
- <th align=right>$form->{"${item}_description"}</th>
+ <th align=right>$form->{"${item}_description"} |
+ . $form->{"${item}_rate"} * 100 .qq|%</th>
<td align=right>$form->{"${item}_total"}</td>
</tr>
|;
$tax .= qq|
<tr>
- <th align=right>Enthaltene $form->{"${item}_description"}</th>
+ <th align=right>Enthaltene $form->{"${item}_description"} |
+ . $form->{"${item}_rate"} * 100 .qq|%</th>
<td align=right>$form->{"${item}_total"}</td>
</tr>
<tr>
<td>$notes</td>
<td>$intnotes</td>
</tr>
- <th align=right>| . $locale->text('Payment Terms') . qq|</th>
- <td><select name=payment_id tabindex=24>$payment
- </select></td>
- </table>
+ <tr>
+ $payments
+ </tr>
+ </table>
</td>
- <td align=right width=100%>
+ <td>
+ <table>
+|;
+
+ if ($form->{type} =~ /^sales_/) {
+ print qq|
+ <tr>
+ <th align=left>| . $locale->text('Ertrag') . qq|</th>
+ <td>| . $form->format_amount(\%myconfig, $form->{marge_total}, 2, 0) . qq|</td>
+ </tr>
+ <tr>
+ <th align=left>| . $locale->text('Ertrag prozentual') . qq|</th>
+ <td>| . $form->format_amount(\%myconfig, $form->{marge_percent}, 2, 0) . qq| %</td>
+ </tr>
+|;
+ }
+
+ print qq|
+ <input type=hidden name="marge_total" value="$form->{"marge_total"}">
+ <input type=hidden name="marge_percent" value="$form->{"marge_percent"}">
+ </table>
+ </td>
+ <td align=right>
$taxincluded
- <table width=100%>
+ <table>
$subtotal
$tax
<tr>
<td align=left width=30%><b>Dateiname</b></td>
<td align=left width=70%><b>Webdavlink</b></td>
|;
- foreach $file (keys %{ $form->{WEBDAV} }) {
+ foreach $file (@{ $form->{WEBDAV} }) {
$webdav_list .= qq|
<tr>
- <td align=left>$file</td>
- <td align=left><a href="$form->{WEBDAV}{$file}">$form->{WEBDAV}{$file}</a></td>
+ <td align="left">$file->{name}</td>
+ <td align="left"><a href="$file->{link}">$file->{type}</a></td>
</tr>
|;
}
print $webdav_list;
}
- print qq|
-<input type=hidden name=jscalendar value=$form->{jscalendar}>
-|;
+
print qq|
<tr>
<td>
|;
- &print_options;
+ print_options();
print qq|
</td>
if (($form->{id})) {
print qq|
+ <input type="button" class="submit" onclick="set_history_window(|
+ . Q($form->{id})
+ . qq|);" name="history" id="history" value="|
+ . $locale->text('history')
+ . qq|">
+
<br>| . $locale->text("Workflow $form->{type}") . qq|<br>
<input class=submit type=submit name=action value="|
. $locale->text('Save as new') . qq|">
<input class=submit type=submit name=action value="|
. $locale->text('Purchase Order') . qq|">|;
}
- if (1) {
print qq|
<input class=submit type=submit name=action value="|
. $locale->text('Invoice') . qq|">
|;
-}
if ($form->{type} =~ /sales_order$/) {
print qq|
. $locale->text('Order') . qq|">
|;
}
- } elsif ($form->{type} =~ /sales_order$/ && $form->{rowcount} && !$form->{proforma}) {
- print qq|
-<br>Workflow $form->{heading}<br>
-<input class=submit type=submit name=action value="|
- . $locale->text('Save as new') . qq|">
-<input class=submit type=submit name=action value="|
- . $locale->text('Invoice') . qq|">
-|;
}
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
+ $form->hide_form("saved_xyznumber");
print qq|
<input name=callback type=hidden value="$form->{callback}">
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
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});
-
- &check_project;
-
+
+ if($form->{payment_id} eq "") {
+ $form->{payment_id} = $payment_id;
+ }
+
$buysell = 'buy';
$buysell = 'sell' if ($form->{vc} eq 'vendor');
$form->{exchangerate} = $exchangerate
$ordnumber = 'ordnumber';
$employee = $locale->text('Employee');
}
+
if ($form->{type} eq 'request_quotation') {
$form->{title} = $locale->text('Request for Quotations');
$form->{vc} = 'vendor';
$ordnumber = 'quonumber';
$employee = $locale->text('Employee');
}
- if ($form->{type} eq 'receive_order') {
- $form->{title} = $locale->text('Receive Merchandise');
- $form->{vc} = 'vendor';
- $ordlabel = $locale->text('Order Number');
- $ordnumber = 'ordnumber';
- $employee = $locale->text('Employee');
- }
+
if ($form->{type} eq 'sales_order') {
$form->{title} = $locale->text('Sales Orders');
$form->{vc} = 'customer';
$ordlabel = $locale->text('Order Number');
$ordnumber = 'ordnumber';
- $employee = $locale->text('Salesperson');
- }
- if ($form->{type} eq 'ship_order') {
- $form->{title} = $locale->text('Ship Merchandise');
- $form->{vc} = 'customer';
- $ordlabel = $locale->text('Order Number');
- $ordnumber = 'ordnumber';
- $employee = $locale->text('Salesperson');
-
+ $employee = $locale->text('Employee');
}
if ($form->{type} eq 'sales_quotation') {
$employee = $locale->text('Employee');
}
- if ($form->{type} =~ /(ship|receive)_order/) {
- OE->get_warehouses(\%myconfig, \%$form);
-
- # warehouse
- if (@{ $form->{all_warehouses} }) {
- $form->{selectwarehouse} = "<option>\n";
- $form->{warehouse} = qq|$form->{warehouse}--$form->{warehouse_id}|;
-
- map {
- $form->{selectwarehouse} .=
- "<option>$_->{description}--$_->{id}\n"
- } (@{ $form->{all_warehouses} });
-
- $warehouse = qq|
- <tr>
- <th align=right>| . $locale->text('Warehouse') . qq|</th>
- <td colspan=3><select name=warehouse>$form->{selectwarehouse}</select></td>
- <input type=hidden name=selectwarehouse value="$form->{selectwarehouse}">
- </tr>
-|;
-
- }
- }
-
# setup vendor / customer selection
$form->all_vc(\%myconfig, $form->{vc},
($form->{vc} eq 'customer') ? "AR" : "AP");
- map { $vc .= "<option>$_->{name}--$_->{id}\n" }
- @{ $form->{"all_$form->{vc}"} };
-
- $vclabel = ucfirst $form->{vc};
- $vclabel = $locale->text($vclabel);
-
- # $locale->text('Vendor')
- # $locale->text('Customer')
-
- $vc =
- ($vc)
- ? qq|<select name=$form->{vc}><option>\n$vc</select>|
- : qq|<input name=$form->{vc} size=35>|;
-
# departments
if (@{ $form->{all_departments} }) {
$form->{selectdepartment} = "<option>\n";
map {
$form->{selectdepartment} .=
- "<option>$_->{description}--$_->{id}\n"
+ "<option>$_->{description}--$_->{id}</option>\n"
} (@{ $form->{all_departments} });
}
</tr>
| if $form->{selectdepartment};
- if ($form->{type} !~ /(ship_order|receive_order)/) {
- $openclosed = qq|
- <tr>
- <td><input name="open" class=checkbox type=checkbox value=1 checked> |
- . $locale->text('Open') . qq|</td>
- <td><input name="closed" class=checkbox type=checkbox value=1 $form->{closed}> |
- . $locale->text('Closed') . qq|</td>
- </tr>
-|;
- } else {
-
- $openclosed = qq|
- <input type=hidden name="open" value=1>
+ my $delivered;
+ if (($form->{"type"} eq "sales_order") ||
+ ($form->{"type"} eq "purchase_order")) {
+ $delivered = qq|
+ <tr>
+ <td><input name="notdelivered" id="notdelivered" class="checkbox" type="checkbox" value="1" checked>
+ <label for="notdelivered">|. $locale->text('Not delivered') . qq|</label></td>
+ <td><input name="delivered" id="delivered" class="checkbox" type="checkbox" value="1" checked>
+ <label for="delivered">| . $locale->text('Delivered') . qq|</label></td>
+ </tr>
|;
}
# use JavaScript Calendar or not
- $form->{jsscript} = $jscalendar;
+ $form->{jsscript} = 1;
$jsscript = "";
- if ($form->{jsscript}) {
-
- # with JavaScript Calendar
- $button1 = qq|
- <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
- <input type=button name=transdatefrom id="trigger3" value=|
- . $locale->text('button') . qq|></td>
- |;
- $button2 = qq|
- <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
- <input type=button name=transdateto name=transdateto id="trigger4" value=|
- . $locale->text('button') . qq|></td>
- |;
-
- #write Trigger
- $jsscript =
- Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger3",
- "transdateto", "BL", "trigger4");
- } else {
- # without JavaScript Calendar
- $button1 = qq|
- <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
- $button2 = qq|
- <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
+ $button1 = qq|
+ <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
+ <input type=button name=transdatefrom id="trigger3" value=|
+ . $locale->text('button') . qq|></td>
+ |;
+ $button2 = qq|
+ <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
+ <input type=button name=transdateto name=transdateto id="trigger4" value=|
+ . $locale->text('button') . qq|></td>
+ |;
+
+ #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 },
+ "employees" => "ALL_EMPLOYEES",
+ $vc => "ALL_" . uc($vc));
+
+ my %labels = ();
+ my @values = ("");
+ foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{"id"}} = $item->{"projectnumber"};
+ }
+ my $projectnumber =
+ 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|
+ <tr>
+ <th align="right">| . $locale->text('Employee') . qq|</th>
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'employee_id',
+ '-values' => \@values,
+ '-labels' => \%labels)) . qq|
+ </td>
+ </tr>|;
+
+ %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|<input type="text" value="| . H(($form->{"old$form->{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|
<td>
<table>
<tr>
- <th align=right>$vclabel</th>
+ <th align=right>$vc_label</th>
<td colspan=3>$vc</td>
</tr>
- $warehouse
$department
<tr>
<th align=right>$ordlabel</th>
<td colspan=3><input name="$ordnumber" size=20></td>
</tr>
+ $employee_block
+ <tr>
+ <th align="right">| . $locale->text('Transaction description') . qq|</th>
+ <td colspan="3"><input name="transaction_description" size=20></td>
+ </tr>
+ <tr>
+ <th align="right">| . $locale->text("Project Number") . qq|</th>
+ <td colspan="3">$projectnumber</td>
+ </tr>
<tr>
<th align=right>| . $locale->text('From') . qq|</th>
$button1
<th align=right>| . $locale->text('Include in Report') . qq|</th>
<td colspan=5>
<table>
- $openclosed
+ <tr>
+ <td><input type="checkbox" name="open" value="1" id="open" checked>
+ <label for="open">| . $locale->text("Open") . qq|</td>
+ <td><input type="checkbox" name="closed" value="1" id="closed">
+ <label for="closed">| . $locale->text("Closed") . qq|</td>
+ </tr>
+ $delivered
<tr>
<td><input name="l_id" class=checkbox type=checkbox value=Y>
| . $locale->text('ID') . qq|</td>
. $locale->text('Required by') . qq|</td>
</tr>
<tr>
- <td><input name="l_name" class=checkbox type=checkbox value=Y checked> $vclabel</td>
+ <td><input name="l_name" class=checkbox type=checkbox value=Y checked> $vc_label</td>
<td><input name="l_employee" class=checkbox type=checkbox value=Y checked> $employee</td>
<td><input name="l_shipvia" class=checkbox type=checkbox value=Y> |
. $locale->text('Ship via') . qq|</td>
. $locale->text('Tax') . qq|</td>
<td><input name="l_amount" class=checkbox type=checkbox value=Y checked> |
. $locale->text('Total') . qq|</td>
+ </tr>
+ <tr>
+ <td><input name="l_marge_total" class=checkbox type=checkbox value=Y> |
+ . $locale->text('Ertrag') . qq|</td>
+ <td><input name="l_marge_percent" class=checkbox type=checkbox value=Y> |
+ . $locale->text('Ertrag prozentual') . qq|</td>
+ </tr>
+ <tr>
+ <td><input name="l_globalprojectnumber" class=checkbox type=checkbox value=Y> |
+ . $locale->text('Project Number') . qq|</td>
+ <td><input name="l_transaction_description" class=checkbox type=checkbox value=Y> |
+ . $locale->text('Transaction description') . qq|</td>
</tr>
<tr>
<td><input name="l_subtotal" class=checkbox type=checkbox value=Y> |
<br>
<input type=hidden name=nextsub value=orders>
-<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 type=hidden name=vc value=$form->{vc}>
$lxdebug->leave_sub();
}
-sub orders {
+sub create_subtotal_row {
$lxdebug->enter_sub();
- # split vendor / customer
- ($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) =
- split(/--/, $form->{ $form->{vc} });
+ my ($totals, $columns, $column_alignment, $subtotal_columns, $class) = @_;
- OE->transactions(\%myconfig, \%$form);
+ my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => $column_alignment->{$_}, } } @{ $columns } };
- $ordnumber = ($form->{type} =~ /_order$/) ? "ordnumber" : "quonumber";
+ map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, 2) } @{ $subtotal_columns };
+
+ $row->{tax}->{data} = $form->format_amount(\%myconfig, $totals->{amount} - $totals->{netamount}, 2);
- $number = $form->escape($form->{$ordnumber});
- $name = $form->escape($form->{ $form->{vc} });
- $department = $form->escape($form->{department});
- $warehouse = $form->escape($form->{warehouse});
+ map { $totals->{$_} = 0 } @{ $subtotal_columns };
- # 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}&$ordnumber=$number&$form->{vc}=$name&department=$department&warehouse=$warehouse";
+ $lxdebug->leave_sub();
+
+ return $row;
+}
- # 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);
+sub orders {
+ $lxdebug->enter_sub();
- $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}&$ordnumber=$number&$form->{vc}=$name&department=$department&warehouse=$warehouse";
+ $ordnumber = ($form->{type} =~ /_order$/) ? "ordnumber" : "quonumber";
- @columns =
- $form->sort_columns("transdate", "reqdate", "id", "$ordnumber",
- "name", "netamount", "tax", "amount",
- "curr", "employee", "shipvia", "open",
- "closed");
+ ($form->{ $form->{vc} }, $form->{"${form->{vc}}_id"}) = split(/--/, $form->{ $form->{vc} });
- $form->{l_open} = $form->{l_closed} = "Y"
- if ($form->{open} && $form->{closed});
+ $form->{sort} ||= 'transdate';
- foreach $item (@columns) {
- if ($form->{"l_$item"} eq "Y") {
- push @column_index, $item;
+ OE->transactions(\%myconfig, \%$form);
- # add column to href and callback
- $callback .= "&l_$item=Y";
- $href .= "&l_$item=Y";
- }
- }
+ $form->{rowcount} = scalar @{ $form->{OE} };
+
+ my @columns = (
+ "transdate", "reqdate",
+ "id", $ordnumber,
+ "name", "netamount",
+ "tax", "amount",
+ "curr", "employee",
+ "shipvia", "globalprojectnumber",
+ "transaction_description", "open",
+ "delivered", "marge_total", "marge_percent"
+ );
# only show checkboxes if gotten here via sales_order form.
- if ($form->{type} =~ /sales_order/) {
- unshift @column_index, "ids";
+ my $allow_multiple_orders = $form->{type} eq 'sales_order';
+ if ($allow_multiple_orders) {
+ unshift @columns, "ids";
}
- if ($form->{l_subtotal} eq 'Y') {
- $callback .= "&l_subtotal=Y";
- $href .= "&l_subtotal=Y";
- }
+ $form->{l_open} = $form->{l_closed} = "Y" if ($form->{open} && $form->{closed});
+ $form->{l_delivered} = "Y" if ($form->{delivered} && $form->{notdelivered});
+ my $attachment_basename;
if ($form->{vc} eq 'vendor') {
- if ($form->{type} eq 'receive_order') {
- $form->{title} = $locale->text('Receive Merchandise');
- } elsif ($form->{type} eq 'purchase_order') {
- $form->{title} = $locale->text('Purchase Orders');
+ if ($form->{type} eq 'purchase_order') {
+ $form->{title} = $locale->text('Purchase Orders');
+ $attachment_basename = $locale->text('purchase_order_list');
} else {
- $form->{title} = $locale->text('Request for Quotations');
+ $form->{title} = $locale->text('Request for Quotations');
+ $attachment_basename = $locale->text('rfq_list');
}
- $name = $locale->text('Vendor');
- $employee = $locale->text('Employee');
- }
- if ($form->{vc} eq 'customer') {
+
+ } else {
if ($form->{type} eq 'sales_order') {
- $form->{title} = $locale->text('Sales Orders');
- $employee = $locale->text('Salesperson');
- } elsif ($form->{type} eq 'ship_order') {
- $form->{title} = $locale->text('Ship Merchandise');
- $employee = $locale->text('Salesperson');
+ $form->{title} = $locale->text('Sales Orders');
+ $attachment_basename = $locale->text('sales_order_list');
} else {
- $form->{title} = $locale->text('Quotations');
- $employee = $locale->text('Employee');
+ $form->{title} = $locale->text('Quotations');
+ $attachment_basename = $locale->text('quotation_list');
}
- $name = $locale->text('Customer');
- }
-
- $column_header{id} =
- qq|<th><a class=listheading href=$href&sort=id>|
- . $locale->text('ID')
- . qq|</a></th>|;
- $column_header{transdate} =
- qq|<th><a class=listheading href=$href&sort=transdate>|
- . $locale->text('Date')
- . qq|</a></th>|;
- $column_header{reqdate} =
- qq|<th><a class=listheading href=$href&sort=reqdate>|
- . $locale->text('Required by')
- . qq|</a></th>|;
- $column_header{ordnumber} =
- qq|<th><a class=listheading href=$href&sort=ordnumber>|
- . $locale->text('Order')
- . qq|</a></th>|;
- $column_header{quonumber} =
- qq|<th><a class=listheading href=$href&sort=quonumber>|
- . ($form->{"type"} eq "request_quotation" ?
- $locale->text('RFQ') :
- $locale->text('Quotation'))
- . qq|</a></th>|;
- $column_header{name} =
- qq|<th><a class=listheading href=$href&sort=name>$name</a></th>|;
- $column_header{netamount} =
- qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
- $column_header{tax} =
- qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
- $column_header{amount} =
- qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
- $column_header{curr} =
- qq|<th class=listheading>| . $locale->text('Curr') . qq|</th>|;
- $column_header{shipvia} =
- qq|<th><a class=listheading href=$href&sort=shipvia>|
- . $locale->text('Ship via')
- . qq|</a></th>|;
- $column_header{open} =
- qq|<th class=listheading>| . $locale->text('O') . qq|</th>|;
- $column_header{closed} =
- qq|<th class=listheading>| . $locale->text('C') . qq|</th>|;
-
- $column_header{employee} =
- qq|<th><a class=listheading href=$href&sort=employee>$employee</a></th>|;
-
- $column_header{ids} = qq|<th></th>|;
-
- if ($form->{ $form->{vc} }) {
- $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";
+ }
+
+ my $report = SL::ReportGenerator->new(\%myconfig, $form);
+
+ my @hidden_variables = map { "l_${_}" } @columns;
+ push @hidden_variables, "l_subtotal", $form->{vc}, qw(l_closed l_notdelivered open closed delivered notdelivered ordnumber quonumber
+ transaction_description transdatefrom transdateto type vc employee_id);
+
+ my $href = build_std_url('action=orders', grep { $form->{$_} } @hidden_variables);
+
+ my %column_defs = (
+ 'ids' => { 'text' => '', },
+ 'transdate' => { 'text' => $locale->text('Date'), },
+ 'reqdate' => { 'text' => $locale->text('Required by'), },
+ 'id' => { 'text' => $locale->text('ID'), },
+ 'ordnumber' => { 'text' => $locale->text('Order'), },
+ 'quonumber' => { 'text' => $form->{type} eq "request_quotation" ? $locale->text('RFQ') : $locale->text('Quotation'), },
+ 'name' => { 'text' => $form->{vc} eq 'customer' ? $locale->text('Customer') : $locale->text('Vendor'), },
+ 'netamount' => { 'text' => $locale->text('Amount'), },
+ 'tax' => { 'text' => $locale->text('Tax'), },
+ 'amount' => { 'text' => $locale->text('Total'), },
+ 'curr' => { 'text' => $locale->text('Curr'), },
+ 'employee' => { 'text' => $locale->text('Salesperson'), },
+ 'shipvia' => { 'text' => $locale->text('Ship via'), },
+ 'globalprojectnumber' => { 'text' => $locale->text('Project Number'), },
+ 'transaction_description' => { 'text' => $locale->text('Transaction description'), },
+ 'open' => { 'text' => $locale->text('Open'), },
+ 'delivered' => { 'text' => $locale->text('Delivered'), },
+ 'marge_total' => { 'text' => $locale->text('Ertrag'), },
+ 'marge_percent' => { 'text' => $locale->text('Ertrag prozentual'), }
+ );
+
+ foreach my $name (qw(id transdate reqdate quonumber ordnumber name employee shipvia)) {
+ $column_defs{$name}->{link} = $href . "&sort=$name";
+ }
+
+ my %column_alignment = map { $_ => 'right' } qw(netamount tax amount curr);
+
+ $form->{"l_type"} = "Y";
+ map { $column_defs{$_}->{visible} = $form->{"l_${_}"} ? 1 : 0 } @columns;
+ $column_defs{ids}->{visible} = $allow_multiple_orders ? 'HTML' : 0;
+
+ $report->set_columns(%column_defs);
+ $report->set_column_order(@columns);
+
+ $report->set_export_options('orders', @hidden_variables);
+
+ $report->set_sort_indicator($form->{sort}, 1);
+
+ my @options;
+ if ($form->{customer}) {
+ push @options, $locale->text('Customer') . " : $form->{customer}";
+ }
+ if ($form->{vendor}) {
+ push @options, $locale->text('Vendor') . " : $form->{vendor}";
}
if ($form->{department}) {
- $option .= "\n<br>" if ($option);
($department) = split /--/, $form->{department};
- $option .= $locale->text('Department') . " : $department";
+ push @options, $locale->text('Department') . " : $department";
+ }
+ if ($form->{ordnumber}) {
+ push @options, $locale->text('Order Number') . " : $form->{ordnumber}";
+ }
+ if ($form->{notes}) {
+ push @options, $locale->text('Notes') . " : $form->{notes}";
+ }
+ if ($form->{transaction_description}) {
+ push @options, $locale->text('Transaction description') . " : $form->{transaction_description}";
}
if ($form->{transdatefrom}) {
- $option .= "\n<br>"
- . $locale->text('From') . " "
- . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
+ push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
}
if ($form->{transdateto}) {
- $option .= "\n<br>"
- . $locale->text('Bis') . " "
- . $locale->date(\%myconfig, $form->{transdateto}, 1);
+ push @options, $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{transdateto}, 1);
}
if ($form->{open}) {
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Open');
+ push @options, $locale->text('Open');
}
if ($form->{closed}) {
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Closed');
+ push @options, $locale->text('Closed');
+ }
+ if ($form->{delivered}) {
+ push @options, $locale->text('Delivered');
+ }
+ if ($form->{notdelivered}) {
+ push @options, $locale->text('Not delivered');
}
- $form->header;
+ $report->set_options('top_info_text' => join("\n", @options),
+ 'raw_top_info_text' => $form->parse_html_template('oe/orders_top'),
+ 'raw_bottom_info_text' => $form->parse_html_template('oe/orders_bottom', { 'SHOW_CONTINUE_BUTTON' => $allow_multiple_orders }),
+ 'output_format' => 'HTML',
+ 'title' => $form->{title},
+ 'attachment_basename' => $attachment_basename . strftime('_%Y%m%d', localtime time),
+ );
+ $report->set_options_from_form();
- print qq|
-<body>
+ # add sort and escape callback, this one we use for the add sub
+ $form->{callback} = $href .= "&sort=$form->{sort}";
-<form method="post" action="oe.pl">
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>$option</td>
- </tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>|;
+ # escape callback for href
+ $callback = $form->escape($href);
- map { print "\n$column_header{$_}" } @column_index;
+ my @subtotal_columns = qw(netamount amount marge_total);
- print qq|
- </tr>
-|;
+ my %totals = map { $_ => 0 } @subtotal_columns;
+ my %subtotals = map { $_ => 0 } @subtotal_columns;
- # add sort and escape callback
- $callback_escaped = $form->escape($callback . "&sort=$form->{sort}");
+ my $idx = 0;
- if (@{ $form->{OE} }) {
- $sameitem = $form->{OE}->[0]->{ $form->{sort} };
- }
+ my $edit_url = build_std_url('action=edit', 'type', 'vc');
- $action = "edit";
- $action = "ship_receive" if ($form->{type} =~ /(ship|receive)_order/);
+ foreach $oe (@{ $form->{OE} }) {
+ map { $oe->{$_} *= $oe->{exchangerate} } @subtotal_columns;
- $warehouse = $form->escape($form->{warehouse});
+ $oe->{tax} = $oe->{amount} - $oe->{netamount};
+ $oe->{open} = $oe->{closed} ? $locale->text('No') : $locale->text('Yes');
+ $oe->{delivered} = $oe->{delivered} ? $locale->text('Yes') : $locale->text('No');
- foreach $oe (@{ $form->{OE} }) {
- $form->{rowcount} = ++$j;
+ map { $subtotals{$_} += $oe->{$_};
+ $totals{$_} += $oe->{$_} } @subtotal_columns;
- if ($form->{l_subtotal} eq 'Y') {
- if ($sameitem ne $oe->{ $form->{sort} }) {
- &subtotal;
- $sameitem = $oe->{ $form->{sort} };
- }
- }
+ map { $oe->{$_} = $form->format_amount(\%myconfig, $oe->{$_}, 2) } qw(netamount tax amount marge_total marge_percent);
- map { $oe->{$_} *= $oe->{exchangerate} } (qw(netamount amount));
-
- $column_data{netamount} =
- "<td align=right>"
- . $form->format_amount(\%myconfig, $oe->{netamount}, 2, " ")
- . "</td>";
- $column_data{tax} = "<td align=right>"
- . $form->format_amount(\%myconfig, $oe->{amount} - $oe->{netamount},
- 2, " ")
- . "</td>";
- $column_data{amount} =
- "<td align=right>"
- . $form->format_amount(\%myconfig, $oe->{amount}, 2, " ") . "</td>";
-
- $totalnetamount += $oe->{netamount};
- $totalamount += $oe->{amount};
-
- $subtotalnetamount += $oe->{netamount};
- $subtotalamount += $oe->{amount};
-
- $column_data{ids} =
- qq|<td><input name="id_$j" class=checkbox type=checkbox><input type="hidden" name="trans_id_$j" value="$oe->{id}"></td>|;
- $column_data{id} = "<td>$oe->{id}</td>";
- $column_data{transdate} = "<td>$oe->{transdate} </td>";
- $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>";
- $column_data{name} = "<td>$oe->{name}</td>";
-
- $column_data{employee} = "<td>$oe->{employee} </td>";
- $column_data{shipvia} = "<td>$oe->{shipvia} </td>";
-
- if ($oe->{closed}) {
- $column_data{closed} = "<td align=center>X</td>";
- $column_data{open} = "<td> </td>";
- } else {
- $column_data{closed} = "<td> </td>";
- $column_data{open} = "<td align=center>X</td>";
+ my $row = { };
+
+ foreach my $column (@columns) {
+ next if ($column eq 'ids');
+ $row->{$column} = {
+ 'data' => $oe->{$column},
+ 'align' => $column_alignment{$column},
+ };
}
- $i++;
- $i %= 2;
- print "
- <tr class=listrow$i>";
+ $row->{ids} = {
+ 'raw_data' => $cgi->hidden('-name' => "trans_id_${idx}", '-value' => $oe->{id})
+ . $cgi->checkbox('-name' => "multi_id_${idx}", '-value' => 1, '-label' => ''),
+ 'valign' => 'center',
+ 'align' => 'center',
+ };
- map { print "\n$column_data{$_}" } @column_index;
+ $row->{$ordnumber}->{link} = $edit_url . "&id=" . E($oe->{id}) . "&callback=${callback}";
- print qq|
- </tr>
-|;
+ my $row_set = [ $row ];
- }
+ if (($form->{l_subtotal} eq 'Y')
+ && (($idx == (scalar @{ $form->{OE} } - 1))
+ || ($oe->{ $form->{sort} } ne $form->{OE}->[$idx + 1]->{ $form->{sort} }))) {
+ push @{ $row_set }, create_subtotal_row(\%subtotals, \@columns, \%column_alignment, \@subtotal_columns, 'listsubtotal');
+ }
- if ($form->{l_subtotal} eq 'Y') {
- &subtotal;
- }
-
- # print totals
- print qq|
- <tr class=listtotal>|;
-
- map { $column_data{$_} = "<td> </td>" } @column_index;
-
- $column_data{netamount} =
- "<th class=listtotal align=right>"
- . $form->format_amount(\%myconfig, $totalnetamount, 2, " ") . "</th>";
- $column_data{tax} = "<th class=listtotal align=right>"
- . $form->format_amount(\%myconfig, $totalamount - $totalnetamount,
- 2, " ")
- . "</th>";
- $column_data{amount} =
- "<th class=listtotal align=right>"
- . $form->format_amount(\%myconfig, $totalamount, 2, " ") . "</th>";
-
- map { print "\n$column_data{$_}" } @column_index;
-
- print qq|
- </tr>
- </td>
- </table>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>|;
-
- # multiple invoice edit button only if gotten there via sales_order form.
-
- if ($form->{type} =~ /sales_order/) {
- print qq|
- <input type="hidden" name="path" value="$form->{path}">
- <input class"submit" type="submit" name="action" value="|
- . $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="callback" value="$callback">
- <input type="hidden" name="rowcount" value="$form->{rowcount}">|;
- }
-
- print qq|
-</form>
-
-<br>
-<form method=post action=$form->{script}>
-
-<input name=callback type=hidden value="$form->{callback}">
-
-<input type=hidden name=type value=$form->{type}>
-<input type=hidden name=vc value=$form->{vc}>
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>
-|;
+ $report->add_data($row_set);
- if ($form->{type} !~ /(ship|receive)_order/) {
- print qq|
-<input class=submit type=submit name=action value="|
- . $locale->text('Add') . qq|">|;
+ $idx++;
}
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
+ $report->add_separator();
+ $report->add_data(create_subtotal_row(\%totals, \@columns, \%column_alignment, \@subtotal_columns, 'listtotal'));
- print qq|
-</form>
-
-</body>
-</html>
-|;
+ $report->generate_with_headers();
$lxdebug->leave_sub();
}
-sub subtotal {
+sub check_delivered_flag {
$lxdebug->enter_sub();
- map { $column_data{$_} = "<td> </td>" } @column_index;
+ if (($form->{type} ne 'sales_order') && ($form->{type} ne 'purchase_order')) {
+ return $lxdebug->leave_sub();
+ }
- $column_data{netamount} =
- "<th class=listsubtotal align=right>"
- . $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ")
- . "</th>";
- $column_data{tax} = "<td class=listsubtotal align=right>"
- . $form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount,
- 2, " ")
- . "</th>";
- $column_data{amount} =
- "<th class=listsubtotal align=right>"
- . $form->format_amount(\%myconfig, $subtotalamount, 2, " ") . "</th>";
+ my $all_delivered = 0;
- $subtotalnetamount = 0;
- $subtotalamount = 0;
+ foreach my $i (1 .. $form->{rowcount}) {
+ next if (!$form->{"id_$i"});
- print "
- <tr class=listsubtotal>
-";
+ if ($form->parse_amount(\%myconfig, $form->{"qty_$i"}) == $form->parse_amount(\%myconfig, $form->{"ship_$i"})) {
+ $all_delivered = 1;
+ next;
+ }
- map { print "\n$column_data{$_}" } @column_index;
+ $all_delivered = 0;
+ last;
+ }
- print qq|
- </tr>
-|;
+ $form->{delivered} = 1 if $all_delivered;
$lxdebug->leave_sub();
}
sub save_and_close {
$lxdebug->enter_sub();
+ $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
+
if ($form->{type} =~ /_order$/) {
$form->isblank("transdate", $locale->text('Order Date missing!'));
} else {
$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!"));
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;
}
$err = $locale->text('Cannot save order!');
+ check_delivered_flag();
+
} else {
if ($form->{type} eq 'sales_quotation') {
$form->{label} = $locale->text('Quotation');
relink_accounts();
- $form->redirect(
- $form->{label} . " $form->{$ordnumber} " . $locale->text('saved!'))
- if (OE->save(\%myconfig, \%$form));
- $form->error($err);
+ $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
+
+ $form->redirect($form->{label} . " $form->{$ordnumber} " .
+ $locale->text('saved!'));
$lxdebug->leave_sub();
}
sub save {
$lxdebug->enter_sub();
+ $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
+
+
if ($form->{type} =~ /_order$/) {
$form->isblank("transdate", $locale->text('Order Date missing!'));
} else {
$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!"));
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;
}
$err = $locale->text('Cannot save order!');
+ check_delivered_flag();
+
} else {
if ($form->{type} eq 'sales_quotation') {
$form->{label} = $locale->text('Quotation');
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
+
$form->{simple_save} = 1;
if(!$form->{print_and_save}) {
set_headings("edit");
<h4>$msg $form->{$ordnumber}</h4>
<p>
+<input type="hidden" name="yes_nextsub" value="delete_order_quotation">
<input name=action class=submit type=submit value="|
. $locale->text('Yes') . qq|">
+<button class=submit type=button onclick="history.back()">|
+ . $locale->text('No') . qq|</button>
</form>
</body>
$lxdebug->leave_sub();
}
-sub yes {
+sub delete_order_quotation {
$lxdebug->enter_sub();
if ($form->{type} =~ /_order$/) {
$msg = $locale->text('Quotation deleted!');
$err = $locale->text('Cannot delete quotation!');
}
-
- $form->redirect($msg) if (OE->delete(\%myconfig, \%$form, $spool));
+ if (OE->delete(\%myconfig, \%$form, $spool)){
+ # saving the history
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
+ $form->{addition} = "DELETED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
+ $form->info($msg);
+ exit();
+ }
$form->error($err);
$lxdebug->leave_sub();
sub invoice {
$lxdebug->enter_sub();
+ $form->{old_employee_id} = $form->{employee_id};
+ $form->{old_salesman_id} = $form->{salesman_id};
+
if ($form->{type} =~ /_order$/) {
# these checks only apply if the items don't bring their own ordnumbers/transdates.
# The if clause ensures that by searching for empty ordnumber_#/transdate_# fields.
$form->isblank("ordnumber", $locale->text('Order Number missing!'))
- if (+{ map { $form->{"ordnumber_$_"}, 1 } (1 .. $form->{rowcount} - 1) }
- ->{''});
+ if (+{ map { $form->{"ordnumber_$_"}, 1 } (1 .. $form->{rowcount} - 1) }->{''});
$form->isblank("transdate", $locale->text('Order Date missing!'))
- if (+{ map { $form->{"transdate_$_"}, 1 } (1 .. $form->{rowcount} - 1) }
- ->{''});
+ if (+{ map { $form->{"transdate_$_"}, 1 } (1 .. $form->{rowcount} - 1) }->{''});
# also copy deliverydate from the order
$form->{deliverydate} = $form->{reqdate} if $form->{reqdate};
+ $form->{orddate} = $form->{transdate};
} else {
$form->isblank("quonumber", $locale->text('Quotation Number missing!'));
$form->isblank("transdate", $locale->text('Quotation Date missing!'));
$form->{ordnumber} = "";
+ $form->{quodate} = $form->{transdate};
}
-
+
+ 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;
}
# if not it's most likely a collective order, which can't be saved back
# so they just have to be closed
if (($form->{ordnumber} ne '') || ($form->{quonumber} ne '')) {
- OE->close_order(\%myconfig, \%$form);
+ OE->close_order(\%myconfig, \%$form) if ($form->{id});
} else {
OE->close_orders(\%myconfig, \%$form);
}
$form->{rowcount}--;
$form->{shipto} = 1;
+ $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
+
if ($form->{type} =~ /_order$/) {
$form->{exchangerate} = $exchangerate;
&create_backorder;
# locale messages
$locale = new Locale "$myconfig{countrycode}", "$script";
- require "$form->{path}/$form->{script}";
+ require "bin/mozilla/$form->{script}";
map { $form->{"select$_"} = "" } ($form->{vc}, currency);
print qq|
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
$form->{saveasnew} = 1;
$form->{closed} = 0;
- map { delete $form->{$_} } qw(printed emailed queued ordnumber quonumber);
+ map { delete $form->{$_} } qw(printed emailed queued);
+
+ # Let Lx-Office assign a new order number if the user hasn't changed the
+ # previous one. If it has been changed manually then use it as-is.
+ my $idx = $form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber";
+ $form->{$idx} =~ s/^\s*//g;
+ $form->{$idx} =~ s/\s*$//g;
+ if ($form->{saved_xyznumber} &&
+ ($form->{saved_xyznumber} eq $form->{$idx})) {
+ delete($form->{$idx});
+ }
&save;
$lxdebug->leave_sub();
}
+sub check_for_direct_delivery_yes {
+ $lxdebug->enter_sub();
+
+ $form->{direct_delivery_checked} = 1;
+ delete @{$form}{grep /^shipto/, keys %{ $form }};
+ map { s/^CFDD_//; $form->{$_} = $form->{"CFDD_${_}"} } grep /^CFDD_/, keys %{ $form };
+ $form->{shipto} = 1;
+ purchase_order();
+ $lxdebug->leave_sub();
+}
+
+sub check_for_direct_delivery_no {
+ $lxdebug->enter_sub();
+
+ $form->{direct_delivery_checked} = 1;
+ delete @{$form}{grep /^shipto/, keys %{ $form }};
+ purchase_order();
+
+ $lxdebug->leave_sub();
+}
+
+sub check_for_direct_delivery {
+ $lxdebug->enter_sub();
+
+ if ($form->{direct_delivery_checked}
+ || (!$form->{shiptoname} && !$form->{shiptostreet} && !$form->{shipto_id})) {
+ $lxdebug->leave_sub();
+ return;
+ }
+
+ if ($form->{shipto_id}) {
+ Common->get_shipto_by_id(\%myconfig, $form, $form->{shipto_id}, "CFDD_");
+
+ } else {
+ map { $form->{"CFDD_${_}"} = $form->{$_ } } grep /^shipto/, keys %{ $form };
+ }
+
+ delete $form->{action};
+ $form->{VARIABLES} = [ map { { "key" => $_, "value" => $form->{$_} } } grep { ref $_ eq "" } keys %{ $form } ];
+
+ $form->header();
+ print $form->parse_html_template("oe/check_for_direct_delivery");
+
+ $lxdebug->leave_sub();
+
+ exit 0;
+}
+
sub purchase_order {
$lxdebug->enter_sub();
+ if ($form->{type} eq 'sales_order') {
+ check_for_direct_delivery();
+ }
+
if ( $form->{type} eq 'sales_quotation'
|| $form->{type} eq 'request_quotation') {
OE->close_order(\%myconfig, \%$form);
}
+ if ($form->{type} =~ /^sales_/) {
+ delete($form->{ordnumber});
+ }
+
$form->{cp_id} *= 1;
$form->{title} = $locale->text('Add Purchase Order');
OE->close_order(\%myconfig, $form);
}
+ if ($form->{type} eq "purchase_order") {
+ delete($form->{ordnumber});
+ }
+
$form->{cp_id} *= 1;
$form->{title} = $locale->text('Add Sales Order');
$form->{closed} = 0;
+ $form->{old_employee_id} = $form->{employee_id};
+ $form->{old_salesman_id} = $form->{salesman_id};
+
# reset
map { delete $form->{$_} }
qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal);
$lxdebug->leave_sub();
}
-sub ship_receive {
- $lxdebug->enter_sub();
-
- &order_links;
-
- &prepare_order;
-
- OE->get_warehouses(\%myconfig, \%$form);
-
- # warehouse
- if (@{ $form->{all_warehouses} }) {
- $form->{selectwarehouse} = "<option>\n";
-
- map { $form->{selectwarehouse} .= "<option>$_->{description}--$_->{id}\n" }
- (@{ $form->{all_warehouses} });
-
- if ($form->{warehouse}) {
- $form->{selectwarehouse} = "<option>$form->{warehouse}";
- }
- }
-
- $form->{shippingdate} = $form->current_date(\%myconfig);
- $form->{"$form->{vc}"} =~ s/--.*//;
-
- @flds = ();
- @a = ();
- $count = 0;
- foreach $key (keys %$form) {
- if ($key =~ /_1$/) {
- $key =~ s/_1//;
- push @flds, $key;
- }
- }
-
- for $i (1 .. $form->{rowcount}) {
-
- # undo formatting from prepare_order
- map {
- $form->{"${_}_$i"} =
- $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
- } qw(qty ship);
- $n = ($form->{"qty_$i"} -= $form->{"ship_$i"});
- if (abs($n) > 0
- && ($form->{"inventory_accno_$i"} || $form->{"assembly_$i"})) {
- $form->{"ship_$i"} = "";
- $form->{"serialnumber_$i"} = "";
-
- push @a, {};
- $j = $#a;
-
- map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
- $count++;
- }
- }
-
- $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
- $form->{rowcount} = $count;
-
- &display_ship_receive;
-
- $lxdebug->leave_sub();
-}
-
-sub display_ship_receive {
- $lxdebug->enter_sub();
-
- $vclabel = ucfirst $form->{vc};
- $vclabel = $locale->text($vclabel);
-
- $form->{rowcount}++;
-
- if ($form->{vc} eq 'customer') {
- $form->{title} = $locale->text('Ship Merchandise');
- $shipped = $locale->text('Shipping Date');
- } else {
- $form->{title} = $locale->text('Receive Merchandise');
- $shipped = $locale->text('Date Received');
- }
-
- # set option selected
- foreach $item (warehouse, employee) {
- $form->{"select$item"} =~ s/ selected//;
- $form->{"select$item"} =~
- s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
- }
-
- $warehouse = qq|
- <tr>
- <th align=right>| . $locale->text('Warehouse') . qq|</th>
- <td><select name=warehouse>$form->{selectwarehouse}</select></td>
- <input type=hidden name=selectwarehouse value="$form->{selectwarehouse}">
- </tr>
-| if $form->{selectwarehouse};
-
- $employee = qq|
- <tr>
- <th align=right nowrap>| . $locale->text('Contact') . qq|</th>
- <td><select name=employee>$form->{selectemployee}</select></td>
- <input type=hidden name=selectemployee value="$form->{selectemployee}">
- </tr>
-|;
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=id value=$form->{id}>
-
-<input type=hidden name=display_form value=display_ship_receive>
-
-<input type=hidden name=type value=$form->{type}>
-<input type=hidden name=media value=$form->{media}>
-<input type=hidden name=format value=$form->{format}>
-
-<input type=hidden name=queued value="$form->{queued}">
-<input type=hidden name=printed value="$form->{printed}">
-<input type=hidden name=emailed value="$form->{emailed}">
-
-<input type=hidden name=vc value=$form->{vc}>
-
-<table width=100%>
- <tr class=listtop>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table width="100%">
- <tr valign=top>
- <td>
- <table width=100%>
- <tr>
- <th align=right>$vclabel</th>
- <td colspan=3>$form->{$form->{vc}}</td>
- <input type=hidden name=$form->{vc} value="$form->{$form->{vc}}">
- <input type=hidden name="$form->{vc}_id" value=$form->{"$form->{vc}_id"}>
- </tr>
- $department
- <tr>
- <th align=right>| . $locale->text('Shipping Point') . qq|</th>
- <td colspan=3>
- <input name=shippingpoint size=35 value="$form->{shippingpoint}">
- </tr>
- <tr>
- <th align=right>| . $locale->text('Ship via') . qq|</th>
- <td colspan=3>
- <input name=shipvia size=35 value="$form->{shipvia}">
- </tr>
- $warehouse
- </table>
- </td>
- <td align=right>
- <table>
- $employee
- <tr>
- <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
- <td>$form->{ordnumber}</td>
- <input type=hidden name=ordnumber value="$form->{ordnumber}">
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Order Date') . qq|</th>
- <td>$form->{transdate}</td>
- <input type=hidden name=transdate value=$form->{transdate}>
- </tr>
- <tr>
- <th align=right nowrap>$shipped</th>
- <td><input name=shippingdate size=11 value=$form->{shippingdate}></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-
-<!-- shipto are in hidden variables -->
-
-<input type=hidden name=shiptoname value="$form->{shiptoname}">
-<input type=hidden name=shiptostreet value="$form->{shiptostreet}">
-<input type=hidden name=shiptozipcode value="$form->{shiptozipcode}">
-<input type=hidden name=shiptocity value="$form->{shiptocity}">
-<input type=hidden name=shiptocountry value="$form->{shiptocountry}">
-<input type=hidden name=shiptocontact value="$form->{shiptocontact}">
-<input type=hidden name=shiptophone value="$form->{shiptophone}">
-<input type=hidden name=shiptofax value="$form->{shiptofax}">
-<input type=hidden name=shiptoemail value="$form->{shiptoemail}">
-<input type=hidden name=shiptodepartment_1 value="$form->{shiptodepartment_1}">
-<input type=hidden name=shiptodepartment_2 value="$form->{shiptodepartment_2}">
-
-<!-- email variables -->
-<input type=hidden name=message value="$form->{message}">
-<input type=hidden name=email value="$form->{email}">
-<input type=hidden name=subject value="$form->{subject}">
-<input type=hidden name=cc value="$form->{cc}">
-<input type=hidden name=bcc value="$form->{bcc}">
-
-|;
-
- @column_index =
- (partnumber, description, qty, ship, unit, bin, serialnumber);
-
- if ($form->{type} eq "ship_order") {
- $column_data{ship} =
- qq|<th class=listheading align=center width="auto">|
- . $locale->text('Ship')
- . qq|</th>|;
- }
- if ($form->{type} eq "receive_order") {
- $column_data{ship} =
- qq|<th class=listheading align=center width="auto">|
- . $locale->text('Recd')
- . qq|</th>|;
- }
-
- my $colspan = $#column_index + 1;
-
- $column_data{partnumber} =
- qq|<th class=listheading nowrap>| . $locale->text('Number') . qq|</th>|;
- $column_data{description} =
- qq|<th class=listheading nowrap>|
- . $locale->text('Description')
- . qq|</th>|;
- $column_data{qty} =
- qq|<th class=listheading nowrap>| . $locale->text('Qty') . qq|</th>|;
- $column_data{unit} =
- qq|<th class=listheading nowrap>| . $locale->text('Unit') . qq|</th>|;
- $column_data{bin} =
- qq|<th class=listheading nowrap>| . $locale->text('Bin') . qq|</th>|;
- $column_data{serialnumber} =
- qq|<th class=listheading nowrap>|
- . $locale->text('Serial No.')
- . qq|</th>|;
-
- print qq|
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>|;
-
- map { print "\n$column_data{$_}" } @column_index;
-
- print qq|
- </tr>
-|;
-
- for $i (1 .. $form->{rowcount} - 1) {
-
- # undo formatting
- $form->{"ship_$i"} = $form->parse_amount(\%myconfig, $form->{"ship_$i"});
-
- # convert " to "
- map { $form->{"${_}_$i"} =~ s/\"/"/g }
- qw(partnumber description unit bin serialnumber);
-
- $description = $form->{"description_$i"};
- $description =~ s/\n/<br>/g;
-
- $column_data{partnumber} =
- qq|<td>$form->{"partnumber_$i"}<input type=hidden name="partnumber_$i" value="$form->{"partnumber_$i"}"></td>|;
- $column_data{description} =
- qq|<td>$description<input type=hidden name="description_$i" value="$form->{"description_$i"}"></td>|;
- $column_data{qty} =
- qq|<td align=right>|
- . $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty)
- . qq|<input type=hidden name="qty_$i" value="$form->{"qty_$i"}"></td>|;
- $column_data{ship} =
- qq|<td align=right><input name="ship_$i" size=5 value=|
- . $form->format_amount(\%myconfig, $form->{"ship_$i"})
- . qq|></td>|;
- $column_data{unit} =
- qq|<td>$form->{"unit_$i"}<input type=hidden name="unit_$i" value="$form->{"unit_$i"}"></td>|;
- $column_data{bin} =
- qq|<td>$form->{"bin_$i"}<input type=hidden name="bin_$i" value="$form->{"bin_$i"}"></td>|;
-
- $column_data{serialnumber} =
- qq|<td><input name="serialnumber_$i" size=15 value="$form->{"serialnumber_$i"}"></td>|;
-
- print qq|
- <tr valign=top>|;
-
- map { print "\n$column_data{$_}" } @column_index;
-
- print qq|
- </tr>
-
-<input type=hidden name="orderitems_id_$i" value=$form->{"orderitems_id_$i"}>
-<input type=hidden name="id_$i" value=$form->{"id_$i"}>
-<input type=hidden name="assembly_$i" value="$form->{"assembly_$i"}">
-<input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">
-
-|;
-
- }
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
- <tr>
- <td>
-|;
-
- $form->{copies} = 1;
-
- &print_options;
-
- print qq|
- </td>
- </tr>
-</table>
-<br>
-<input class=submit type=submit name=action value="|
- . $locale->text('Update') . qq|">
-<input class=submit type=submit name=action value="|
- . $locale->text('Print') . qq|">
-|;
-
- if ($form->{type} eq 'ship_order') {
- print qq|
-<input class=submit type=submit name=action value="|
- . $locale->text('Ship to') . qq|">
-<input class=submit type=submit name=action value="|
- . $locale->text('E-mail') . qq|">
-|;
- }
-
- print qq|
-
-<input class=submit type=submit name=action value="|
- . $locale->text('Done') . qq|">
-|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
-
-<input type=hidden name=rowcount value=$form->{rowcount}>
-
-<input name=callback type=hidden value="$callback">
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>
-
-</form>
-
-</body>
-</html>
-|;
-
- $lxdebug->leave_sub();
-}
-
-sub done {
- $lxdebug->enter_sub();
-
- if ($form->{type} eq 'ship_order') {
- $form->isblank("shippingdate", $locale->text('Shipping Date missing!'));
- } else {
- $form->isblank("shippingdate", $locale->text('Date received missing!'));
- }
-
- $total = 0;
- map {
- $total += $form->{"ship_$_"} =
- $form->parse_amount(\%myconfig, $form->{"ship_$_"})
- } (1 .. $form->{rowcount} - 1);
-
- $form->error($locale->text('Nothing entered!')) unless $total;
-
- $form->redirect($locale->text('Inventory saved!'))
- if OE->save_inventory(\%myconfig, \%$form);
- $form->error($locale->text('Could not save!'));
-
- $lxdebug->leave_sub();
-}
-
-sub search_transfer {
+sub e_mail {
$lxdebug->enter_sub();
- OE->get_warehouses(\%myconfig, \%$form);
-
- # warehouse
- if (@{ $form->{all_warehouses} }) {
- $form->{selectwarehouse} = "<option>\n";
- $form->{warehouse} = qq|$form->{warehouse}--$form->{warehouse_id}|;
-
- map { $form->{selectwarehouse} .= "<option>$_->{description}--$_->{id}\n" }
- (@{ $form->{all_warehouses} });
- } else {
- $form->error($locale->text('Nothing to transfer!'));
- }
-
- $form->{title} = $locale->text('Transfer Inventory');
-
- $form->header;
-
- print qq|
-<body>
+ $form->{print_and_save} = 1;
-<form method=post action=$form->{script}>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align=right nowrap>| . $locale->text('Transfer to') . qq|</th>
- <td><select name=warehouse>$form->{selectwarehouse}</select></td>
- </tr>
- <tr>
- <th align="right" nowrap="true">| . $locale->text('Part Number') . qq|</th>
- <td><input name=partnumber size=20></td>
- </tr>
- <tr>
- <th align="right" nowrap="true">| . $locale->text('Description') . qq|</th>
- <td><input name=description size=40></td>
- </tr>
- <tr>
- <th align=right nowrap>| . $locale->text('Group') . qq|</th>
- <td><input name=partsgroup size=20></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
+ $print_post = 1;
-<br>
-<input type=hidden name=sort value=partnumber>
-<input type=hidden name=nextsub value=list_transfer>
+ my $saved_form = save_form();
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>
+ save();
-<input class=submit type=submit name=action value="|
- . $locale->text('Continue') . qq|">
-</form>
+ my %saved_vars;
+ map({ $saved_vars{$_} = $form->{$_}; } qw(id ordnumber quonumber));
+ restore_form($saved_form);
+ map({ $form->{$_} = $saved_vars{$_}; } qw(id ordnumber quonumber));
-</body>
-</html>
-|;
+ edit_e_mail();
$lxdebug->leave_sub();
}
-sub list_transfer {
- $lxdebug->enter_sub();
-
- OE->get_inventory(\%myconfig, \%$form);
-
- $partnumber = $form->escape($form->{partnumber});
- $warehouse = $form->escape($form->{warehouse});
- $description = $form->escape($form->{description});
- $partsgroup = $form->escape($form->{partsgroup});
-
- # construct href
- $href =
- "$form->{script}?path=$form->{path}&action=list_transfer&partnumber=$partnumber&warehouse=$warehouse&description=$description&partsgroup=$partsgroup&login=$form->{login}&password=$form->{password}";
-
- # construct callback
- $partnumber = $form->escape($form->{partnumber}, 1);
- $warehouse = $form->escape($form->{warehouse}, 1);
- $description = $form->escape($form->{description}, 1);
- $partsgroup = $form->escape($form->{partsgroup}, 1);
-
- $callback =
- "$form->{script}?path=$form->{path}&action=list_transfer&partnumber=$partnumber&warehouse=$warehouse&description=$description&partsgroup=$partsgroup&login=$form->{login}&password=$form->{password}";
-
- @column_index =
- $form->sort_columns(
- qw(partnumber description partsgroup make model warehouse qty transfer));
-
- $column_header{partnumber} =
- qq|<th><a class=listheading href=$href&sort=partnumber>|
- . $locale->text('Part Number')
- . qq|</a></th>|;
- $column_header{description} =
- qq|<th><a class=listheading href=$href&sort=description>|
- . $locale->text('Description')
- . qq|</a></th>|;
- $column_header{partsgroup} =
- qq|<th><a class=listheading href=$href&sort=partsgroup>|
- . $locale->text('Group')
- . qq|</a></th>|;
- $column_header{warehouse} =
- qq|<th><a class=listheading href=$href&sort=warehouse>|
- . $locale->text('From')
- . qq|</a></th>|;
- $column_header{qty} =
- qq|<th><a class=listheading>| . $locale->text('Qty') . qq|</a></th>|;
- $column_header{transfer} =
- qq|<th><a class=listheading>| . $locale->text('Transfer') . qq|</a></th>|;
-
- $option = $locale->text('Transfer to');
-
- ($warehouse, $warehouse_id) = split /--/, $form->{warehouse};
-
- if ($form->{warehouse}) {
- $option .= " : $warehouse";
- }
- if ($form->{partnumber}) {
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Part Number') . " : $form->{partnumber}";
- }
- if ($form->{description}) {
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Description') . " : $form->{description}";
- }
- if ($form->{partsgroup}) {
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Group') . " : $form->{partsgroup}";
- }
-
- $form->{title} = $locale->text('Transfer Inventory');
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=warehouse_id value=$warehouse_id>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>$option</td>
- </tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>|;
-
- map { print "\n$column_header{$_}" } @column_index;
-
- print qq|
- </tr>
-|;
-
- if (@{ $form->{all_inventory} }) {
- $sameitem = $form->{all_inventory}->[0]->{ $form->{sort} };
- }
-
- $i = 0;
- foreach $ref (@{ $form->{all_inventory} }) {
-
- $i++;
-
- $column_data{partnumber} =
- qq|<td><input type=hidden name="id_$i" value=$ref->{id}>$ref->{partnumber}</td>|;
- $column_data{description} = "<td>$ref->{description} </td>";
- $column_data{partsgroup} = "<td>$ref->{partsgroup} </td>";
- $column_data{warehouse} =
- qq|<td><input type=hidden name="warehouse_id_$i" value=$ref->{warehouse_id}>$ref->{warehouse} </td>|;
- $column_data{qty} =
- qq|<td><input type=hidden name="qty_$i" value=$ref->{qty}>|
- . $form->format_amount(\%myconfig, $ref->{qty}, $dec_qty)
- . qq|</td>|;
- $column_data{transfer} = qq|<td><input name="transfer_$i" size=4></td>|;
-
- $j++;
- $j %= 2;
- print "
- <tr class=listrow$j>";
-
- map { print "\n$column_data{$_}" } @column_index;
-
- print qq|
- </tr>
-|;
-
- }
-
- print qq|
- </table>
- </td>
- </tr>
-
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<br>
-
-<input name=callback type=hidden value="$callback">
-
-<input type=hidden name=rowcount value=$i>
-
-<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('Transfer') . qq|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
-</form>
-
-</body>
-</html>
-|;
-
- $lxdebug->leave_sub();
+sub yes {
+ call_sub($form->{yes_nextsub});
}
-sub transfer {
- $lxdebug->enter_sub();
-
- $form->redirect($locale->text('Inventory transferred!'))
- if OE->transfer(\%myconfig, \%$form);
- $form->error($locale->text('Could not transfer Inventory!'));
-
- $lxdebug->leave_sub();
+sub no {
+ call_sub($form->{no_nextsub});
}
use SL::PE;
+require "bin/mozilla/common.pl";
+
1;
# end of main
# construct callback
$form->{callback} =
- "$form->{script}?action=add&type=$form->{type}&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=add&type=$form->{type}&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
- &{"form_$form->{type}_header"};
- &{"form_$form->{type}_footer"};
+ call_sub("form_$form->{type}_header");
+ call_sub("form_$form->{type}_footer");
$lxdebug->leave_sub();
}
sub edit {
$lxdebug->enter_sub();
-
+ # show history button
+ $form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
+ #/show hhistory button
$form->{title} = "Edit";
if ($form->{type} eq 'project') {
if ($form->{type} eq 'pricegroup') {
PE->get_pricegroup(\%myconfig, \%$form);
}
- &{"form_$form->{type}_header"};
- &{"form_$form->{type}_footer"};
+ call_sub("form_$form->{type}_header");
+ call_sub("form_$form->{type}_footer");
$lxdebug->leave_sub();
}
$number = qq|
<tr>
<th align=right width=1%>| . $locale->text('Number') . qq|</th>
- <td><input name=projectnumber size=20></td>
+ <td>| . $cgi->textfield('-name' => 'projectnumber', '-size' => 20) . qq|</td>
</tr>
<tr>
<th align=right>| . $locale->text('Description') . qq|</th>
- <td><input name=description size=60></td>
+ <td>| . $cgi->textfield('-name' => 'description', '-size' => 60) . qq|</td>
</tr>
+ <tr>
+ <th> </th>
+ <td>| .
+ $cgi->radio_group('-name' => 'active', '-default' => 'active',
+ '-values' => ['active', 'inactive', 'both'],
+ '-labels' => { 'active' => ' ' . $locale->text("Active"),
+ 'inactive' => ' ' . $locale->text("Inactive"),
+ 'both' => ' ' . $locale->text("Both") })
+ . qq|</td>
+ </tr>
|;
}
<input type=hidden name=nextsub value=$report>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
PE->projects(\%myconfig, \%$form);
$callback =
- "$form->{script}?action=project_report&type=$form->{type}&path=$form->{path}&login=$form->{login}&password=$form->{password}&status=$form->{status}";
+ "$form->{script}?action=project_report&type=$form->{type}&login=$form->{login}&password=$form->{password}&status=$form->{status}&active=" .
+ E($form->{active});
$href = $callback;
if ($form->{status} eq 'all') {
"\n<br>" . $locale->text('Description') . " : $form->{description}";
}
- @column_index = $form->sort_columns(qw(projectnumber description));
+ @column_index = qw(projectnumber description);
+
+ push(@column_index, "active") if ("both" eq $form->{active});
$column_header{projectnumber} =
qq|<th><a class=listheading href=$href&sort=projectnumber>|
qq|<th><a class=listheading href=$href&sort=description>|
. $locale->text('Description')
. qq|</a></th>|;
+ $column_header{active} =
+ qq|<th class="listheading">| . $locale->text('Active') . qq|</th>|;
$form->{title} = $locale->text('Projects');
|;
$column_data{projectnumber} =
- qq|<td><a href=$form->{script}?action=edit&type=$form->{type}&status=$form->{status}&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{projectnumber}</td>|;
+ qq|<td><a href=$form->{script}?action=edit&type=$form->{type}&status=$form->{status}&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{projectnumber}</td>|;
$column_data{description} = qq|<td>$ref->{description} </td>|;
+ $column_data{active} =
+ qq|<td>| .
+ ($ref->{active} ? $locale->text("Yes") : $locale->text("No")) .
+ qq|</td>|;
map { print "$column_data{$_}\n" } @column_index;
<input type=hidden name=type value=$form->{type}>
-<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|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
+ . $locale->text('Add') . qq|">
- print qq|
</form>
</body>
$form->{description} =~ s/\"/"/g;
+ my $projectnumber =
+ $cgi->textfield('-name' => 'projectnumber', '-size' => 20,
+ '-default' => $form->{projectnumber});
+
+ my $description;
if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
$description =
- qq|<textarea name="description" rows=$rows cols=60 style="width: 100%" wrap=soft>$form->{description}</textarea>|;
+ $cgi->textarea('-name' => 'description', '-rows' => $rows, '-cols' => 60,
+ '-style' => 'width: 100%', '-wrap' => 'soft',
+ '-default' => $form->{description});
} else {
$description =
- qq|<input name=description size=60 value="$form->{description}">|;
+ $cgi->textfield('-name' => 'description', '-size' => 60,
+ '-default' => $form->{description});
+ }
+
+ my $active;
+ if ($form->{id}) {
+ $active =
+ qq|
+ <tr>
+ <th> </th>
+ <td>| .
+ $cgi->radio_group('-name' => 'active',
+ '-values' => [1, 0],
+ '-default' => $form->{active} * 1,
+ '-labels' => { 1 => $locale->text("Active"),
+ 0 => $locale->text("Inactive") })
+ . qq|</td>
+ </tr>
+|;
}
$form->header;
<table>
<tr>
<th align=right>| . $locale->text('Number') . qq|</th>
- <td><input name=projectnumber size=20 value="$form->{projectnumber}"></td>
+ <td>$projectnumber</td>
</tr>
<tr>
<th align=right>| . $locale->text('Description') . qq|</th>
<td>$description</td>
</tr>
+ $active
</table>
</td>
</tr>
<input name=callback type=hidden value="$form->{callback}">
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
. $locale->text('Delete') . qq|">|;
}
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
+ if ($form->{id}) {
+ # button for saving history
+ print qq|
+ <input type=button onclick=set_history_window(|
+ . $form->{id}
+ . qq|); name=history id=history value=|
+ . $locale->text('history')
+ . qq|>|;
+ # /button for saving history
}
print qq|
PE->save_pricegroup(\%myconfig, \%$form);
$form->redirect($locale->text('Pricegroup saved!'));
}
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $form->{snumbers} = qq|projectnumber_| . $form->{projectnumber};
+ $form->{addition} = "SAVED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
$lxdebug->leave_sub();
}
if ($form->{type} eq 'pricegroup') {
$form->redirect($locale->text('Pricegroup deleted!'));
}
-
+ # saving the history
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|projectnumber_| . $form->{projectnumber};
+ $form->{addition} = "DELETED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
$lxdebug->leave_sub();
}
-sub continue { &{ $form->{nextsub} } }
+sub continue { call_sub($form->{"nextsub"}); }
sub partsgroup_report {
$lxdebug->enter_sub();
PE->partsgroups(\%myconfig, \%$form);
$callback =
- "$form->{script}?action=partsgroup_report&type=$form->{type}&path=$form->{path}&login=$form->{login}&password=$form->{password}&status=$form->{status}";
+ "$form->{script}?action=partsgroup_report&type=$form->{type}&login=$form->{login}&password=$form->{password}&status=$form->{status}";
if ($form->{status} eq 'all') {
$option = $locale->text('All');
|;
$column_data{partsgroup} =
- qq|<td><a href=$form->{script}?action=edit&type=$form->{type}&status=$form->{status}&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{partsgroup}</td>|;
+ qq|<td><a href=$form->{script}?action=edit&type=$form->{type}&status=$form->{status}&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{partsgroup}</td>|;
map { print "$column_data{$_}\n" } @column_index;
print "
<input type=hidden name=type value=$form->{type}>
-<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|">|;
+ . $locale->text('Add') . qq|">
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
</form>
</body>
<input name=callback type=hidden value="$form->{callback}">
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
. $locale->text('Delete') . qq|">|;
}
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
+# button for saving history
+print qq|
+ <input type=button onclick=set_history_window(|
+ . $form->{id}
+ . qq|); name=history id=history value=|
+ . $locale->text('history')
+ . qq|>|;
+# /button for saving history
print qq|
</form>
PE->pricegroups(\%myconfig, \%$form);
$callback =
- "$form->{script}?action=pricegroup_report&type=$form->{type}&path=$form->{path}&login=$form->{login}&password=$form->{password}&status=$form->{status}";
+ "$form->{script}?action=pricegroup_report&type=$form->{type}&login=$form->{login}&password=$form->{password}&status=$form->{status}";
if ($form->{status} eq 'all') {
$option = $locale->text('All');
<tr valign=top class=listrow$i>
|;
$column_data{pricegroup} =
- qq|<td><a href=$form->{script}?action=edit&type=$form->{type}&status=$form->{status}&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{pricegroup}</td>|;
+ qq|<td><a href=$form->{script}?action=edit&type=$form->{type}&status=$form->{status}&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{pricegroup}</td>|;
map { print "$column_data{$_}\n" } @column_index;
<input type=hidden name=type value=$form->{type}>
-<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|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
+ . $locale->text('Add') . qq|">
- print qq|
</form>
</body>
<input name=callback type=hidden value="$form->{callback}">
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
. $locale->text('Delete') . qq|">|;
}
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
+# button for saving history
+print qq|
+ <input type=button onclick=set_history_window(|
+ . $form->{id}
+ . qq|); name=history id=history value=|
+ . $locale->text('history')
+ . qq|>|;
+# /button for saving history
print qq|
</form>
use SL::RC;
+require "bin/mozilla/common.pl";
+
1;
# end of main
@{ $form->{PR} };
$form->{title} = $locale->text('Reconciliation');
-
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
$form->{"jsscript"} = 1;
$form->header;
+ $onload = qq|focus()|;
+ $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
print qq|
-<body>
+<body onLoad="$onload">
<form method=post action=$form->{script}>
</tr>
<tr>
<th align=right>| . $locale->text('From') . qq|</th>
- <td><input name=fromdate id=fromdate size=11 title="$myconfig{dateformat}">
+ <td><input name=fromdate id=fromdate size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
<input type="button" name="fromdate" id="trigger_fromdate" value="?"></td>
<th align=right>| . $locale->text('Until') . qq|</th>
- <td><input name=todate id=todate size=11 title="$myconfig{dateformat}">
+ <td><input name=todate id=todate size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
<input type="button" name="todate" id="trigger_todate" value="?"></td>
</tr>
</table>
<br>
<input type=hidden name=nextsub value=get_payments>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
$lxdebug->leave_sub();
}
-sub continue { &{ $form->{nextsub} } }
+sub continue { call_sub($form->{"nextsub"}); }
sub get_payments {
$lxdebug->enter_sub();
<input type=hidden name=fromdate value=$form->{fromdate}>
<input type=hidden name=todate value=$form->{todate}>
-<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 type=submit class=submit name=action value="|
. $locale->text('Select all') . qq|">
<input type=submit class=submit name=action value="|
- . $locale->text('Done') . qq|">|;
+ . $locale->text('Done') . qq|">
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
</form>
</body>
$lxdebug->enter_sub();
$form->{callback} =
- "$form->{script}?path=$form->{path}&action=reconciliation&login=$form->{login}&password=$form->{password}";
+ "$form->{script}?action=reconciliation&login=$form->{login}&password=$form->{password}";
$form->error($locale->text('Out of balance!')) if ($form->{difference} *= 1);
--- /dev/null
+#=====================================================================
+# LX-Office ERP
+# Copyright (C) 2004
+# Based on SQL-Ledger Version 2.1.9
+# Web http://www.lx-office.org
+######################################################################
+#
+# Stuff that can be used from other modules
+#
+######################################################################
+
+use List::Util qw(max);
+
+use SL::Form;
+use SL::Common;
+use SL::MoreCommon;
+use SL::ReportGenerator;
+
+sub report_generator_export_as_pdf {
+ $lxdebug->enter_sub();
+
+ if ($form->{report_generator_pdf_options_set}) {
+ my $saved_form = save_form();
+
+ report_generator_do('PDF');
+
+ if ($form->{report_generator_printed}) {
+ restore_form($saved_form);
+ $form->{MESSAGE} = $locale->text('The list has been printed.');
+ report_generator_do('HTML');
+ }
+
+ $lxdebug->leave_sub();
+ return;
+ }
+
+ my @form_values;
+ map { push @form_values, { 'key' => $_, 'value' => $form->{$_} } } keys %{ $form };
+
+ $form->get_lists('printers' => 'ALL_PRINTERS');
+ map { $_->{selected} = $myconfig{default_printer_id} == $_->{id} } @{ $form->{ALL_PRINTERS} };
+
+ $form->{copies} = max $myconfig{copies} * 1, 1;
+
+ $form->{title} = $locale->text('PDF export -- options');
+ $form->header();
+ print $form->parse_html_template('report_generator/pdf_export_options',
+ { 'HIDDEN' => \@form_values,
+ 'default_margin' => $form->format_amount(\%myconfig, 1.5),
+ 'SHOW_PRINTERS' => scalar @{ $form->{ALL_PRINTERS} },
+ });
+
+ $lxdebug->leave_sub();
+}
+
+sub report_generator_export_as_csv {
+ $lxdebug->enter_sub();
+
+ if ($form->{report_generator_csv_options_set}) {
+ report_generator_do('CSV');
+ $lxdebug->leave_sub();
+ return;
+ }
+
+ my @form_values;
+ map { push @form_values, { 'key' => $_, 'value' => $form->{$_} } } keys %{ $form };
+
+ $form->{title} = $locale->text('CSV export -- options');
+ $form->header();
+ print $form->parse_html_template('report_generator/csv_export_options', { 'HIDDEN' => \@form_values });
+
+ $lxdebug->leave_sub();
+}
+
+sub report_generator_back {
+ $lxdebug->enter_sub();
+
+ report_generator_do('HTML');
+
+ $lxdebug->leave_sub();
+}
+
+sub report_generator_do {
+ $lxdebug->enter_sub();
+
+ my $format = shift;
+
+ my $nextsub = $form->{report_generator_nextsub};
+ if (!$nextsub) {
+ $form->error($locale->text('report_generator_nextsub is not defined.'));
+ }
+
+ foreach my $key (split m/ +/, $form->{report_generator_variable_list}) {
+ $form->{$key} = $form->{"report_generator_hidden_${key}"};
+ }
+
+ $form->{report_generator_output_format} = $format;
+
+ delete @{$form}{map { "report_generator_$_" } qw(nextsub variable_list)};
+
+ call_sub($nextsub);
+
+ $lxdebug->leave_sub();
+}
+
+sub report_generator_dispatcher {
+ $lxdebug->enter_sub();
+
+ my $nextsub = $form->{report_generator_dispatch_to};
+ if (!$nextsub) {
+ $form->error($locale->text('report_generator_dispatch_to is not defined.'));
+ }
+
+ delete $form->{report_generator_dispatch_to};
+
+ call_sub($nextsub);
+
+ $lxdebug->leave_sub();
+}
+
+1;
#
#======================================================================
-require "$form->{path}/arap.pl";
+use POSIX qw(strftime);
use SL::PE;
use SL::RP;
+use SL::USTVA;
+use SL::Iconv;
+use SL::ReportGenerator;
+
+require "bin/mozilla/arap.pl";
+require "bin/mozilla/common.pl";
+require "bin/mozilla/reportgenerator.pl";
1;
$accrual = ($eur) ? "" : "checked";
$cash = ($eur) ? "checked" : "";
- ($null, $null, $null, $null, $null, $year, $null, $null, $null) =
- localtime();
- $year += 1900;
+ $year = (localtime)[5] + 1900;
# get departments
$form->all_departments(\%myconfig);
</tr>
| if $form->{selectdepartment};
+ $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
+ "all" => 1 });
+
+ my %project_labels = ();
+ my @project_values = ("");
+ foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
+ push(@project_values, $item->{"id"});
+ $project_labels{$item->{"id"}} = $item->{"projectnumber"};
+ }
+
+ my $projectnumber =
+ NTI($cgi->popup_menu('-name' => "project_id",
+ '-values' => \@project_values,
+ '-labels' => \%project_labels));
+
# use JavaScript Calendar or not
- $form->{jsscript} = $jscalendar;
+ $form->{jsscript} = 1;
$jsscript = "";
if ($form->{report} eq "ustva") {
$department = "";
if ($name_1 eq "") {
$button1 = qq|
- <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}">|;
+ <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
$button1_2 = qq|
<input type=button name=$name_2 id="$trigger_2" value=|
. $locale->text('button') . qq|>|;
Form->write_trigger(\%myconfig, "1", "$name_2", "BR", "$trigger_2");
} else {
$button1 = qq|
- <input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value=$value_1>|;
+ <input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value="$value_1" onBlur=\"check_right_date_format(this)\">|;
$button1_2 = qq|
<input type=button name=$name_1 id="$trigger_1" value=|
. $locale->text('button') . qq|>|;
$button2 = qq|
- <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}">|;
+ <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
$button2_2 = qq|
<input type=button name=$name_2 id="$trigger_2" value=|
. $locale->text('button') . qq|>
# without JavaScript Calendar
if ($name_1 eq "") {
$button1 =
- qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}">|;
+ qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
} else {
$button1 =
- qq|<input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value=$value_1>|;
+ qq|<input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value=$value_1 onBlur=\"check_right_date_format(this)\">|;
$button2 =
- qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}">|;
+ qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
}
}
-
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
$form->header;
-
+ $onload = qq|focus()|;
+ $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
+ $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
print qq|
-<body>
+<body onLoad="$onload">
<form method=post action=$form->{script}>
print qq|
<tr>
<th align=right nowrap>| . $locale->text('Project') . qq|</th>
- <td colspan=3><input name=projectnumber size=25</td>
+ <td colspan=3>$projectnumber</td>
</tr>
<input type=hidden name=nextsub value=generate_income_statement>
</table>
print qq|
<tr>
<th align=right nowrap>| . $locale->text('Project') . qq|</th>
- <td colspan=3><input name=projectnumber size=25</td>
+ <td colspan=3>$projectnumber</td>
</tr>
<input type=hidden name=nextsub value=generate_bwa>
</table>
}
if ($form->{report} =~ /^tax_/) {
- $gifi = "";
-
$form->{db} = ($form->{report} =~ /_collected/) ? "ar" : "ap";
RP->get_taxaccounts(\%myconfig, \%$form);
</td>
</tr>
-|;
-
- if (@{ $form->{gifi_taxaccounts} }) {
- print qq|
- <tr>
- <th align=right>| . $locale->text('GIFI') . qq|</th>
- <td colspan=3>
-|;
-
- foreach $ref (@{ $form->{gifi_taxaccounts} }) {
-
- print
- qq|<input name=accno class=radio type=radio value="gifi_$ref->{accno}"> $ref->{description}
-
- <input name="gifi_$ref->{accno}_description" type=hidden value="$ref->{description}">
- <input name="gifi_$ref->{accno}_rate" type=hidden value="$ref->{rate}">|;
-
- }
-
- print qq|
- </td>
- </tr>
-|;
- }
-
- print qq|
<tr>
<th align=right>| . $locale->text('Method') . qq|</th>
<td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
}
if ($form->{report} =~ /^nontaxable_/) {
- $gifi = "";
-
$form->{db} = ($form->{report} =~ /_sales/) ? "ar" : "ap";
print qq|
}
if (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) {
- $gifi = "";
-
if ($form->{report} eq 'ar_aging') {
$label = $locale->text('Customer');
$form->{vc} = 'customer';
# above action can be removed if there is more than one input field
if ($form->{report} =~ /(receipts|payments)$/) {
- $gifi = "";
-
$form->{db} = ($form->{report} =~ /payments$/) ? "ap" : "ar";
RP->paymentaccounts(\%myconfig, \%$form);
</table>
<br>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
. $locale->text('Continue') . qq|">
|;
- # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum
- # Einlesen der Finanzamtdaten
- get_config($userspath, 'finanzamt.ini');
+ # Hier Aufruf von get_config zum Einlesen der Finanzamtdaten
+ USTVA->get_config($userspath, 'finanzamt.ini');
$disabled = qq|disabled="disabled"|;
$disabled = '' if ($form->{elster} eq '1');
$lxdebug->leave_sub();
}
-sub continue { &{ $form->{nextsub} } }
+sub continue { call_sub($form->{"nextsub"}); }
sub get_project {
$lxdebug->enter_sub();
$form->{endbold} = "</b>";
$form->{br} = "<br>";
- &get_project(generate_income_statement);
-
- $form->{projectnumber} = $form->{projectnumber_1};
-
if ($form->{reporttype} eq "custom") {
#forgotten the year --> thisyear
$form->{title} = $locale->text('Project Transactions');
RP->trial_balance(\%myconfig, \%$form);
- &list_accounts;
+ list_accounts('generate_projects');
$lxdebug->leave_sub();
}
$form->{nextsub} = "generate_trial_balance";
$form->{title} = $locale->text('Trial Balance');
- &list_accounts;
+ list_accounts('generate_trial_balance');
+
+ $lxdebug->leave_sub();
+}
+
+sub create_list_accounts_subtotal_row {
+ $lxdebug->enter_sub();
+
+ my ($subtotals, $columns, $fields, $class) = @_;
+
+ my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => 'right' } } @{ $columns } };
+
+ map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $subtotals->{$_}, 2) } @{ $fields };
$lxdebug->leave_sub();
+
+ return $row;
}
sub list_accounts {
$lxdebug->enter_sub();
- $title = $form->escape($form->{title});
+ my ($action) = @_;
+ my @options;
if ($form->{department}) {
- ($department) = split /--/, $form->{department};
- $options = $locale->text('Department') . " : $department<br>";
- $department = $form->escape($form->{department});
+ my ($department) = split /--/, $form->{department};
+ push @options, $locale->text('Department') . " : $department";
}
if ($form->{projectnumber}) {
- $options .=
- $locale->text('Project Number') . " : $form->{projectnumber}<br>";
- $projectnumber = $form->escape($form->{projectnumber});
+ push @options, $locale->text('Project Number') . " : $form->{projectnumber}";
}
# if there are any dates
if ($form->{fromdate} || $form->{todate}) {
+ my ($fromdate, $todate);
+
if ($form->{fromdate}) {
$fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
}
$todate = $locale->date(\%myconfig, $form->{todate}, 1);
}
- $form->{period} = "$fromdate - $todate";
- } else {
- $form->{period} =
- $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
+ push @options, "$fromdate - $todate";
+ } else {
+ push @options, $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
}
- $options .= $form->{period};
- @column_index = qw(accno description begbalance debit credit endbalance);
+ my @columns = qw(accno description begbalance debit credit endbalance);
+ my %column_defs = (
+ 'accno' => { 'text' => $locale->text('Account'), },
+ 'description' => { 'text' => $locale->text('Description'), },
+ 'debit' => { 'text' => $locale->text('Debit'), },
+ 'credit' => { 'text' => $locale->text('Credit'), },
+ 'begbalance' => { 'text' => $locale->text('Balance'), },
+ 'endbalance' => { 'text' => $locale->text('Balance'), },
+ );
+ my %column_alignment = map { $_ => 'right' } qw(debit credit begbalance endbalance);
- $column_header{accno} =
- qq|<th class=listheading>| . $locale->text('Account') . qq|</th>|;
- $column_header{description} =
- qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
- $column_header{debit} =
- qq|<th class=listheading>| . $locale->text('Debit') . qq|</th>|;
- $column_header{credit} =
- qq|<th class=listheading>| . $locale->text('Credit') . qq|</th>|;
- $column_header{begbalance} =
- qq|<th class=listheading>| . $locale->text('Balance') . qq|</th>|;
- $column_header{endbalance} =
- qq|<th class=listheading>| . $locale->text('Balance') . qq|</th>|;
+ my @hidden_variables = qw(fromdate todate department l_heading l_subtotal all_accounts sort accounttype eur projectnumber project_id title nextsub);
- if ($form->{accounttype} eq 'gifi') {
- $column_header{accno} =
- qq|<th class=listheading>| . $locale->text('GIFI') . qq|</th>|;
- }
+ $form->{callback} = build_std_url("action=$action", grep { $form->{$_} } @hidden_variables);
- $form->header;
+ my $report = SL::ReportGenerator->new(\%myconfig, $form);
- print qq|
-<body>
+ $report->set_options('top_info_text' => join("\n", @options),
+ 'output_format' => 'HTML',
+ 'title' => $form->{title},
+ 'attachment_basename' => $locale->text('list_of_transactions') . strftime('_%Y%m%d', localtime time),
+ 'std_column_visibility' => 1,
+ );
+ $report->set_options_from_form();
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>$options</td>
- </tr>
- <tr>
- <td>
- <table width=100%>
- <tr>|;
-
- map { print "$column_header{$_}\n" } @column_index;
-
- print qq|
- </tr>
-|;
-
- # sort the whole thing by account numbers and display
- foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{TB} }) {
-
- $description = $form->escape($ref->{description});
+ $report->set_columns(%column_defs);
+ $report->set_column_order(@columns);
- $href =
- qq|ca.pl?path=$form->{path}&action=list_transactions&accounttype=$form->{accounttype}&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&sort=transdate&l_heading=$form->{l_heading}&l_subtotal=$form->{l_subtotal}&department=$department&eur=$form->{eur}&projectnumber=$projectnumber&project_id=$form->{project_id}&title=$title&nextsub=$form->{nextsub}|;
+ $report->set_export_options($action, @hidden_variables);
- if ($form->{accounttype} eq 'gifi') {
- $href .= "&gifi_accno=$ref->{accno}&gifi_description=$description";
- $na = $locale->text('N/A');
- map { $ref->{$_} = $na } qw(accno description) unless $ref->{accno};
- } else {
- $href .= "&accno=$ref->{accno}&description=$description";
- }
-
- $ml = ($ref->{category} =~ /(A|C|E)/) ? -1 : 1;
-
- $debit = ($ref->{debit} != 0) ? $form->format_amount(\%myconfig, $ref->{debit}, 2, " ") : " ";
- $credit = ($ref->{credit} != 0) ? $form->format_amount(\%myconfig, $ref->{credit}, 2, " ") : " ";
- $begbalance =
- $form->format_amount(\%myconfig, $ref->{balance} * $ml, 2, " ");
- $endbalance =
- $form->format_amount(\%myconfig,
- ($ref->{balance} + $ref->{amount}) * $ml,
- 2, " ");
-
- # next if ($ref->{debit} == 0 && $ref->{credit} == 0);
-
- if ($ref->{charttype} eq "H" && $subtotal && $form->{l_subtotal}) {
- map { $column_data{$_} = "<th> </th>" }
- qw(accno begbalance endbalance);
-
- $subtotalbegbalance =
- $form->format_amount(\%myconfig, $subtotalbegbalance, 2, " ");
- $subtotalendbalance =
- $form->format_amount(\%myconfig, $subtotalendbalance, 2, " ");
- $subtotaldebit =
- $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
- $subtotalcredit =
- $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
-
- $column_data{description} = "<th>$subtotaldescription</th>";
- $column_data{begbalance} = "<th align=right>$subtotalbegbalance</th>";
- $column_data{endbalance} = "<th align=right>$subtotalendbalance</th>";
- $column_data{debit} = "<th align=right>$subtotaldebit</th>";
- $column_data{credit} = "<th align=right>$subtotalcredit</th>";
-
- print qq|
- <tr class=listsubtotal>
-|;
- map { print "$column_data{$_}\n" } @column_index;
+ $report->set_sort_indicator('accno', 1);
- print qq|
- </tr>
-|;
- }
+ my @totals_columns = qw(credit debit begbalance endbalance);
+ my %subtotals = map { $_ => 0 } @totals_columns;
+ my %totals = map { $_ => 0 } @totals_columns;
+ my $found_heading = 0;
+ my @tb = sort { $a->{accno} cmp $b->{accno} } @{ $form->{TB} };
- if ($ref->{charttype} eq "H") {
- $subtotal = 1;
- $subtotaldescription = $ref->{description};
- $subtotaldebit = $ref->{debit};
- $subtotalcredit = $ref->{credit};
- $subtotalbegbalance = 0;
- $subtotalendbalance = 0;
+ # sort the whole thing by account numbers and display
+ foreach my $idx (0 .. scalar(@tb) - 1) {
+ my $ref = $tb[$idx];
+ my $href = build_std_url('script=ca.pl', 'action=list_transactions', 'accno=' . E($ref->{accno}), 'description=' . E($ref->{description}), @hidden_variables);
- next unless $form->{l_heading};
+ my $ml = ($ref->{category} =~ /(A|C|E)/) ? -1 : 1;
- map { $column_data{$_} = "<th> </th>" }
- qw(accno debit credit begbalance endbalance);
- $column_data{description} =
- "<th class=listheading>$ref->{description}</th>";
- }
+ my $row = { map { $_ => { 'align' => $column_alignment{$_} } } @columns };
- if ($ref->{charttype} eq "A") {
- $column_data{accno} = "<td><a href=$href>$ref->{accno}</a></td>";
- $column_data{description} = "<td>$ref->{description}</td>";
- $column_data{debit} = "<td align=right>$debit</td>";
- $column_data{credit} = "<td align=right>$credit</td>";
- $column_data{begbalance} = "<td align=right>$begbalance</td>";
- $column_data{endbalance} = "<td align=right>$endbalance</td>";
+ if ($ref->{charttype} eq 'H') {
+ next unless ($form->{l_heading});
- $totaldebit += $ref->{debit};
- $totalcredit += $ref->{credit};
+ %subtotals = map { $_ => 0 } @totals_columns;
+ $found_heading = 1;
+ $row->{description}->{class} = 'listheading';
+ $row->{description}->{data} = $ref->{description};
- $subtotalbegbalance += $ref->{balance} * $ml;
- $subtotalendbalance += ($ref->{balance} + $ref->{amount}) * $ml;
+ $report->add_data($row);
+ next;
}
- if ($ref->{charttype} eq "H") {
- print qq|
- <tr class=listheading>
-|;
- }
- if ($ref->{charttype} eq "A") {
- $i++;
- $i %= 2;
- print qq|
- <tr class=listrow$i>
-|;
+ foreach (qw(debit credit)) {
+ $subtotals{$_} += $ref->{$_};
+ $totals{$_} += $ref->{$_};
}
- map { print "$column_data{$_}\n" } @column_index;
+ $subtotals{begbalance} += $ref->{balance} * $ml;
+ $subtotals{endbalance} += ($ref->{balance} + $ref->{amount}) * $ml;
- print qq|
- </tr>
-|;
- }
+ map { $row->{$_}->{data} = $ref->{$_} } qw(accno description);
+ map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $ref->{$_}, 2) if ($ref->{$_} != 0) } qw(credit debit);
- # print last subtotal
- if ($subtotal && $form->{l_subtotal}) {
- map { $column_data{$_} = "<th> </th>" }
- qw(accno begbalance endbalance);
- $subtotalbegbalance =
- $form->format_amount(\%myconfig, $subtotalbegbalance, 2, " ");
- $subtotalendbalance =
- $form->format_amount(\%myconfig, $subtotalendbalance, 2, " ");
- $subtotaldebit =
- $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
- $subtotalcredit =
- $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
- $column_data{description} = "<th>$subdescription</th>";
- $column_data{begbalance} = "<th align=right>$subtotalbegbalance</th>";
- $column_data{endbalance} = "<th align=right>$subtotalendbalance</th>";
- $column_data{debit} = "<th align=right>$subtotaldebit</th>";
- $column_data{credit} = "<th align=right>$subtotalcredit</th>";
+ $row->{begbalance}->{data} = $form->format_amount(\%myconfig, $ref->{balance} * $ml, 2);
+ $row->{endbalance}->{data} = $form->format_amount(\%myconfig, ($ref->{balance} + $ref->{amount}) * $ml, 2);
- print qq|
- <tr class=listsubtotal>
-|;
- map { print "$column_data{$_}\n" } @column_index;
+ $report->add_data($row);
- print qq|
- </tr>
-|;
+ if ($form->{l_heading} && $found_heading &&
+ (($idx == scalar(@tb) - 1) || ('H' eq $tb[$idx + 1]->{charttype}))) {
+ $report->add_data(create_list_accounts_subtotal_row(\%subtotals, \@columns, \@totals_columns, 'listsubtotal'));
+ }
}
- $totaldebit = $form->format_amount(\%myconfig, $totaldebit, 2, " ");
- $totalcredit = $form->format_amount(\%myconfig, $totalcredit, 2, " ");
-
- map { $column_data{$_} = "<th> </th>" }
- qw(accno description begbalance endbalance);
-
- $column_data{debit} = qq|<th align=right class=listtotal>$totaldebit</th>|;
- $column_data{credit} = qq|<th align=right class=listtotal>$totalcredit</th>|;
+ $report->add_separator();
- print qq|
- <tr class=listtotal>
-|;
+ $report->add_data(create_list_accounts_subtotal_row(\%totals, \@columns, [ qw(debit credit) ], 'listtotal'));
- map { print "$column_data{$_}\n" } @column_index;
-
- print qq|
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-</body>
-</html>
-|;
+ $report->generate_with_headers();
$lxdebug->leave_sub();
}
# split customer
($form->{customer}) = split(/--/, $form->{customer});
- $customer = $form->escape($form->{customer}, 1);
- $title = $form->escape($form->{title}, 1);
$form->{ct} = "customer";
$form->{arap} = "ar";
- $form->{callback} =
- qq|$form->{script}?path=$form->{path}&action=generate_ar_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&customer=$customer&title=$title|;
+ $form->{callback} = build_std_url('action=generate_ar_aging', qw(todate customer title));
RP->aging(\%myconfig, \%$form);
- &aging;
+ aging();
$lxdebug->leave_sub();
}
# split vendor
($form->{vendor}) = split(/--/, $form->{vendor});
- $vendor = $form->escape($form->{vendor}, 1);
- $title = $form->escape($form->{title}, 1);
$form->{ct} = "vendor";
$form->{arap} = "ap";
- $form->{callback} =
- qq|$form->{script}?path=$form->{path}&action=generate_ap_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&vendor=$vendor&title=$title|;
+ $form->{callback} = build_std_url('action=generate_ap_aging', qw(todate vendor title));
RP->aging(\%myconfig, \%$form);
- &aging;
+ aging();
$lxdebug->leave_sub();
}
-sub aging {
+sub create_aging_subtotal_row {
$lxdebug->enter_sub();
- $form->header;
-
- $column_header{statement} = qq|<th> </th>|;
- $column_header{ct} =
- qq|<th class=listheading>|
- . $locale->text(ucfirst $form->{ct})
- . qq|</th>|;
- $column_header{invnumber} =
- qq|<th class=listheading>| . $locale->text('Invoice') . qq|</th>|;
- $column_header{transdate} =
- qq|<th class=listheading>| . $locale->text('Date') . qq|</th>|;
- $column_header{duedate} =
- qq|<th class=listheading>| . $locale->text('Due') . qq|</th>|;
- $column_header{c0} =
- qq|<th class=listheading>| . $locale->text('Current') . qq|</th>|;
- $column_header{c30} = qq|<th class=listheading>30</th>|;
- $column_header{c60} = qq|<th class=listheading>60</th>|;
- $column_header{c90} = qq|<th class=listheading>90</th>|;
-
- @column_index =
- (qw(statement ct invnumber transdate duedate c0 c30 c60 c90));
+ my ($subtotals, $columns, $periods, $class) = @_;
- if ($form->{department}) {
- $option .= "\n<br>" if $option;
- ($department) = split /--/, $form->{department};
- $option .= $locale->text('Department') . " : $department";
- $department = $form->escape($form->{department}, 1);
- $form->{callback} .= "&department=$department";
- }
+ my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => 'right' } } @{ $columns } };
- if ($form->{arap} eq 'ar') {
- if ($form->{customer}) {
- $option .= "\n<br>" if $option;
- $option .= $form->{customer};
- }
- }
- if ($form->{arap} eq 'ap') {
- shift @column_index;
- if ($form->{vendor}) {
- $option .= "\n<br>" if $option;
- $option .= $form->{vendor};
- }
+ foreach (@{ $periods }) {
+ $row->{"c$_"}->{data} = $subtotals->{$_} != 0 ? $form->format_amount(\%myconfig, $subtotals->{$_}, 2) : '';
+ $subtotals->{$_} = 0;
}
- $todate = $locale->date(\%myconfig, $form->{todate}, 1);
- $option .= "\n<br>" if $option;
- $option .=
- $locale->text('for Period') . " " . $locale->text('Bis') . " $todate";
+ $lxdebug->leave_sub();
- print qq|
-<body>
+ return $row;
+}
-<form method=post action=$form->{script}>
+sub aging {
+ $lxdebug->enter_sub();
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>$option</td>
- </tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>
-|;
+ my $report = SL::ReportGenerator->new(\%myconfig, $form);
- map { print "$column_header{$_}\n" } @column_index;
+ my @columns = qw(statement ct invnumber transdate duedate c0 c30 c60 c90);
- print qq|
- </tr>
-|;
+ my %column_defs = (
+ 'statement' => { 'text' => '', 'visible' => $form->{ct} eq 'customer' ? 'HTML' : 0, },
+ 'ct' => { 'text' => $form->{ct} eq 'customer' ? $locale->text('Customer') : $locale->text('Vendor'), },
+ 'invnumber' => { 'text' => $locale->text('Invoice'), },
+ 'transdate' => { 'text' => $locale->text('Date'), },
+ 'duedate' => { 'text' => $locale->text('Due'), },
+ 'c0' => { 'text' => $locale->text('Current'), },
+ 'c30' => { 'text' => '30', },
+ 'c60' => { 'text' => '60', },
+ 'c90' => { 'text' => '90', },
+ );
- $ctid = 0;
- $subtotal = 0;
- $i = 0;
+ my %column_alignment = ('statement' => 'center',
+ map { $_ => 'right' } qw(c0 c30 c60 c90));
- foreach $ref (@{ $form->{AG} }) {
+ $report->set_options('std_column_visibility' => 1);
+ $report->set_columns(%column_defs);
+ $report->set_column_order(@columns);
- if ($ctid != $ref->{ctid}) {
+ my @hidden_variables = qw(todate customer vendor arap title ct);
+ $report->set_export_options('generate_' . ($form->{arap} eq 'ar' ? 'ar' : 'ap') . '_aging', @hidden_variables);
- $i++;
+ my @options;
- if ($subtotal) {
- $c0subtotal = ($c0subtotal != 0) ?
- $form->format_amount(\%myconfig, $c0subtotal, 2, " ") : "";
- $c30subtotal = ($c30subtotal != 0) ?
- $form->format_amount(\%myconfig, $c30subtotal, 2, " ") : "";
- $c60subtotal = ($c60subtotal != 0) ?
- $form->format_amount(\%myconfig, $c60subtotal, 2, " ") : "";
- $c90subtotal = ($c90subtotal != 0) ?
- $form->format_amount(\%myconfig, $c90subtotal, 2, " ") : "";
- }
+ if ($form->{department}) {
+ my ($department) = split /--/, $form->{department};
+ push @options, $locale->text('Department') . " : $department";
+ $form->{callback} .= "&department=" . E($department);
+ }
- $column_data{ct} = qq|<th> </th>|;
- $column_data{invnumber} = qq|<th> </th>|;
- $column_data{transdate} = qq|<th> </th>|;
- $column_data{duedate} = qq|<th> </th>|;
- $column_data{c0} =
- qq|<th align=right class=listsubtotal>$c0subtotal</th>|;
- $column_data{c30} =
- qq|<th align=right class=listsubtotal>$c30subtotal</th>|;
- $column_data{c60} =
- qq|<th align=right class=listsubtotal>$c60subtotal</th>|;
- $column_data{c90} =
- qq|<th align=right class=listsubtotal>$c90subtotal</th>|;
-
- if ($subtotal) {
-
- # print subtotals
- print qq|
- <tr class=listsubtotal>
-|;
+ if (($form->{arap} eq 'ar') && $form->{customer}) {
+ push @options, $form->{customer};
+ }
- map { print "$column_data{$_}\n" } @column_index;
+ if (($form->{arap} eq 'ap') && $form->{vendor}) {
+ push @options, $form->{vendor};
+ }
- $column_data{statement} = qq|<td> </td>|;
+ push @options, $locale->text('for Period') . " " . $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{todate}, 1);
- print qq|
- </tr>
-|;
- }
+ my $attachment_basename = $form->{ct} eq 'customer' ? $locale->text('ar_aging_list') : $locale->text('ap_aging_list');
- $subtotal = 1;
+ $report->set_options('top_info_text' => join("\n", @options),
+ 'output_format' => 'HTML',
+ 'title' => $form->{title},
+ 'attachment_basename' => $attachment_basename . strftime('_%Y%m%d', localtime time),
+ );
- $c0subtotal = 0;
- $c30subtotal = 0;
- $c60subtotal = 0;
- $c90subtotal = 0;
+ my $previous_ctid = 0;
+ my $row_idx = 0;
+ my @periods = qw(0 30 60 90);
+ my %subtotals = map { $_ => 0 } @periods;
+ my %totals = map { $_ => 0 } @periods;
- $column_data{ct} = qq|<td>$ref->{name}</td>|;
- $column_data{statement} =
- qq|<td><input name="statement_$i" type=checkbox class=checkbox value=1 $ref->{checked}>
- <input type=hidden name="$form->{ct}_id_$i" value=$ref->{ctid}>
- </td>|;
+ foreach $ref (@{ $form->{AG} }) {
+ if ($row_idx && ($previous_ctid != $ref->{ctid})) {
+ $report->add_data(create_aging_subtotal_row(\%subtotals, \@columns, \@periods, 'listsubtotal'));
}
- $c0subtotal += $ref->{c0};
- $c30subtotal += $ref->{c30};
- $c60subtotal += $ref->{c60};
- $c90subtotal += $ref->{c90};
-
- $c0total += $ref->{c0};
- $c30total += $ref->{c30};
- $c60total += $ref->{c60};
- $c90total += $ref->{c90};
-
- $ref->{c0} = ($ref->{c0} != 0) ? $form->format_amount(\%myconfig, $ref->{c0}, 2, " ") : "";
- $ref->{c30} = ($ref->{c30} != 0) ? $form->format_amount(\%myconfig, $ref->{c30}, 2, " ") : "";
- $ref->{c60} = ($ref->{c60} != 0) ? $form->format_amount(\%myconfig, $ref->{c60}, 2, " ") : "";
- $ref->{c90} = ($ref->{c90} != 0) ? $form->format_amount(\%myconfig, $ref->{c90}, 2, " ") : "";
+ foreach my $key (@periods) {
+ $subtotals{$key} += $ref->{"c${key}"};
+ $totals{$key} += $ref->{"c${key}"};
+ $ref->{"c${key}"} = $ref->{"c${key}"} != 0 ? $form->format_amount(\%myconfig, $ref->{"c${key}"}, 2) : '';
+ }
- $href =
- qq|$ref->{module}.pl?path=$form->{path}&action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=|
- . $form->escape($form->{callback});
+ my $row = { };
- $column_data{invnumber} = qq|<td><a href=$href>$ref->{invnumber}</a></td>|;
- $column_data{transdate} = qq|<td>$ref->{transdate}</td>|;
- $column_data{duedate} = qq|<td>$ref->{duedate} </td>|;
- $column_data{c0} = qq|<td align=right>$ref->{c0}</td>|;
- $column_data{c30} = qq|<td align=right>$ref->{c30}</td>|;
- $column_data{c60} = qq|<td align=right>$ref->{c60}</td>|;
- $column_data{c90} = qq|<td align=right>$ref->{c90}</td>|;
-
- $j++;
- $j %= 2;
- print qq|
- <tr class=listrow$j>
-|;
+ foreach my $column (@columns) {
+ $row->{$column} = {
+ 'data' => (($column eq 'ct') || ($column eq 'statement')) ? '' : $ref->{$column},
+ 'align' => $column_alignment{$column},
+ 'valign' => $column eq 'statement' ? 'center' : '',
+ };
+ }
- map { print "$column_data{$_}\n" } @column_index;
+ $row->{invnumber}->{link} = build_std_url("script=$ref->{module}.pl", 'action=edit', 'callback', 'id=' . E($ref->{id}));
- print qq|
- </tr>
-|;
+ if ($previous_ctid != $ref->{ctid}) {
+ $row->{statement}->{raw_data} =
+ $cgi->hidden('-name' => "customer_id_${row_idx}", '-value' => $ref->{ctid})
+ . $cgi->checkbox('-name' => "statement_${row_idx}", '-value' => 1, '-label' => '', 'checked' => $ref->{checked});
+ $row->{ct}->{data} = $ref->{name};
- $column_data{ct} = qq|<td> </td>|;
- $column_data{statement} = qq|<td> </td>|;
+ $row_idx++;
+ }
- $ctid = $ref->{ctid};
+ $previous_ctid = $ref->{ctid};
+ $report->add_data($row);
}
- # print subtotals
- $c0subtotal = $form->format_amount(\%myconfig, $c0subtotal, 2, " ");
- $c30subtotal = $form->format_amount(\%myconfig, $c30subtotal, 2, " ");
- $c60subtotal = $form->format_amount(\%myconfig, $c60subtotal, 2, " ");
- $c90subtotal = $form->format_amount(\%myconfig, $c90subtotal, 2, " ");
-
- print qq|
- <tr class=listsubtotal>
-|;
-
- map { $column_data{$_} = qq|<th> </th>| } @column_index;
-
- $column_data{c0} = qq|<th align=right class=listsubtotal>$c0subtotal</th>|;
- $column_data{c30} = qq|<th align=right class=listsubtotal>$c30subtotal</th>|;
- $column_data{c60} = qq|<th align=right class=listsubtotal>$c60subtotal</th>|;
- $column_data{c90} = qq|<th align=right class=listsubtotal>$c90subtotal</th>|;
-
- map { print "$column_data{$_}\n" } @column_index;
-
- print qq|
- </tr>
- <tr class=listtotal>
-|;
-
- $c0total = $form->format_amount(\%myconfig, $c0total, 2, " ");
- $c30total = $form->format_amount(\%myconfig, $c30total, 2, " ");
- $c60total = $form->format_amount(\%myconfig, $c60total, 2, " ");
- $c90total = $form->format_amount(\%myconfig, $c90total, 2, " ");
-
- $column_data{c0} = qq|<th align=right class=listtotal>$c0total</th>|;
- $column_data{c30} = qq|<th align=right class=listtotal>$c30total</th>|;
- $column_data{c60} = qq|<th align=right class=listtotal>$c60total</th>|;
- $column_data{c90} = qq|<th align=right class=listtotal>$c90total</th>|;
-
- map { print "$column_data{$_}\n" } @column_index;
-
- print qq|
- <input type=hidden name=rowcount value=$i>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td>
-|;
-
- &print_options if ($form->{arap} eq 'ar');
+ $report->add_data(create_aging_subtotal_row(\%subtotals, \@columns, \@periods, 'listsubtotal')) if ($row_idx);
- print qq|
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-|;
+ $report->add_data(create_aging_subtotal_row(\%totals, \@columns, \@periods, 'listtotal'));
if ($form->{arap} eq 'ar') {
- print qq|
-<input type=hidden name=todate value=$form->{todate}>
-
-<input type=hidden name=title value="$form->{title}">
-
-<input type=hidden name=arap value=$form->{arap}>
-<input type=hidden name=ct value=$form->{ct}>
-<input type=hidden name=$form->{ct} value="$form->{$form->{ct}}">
-
-<input type=hidden name=department value="$form->{department}">
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>
-
-<br>
-<input class=submit type=submit name=action value="|
- . $locale->text('Select all') . qq|">
-<input class=submit type=submit name=action value="|
- . $locale->text('Print') . qq|">
-<input class=submit type=submit name=action value="|
- . $locale->text('E-mail') . qq|">
-|;
+ $raw_top_info_text = $form->parse_html_template('rp/aging_ar_top');
+ $raw_bottom_info_text = $form->parse_html_template('rp/aging_ar_bottom', { 'row_idx' => $row_idx,
+ 'PRINT_OPTIONS' => print_options(1), });
+ $report->set_options('raw_top_info_text' => $raw_top_info_text,
+ 'raw_bottom_info_text' => $raw_bottom_info_text);
}
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
+ $report->set_options_from_form();
- print qq|
-</form>
-
-</body>
-</html>
-|;
+ $report->generate_with_headers();
$lxdebug->leave_sub();
}
sub send_email {
$lxdebug->enter_sub();
- $form->{OUT} = "$sendmail";
-
$form->{subject} = $locale->text('Statement') . qq| - $form->{todate}|
unless $form->{subject};
$form->{"statement_1"} = 1;
- &print_form;
+ $form->{media} = 'email';
+ print_form();
- $form->redirect(
- $locale->text('Statement sent to') . " $form->{$form->{ct}}");
+ $form->redirect($locale->text('Statement sent to') . " $form->{$form->{ct}}");
$lxdebug->leave_sub();
}
$form->error($locale->text('Nothing selected!')) unless $selected;
if ($form->{media} eq 'printer') {
- $form->{OUT} = "| $myconfig{printer}";
$form->{"$form->{ct}_id"} = "";
} else {
$form->{"statement_1"} = 1;
RP->aging(\%myconfig, \%$form);
- &print_form;
+ print_form();
$form->redirect($locale->text('Statements sent to printer!'))
if ($form->{media} eq 'printer');
sub print_form {
$lxdebug->enter_sub();
+ my %replacements =
+ (
+ "ä" => "ae", "ö" => "oe", "ü" => "ue",
+ "Ä" => "Ae", "Ö" => "Oe", "Ü" => "Ue",
+ "ß" => "ss",
+ " " => "_"
+ );
+
+ foreach my $key (keys %replacements) {
+ my $new_key = SL::Iconv::convert("ISO-8859-15", $dbcharset, $key);
+ $replacements{$new_key} = $replacements{$key} if $new_key ne $key;
+ }
+
$form->{statementdate} = $locale->date(\%myconfig, $form->{todate}, 1);
$form->{templates} = "$myconfig{templates}";
- $form->{IN} = "$form->{type}.html";
-
+ my $suffix = "html";
+ my $attachment_suffix = "html";
if ($form->{format} eq 'postscript') {
$form->{postscript} = 1;
- $form->{IN} =~ s/html$/tex/;
- }
- if ($form->{format} eq 'pdf') {
+ $suffix = "tex";
+ $attachment_suffix = "ps";
+ } elsif ($form->{format} eq 'pdf') {
$form->{pdf} = 1;
- $form->{IN} =~ s/html$/tex/;
+ $suffix = "tex";
+ $attachment_suffix = "pdf";
}
+ $form->{IN} = "$form->{type}.$suffix";
+ $form->{OUT} =
+ $form->{media} eq 'email' ? $sendmail :
+ $form->{media} eq 'printer' ? "| $myconfig{printer}" : "";
+
+ # Save $form->{email} because it will be overwritten.
+ $form->{EMAIL_RECIPIENT} = $form->{email};
+
$i = 0;
while (@{ $form->{AG} }) {
$form->format_amount(\%myconfig, $form->{"${_}total"}, 2)
} (c0, c30, c60, c90, "");
+ $form->{attachment_filename} = $locale->text("Statement") . "_$form->{todate}.$attachment_suffix";
+ map({ $form->{attachment_filename} =~ s/$_/$replacements{$_}/g; } keys(%replacements));
+
$form->parse_template(\%myconfig, $userspath);
}
}
}
-
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
+ $form->{addition} = "PRINTED";
+ $form->{what_done} = $form->{type};
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
$lxdebug->leave_sub();
}
push @{ $form->{duedate} }, $ref->{duedate};
foreach $item (qw(c0 c30 c60 c90)) {
- eval {
+ if ($ref->{exchangerate} * 1) {
$ref->{$item} =
$form->round_amount($ref->{$item} / $ref->{exchangerate}, 2);
- };
+ }
$form->{"${item}total"} += $ref->{$item};
$form->{total} += $ref->{$item};
push @{ $form->{$item} },
$description = $form->escape($form->{$descvar});
$ratevar = "$form->{accno}_rate";
- if ($form->{accno} =~ /^gifi_/) {
- $descvar = "gifi_$form->{accno}_description";
- $description = $form->escape($form->{$descvar});
- $ratevar = "gifi_$form->{accno}_rate";
- }
-
$department = $form->escape($form->{department});
# construct href
$href =
- "$form->{script}?path=$form->{path}&action=generate_tax_report&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}";
+ "$form->{script}?&action=generate_tax_report&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}";
# construct callback
$description = $form->escape($form->{$descvar}, 1);
$department = $form->escape($form->{department}, 1);
$callback =
- "$form->{script}?path=$form->{path}&action=generate_tax_report&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}";
-
- $form->{title} = $locale->text('GIFI') . " - "
- if ($form->{accno} =~ /^gifi_/);
+ "$form->{script}?&action=generate_tax_report&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}";
$title = $form->escape($form->{title});
$href .= "&title=$title";
$column_data{id} = qq|<td>$ref->{id}</td>|;
$column_data{invnumber} =
- qq|<td><a href=$module?path=$form->{path}&action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber}</a></td>|;
+ qq|<td><a href=$module?action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber}</a></td>|;
$column_data{transdate} = qq|<td>$ref->{transdate}</td>|;
$column_data{name} = qq|<td>$ref->{name} </td>|;
RP->payments(\%myconfig, \%$form);
- @columns =
- $form->sort_columns(qw(transdate reference name paid source memo));
+ my @hidden_variables = qw(account title department reference source memo fromdate todate
+ fx_transaction db prepayment paymentaccounts sort);
- # construct href
- $account = $form->escape($form->{account});
- $title = $form->escape($form->{title});
- $department = $form->escape($form->{department});
- $form->{paymentaccounts} =~ s/ /%20/g;
- $reference = $form->escape($form->{reference});
- $source = $form->escape($form->{source});
- $memo = $form->escape($form->{memo});
+ my $href = build_std_url('action=list_payments', grep { $form->{$_} } @hidden_variables);
+ $form->{callback} = $href;
- $href =
- "$form->{script}?path=$form->{path}&action=list_payments&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&fx_transaction=$form->{fx_transaction}&db=$form->{db}&prepayment=$form->{prepayment}&title=$title&account=$account&department=$department&paymentaccounts=$form->{paymentaccounts}&reference=$reference&source=$source&memo=$memo";
-
- # construct callback
- $account = $form->escape($form->{account}, 1);
- $title = $form->escape($form->{title}, 1);
- $department = $form->escape($form->{department}, 1);
- $reference = $form->escape($form->{reference}, 1);
- $source = $form->escape($form->{source}, 1);
- $memo = $form->escape($form->{memo}, 1);
+ my @columns = qw(transdate invnumber name paid source memo);
+ my %column_defs = (
+ 'name' => { 'text' => $locale->text('Description'), },
+ 'invnumber' => { 'text' => $locale->text('Reference'), },
+ 'transdate' => { 'text' => $locale->text('Date'), },
+ 'paid' => { 'text' => $locale->text('Amount'), },
+ 'source' => { 'text' => $locale->text('Source'), },
+ 'memo' => { 'text' => $locale->text('Memo'), },
+ );
+ my %column_alignment = ('paid' => 'right');
- $form->{callback} =
- "$form->{script}?path=$form->{path}&action=list_payments&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&fx_transaction=$form->{fx_transaction}&db=$form->{db}&prepayment=$form->{prepayment}&title=$title&account=$account&department=$department&paymentaccounts=$form->{paymentaccounts}&reference=$reference&source=$source&memo=$memo&sort=$form->{sort}";
- $callback = $form->escape($form->{callback});
-
- $column_header{name} =
- "<th><a class=listheading href=$href&sort=name>"
- . $locale->text('Description')
- . "</a></th>";
- $column_header{reference} =
- "<th><a class=listheading href=$href&sort=invnumber>"
- . $locale->text('Reference')
- . "</a></th>";
- $column_header{transdate} =
- "<th><a class=listheading href=$href&sort=transdate>"
- . $locale->text('Date')
- . "</a></th>";
- $column_header{paid} =
- "<th class=listheading>" . $locale->text('Amount') . "</a></th>";
- $column_header{source} =
- "<th><a class=listheading href=$href&sort=source>"
- . $locale->text('Source')
- . "</a></th>";
- $column_header{memo} =
- "<th><a class=listheading href=$href&sort=memo>"
- . $locale->text('Memo')
- . "</a></th>";
+ map { $column_defs{$_}->{link} = $href . "&sort=$_" } grep { $_ ne 'paid' } @columns;
+ my @options;
if ($form->{fromdate}) {
- $option .= "\n<br>" if ($option);
- $option .=
- $locale->text('From') . " "
- . $locale->date(\%myconfig, $form->{fromdate}, 1);
+ push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{fromdate}, 1);
}
if ($form->{todate}) {
- $option .= "\n<br>" if ($option);
- $option .=
- $locale->text('bis') . " "
- . $locale->date(\%myconfig, $form->{todate}, 1);
+ push @options, $locale->text('bis') . " " . $locale->date(\%myconfig, $form->{todate}, 1);
}
- @column_index = @columns;
- $colspan = $#column_index + 1;
+ my $report = SL::ReportGenerator->new(\%myconfig, $form);
- $form->header;
+ my $attachment_basename = $form->{db} eq 'ar' ? $locale->text('list_of_receipts') : $locale->text('list_of_payments');
- print qq|
-<body>
+ $report->set_options('top_info_text' => join("\n", @options),
+ 'output_format' => 'HTML',
+ 'title' => $form->{title},
+ 'attachment_basename' => $attachment_basename . strftime('_%Y%m%d', localtime time),
+ 'std_column_visibility' => 1,
+ );
+ $report->set_options_from_form();
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>$option</td>
- </tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>
-|;
+ $report->set_columns(%column_defs);
+ $report->set_column_order(@columns);
- map { print "\n$column_header{$_}" } @column_index;
+ $report->set_export_options('list_payments', @hidden_variables);
- print qq|
- </tr>
-|;
+ $report->set_sort_indicator($form->{sort}, 1);
- foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{PR} }) {
+ my $total_paid = 0;
+ foreach my $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{PR} }) {
next unless @{ $form->{ $ref->{id} } };
- print qq|
- <tr>
- <th colspan=$colspan align=left>$ref->{accno}--$ref->{description}</th>
- </tr>
-|;
+ $report->add_control({ 'type' => 'colspan_data', 'data' => "$ref->{accno}--$ref->{description}" });
- foreach $payment (@{ $form->{ $ref->{id} } }) {
+ my $subtotal_paid = 0;
- $module = $payment->{module};
+ foreach my $payment (@{ $form->{ $ref->{id} } }) {
+ my $module = $payment->{module};
$module = 'is' if ($payment->{invoice} && $payment->{module} eq 'ar');
$module = 'ir' if ($payment->{invoice} && $payment->{module} eq 'ap');
- $href =
- qq|${module}.pl?path=$form->{path}&action=edit&id=$payment->{id}&login=$form->{login}&password=$form->{password}&callback=$callback|;
+ $subtotal_paid += $payment->{paid};
+ $total_paid += $payment->{paid};
- $column_data{name} = "<td>$payment->{name} </td>";
- $column_data{reference} =
- qq|<td><a href=$href>$payment->{invnumber}</a></td>|;
- $column_data{transdate} = "<td>$payment->{transdate} </td>";
- $column_data{paid} =
- "<td align=right>"
- . $form->format_amount(\%myconfig, $payment->{paid}, 2, " ")
- . "</td>";
- $column_data{source} = "<td>$payment->{source} </td>";
- $column_data{memo} = "<td>$payment->{memo} </td>";
+ $payment->{paid} = $form->format_amount(\%myconfig, $payment->{paid}, 2);
- $subtotalpaid += $payment->{paid};
- $totalpaid += $payment->{paid};
+ my $row = { };
- $i++;
- $i %= 2;
- print qq|
- <tr class=listrow$i>
-|;
-
- map { print "\n$column_data{$_}" } @column_index;
+ foreach my $column (@columns) {
+ $row->{$column} = {
+ 'data' => $payment->{$column},
+ 'align' => $column_alignment{$column},
+ };
+ }
- print qq|
- </tr>
-|;
+ $row->{invnumber}->{link} = build_std_url("script=${module}.pl", 'action=edit', 'id=' . E($payment->{id}), 'callback');
+ $report->add_data($row);
}
- # print subtotals
- map { $column_data{$_} = "<td> </td>" } @column_index;
-
- $column_data{paid} =
- "<th class=listsubtotal align=right>"
- . $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "</th>";
-
- print qq|
- <tr class=listsubtotal>
-|;
-
- map { print "\n$column_data{$_}" } @column_index;
-
- print qq|
- </tr>
-|;
-
- $subtotalpaid = 0;
+ my $row = { map { $_ => { 'class' => 'listsubtotal' } } @columns };
+ $row->{paid} = {
+ 'data' => $form->format_amount(\%myconfig, $subtotal_paid, 2),
+ 'align' => 'right',
+ 'class' => 'listsubtotal',
+ };
+ $report->add_data($row);
}
- # print total
- map { $column_data{$_} = "<td> </td>" } @column_index;
-
- $column_data{paid} =
- "<th class=listtotal align=right>"
- . $form->format_amount(\%myconfig, $totalpaid, 2, " ") . "</th>";
+ $report->add_separator();
- print qq|
- <tr class=listtotal>
-|;
+ my $row = { map { $_ => { 'class' => 'listtotal' } } @columns };
+ $row->{paid} = {
+ 'data' => $form->format_amount(\%myconfig, $total_paid, 2),
+ 'align' => 'right',
+ 'class' => 'listtotal',
+ };
- map { print "\n$column_data{$_}" } @column_index;
+ $report->add_data($row);
- print qq|
- </tr>
-
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-</body>
-</html>
-|;
+ $report->generate_with_headers();
$lxdebug->leave_sub();
}
sub print_options {
$lxdebug->enter_sub();
+ my ($dont_print) = @_;
+
$form->{sendmode} = "attachment";
$form->{"format"} =
}
}
- print qq|
+ my $output = qq|
<table>
<tr>
<td><select name=type>$type</select></td>
|;
if ($myconfig{printer} && $latex_templates && $form->{media} ne 'email') {
- print qq|
+ $output .= qq|
<td>| . $locale->text('Copies') . qq|
<input name=copies size=2 value=$form->{copies}></td>
|;
}
- print qq|
+ $output .= qq|
</tr>
</table>
|;
+ print $output unless $dont_print;
+
$lxdebug->leave_sub();
+
+ return $output;
}
sub generate_bwa {
$form->{endbold} = "</b>";
$form->{br} = "<br>";
- # &get_project(generate_bwa);
-
if ($form->{reporttype} eq "custom") {
#forgotten the year --> thisyear
sub generate_ustva {
$lxdebug->enter_sub();
- # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum
- # Einlesen der Finanzamtdaten
- get_config($userspath, 'finanzamt.ini');
+ # Hier Aufruf von get_config zum Einlesen der Finanzamtdaten
+ USTVA->get_config($userspath, 'finanzamt.ini');
# &get_project(generate_bwa);
@anmeldungszeitraum =
# German Tax authority Module and later ELSTER Interface
#======================================================================
-require "$form->{path}/arap.pl";
+require "bin/mozilla/arap.pl";
+require "bin/mozilla/common.pl";
#use strict;
#no strict 'refs';
# $locale->text('Oct')
# $locale->text('Nov')
# $locale->text('Dec')
+
+# $form->parse_html_template('generic/util_hidden_variables');
+
#############################
sub report {
$lxdebug->enter_sub();
+
my $myconfig = \%myconfig;
- use CGI;
$form->{title} = $locale->text('UStVA');
$form->{kz10} = ''; #Berichtigte Anmeldung? Ja =1 Nein=0
local $hide = '';
$form->header;
- print qq|
- <body>
- <form method=post action=$form->{script}>
-
- <input type=hidden name=title value="$form->{title}">
-
- <table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table>
- $department
- |;
-
- # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum
# Einlesen der Finanzamtdaten
- &get_config($userspath, 'finanzamt.ini');
+ USTVA->get_config($userspath, 'finanzamt.ini');
# Hier Einlesen der user-config
# steuernummer entfernt für prerelease
- my @a = qw(signature name company address businessnumber tel fax email
- co_chief co_department co_custom1 co_custom2 co_custom3 co_custom4 co_custom5
- co_name1 co_name2
- co_street co_street1 co_zip co_city co_city1 co_country co_tel co_tel1 co_tel2
- co_fax co_fax1 co_email co_email1 co_url co_url1 ustid duns
- co_bankname co_bankname1 co_bankname2 co_bankname3 co_blz co_blz1
- co_blz2 co_blz3 co_accountnr co_accountnr1 co_accountnr2 co_accountnr3);
+ my @a = qw(
+ signature name company address businessnumber
+ tel fax email co_chief co_department
+ co_custom1 co_custom2 co_custom3 co_custom4 co_custom5
+ co_name1 co_name2 co_street co_street1 co_zip
+ co_city co_city1 co_country co_tel co_tel1
+ co_tel2 co_fax co_fax1 co_email co_email1
+ co_url co_url1 ustid duns co_bankname
+ co_bankname1 co_bankname2 co_bankname3 co_blz co_blz1
+ co_blz2 co_blz3 co_accountnr co_accountnr1 co_accountnr2
+ co_accountnr3
+ );
map { $form->{$_} = $myconfig->{$_} } @a;
- my $oeffnungszeiten = $form->{FA_Oeffnungszeiten};
- $oeffnungszeiten =~ s/\\\\n/<br>/g;
- print qq|
- <tr >
- <td width="50%" align="left" valign="top">
- <fieldset>
- <legend>
- <b>| . $locale->text('Company') . qq|</b>
- </legend>
- |;
- if ($form->{company} ne '') {
- print qq|<h3>$form->{company}</h3>\n|;
- } else {
- print qq|
- <a href=am.pl?path=$form->{path}&action=config&level=Programm--Preferences&login=$form->{login}&password=$form->{password}>
- | . $locale->text('No Company Name given') . qq|!</a><br>
- |;
- }
+ my $openings = $form->{FA_Oeffnungszeiten};
+ $openings =~ s/\\\\n/<br>/g;
+
+ my $company_given = ($form->{company} ne '')
+ ? qq|<h3>$form->{company}</h3>\n|
+ : qq|<a href=am.pl?action=config|
+ . qq|&level=Programm--Preferences&login=$form->{login}|
+ . qq|&password=$form->{password}>|
+ . $locale->text('No Company Name given') . qq|!</a><br>|;
+
# Anpassungen der Variablennamen auf pre 2.1.1 Namen
# klären, ob $form->{company_street|_address} gesetzt sind
- #
-
if ($form->{address} ne '') {
my $temp = $form->{address};
$temp =~ s/\\n/<br \/>/;
$form->{co_city} =~ s/\\n//g;
}
- if ($form->{co_street} ne ''
- and ( $form->{co_zip} ne ''
- or $form->{co_city} ne '')
- ) {
- print qq|
- $form->{co_street}<br>
- $form->{co_street1}<br>
- $form->{co_zip} $form->{co_city}|;
- } else {
- print qq|
- <a href=am.pl?path=$form->{path}&action=config&level=Programm--Preferences&login=$form->{login}&password=$form->{password}>
- | . $locale->text('No Company Address given') . qq|!</a>\n|;
- }
+
+ my $address_given =
+ ($form->{co_street} ne ''
+ and (
+ $form->{co_zip} ne ''
+ or $form->{co_city} ne ''
+ )
+ )
+ ? qq|$form->{co_street}<br>|
+ . qq|$form->{co_street1}<br>|
+ . qq|$form->{co_zip} $form->{co_city}|
+ : qq|<a href=am.pl?action=config|
+ . qq|&level=Programm--Preferences&login=$form->{login}|
+ . qq|&password=$form->{password}>|
+ . $locale->text('No Company Address given')
+ . qq|!</a>\n|;
+
$form->{co_email} = $form->{email} unless $form->{co_email};
$form->{co_tel} = $form->{tel} unless $form->{co_tel};
$form->{co_fax} = $form->{fax} unless $form->{co_fax};
$form->{co_url} = $form->{urlx} unless $form->{co_url};
- print qq|
- <br>
- <br>
- | . $locale->text('Tel') . qq|.:
- $form->{co_tel}
- <br>
- | . $locale->text('Fax') . qq|.:nbsp;
- $form->{co_fax}
- <br>
- <br>
- $form->{co_email}
- <br>
- <br>
- | . $locale->text('Tax Number') . qq|:
- |;
-
- if ($form->{steuernummer} ne '') {
- print qq|$form->{steuernummer}|;
- } else {
- print qq|
- <a href="ustva.pl?path=$form->{path}&action=edit&level=Programm--Finanzamteinstellungen&login=$form->{login}&password=$form->{password}">
- Keine Steuernummer hinterlegt!</a><br>|;
- }
- print qq|
- <br>
- | . $locale->text('ELSTER Tax Number') . qq|:
- $form->{elstersteuernummer}
- <br>
- <br>
-
- </fieldset>
- <br>
- |;
- if ($form->{FA_steuerberater_name} ne '') {
- print qq|
- <fieldset>
- <legend>
- <input checked="checked" title="|
- . $locale->text('Assume Tax Consultant Data in Tax Computation?')
- . qq|" name="FA_steuerberater" id=steuerberater class=checkbox type=checkbox value="1">
- <b>| . $locale->text('Tax Consultant') . qq|</b>
- </legend>
-
- $form->{FA_steuerberater_name}<br>
- $form->{FA_steuerberater_street}<br>
- $form->{FA_steuerberater_city}<br>
- Tel: $form->{FA_steuerberater_tel}<br>
- </fieldset>
- <br>
- |;
- }
- print qq|
- <fieldset>
- <legend>
- <b>| . $locale->text('Tax Period') . qq|</b>
- </legend>
- |;
- &ustva_vorauswahl();
-
- my @years = ();
- if (not defined $form->{all_years}) {
+ my $taxnumber_given = ($form->{steuernummer} ne '')
+ ? qq|$form->{steuernummer}|
+ : qq|<a href="ustva.pl?action="config_step1"|
+ . qq|&level=Programm--Finanzamteinstellungen&login=$form->{login}|
+ . qq|&password=$form->{password}">Keine Steuernummer hinterlegt!|
+ . qq|</a><br>|;
- # accounting years if SQL-Ledger Version < 2.4.1
- # $year = $form->{year} * 1;
- @years = sort { $b <=> $a } (2003 .. ($year + 1));
- $form->{all_years} = \@years;
- }
- map { $form->{selectaccountingyear} .= qq|<option>$_\n| }
- @{ $form->{all_years} };
- print qq|
- <select name=year title="| . $locale->text('Year') . qq|">
- |;
- my $key = '';
- foreach $key (@years) {
- print qq|<option |;
- print qq|selected| if ($key eq $form->{year});
- print qq| >$key</option>
- |;
- }
+ my $ustva_vorauswahl = &ustva_vorauswahl();
- my $voranmeld = $form->{FA_voranmeld};
- print qq| </select>|;
- my $checked = '';
- $checked = "checked" if ($form->{kz10} eq '1');
- print qq|
- <input name="FA_10" id=FA_10 class=checkbox type=checkbox value="1" $checked title = "|
- . $locale->text(
- 'Amended Advance Turnover Tax Return (Nr. 10)')
- . qq|">
- | . $locale->text('Amended Advance Turnover Tax Return') . qq|
- <br>
- |;
-
- if ($voranmeld ne '') {
- print qq|
- <br>
- | . $locale->text($voranmeld) . qq|
- |;
- print $locale->text('With Extension Of Time') if ($form->{FA_dauerfrist} eq '1');
- print qq|
+ my @all_years = $form->all_years(\%myconfig);
- <br>
- |;
- }
- if ($form->{method} ne '') {
- print qq|| . $locale->text('Method') . qq|: |;
- print qq|| . $locale->text('accrual') . qq||
- if ($form->{method} eq 'accrual');
- print qq|| . $locale->text('cash') . qq|| if ($form->{method} eq 'cash');
+ my $select_year = qq|<select name=year title="|
+ . $locale->text('Year') . qq|">|;
+ foreach my $key (@all_years) {
+ $select_year .= qq|<option |;
+ $select_year .= qq|selected| if ($key eq $form->{year});
+ $select_year .= qq| >$key</option>|;
}
- print qq|
- </fieldset>
-
- </td>|;
-
- if ($form->{FA_Name} ne '') {
- print qq|
- <td width="50%" valign="top">
- <fieldset>
- <legend>
- <b>| . $locale->text('Tax Office') . qq|</b>
- </legend>
- <h3>$form->{FA_Name}</h2>
- |;
-
- #if ($form->{FA_Ergaenzung_Name ne ''}){
- # print qq|
- # $form->{FA_Ergaenzung_Name} 
- # <br>
- # |;
- #}
- print qq|
- $form->{FA_Strasse}
- <br>
- $form->{FA_PLZ} $form->{FA_Ort}
- <br>
- <br>
- | . $locale->text('Tel') . qq|.:
- $form->{FA_Telefon}
- <br>
- | . $locale->text('Fax') . qq|.:$nbsp;
- $form->{FA_Fax}
- <br>
- <br>
- <a href="mailto:$form->{FA_Email}?subject=|
- . CGI::escape("Steuer Nr: $form->{steuernummer}:")
- . qq|&body=|
- . CGI::escape(
- "Sehr geehrte Damen und Herren,\n\n\nMit freundlichen Grüßen\n\n")
- . CGI::escape($form->{signature}) . qq|">
- $form->{FA_Email}
- </a>
- <br>
- <a href="$form->{FA_Internet}">
- $form->{FA_Internet}
- </a>
- <br>
- <br>
- | . $locale->text('Openings') . qq|
- <br>
- $oeffnungszeiten
- <br>
- |;
-
- my $FA_1 =
- ( $form->{FA_BLZ_1} ne ''
- && $form->{FA_Kontonummer_1} ne ''
- && $form->{FA_Bankbezeichnung_1} ne '');
- my $FA_2 =
- ( $form->{FA_BLZ_2} ne ''
- && $form->{FA_Kontonummer_2} ne ''
- && $form->{FA_Bankbezeichnung_oertlich} ne '');
-
- if ($FA_1 && $FA_2) {
- print qq|
- <br>
- | . $locale->text('Bank Connection') . qq|
- <table>
- <tr>
- <td>
- $form->{FA_Bankbezeichnung_1}
- <br>
- | . $locale->text('Account') . qq|:
- $form->{FA_Kontonummer_1}
- <br>
- | . $locale->text('Bank Code') . qq|:
- $form->{FA_BLZ_1}
- </td>
- <td>
- $form->{FA_Bankbezeichnung_oertlich}
- <br>
- | . $locale->text('Account') . qq|:
- $form->{FA_Kontonummer_2}
- <br>
- | . $locale->text('Bank Code') . qq|:
- $form->{FA_BLZ_2}
- </td>
- </tr>
- </table>
- <br>|;
- } elsif ($FA_1) {
- print qq|
- <br>
- | . $locale->text('Bank Connection') . qq|
- <br>
- <br>
- $form->{FA_Bankbezeichnung_1}
- <br>
- | . $locale->text('Account') . qq|:
- $form->{FA_Kontonummer_1}
- <br>
- | . $locale->text('Bank Code') . qq|:
- $form->{FA_BLZ_1} <br>
- <br>|;
- } elsif ($FA_2) {
- print qq|
- <br>
- | . $locale->text('Bank Connection') . qq|
- <br>
- <br>
- $form->{FA_Bankbezeichnung_oertlich}
- <br>
- | . $locale->text('Account') . qq|:
- $form->{FA_Kontonummer_2}
- <br>
- | . $locale->text('Bank Code') . qq|:
- $form->{FA_BLZ_2}
- |;
+ $select_year .= qq|</select>|;
+
+ my $_checked = '';
+ $_checked = "checked" if ($form->{kz10} eq '1');
+ my $checkbox_kz_10 = qq|<input name="FA_10" id=FA_10 class=checkbox|
+ . qq| type=checkbox value="1" $_checked title = "|
+ . $locale->text('Amended Advance Turnover Tax Return (Nr. 10)')
+ . qq|">|
+ . $locale->text('Amended Advance Turnover Tax Return');
+
+ my $method_local = ($form->{method} eq 'accrual') ? $locale->text('accrual')
+ : ($form->{method} eq 'cash') ? $locale->text('cash')
+ : '';
+
+ my $period_local = ( $form->{FA_voranmeld} eq 'month') ? $locale->text('month')
+ : ( $form->{FA_voranmeld} eq 'quarter') ? $locale->text('quarter')
+ : '';
+
+ my $tax_office_banks_ref = [
+ { BLZ => $form->{FA_BLZ_1},
+ Kontonummer => $form->{FA_Kontonummer_1},
+ Bankbezeichnung => $form->{FA_Bankbezeichnung_1}
+ },
+ { BLZ => $form->{FA_BLZ_2},
+ Kontonummer => $form->{FA_Kontonummer_2},
+ Bankbezeichnung => $form->{FA_Bankbezeichnung_oertlich}
}
- print qq|
-
- </fieldset>
- <br>
- <fieldset>
- <legend>
- <b>| . $locale->text('Outputformat') . qq|</b>
- </legend>
- |;
-
- &show_options;
- my $ausgabe = '1';
- print qq|
- </fieldset>
- |;
-
- } else {
- print qq|
- <td width="50%" valign="bottom">
- <fieldset>
- <legend>
- <b>| . $locale->text('Hints') . qq|</b>
- </legend>
- <h2 class="confirm">|
- . $locale->text('Missing Preferences: Outputroutine disabled')
- . qq|</h2>
- <h3>| . $locale->text('Help') . qq|</h3>
- <ul>
- <li>| . $locale->text('Hint-Missing-Preferences') . qq|</li>
- </ul>
- </fieldset>
- |;
- my $ausgabe = '';
- $hide = q|disabled="disabled"|;
- }
-
- print qq|
- </td>
- </tr>
- |;
+ ];
+
+
+ my $template_ref = {
+ openings => $openings,
+ company_given => $company_given,
+ address_given => $address_given,
+ taxnumber_given => $taxnumber_given,
+ select_year => $select_year,
+ period_local => $period_local,
+ method_local => $method_local,
+ ustva_vorauswahl => $ustva_vorauswahl,
+ checkbox_kz_10 => $checkbox_kz_10,
+ tax_office_banks => $tax_office_banks_ref,
+ select_options => &show_options,
+ };
+
+ print($form->parse_html_template('ustva/report', $template_ref));
- #}# end if report = ustva
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size="3" noshade></td>
- </tr>
- </table>
-
- <br>
- <input type="hidden" name="address" value="$form->{address}">
- <input type="hidden" name="reporttype" value="custom">
- <input type="hidden" name="co_street" value="$form->{co_street}">
- <input type="hidden" name="co_city" value="$form->{co_city}">
- <input type="hidden" name="path" value="$form->{path}">
- <input type="hidden" name="login" value="$form->{login}">
- <input type="hidden" name="password" value="$form->{password}">
- <table width="100%">
- <tr>
- <td align="left">
- <input type=hidden name=nextsub value=generate_ustva>
- <input $hide type=submit class=submit name=action value="|
- . $locale->text('Show') . qq|">
- </td>
- <td align="right">
-
- </form>
- <!--
- <form action="doc/ustva.html" method="get">
-
- <input type=submit class=submit name=action value="|
- . $locale->text('Help') . qq|">
- </form>-->
- </td>
- </tr>
- </table>
- |;
- print qq|
- </body>
- </html>
- |;
$lxdebug->leave_sub();
}
-#############################
+
sub help {
$lxdebug->enter_sub();
#&generate_ustva();
no strict 'refs';
$lxdebug->leave_sub();
- &{ $form->{nextsub} };
+ call_sub($form->{"nextsub"});
use strict 'refs';
}
sub ustva_vorauswahl {
$lxdebug->enter_sub();
+ my $select_vorauswahl;
+
#Aktuelles Datum zerlegen:
my $date = $form->datetonum($form->current_date(\%myconfig), \%myconfig);
#$form->{day}= '11';
#$form->{month}= '01';
#$form->{year}= 2004;
- print qq|
+ $select_vorauswahl = qq|
<input type=hidden name=day value=$form->{day}>
<input type=hidden name=month value=$form->{month}>
<input type=hidden name=yymmdd value=$yymmdd>
<input type=hidden name=sel value=$sel>
- |;
+ |;
if ($form->{FA_voranmeld} eq 'month') {
};
}
- print qq|<select id="zeitraum" name="period" title="|
+ $select_vorauswahl .= qq|<select id="zeitraum" name="period" title="|
. $locale->text('Select a period') . qq|" >|;
my $key = '';
foreach $key (sort keys %liste) {
my $selected = '';
$selected = 'selected' if ($sel eq $key);
- print qq|
+ $select_vorauswahl .= qq|
<option value="$key" $selected> $liste{$key}</option>
- |;
+ |;
}
- print qq|</select>|;
+ $select_vorauswahl .= qq|</select>|;
} elsif ($form->{FA_voranmeld} eq 'quarter') {
};
}
- print qq|<select id="zeitraum" name="period" title="|
+ $select_vorauswahl .= qq|<select id="zeitraum" name="period" title="|
. $locale->text('Select a period') . qq|" >|;
my $key = '';
foreach $key (sort keys %liste) {
my $selected = '';
$selected = 'selected' if ($sel eq $key);
- print qq|
+ $select_vorauswahl .= qq|
<option value="$key" $selected>$liste{$key}</option>
|;
}
- print qq|\n</select>
+ $select_vorauswahl .= qq|\n</select>
|;
} else {
# keine Vorauswahl bei Voranmeldungszeitraum
- print qq|<select id="zeitraum" name="period" title="|
+ $select_vorauswahl .= qq|<select id="zeitraum" name="period" title="|
. $locale->text('Select a period') . qq|" >|;
my %listea = ('41' => '1. Quarter',
'13' => 'Yearly',);
my $key = '';
foreach $key (sort keys %listea) {
- print qq|
+ $select_vorauswahl .= qq|
<option value="$key">|
. $locale->text("$listea{$key}")
. qq|</option>\n|;
}
foreach $key (sort keys %listeb) {
- print qq|
+ $select_vorauswahl .= qq|
<option value="$key">|
. $locale->text("$listeb{$key}")
. qq|</option>\n|;
}
- print qq|</select>|;
+ $select_vorauswahl .= qq|</select>|;
}
$lxdebug->leave_sub();
+
+ return $select_vorauswahl;
}
-sub config {
- $lxdebug->enter_sub();
- edit();
- $lxdebug->leave_sub();
-}
+#sub config {
+# $lxdebug->enter_sub();
+# config_step1();
+# $lxdebug->leave_sub();
+#}
sub debug {
$lxdebug->enter_sub();
}
#$format .= qq|<option value=elster>|.$locale->text('ELSTER Export nach Winston').qq|</option>|;
- print qq|
+ my $show_options = qq|
$type
$media
<select name=format title = "|
. $locale->text('Choose Outputformat') . qq|">$format</select>
|;
$lxdebug->leave_sub();
+
+ return $show_options;
}
sub generate_ustva {
$lxdebug->enter_sub();
- # Aufruf von get_config aus bin/mozilla/ustva.pl zum
- # Einlesen der Finanzamtdaten aus finanzamt.ini
+ # Aufruf von get_config zum Einlesen der Finanzamtdaten aus finanzamt.ini
- get_config($userspath, 'finanzamt.ini');
+ USTVA->get_config($userspath, 'finanzamt.ini');
# init some form vars
my @anmeldungszeitraum =
- qw('0401' '0402' '0403' '0404' '0405' '0405' '0406' '0407' '0408' '0409' '0410' '0411' '0412' '0441' '0442' '0443' '0444');
+ qw('0401' '0402' '0403'
+ '0404' '0405' '0406'
+ '0407' '0408' '0409'
+ '0410' '0411' '0412'
+ '0441' '0442' '0443' '0444');
+
foreach my $item (@anmeldungszeitraum) {
$form->{$item} = "";
}
};
}
-
+ # Kontrollvariable für die Templates
+ $form->{'year2007'} = ($form->{year} >= 2007 ) ? "1":"0";
# Get the USTVA
$form->{co_city} =~ s/\\n//g;
}
+ ################################
#
- # Outputformat specific customisation's
+ # Nation specific customisations
#
+ ################################
+
+ # Germany
+
+ if ( $form->{coa} eq 'Germany-DATEV-SKR03EU' or $form->{coa} eq 'Germany-DATEV-SKR04EU') {
+
+ #
+ # Outputformat specific customisation's
+ #
- my @category_cent = qw(511 861 36 80 971 931 98 96 53 74
- 85 65 66 61 62 67 63 64 59 69 39 83
- Z43 Z45 Z53 Z62 Z65 Z67);
-
- my @category_euro = qw(41 44 49 43 48 51 86 35 77 76 91 97 93
- 95 94 42 60 45 52 73 84);
+ my @category_cent = USTVA->report_variables({
+ myconfig => \%myconfig,
+ form => $form,
+ type => '',
+ attribute => 'position',
+ dec_places => '2',
+ });
+
+ push @category_cent, qw(83 Z43 Z45 Z53 Z62 Z65 Z67);
- if ( $form->{format} eq 'pdf' or $form->{format} eq 'postscript') {
+ my @category_euro = USTVA->report_variables({
+ myconfig => \%myconfig,
+ form => $form,
+ type => '',
+ attribute => 'position',
+ dec_places => '0',
+ });
- $form->{IN} = "$form->{type}-$form->{year}.tex";
- $form->{padding} = "~~";
- $form->{bold} = "\textbf{";
- $form->{endbold} = "}";
- $form->{br} = '\\\\';
+ $form->{id} = [];
+ $form->{amount} = [];
- # Zahlenformatierung für Latex USTVA Formulare
+ if ( $form->{format} eq 'pdf' or $form->{format} eq 'postscript') {
- foreach my $number (@category_euro) {
- $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '0', '');
- }
+ $form->{IN} = "$form->{type}-$form->{year}.tex";
+ $form->{padding} = "~~";
+ $form->{bold} = "\textbf{";
+ $form->{endbold} = "}";
+ $form->{br} = '\\\\';
- my ${decimal_comma} = ( $myconfig{numberformat} eq '1.000,00'
- or $myconfig{numberformat} eq '1000,00' ) ? ',':'.';
+ # Zahlenformatierung für Latex USTVA Formulare
- foreach my $number (@category_cent) {
- $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '2', '');
- $form->{$number} =~ s/${decimal_comma}/~~/g;
- }
+ foreach my $number (@category_euro) {
+ $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '0', '');
+ }
- } elsif ( $form->{format} eq 'html') { # Formatierungen für HTML Ausgabe
+ my ${decimal_comma} = ( $myconfig{numberformat} eq '1.000,00'
+ or $myconfig{numberformat} eq '1000,00' ) ? ',':'.';
- $form->{IN} = $form->{type} . '.html';
- $form->{padding} = " ";
- $form->{bold} = "<b>";
- $form->{endbold} = "</b>";
- $form->{br} = "<br>";
- $form->{address} =~ s/\\n/\n/g;
+ foreach my $number (@category_cent) {
+ $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '2', '');
+ $form->{$number} =~ s/${decimal_comma}/~~/g;
+ }
- foreach $number (@category_cent) {
- $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '2', '0');
- }
-
- foreach $number (@category_euro) {
- $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '0', '0');
- }
+ } elsif ( $form->{format} eq 'html') { # Formatierungen für HTML Ausgabe
- } elsif ( $form->{format} eq 'elsterwinston' ) {
+ $form->{IN} = $form->{type} . '.html';
+ $form->{padding} = " ";
+ $form->{bold} = "<b>";
+ $form->{endbold} = "</b>";
+ $form->{br} = "<br>";
+ $form->{address} =~ s/\\n/\n/g;
- $form->{IN} = 'winston.xml';
-
- #
- # Build Winston filename
- #
-
- my $file = 'U'; # 1. char 'U' = USTVA
- $file .= $form->{period};
- #4. and 5. char = year modulo 100
- $file .= sprintf("%02d", $form->{year} % 100);
- #6. to 18. char = Elstersteuernummer
- #Beispiel: Steuernummer in Bayern
- #111/222/33334 ergibt für UStVA Jan 2004: U01049111022233334
- $file .= $form->{elsterFFFF};
- $file .= $form->{elstersteuernummer};
- #file suffix
- $file .= '.xml';
- $form->{tmpfile} = "$userspath/$file";
-
- $form->{attachment_filename} = "$file";
-
- # Zahlenformatierung für Winston
+ foreach $number (@category_cent) {
+ $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '2', '0');
+ }
+
+ foreach $number (@category_euro) {
+ $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '0', '0');
+ }
- my $temp_numberformat = $myconfig{numberformat};
+ } elsif ( $form->{format} eq 'elsterwinston' ) {
- # Numberformat must be '1000.00' for Winston
+ $form->{IN} = 'winston.xml';
+
+ #
+ # Build Winston filename
+ #
+
+ my $file = 'U'; # 1. char 'U' = USTVA
+ $file .= $form->{period};
+ #4. and 5. char = year modulo 100
+ $file .= sprintf("%02d", $form->{year} % 100);
+ #6. to 18. char = Elstersteuernummer
+ #Beispiel: Steuernummer in Bayern
+ #111/222/33334 ergibt für UStVA Jan 2004: U01049111022233334
+ $file .= $form->{elsterFFFF};
+ $file .= $form->{elstersteuernummer};
+ #file suffix
+ $file .= '.xml';
+ $file =~ s|.*/||;
+ $form->{tmpfile} = "$userspath/$file";
+
+ $form->{attachment_filename} = $file;
+
+ # Zahlenformatierung für Winston
- $myconfig{numberformat} = '1000.00';
+ my $temp_numberformat = $myconfig{numberformat};
- foreach my $number (@category_cent) {
- $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '2', '') : '';
- }
-
- foreach my $number (@category_euro) {
- $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '0', '') : '';
- }
- # Re-set Numberformat
- $myconfig{numberformat} = $temp_numberformat;
+ # Numberformat must be '1000.00' for Winston
- }
+ $myconfig{numberformat} = '1000.00';
- elsif ( $form->{format} eq 'elstertaxbird' ) {
+ foreach my $number (@category_cent) {
+ $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '2', '') : '';
+ }
+
+ foreach my $number (@category_euro) {
+ $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '0', '') : '';
+ }
+ # Re-set Numberformat
+ $myconfig{numberformat} = $temp_numberformat;
- $form->{IN} = 'taxbird.txb';
+ # push Kennziffern to <%foreach Array fo easyer
+ # output in xml format. Thx to Moritz.
+ my %winston_id_for = (
+ # No Winston remap?!
+ );
- $form->{attachment_filename} = "USTVA-" . $form->{period}
- . sprintf("%02d", $form->{year} % 100) . ".txb";
-
- $form->{tmpfile} = "$userspath/" . $form->{attachment_filename};
-
- if ($form->{period} =~ /^[4]\d$/ ){
- my %periods = ( # Lx => taxbird
- '41' => '12',
- '42' => '13',
- '43' => '14',
- '44' => '15',
- );
-
- foreach my $quarter ( keys %periods ) {
- $form->{taxbird_period} = $periods{$quarter} if ( $form->{period} eq $quarter);
+ foreach my $kennziffer (@category_cent, @category_euro) {
+
+ next if ( $kennziffer =~ m/Z\d\d/);
+ next if ( $form->{$kennziffer} == 0 );
+
+ if (defined $winston_id_for{$kennziffer} ) {
+ push(@{ $form->{id}}, $winston_id_for{$kennziffer});
+ } else {
+ push(@{ $form->{id}}, "Kz$kennziffer");
+ }
+ push(@{ $form->{amount}}, $form->{$kennziffer});
+ }
+
+ } elsif ( $form->{format} eq 'elstertaxbird' ) {
+
+ # Define serveral filenames
+ $form->{IN} = 'taxbird.txb';
+
+ $form->{attachment_filename} = "USTVA-" . $form->{period}
+ . sprintf("%02d", $form->{year} % 100) . ".txb";
+
+ $form->{attachment_filename} =~ s|.*/||;
+ $form->{tmpfile} = "$userspath/" . $form->{attachment_filename};
+
+ # TODO: set Output to UTF-8 or system Preference
+ #$form->{"iconv"} = Text::Iconv->new($myconfig{dbcharset}, "UTF-8");
+ #my $iconv = $self->{"iconv"};
+ #$iconv->convert($variable);
+ if ($form->{period} =~ /^[4]\d$/ ){
+ my %periods = ( # Lx => taxbird
+ '41' => '12',
+ '42' => '13',
+ '43' => '14',
+ '44' => '15',
+ );
+
+ foreach my $quarter ( keys %periods ) {
+ $form->{taxbird_period} = $periods{$quarter} if ( $form->{period} eq $quarter);
+ }
+ } elsif ($form->{period} =~ /^\d+$/ ) {
+ $form->{period} =~ s/^0//g;
+ my $period = $form->{period};
+ $period * 1;
+ $period--;
+ $form->{period} = $period;
+ } else {
+ $form->header;
+ USTVA::error( $locale->text('Wrong Period' ));
+ exit(0);
}
my %lands = ( # Lx => taxbird # TODO: besser als array...
'Schleswig Holstein' => '14',
'Thüringen' => '15',
);
-
foreach my $land ( keys %lands ){
$form->{taxbird_land_nr} = $lands{$land} if ($form->{elsterland} eq $land );
}
- $form->{taxbird_steuernummer} = $form->{steuernummer};
- $form->{taxbird_steuernummer} =~ s/\D//g;
-
$form->{co_zip} = $form->{co_city};
$form->{co_zip} =~ s/\D//g;
$form->{co_city} =~ s/\d//g;
$form->{co_city} =~ s/^\s//g;
($form->{co_phone_prefix}, $form->{co_phone}) = split("-", $form->{tel});
+ $form->{co_phone_prefix} =~ s/\s//g;
+ $form->{co_phone} =~ s/\s//g;
+
+ $form->{taxbird_steuernummer} = $form->{steuernummer};
+ # $form->{taxbird_steuernummer} =~ s/\D//g;
+ $form->{taxbird_steuernummer} =~ s/\///; # ersten Querstrich ersetzen
# Numberformatting for Taxbird
-
my $temp_numberformat = $myconfig{numberformat};
- # Numberformat must be '1000.00' for Taxbird ?!
-
- $myconfig{numberformat} = '1000.00';
-
+ # Numberformat must be '1000,00' for Taxbird ?!
+ $myconfig{numberformat} = '1000,00';
foreach my $number (@category_cent) {
$form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '2', '') : '';
}
# Re-set Numberformat
$myconfig{numberformat} = $temp_numberformat;
- } elsif ($form->{period} =~ /^\d+$/ ) {
- $form->{period} =~ s/^0//g;
- my $period = $form->{period};
- $period * 1;
- $period--;
- $form->{period} = $period;
- } else {
+ # push Kennziffern to <%foreach Array fo easyer
+ # output in xml format. Thx to Moritz.
+ my %taxbird_id_for = (
+
+ '511' => 'Kz51-calc',
+ '861' => 'Kz86-calc',
+ '971' => 'Kz97-calc',
+ '931' => 'Kz93-calc',
+ '811' => 'Kz81-calc',
+ '891' => 'Kz89-calc',
+ 'Z45' => 'uebertrag',
+ 'Z53' => 'ust-sum',
+ 'Z62' => 'ust-minus-vost',
+ 'Z65' => 'ust-sum+69',
+ 'Z67' => 'ust-vz',
+ );
+
+
+ for my $kennziffer (@category_cent, @category_euro) {
+
+ next if ($kennziffer eq 'Z43');
+
+ if ($form->{$kennziffer} != 0){
+ if (defined $taxbird_id_for{$kennziffer}) {
+ push(@{ $form->{id}}, $taxbird_id_for{$kennziffer});
+ } else {
+ push(@{ $form->{id}}, "Kz$kennziffer");
+ }
+ push(@{ $form->{amount}}, $form->{$kennziffer});
+ }
+ }
+
+ } elsif ( $form->{format} eq '' ){ # No format error.
$form->header;
- USTVA::error( $locale->text('Wrong Period' ));
+ USTVA::error( $locale->text('Application Error. No Format given' ) . "!");
+ exit(0);
+
+ } else { # All other Formats are wrong
+ $form->header;
+ USTVA::error( $locale->text('Application Error. Wrong Format') . ": " . $form->{format} );
exit(0);
}
+
+ # Austria
+ } elsif ($form->{coa} eq 'Austria') {
+
+ #
+ # Outputformat specific customisation's
+ #
+
+ my @category_euro = qw(
+ 511 861 36 80 971 931 98 96 53 74
+ 85 65 66 61 62 67 63 64 59 69
+ 39 83 811 891 Z43 Z45 Z53 Z62 Z65 Z67
+ 41 44 49 43 48 51 86 35 77 76 91 89
+ 97 93 95 94 42 60 45 52 73 84 81
+ );
+
+
+ if ( $form->{format} eq 'html') { # Formatierungen für HTML Ausgabe
+
+ $form->{IN} = $form->{type} . '.html';
+ $form->{padding} = " ";
+ $form->{bold} = "<b>";
+ $form->{endbold} = "</b>";
+ $form->{br} = "<br>";
+ $form->{address} =~ s/\\n/\n/g;
+
+ foreach $number (@category_euro) {
+ $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '2', '0');
+ }
+ }
- } elsif ( $form->{format} eq '' ){ # No format error.
- $form->header;
- USTVA::error( $locale->text('Application Error. No Format given' ) . "!");
- exit(0);
-
- } else { # All other Formats are wrong
- $form->header;
- USTVA::error( $locale->text('Application Error. Wrong Format') . ": " . $form->{format} );
- exit(0);
}
+ # end nation specific customisations
+
if ( $form->{period} eq '13' and $form->{format} ne 'html') {
$form->header;
USTVA::info(
$lxdebug->leave_sub();
}
-sub edit {
+sub config_step1 {
$lxdebug->enter_sub();
# edit all taxauthority prefs
$form->header;
- &get_config($userspath, 'finanzamt.ini');
-
- #&create_steuernummer;
+ USTVA->get_config($userspath, 'finanzamt.ini');
my $land = $form->{elsterland};
my $amt = $form->{elsterFFFF};
- my $callback = '';
- $callback =
- "$form->{cbscript}?action=edit&login=$form->{cblogin}&path=$form->{cbpath}&root=$form->{cbroot}&rpw=$form->{cbrpw}"
- if ($form->{cbscript} ne '' and $form->{cblogin} ne '');
+
+ if ($form->{cbscript} ne '' and $form->{cblogin} ne '') {
+ $callback = qq|$form->{cbscript}|
+ .qq|?action="config_step1"|
+ .qq|&login="$form->{cblogin}"|
+ .qq|&root="$form->{cbroot}"|
+ .qq|&rpw="$form->{cbrpw}"|;
+ }
$form->{title} = $locale->text('Tax Office Preferences');
- print qq|
- <body>
- <form name="verzeichnis" method=post action="$form->{script}">
- <table width=100%>
- <tr>
- <th class="listtop">|
- . $locale->text('Tax Office Preferences') . qq|</th>
- </tr>
- <tr>
- <td>
- <br>
- <fieldset>
- <legend><b>|
- . $locale->text('Local Tax Office Preferences') . qq|</b></legend>
- |;
- #print qq|$form->{terminal}|;
- USTVA::fa_auswahl($land, $amt, &elster_hash());
- print qq|
- </fieldset>
- <br>
- |;
- my $checked = '';
- $checked = "checked" if ($form->{method} eq 'accrual');
- print qq|
- <fieldset>
- <legend><b>| . $locale->text('Taxation') . qq|</b>
- </legend>
- <input name=method id=accrual class=radio type=radio value="accrual" $checked>
- <label for="accrual">| . $locale->text('accrual') . qq|</label>
- <br>
- |;
- $checked = '';
- $checked = "checked" if ($form->{method} eq 'cash');
- print qq|
- <input name=method id=cash class=radio type=radio value="cash" $checked>
- <label for="cash">| . $locale->text('cash') . qq|</label>
- </fieldset>
- <br>
- <fieldset>
- <legend><b>| . $locale->text('Tax Period') . qq|</b>
- </legend>
- |;
- $checked = '';
- $checked = "checked" if ($form->{FA_voranmeld} eq 'month');
- print qq|
- <input name=FA_voranmeld id=month class=radio type=radio value="month" $checked>
- <label for="month">| . $locale->text('month') . qq|</label>
- <br>
- |;
- $checked = '';
- $checked = "checked" if ($form->{FA_voranmeld} eq 'quarter');
- print qq|
- <input name="FA_voranmeld" id=quarter class=radio type=radio value="quarter" $checked>
- <label for="quarter">| . $locale->text('quarter') . qq|</label>
- <br>
- |;
- $checked = '';
- $checked = "checked" if ($form->{FA_dauerfrist} eq '1');
- print qq|
- <input name="FA_dauerfrist" id=FA_dauerfrist class=checkbox type=checkbox value="1" $checked>
- <label for="">|
- . $locale->text('Extension Of Time') . qq|</label>
-
- </fieldset>
- <br>
- <fieldset>
- <legend><b>| . $locale->text('Tax Consultant') . qq|</b>
- </legend>
- |;
- $checked = '';
- $checked = "checked" if ($form->{FA_71} eq 'X');
- print qq|
- <!-- <input name="FA_71" id=FA_71 class=checkbox type=checkbox value="X" $checked>
- <label for="FA_71">|
- . $locale->text('Clearing Tax Received (No 71)')
- . qq|</label>
- <br>
- <br>-->
- <table>
- <tr>
- <td>
- | . $locale->text('Name') . qq|
- </td>
- <td>
- | . $locale->text('Street') . qq|
- </td>
- <td>
- | . $locale->text('Zip, City') . qq|
- </td>
- <td>
- | . $locale->text('Telephone') . qq|
- </td>
- </tr>
- <tr>
- <td>
- <input name="FA_steuerberater_name" id=steuerberater size=25 value="$form->{FA_steuerberater_name}">
- </td>
- <td>
- <input name="FA_steuerberater_street" id=steuerberater size=25 value="$form->{FA_steuerberater_street}">
- </td>
- <td>
- <input name="FA_steuerberater_city" id=steuerberater size=25 value="$form->{FA_steuerberater_city}">
- </td>
- <td>
- <input name="FA_steuerberater_tel" id=steuerberater size=25 value="$form->{FA_steuerberater_tel}">
- </tr>
- </table>
-
- </fieldset>
-
- <br>
- <br>
- <hr>
- <!--<input type=submit class=submit name=action value="|
- . $locale->text('debug') . qq|">-->
- |;
- print qq|
- <input type="button" name="Verweis" value="|
- . $locale->text('User Config') . qq|"
- onClick="self.location.href='$callback'">| if ($callback ne '');
- print qq|
-
- <input type=submit class=submit name=action value="|
- . $locale->text('continue') . qq|">
-
- </td>
- </tr>
- </table>
- |;
+ my $select_tax_office = USTVA->fa_auswahl($land, $amt, &elster_hash());
+ my $checked_accrual = q|checked="checked"| if ($form->{method} eq 'accrual');
+ my $checked_cash = q|checked="checked"| if ($form->{method} eq 'cash');
+ my $checked_monthly = "checked" if ($form->{FA_voranmeld} eq 'month');
+ my $checked_quarterly = "checked" if ($form->{FA_voranmeld} eq 'quarter');
+ my $checked_dauerfristverlaengerung = "checked" if ($form->{FA_dauerfrist} eq '1');
+ my $checked_kz_71 = "checked" if ($form->{FA_71} eq 'X');
- my @variables = qw( steuernummer elsterland elstersteuernummer elsterFFFF);
- my $variable = '';
- foreach $variable (@variables) {
- print qq|
- <input name=$variable type=hidden value="$form->{$variable}">|;
- }
- my $steuernummer_new = '';
+ my $_hidden_variables_ref;
- #<input type=hidden name="steuernummer_new" value="$form->{$steuernummer_new}">
- print qq|
- <input type=hidden name="callback" value="$callback">
- <input type=hidden name="nextsub" value="edit_form">
- <input type=hidden name="warnung" value="1">
- <input type=hidden name="saved" value="|
- . $locale->text('Check Details') . qq|">
- <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 type=hidden name="warnung" value="0">
- |;
+ my %_hidden_local_variables = (
+ 'saved' => $locale->text('Check Details'),
+ 'nextsub' => 'config_step2',
+ 'warnung' => '0',
+ );
- @variables = qw(FA_Name FA_Strasse FA_PLZ
- FA_Ort FA_Telefon FA_Fax FA_PLZ_Grosskunden FA_PLZ_Postfach FA_Postfach
- FA_BLZ_1 FA_Kontonummer_1 FA_Bankbezeichnung_1 FA_BLZ_2
- FA_Kontonummer_2 FA_Bankbezeichnung_oertlich FA_Oeffnungszeiten
- FA_Email FA_Internet);
+ foreach my $variable (keys %_hidden_local_variables) {
+ push @{ $_hidden_variables_ref },
+ { 'variable' => $variable, 'value' => $_hidden_local_variables{$variable} };
+ }
+
+ my @_hidden_form_variables = qw(
+ FA_Name FA_Strasse FA_PLZ
+ FA_Ort FA_Telefon FA_Fax
+ FA_PLZ_Grosskunden FA_PLZ_Postfach FA_Postfach
+ FA_BLZ_1 FA_Kontonummer_1 FA_Bankbezeichnung_1
+ FA_BLZ_2 FA_Kontonummer_2 FA_Bankbezeichnung_oertlich
+ FA_Oeffnungszeiten FA_Email FA_Internet
+ steuernummer elsterland elstersteuernummer
+ elsterFFFF login password
+ );
- foreach $variable (@variables) {
- print qq|
- <input name=$variable type=hidden value="$form->{$variable}">|;
+ foreach my $variable (@_hidden_form_variables) {
+ push @{ $_hidden_variables_ref},
+ { 'variable' => $variable, 'value' => $form->{$variable} };
}
- print qq|
- </form>
- </body>
-|;
+ # hä? kann die weg?
+ my $steuernummer_new = '';
+
+ # Variablen für das Template zur Verfügung stellen
+ my $template_ref = {
+ select_tax_office => $select_tax_office,
+ checked_accrual => $checked_accrual,
+ checked_cash => $checked_cash,
+ checked_monthly => $checked_monthly,
+ checked_quarterly => $checked_quarterly,
+ checked_dauerfristverlaengerung => $checked_dauerfristverlaengerung,
+ hidden_variables => $_hidden_variables_ref,
+
+ };
+
+ # Ausgabe des Templates
+ print($form->parse_html_template('ustva/config_step1', $template_ref));
+
$lxdebug->leave_sub();
}
-sub edit_form {
+sub config_step2 {
$lxdebug->enter_sub();
$form->header();
- print qq|
- <body>
- |;
+
+# print qq|
+# <body>
+# |;
+
my $elsterland = '';
my $elster_amt = '';
my $elsterFFFF = '';
my $elstersteuernummer = '';
- &get_config($userspath, 'finanzamt.ini')
+ USTVA->get_config($userspath, 'finanzamt.ini')
if ($form->{saved} eq $locale->text('saved'));
# Auf Übergabefehler checken
$change = '0' if ($form->{saved} eq $locale->text('saved'));
my $elster_init = &elster_hash();
- #my %elster_init = ();
my %elster_init = %$elster_init;
if ($change eq '1') {
$form->{elsterland} = $elsterland;
$form->{elsterFFFF} = $elsterFFFF;
$form->{steuernummer} = '';
- &create_steuernummer;
+
+ create_steuernummer();
# rebuild elster_amt
my $amt = '';
my $patterncount = $form->{patterncount};
my $elster_pattern = $form->{elster_pattern};
my $delimiter = $form->{delimiter};
- my $steuernummer = '';
- $steuernummer = $form->{steuernummer} if ($steuernummer eq '');
-
- #Warnung
- my $warnung = $form->{warnung};
-
- #printout form
- print qq|
- <form name="elsterform" method=post action="$form->{script}">
- <table width="100%">
- <tr>
- <th colspan="2" class="listtop">|
- . $locale->text('Tax Office Preferences') . qq|</th>
- </tr>
- <tr>
- <td colspan=2>
- <br>
- |;
- &show_fa_daten;
- print qq|
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <br>
- <fieldset>
- <legend>
- <font size="+1">| . $locale->text('Tax Number') . qq|</font>
- </legend>
- <br>
- |;
- $steuernummer =
- USTVA::steuernummer_input($form->{elsterland}, $form->{elsterFFFF},
- $form->{steuernummer});
- print qq|
- </H2><br>
- </fieldset>
- <br>
- <br>
- <hr>
- </td>
- </tr>
- <tr>
- <td align="left">
-
- <input type=hidden name=lastsub value="edit">
- |;
- print qq|<input type=submit class=submit name=action value="|
- . $locale->text('back') . qq|">|
- if ($form->{callback} eq '');
-
- print qq|
- <input type="button" name="Verweis" value="|
- . $locale->text('User Config') . qq|"
- onClick="self.location.href='$form->{callback}'">|
- if ($form->{callback} ne '');
-
- if ($form->{warnung} eq "1") {
- print qq|
- <input type=hidden name=nextsub value="edit_form">
- <input type=submit class=submit name=action value="|
- . $locale->text('continue') . qq|">
- <input type=hidden name="saved" value="|
- . $locale->text('Check Details') . qq|">
- |;
- } else {
- print qq|
- <input type=hidden name="nextsub" value="save">
- <input type=hidden name="filename" value="finanzamt.ini">
- <input type=submit class=submit name=action value="|
- . $locale->text('save') . qq|">
- |;
- }
+ my $steuernummer = $form->{steuernummer} if ($steuernummer eq '');
- print qq|
- </td>
- <td align="right">
- <H2 class=confirm>$form->{saved}</H2>
- </td>
- </tr>
- </table>
- |;
+ $form->{FA_Oeffnungszeiten} =~ s/\\\\n/\n/g;
+
+
+
+ my $input_steuernummer = USTVA->steuernummer_input(
+ $form->{elsterland},
+ $form->{elsterFFFF},
+ $form->{steuernummer}
+ );
+
+ $lxdebug->message(LXDebug::DEBUG1, qq|$input_steuernummer|);
+
+
+ my $_hidden_variables_ref;
- my @variables = qw(FA_steuerberater_name FA_steuerberater_street
- FA_steuerberater_city FA_steuerberater_tel
- FA_voranmeld method
- FA_dauerfrist FA_71 elster
- path login password type elster_init saved
+ my %_hidden_local_variables = (
+ 'elsterland' => $elsterland,
+ 'elsterFFFF' => $elsterFFFF,
+ 'warnung' => $warnung,
+ 'elstersteuernummer' => $elstersteuernummer,
+ 'steuernummer' => $stnr,
+ 'lastsub' => 'config_step1',
+ 'nextsub' => 'save',
+
);
- my $variable = '';
- foreach $variable (@variables) {
- print qq|
- <input name="$variable" type="hidden" value="$form->{$variable}">|;
+
+ foreach my $variable (keys %_hidden_local_variables) {
+ push @{ $_hidden_variables_ref },
+ { 'variable' => $variable, 'value' => $_hidden_local_variables{$variable} };
}
- print qq|
- <input type=hidden name="elsterland" value="$elsterland">
- <input type=hidden name="elsterFFFF" value="$elsterFFFF">
- <input type=hidden name="warnung" value="$warnung">
- <input type=hidden name="elstersteuernummer" value="$elstersteuernummer">
- <input type=hidden name="steuernummer" value="$stnr">
- <input type=hidden name="callback" value="$form->{callback}">
- </form>
- |;
+
+ my @_hidden_form_variables = qw(
+ FA_steuerberater_name FA_steuerberater_street
+ FA_steuerberater_city FA_steuerberater_tel
+ FA_voranmeld method
+ FA_dauerfrist FA_71
+ elster
+ login password
+ type elster_init
+ saved callback
+ );
+
+
+
+ foreach my $variable (@_hidden_form_variables) {
+ push @{ $_hidden_variables_ref},
+ { 'variable' => $variable, 'value' => $form->{$variable} };
+ }
+
+ my $template_ref = {
+ tax_office_data => $tax_office_data,
+ input_steuernummer => $input_steuernummer,
+ readonly => '', #q|disabled="disabled"|,
+ callback => $callback,
+ hidden_variables => $_hidden_variables_ref,
+ };
+
+ # Ausgabe des Templates
+ print($form->parse_html_template('ustva/config_step2', $template_ref));
+
+
$lxdebug->leave_sub();
}
$lxdebug->leave_sub();
}
-sub get_config {
- $lxdebug->enter_sub();
-
- my ($userpath, $filename) = @_;
- my ($key, $value) = '';
- open(FACONF, "$userpath/$form->{login}_$filename")
- or #falls Datei nicht vorhanden ist
- sub {
- open(FANEW, ">$userpath/$form->{login}_$filename")
- or $form->error("$userpath/$filename : $!");
- close FANEW;
- open(FACONF, "$userpath/$form->{login}_$filename")
- or $form->error("$userpath/$form->{username}_$filename : $!");
- };
- while (<FACONF>) {
- last if /^\[/;
- next if /^(#|\s)/;
-
- # remove comments
- s/\s#.*//g;
-
- # remove any trailing whitespace
- s/^\s*(.*?)\s*$/$1/;
- ($key, $value) = split /=/, $_, 2;
-
- #if ($value eq ' '){
- # $form->{$key} = " " ;
- #} elsif ($value ne ' '){
- $form->{$key} = "$value";
-
- #}
- }
- close FACONF;
-
- # Textboxen formatieren: Linebreaks entfernen
- #
- #$form->{FA_Oeffnungszeiten} =~ s/\\\\n/<br>/g;
- $lxdebug->leave_sub();
-}
-
sub save {
$lxdebug->enter_sub();
+
my $filename = "$form->{login}_$form->{filename}";
+ $filename =~ s|.*/||;
#zuerst die steuernummer aus den part, parts_X_Y und delimiter herstellen
- create_steuernummer;
+ create_steuernummer();
# Textboxen formatieren: Linebreaks entfernen
#
$form->{FA_Internet} =~ s/^http:\/\///;
$form->{FA_Internet} = 'http://' . $form->{FA_Internet};
- my @config = qw(elster elsterland elstersteuernummer steuernummer
- elsteramt elsterFFFF FA_Name FA_Strasse
- FA_PLZ FA_Ort FA_Telefon FA_Fax FA_PLZ_Grosskunden
- FA_PLZ_Postfach FA_Postfach FA_BLZ_1 FA_Kontonummer_1
- FA_Bankbezeichnung_1 FA_BLZ_2 FA_Kontonummer_2
+ my @config = qw(
+ elster elsterland elstersteuernummer steuernummer
+ elsteramt elsterFFFF FA_Name FA_Strasse
+ FA_PLZ FA_Ort FA_Telefon FA_Fax
+ FA_PLZ_Grosskunden FA_PLZ_Postfach FA_Postfach FA_BLZ_1
+ FA_Kontonummer_1 FA_Bankbezeichnung_1 FA_BLZ_2 FA_Kontonummer_2
FA_Bankbezeichnung_oertlich FA_Oeffnungszeiten
FA_Email FA_Internet FA_voranmeld method FA_steuerberater_name
FA_steuerberater_street FA_steuerberater_city FA_steuerberater_tel
# Hier kommt dann die Plausibilitätsprüfung der ELSTERSteuernummer
if ($form->{elstersteuernummer} ne '000000000') {
+
$form->{elster} = '1';
- open(CONF, ">$userspath/$filename") or $form->error("$filename : $!");
+
+ open my $ustvaconfig, ">", "$userspath/$filename" or $form->error("$filename : $!");
# create the config file
- print CONF qq|# Configuration file for USTVA\n\n|;
+ print {$ustvaconfig} qq|# Configuration file for USTVA\n\n|;
my $key = '';
foreach $key (sort @config) {
$form->{$key} =~ s/\\/\\\\/g;
- $form->{$key} =~ s/"/\\"/g;
-
# strip M
$form->{$key} =~ s/\r\n/\n/g;
- print CONF qq|$key=|;
+
+ print {$ustvaconfig} qq|$key=|;
if ($form->{$key} ne 'Y') {
- print CONF qq|$form->{$key}\n|;
+ print {$ustvaconfig} qq|$form->{$key}\n|;
}
if ($form->{$key} eq 'Y') {
- print CONF qq|checked \n|;
+ print {$ustvaconfig} qq|checked \n|;
}
}
- print CONF qq|\n\n|;
- close CONF;
+ print {$ustvaconfig} qq|\n\n|;
+ close $ustvaconfig;
$form->{saved} = $locale->text('saved');
} else {
$form->{saved} = $locale->text('Choose a Tax Number');
}
- &edit_form;
- $lxdebug->leave_sub();
-}
-
-sub show_fa_daten {
- $lxdebug->enter_sub();
- my $readonly = $_;
- my $oeffnungszeiten = $form->{FA_Oeffnungszeiten};
- $oeffnungszeiten =~ s/\\\\n/\n/g;
- print qq| <br>
- <fieldset>
- <legend>
- <font size="+1">|
- . $locale->text('Tax Office') . qq| $form->{FA_Name}</font>
- </legend>
- |;
-
- #print qq|\n<h4>$form->{FA_Ergaenzung_Name} </h4>
- # | if ( $form->{FA_Ergaenzung_Name} );
- print qq|
- <table width="100%" valign="top">
- <tr>
- <td valign="top">
- <br>
- <fieldset>
- <legend>
- <b>| . $locale->text('Address') . qq|</b>
- </legend>
-
- <table width="100%">
- <tr>
- <td>
- | . $locale->text('Tax Office') . qq|
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <input name="FA_Name" size="40" title="FA_Name" value="$form->{FA_Name}" $readonly>
- <td>
- </tr>
- <tr>
- <td colspan="2">
- <input name="FA_Strasse" size="40" title="FA_Strasse" value="$form->{FA_Strasse}" $readonly>
- </td width="100%">
- </tr>
- <tr>
- <td width="116px">
- <input name="FA_PLZ" size="10" title="FA_PLZ" value="$form->{FA_PLZ}" $readonly>
- </td>
- <td>
- <input name="FA_Ort" size="20" title="FA_Ort" value="$form->{FA_Ort}" $readonly>
- </td>
- </tr>
- </table>
- </fieldset>
- <br>
- <fieldset>
- <legend>
- <b>| . $locale->text('Contact') . qq|</b>
- </legend>
- | . $locale->text('Telephone') . qq|<br>
- <input name="FA_Telefon" size="40" title="FA_Telefon" value="$form->{FA_Telefon}" $readonly>
- <br>
- <br>
- | . $locale->text('Fax') . qq|<br>
- <input name="FA_Fax" size="40" title="FA_Fax" value="$form->{FA_Fax}" $readonly>
- <br>
- <br>
- | . $locale->text('Internet') . qq|<br>
- <input name="FA_Email" size="40" title="FA_Email" value="$form->{FA_Email}" $readonly>
- <br>
- <br>
- <input name="FA_Internet" size="40" title="" title="FA_Internet" value="$form->{FA_Internet}" $readonly>
- <br>
- </fieldset>
- </td>
- <td valign="top">
- <br>
- <fieldset>
- <legend>
- <b>| . $locale->text('Openings') . qq|</b>
- </legend>
- <textarea name="FA_Oeffnungszeiten" rows="4" cols="40" $readonly>$oeffnungszeiten</textarea>
- </fieldset>
- <br>
- |;
- my $FA_1 =
- ( $form->{FA_BLZ_1} ne ''
- && $form->{FA_Kontonummer_1} ne ''
- && $form->{FA_Bankbezeichnung_1} ne '');
- my $FA_2 =
- ( $form->{FA_BLZ_2} ne ''
- && $form->{FA_Kontonummer_2} ne ''
- && $form->{FA_Bankbezeichnung_oertlich} ne '');
-
- if ($FA_1 && $FA_2) {
- print qq|
- <fieldset>
- <legend>
- <b>|
- . $locale->text('Bank Connection Tax Office') . qq|</b>
- <legend>
- <table>
- <tr>
- <td>
- | . $locale->text('Bank') . qq|
- <br>
- <input name="FA_Bankbezeichnung_1" size="30" value="$form->{FA_Bankbezeichnung_1}" $readonly>
- <br>
- <br>
- | . $locale->text('Account Nummer') . qq|
- <br>
- <input name="FA_Kontonummer_1" size="15" value="$form->{FA_Kontonummer_1}" $readonly>
- <br>
- <br>
- | . $locale->text('Bank Code (long)') . qq|
- <br>
- <input name="FA_BLZ_1" size="15" value="$form->{FA_BLZ_1}" $readonly>
- </td>
- <td>
- | . $locale->text('Bank') . qq|
- <br>
- <input name="FA_Bankbezeichnung_oertlich" size="30" value="$form->{FA_Bankbezeichnung_oertlich}" $readonly>
- <br>
- <br>
- | . $locale->text('Account Nummer') . qq|
- <br>
- <input name="FA_Kontonummer_2" size="15" value="$form->{FA_Kontonummer_2}" $readonly>
- <br>
- <br>
- | . $locale->text('Bank Code (long)') . qq|
- <br>
- <input name="FA_BLZ_2" size="15" value="$form->{FA_BLZ_2}" $readonly>
- </td>
- </tr>
- </table>
- </fieldset>
- |;
- } elsif ($FA_1) {
- print qq|
- <fieldset>
- <legend>
- <b>|
- . $locale->text('Bank Connection Tax Office') . qq|</b>
- <legend>
- | . $locale->text('Account Nummer') . qq|
- <br>
- <input name="FA_Kontonummer_1" size="30" value="$form->{FA_Kontonummer_1}" $readonly>
- <br>
- <br>
- | . $locale->text('Bank Code (long)') . qq|
- <br>
- <input name="FA_BLZ_1" size="15" value="$form->{FA_BLZ_1}" $readonly>
- <br>
- <br>
- | . $locale->text('Bank') . qq|
- <br>
- <input name="FA_Bankbezeichnung_1" size="15" value="$form->{FA_Bankbezeichnung_1}" $readonly>
- <br>
- </fieldset>
- |;
- } else {
- print qq|
- <fieldset>
- <legend>
- <b>|
- . $locale->text('Bank Connection Tax Office') . qq|</b>
- <legend>
- | . $locale->text('Account Nummer') . qq|
- <br>
- <input name="FA_Kontonummer_2" size="30" value="$form->{FA_Kontonummer_2}" $readonly>
- <br>
- <br>
- | . $locale->text('Bank Code (long)') . qq|
- <br>
- <input name="FA_BLZ_2" size="15" value="$form->{FA_BLZ_2}" $readonly>
- <br>
- <br>
- | . $locale->text('Bank') . qq|
- <br>
- <input name="FA_Bankbezeichnung_oertlich" size="15" value="$form->{FA_Bankbezeichnung_oertlich}" $readonly>
- </fieldset>
- |;
- }
- print qq|
- </td>
- </tr>
- </table>
- </fieldset>
- |;
+ config_step2();
$lxdebug->leave_sub();
}
# allow Symbolic references just here:
no strict 'refs';
- &{ $form->{nextsub} };
+ call_sub($form->{"nextsub"});
use strict 'refs';
$lxdebug->leave_sub();
}
sub back {
$lxdebug->enter_sub();
- &{ $form->{lastsub} };
+ call_sub($form->{"lastsub"});
$lxdebug->leave_sub();
}
sub elster_hash {
$lxdebug->enter_sub();
- my $finanzamt = USTVA::query_finanzamt(\%myconfig, \%$form);
+ my $finanzamt = USTVA->query_finanzamt(\%myconfig, \%$form);
$lxdebug->leave_sub();
return $finanzamt;
}
--- /dev/null
+am.pl
\ No newline at end of file
--- /dev/null
+am.pl
\ No newline at end of file
--- /dev/null
+am.pl
\ No newline at end of file
--- /dev/null
+am.pl
\ No newline at end of file
/* stylesheet for LX-Office ERP */
-/* general stuff */
-/*
-A:link { color: #a0522d; text-decoration: none; }
-A:visited { color: #0522d; text-decoration: none; }
-A:active { color: #a0522d; text-decoration: underline; }
-A:hover { color: white;
- background-color: rgb(187,187,187);
- text-decoration: none;
-}
-*/
-A:link { color: black; text-decoration: none; }
-A:visited { color: black; text-decoration: none; }
-A:active { color: black; text-decoration: underline; }
-
-/*
- Menu: oberste Linkebene
-*/
-A.nohover:hover {
- /* color: black;*/
- color:#8c1919;
- /* font-weight: bolder;
- background-image: url("px_3.gif");
- text-decoration:none;
- */
-}
-
-
-/*
- Menu : Unterpunkte
-*/
-A:hover {
- color:#8c1919;
-/* color: black;
- font-weight: bolder;
- background-color: #FFFFCC;
- text-decoration:none;
-*/
-}
+/* The look of links */
+A:link { color: mediumblue; text-decoration: none; }
+A:visited { color: mediumblue; text-decoration: none; }
+A:active { color: black; text-decoration: none; }
+A:hover { color: black;
+ background-color: lemonchiffon;
+ text-decoration: none;
+ }
body {
/*
- �erschriftsbalken
+ Überschriftsbalken
*/
.listtop {
background-color: rgb(236,233,216);
border-style:dotted;
border-width:thin;
}
-
-
+
+.accountlistheading {
+ font-size: 10pt;
+ padding:3px;
+ color: white;
+ font-weight: bold;
+ text-align:left;
+ background-color:rgb(133,132,129);
+}
+
.subsubheading {
color: black;
font-weight: bolder;
}
-A.listheading:link, A.listheading:active, A.listheading:visited {
- color: black;
- text-decoration: none;
- }
-
.listrow1 {
background-color: rgb(208,207,201);
color: black;
font-size: 14pt;
}
+fieldset {
+ margin-top:15px;
+ color: black;
+ font-weight: bolder;
+}
/* media stuff */
}
}
+.filecontent {
+ border: 1px solid blue;
+ padding-left: 2px;
+ padding-right: 2px;
+}
+
+label {
+ cursor:pointer;
+}
+
+.unbalanced_ledger {
+ background-color: #ffa0a0;
+}
behavior:url("css/csshover.htc");\r
}\r
\r
-#menu{\r
-width:100%;\r
+#menu {\r
+width:99.8%;\r
float:left;\r
+background:url(../image/bg_css_menu.png) repeat bottom;\r
+border:1px solid;\r
+border-color:#ccc #888 #555 #bbb;\r
}\r
\r
#menu a, #menu h2, #menu div.x {\r
font:11px/16px arial,helvetica,sans-serif;\r
display:block;\r
-border-width:1px;\r
+border:0;\r
+border-right:1px;\r
border-style:solid;\r
border-color:#ccc #888 #555 #bbb;\r
white-space:nowrap;\r
padding:1px 0 1px 3px;\r
}\r
\r
-#menu h2{\r
+#menu h2 {\r
color:#fff;\r
-background:#000 url(../image/bg_css_menu.png) repeat 100% 100%;\r
+padding:0 5px;\r
}\r
\r
-#menu a{\r
-background:#eee;\r
+#menu a, #menu a:visited, #menu div.x, #menu div.x:visited {\r
+color:#000;\r
text-decoration:none;\r
+padding-right:10px;\r
}\r
\r
-#menu a, #menu a:visited{\r
-color:#000;\r
+#menu a {\r
+background:#eee;\r
+}\r
+\r
+#menu div.x, #menu div.x:visited {\r
+background:#eee url(../image/right.gif) no-repeat right;\r
}\r
\r
-#menu a:hover{\r
+#menu a:hover, #menu div.x:hover {\r
color:#a00;\r
-background:#ddd;\r
+background-color:#ddd;\r
}\r
\r
-#menu a:active{\r
+#menu a:active, #menu div.x:active {\r
color:#060;\r
-background:#ccc;\r
+background-color:#ccc;\r
}\r
\r
-#menu ul{\r
+#menu ul {\r
list-style:none;\r
margin:0;\r
padding:0;\r
min-width:7em;\r
}\r
\r
-#menu li{\r
+#menu li {\r
position:relative;\r
+float:none;\r
+border:0;\r
+}\r
+\r
+/* IE6 spacing bug fix, <li>s without a bottom border get spaced to far \r
+ * correction: the bug will change the height of the parent element! this will also cause the whole menu to grow \r
+ * so the only method to get this pile of crap going is to add a bottom border to the <li>s, where the enclosing <ul> already has\r
+ * a bottom border, which just looks ugly\r
+ * the trick: color the bottom border with the same color as the bottom pixel of the background image - noone notices */\r
+#menu ul li {\r
+border:solid;\r
+border-color:#ccd5e5;\r
+border-width:0 0 1px 0;\r
+}\r
+\r
+#menu ul ul li {\r
+border:solid;\r
+border-width:0 0 1px 0;\r
}\r
\r
-#menu ul ul{\r
+/* IE6 event bug fix, without a background there hovers will be occassionally lost between the li's to the layer below \r
+ * causing the menu to close. Opera 9 has the same bug btw. */\r
+#menu ul ul {\r
position:absolute;\r
z-index:500;\r
top:auto;\r
display:none;\r
+background:#000;\r
}\r
\r
-#menu ul ul ul{\r
+#menu ul ul ul {\r
top:0;\r
left:100%;\r
+background:#000;\r
}\r
\r
/* Begin non-anchor hover selectors */\r
improves IE's performance speed to use the older\r
file and this method */\r
\r
-div#menu h2:hover{\r
-background:#A3C5FF url(../image/expand3.gif) no-repeat -999px -9999px;\r
+div#menu h2:hover {\r
+background:#A3C5FF;\r
color:#a00;\r
}\r
\r
-div#menu li:hover{\r
+div#menu li:hover {\r
cursor:pointer;\r
z-index:100;\r
}\r
\r
/* End of non-anchor hover selectors */\r
\r
-/* Styling for Expand */\r
-\r
-#menu a.x, #menu a.x:visited{\r
-/*font-weight:bold;*/\r
-color:#000;\r
-background:#eee url(../image/expand3.gif) no-repeat 100% 100%;\r
-}\r
-\r
-#menu a.x:hover{\r
-color:#fff;\r
-background:#000;\r
-}\r
-\r
-#menu a.x:active{\r
-color:#060;\r
-background:#ccc;\r
-}\r
-\r
-#menu div.x, #menu div.x:visited{\r
-/*font-weight:bold;*/\r
-color:#000;\r
-background:#eee url(../image/expand3.gif) no-repeat 100% 100%;\r
-}\r
-\r
-#menu div.x:hover{\r
-color:#a00;\r
-background:#ddd;\r
-}\r
-\r
-#menu div.x:active{\r
-color:#060;\r
-background:#ccc;\r
-}\r
--- /dev/null
+am.pl
\ No newline at end of file
--- /dev/null
+am.pl
\ No newline at end of file
--- /dev/null
+am.pl
\ No newline at end of file
-Aktuelle Installations- und Konfigurationshinweise:
-===================================================
+Aktuelle Installations- und Konfigurationshinweise
+==================================================
gibt es:
--auf der Lx-Office Homepage unter
-http://lx-office.org/index.php?id=dokumentation
--im Lx-Office-Wiki unter Dokumentation
-http://wiki.lx-office.org/index.php/Lx-Office_ERP
--im Lx-Office-Forum:
-http://www.lx-office.org/forum/
+- auf der Lx-Office Homepage unter
+ http://lx-office.org/index.php?id=dokumentation
+
+- im Lx-Office-Wiki unter Dokumentation
+ http://wiki.lx-office.org/index.php/Lx-Office_ERP
+
+- im Lx-Office-Forum:
+ http://www.lx-office.org/forum/
=======================================
Folgende Pakete müssen installiert sein:
========================================
+
Webserver (Apache)
-PostgreSQL - Datenbank
-Perl-DBI, Perl-DBD, Perl-HTML-Template, Perl-CGI-Ajax, Perl-Class-Accessor
-Diese Pakete können bei den unterschiedlichen Distributionen anders heißen.
-(Debian: apache, postgresql, libdbi-perl, libdbd-pg-perl, libpgperl, libhtml-template-perl, libclass-accessor-perl)
-(Fedora: httpd, postgresql-server, perl-DBI, perl-DBD-Pg)
-(SuSE: apache2, postgresql-server, perl-DBI, perl-DBD-Pg)
+PostgreSQL - Datenbank
+
+Benötigte Perl-Pakete, die nicht Bestandteil einer
+Standard-Perl-Installation sind:
+
+* DBI
+* DBD::Pg
+* HTML::Template
+* CGI::Ajax
+* Class::Accessor
+* Archive::Zip
+* Text::Iconv
+* Text::CSV_XS
+* IO::Wrap (aus dem Paket IO::Stringy)
+* YAML
+* Template
+
+Diese Pakete können bei den unterschiedlichen Distributionen anders
+heißen.
+
+Für Debian beötigen Sie diese Pakete:
+
+ apache, postgresql, libdbi-perl, libdbd-pg-perl, libpgperl,
+ libhtml-template-perl, libclass-accessor-perl, libarchive-zip-perl,
+ libtext-iconv-perl, libyaml-perl, libtext-csv-perl,
+ libio-stringy-perl, libtemplate-perl
+
+Für Fedora Core beötigen Sie unter anderem diese Pakete:
+
+ httpd, postgresql-server, perl-DBI, perl-DBD-Pg
+
+Für OpenSuSE beötigen Sie diese Pakete:
+ apache2, postgresql-server, perl-DBI, perl-DBD-Pg, perl-Archive-Zip,
+ perl-Class-Accessor, perl-Text-Iconv, perl-Text-CSV_XS,
+ perl-HTML-Template, perl-IO-stringy, perl-Template-Toolkit
-Da Perl-CGI-Ajax nicht als Paket für Distributionen bereit steht, muß es mit der CPAN-Shell installiert werden.
-Leider ist dazu nicht jeder in der Lage. LxO liefert daher das Paket im CGI-Verzeichnis mit. Das sollte als Fall-Back greifen.
+
+Da Perl-CGI-Ajax nicht als Paket für Distributionen bereit steht, muß
+es mit der CPAN-Shell installiert werden. Leider gibt es Fälle, in
+denen das nicht möglich oder praktikabel ist. LxO liefert daher das
+Paket im CGI-Verzeichnis mit. Das sollte als Fall-Back greifen.
Die PostgreSQL Konfiguration muß angepasst werden.
==================================================
-In der Datei postgresql.conf (/var/lib/pgsql/data/ oder /etc/postgresql/) muß folgender Wert verändert werden:
+
+In der Datei postgresql.conf (/var/lib/pgsql/data/ oder
+/etc/postgresql/) muß folgender Wert verändert werden:
TCPIP_SOCKET = 1 # Nur PostgreSQL < 8.0
default_with_oids = on # Nur PostgreSQL >= 8.0
-In der Datei pg_hba.conf (/var/lib/pgsql/data/ oder /etc/postgresql/) müssen die Berichtigungen für den
-Zugriff geändert werden:
+In der Datei pg_hba.conf (/var/lib/pgsql/data/ oder /etc/postgresql/)
+müssen die Berichtigungen für den Zugriff geändert werden:
-alte Eintragung:
+alte Eintragung:
----------------
local all all ident sameuser
host all all 127.0.0.1 255.0.0.0 ident sameuser
-Änderung:
+Änderung:
---------
local all all trust
host all all 127.0.0.1 255.0.0.0 trust
host all lxoffice 127.0.0.1 255.255.255.255 password
-Installation des Programmpaketes
+Installation des Programmpaketes
================================
-Die Lx-Office ERP Installationsdatei (lxoffice-erp-2.4.x.tgz) in den DocumentRoot des Webservers
-(/var/www/html/ oder /srv/www/htdocs oder /var/www/) entpacken.
+
+Die Lx-Office ERP Installationsdatei (lxoffice-erp-2.4.x.tgz) in den
+DocumentRoot des Webservers (/var/www/html/ oder /srv/www/htdocs oder
+/var/www/) entpacken.
tar xvzf lxoffice-erp-2.4.x.tgz
mv lxoffice-erp/ lx-erp/
-oder noch besser, Sie verwenden einen Alias in der Webserverkonfiguration.
+oder noch besser, Sie verwenden einen Alias in der
+Webserverkonfiguration.
-Das Verzeichnis muß dem Webserverbenutzer (Debian: www-data, Fedora: apache, SuSE: wwwrun) übergeben werden:
+Das Verzeichnis muß dem Webserverbenutzer (Debian: www-data, Fedora:
+apache, SuSE: wwwrun) übergeben werden:
chown apache: -R lx-office-erp/
Datenbankbenutzer anlegen
=========================
-Es sollte zum Zugriff auf die PostgreSQL Datenbank ein Datenbankbenutzer angelegt werden. Führen Sie dazu
-folgende Befehle nacheinander aus.
+Es sollte zum Zugriff auf die PostgreSQL Datenbank ein
+Datenbankbenutzer angelegt werden. Führen Sie dazu folgende Befehle
+nacheinander aus.
su - postgres
-createuser -d lxoffice (ohne Passwort)
+createuser -d lxoffice (ohne Passwort)
oder besser
createuser -d -P lxoffice (mit Passwort)
-Wenn Sie später einen Datenbankzugriff konfigurieren, verändern Sie den evtl. voreingestellten Benutzer
-"postgres" auf "lxoffice".
+Wenn Sie später einen Datenbankzugriff konfigurieren, verändern Sie
+den evtl. voreingestellten Benutzer "postgres" auf "lxoffice".
-PostgreSQL - Datenbank erweitern
+PostgreSQL - Datenbank erweitern
================================
-In der Datenbank "template1" sollte bevor die restliche Konfiguration von LxOffice ERP erfolgt noch folgende
-Funktion hinzugefügt werden:
+
+In der Datenbank "template1" sollte bevor die restliche Konfiguration
+von LxOffice ERP erfolgt noch folgende Funktion hinzugefügt werden:
su postgres
psql template1 (Zugriff über Admintool auf die Datenbank)
create function plpgsql_call_handler ()
returns opaque
-as '/usr/lib/pgsql/plpgsql.so'
+as '/usr/lib/pgsql/plpgsql.so'
language 'c';
create language 'plpgsql' handler plpgsql_call_handler
lancompiler 'pl/pgsql';
-!!!! Bitte beachten Sie, das der Pfad zur Datei plpgsql.so und der Name von Distribution zu Distribution verschieden sein kann.
-Bei z.B. Debian befindet sie sich unter '/usr/lib/postgresql/lib/plpgsql.so'.
+!!!! Bitte beachten Sie, das der Pfad zur Datei plpgsql.so und der
+Name von Distribution zu Distribution verschieden sein kann. Bei
+z.B. Debian befindet sie sich unter
+'/usr/lib/postgresql/lib/plpgsql.so'.
-Apache Konfiguration
+Apache Konfiguration
====================
-Der Zugriff auf das Programmverzeichnis muß in der Apache Webserver- konfiguration httpd.conf
-(/etc/httpd/conf/) [bei SuSE evtl. httpd2.conf] konfiguriert werden:
+
+Der Zugriff auf das Programmverzeichnis muß in der Apache Webserver-
+konfiguration httpd.conf (/etc/httpd/conf/) [bei SuSE
+evtl. httpd2.conf] konfiguriert werden:
AddHandler cgi-script .pl
Alias /lx-erp/ /var/www/lx-erp/
Deny from All
</Directory>
-!!!Vor den einzelnen Optionen muß bei einigen Distributionen ein Plus "+" gesetzt werden.
+!!!Vor den einzelnen Optionen muß bei einigen Distributionen ein Plus
+"+" gesetzt werden.
-Auf einigen Webservern werden manchmal die Grafiken und Style-Sheets nicht ausgeliefert. Daher die Apache-Konfig um diese Zeile erweitern:
+Auf einigen Webservern werden manchmal die Grafiken und Style-Sheets
+nicht ausgeliefert. Daher die Apache-Konfig um diese Zeile erweitern:
EnableSendfile Off
-Datenbank anlegen
+Datenbank anlegen
=================
-Das Administrationsmenü finden Sie unter:
+
+Das Administrationsmenü finden Sie unter:
http://localhost/lx-erp/admin.pl
-Zuerst muß eine Datenbank angelegt werden. Anschließend ein Benutzer. Verwenden Sie für den
-Datenbankzugriff den eben angelegten Benutzer lxoffice.
+Zuerst muß eine Datenbank angelegt werden. Anschließend ein
+Benutzer. Verwenden Sie für den Datenbankzugriff den eben angelegten
+Benutzer lxoffice.
+
+Wenn Sie für die Lx-Office-Installation nicht den europäischen
+Schriftsatz ISO-8859-15 sondern UTF-8 (Unicode) benutzen wollen, so
+müssen Sie vor dem Anlegen der Datenbank in der Datei 'lx-erp.conf'
+die Variable '$dbcharset' auf den Wert 'UTF-8' setzen. Zusätzlich muss
+beim Anlegen der Datenbank 'UTF-8 Unicode' als Schriftsatz ausgewählt
+werden.
OpenDocument-Vorlagen
=====================
+
Lx-Office unterstützt die Verwendung von Vorlagen im
OpenDocument-Format, wie es OpenOffice.org ab Version 2
erzeugt. Lx-Office kann dabei sowohl neue OpenDocument-Dokumente als
werden, wenn die Konvertierung nach PDF fehlschlägt.
-Lx-Office ERP verwenden
+Lx-Office ERP verwenden
=======================
-Einloggen können Sie sich unter:
+
+Einloggen können Sie sich unter:
http://localhost/lx-office-erp/login.pl
+
+Die Administrationsseite erreichen Sie unter:
+
+http://localhost/lx-office-erp/admin.pl
** BITTE FERTIGEN SIE VOR DEM UPGRADE EIN BACKUP IHRER DATENBANK(EN) AN! **
+Upgrade von v2.4.0 und neuer auf v2.4.3
+=======================================
-Upgrade von v2.4.0 auf 2.4.1
-============================
+Ein Upgrade von v2.4.0 oder neuer auf v2.4.3 aus zwei Teilen: den
+Dateien (einfaches Entpacken und Kopieren in das
+Installationsverzeichnis genügen) sowie dem Datenbankupgrade.
+
+ Neue Variablen in der Datei lx-erp.conf
+ ---------------------------------------
+
+Wenn Sie eine eigene Version der Konfigurationsdatei "lx-erp.conf"
+einsetzen und diese nicht mit der Standardkonfigurationsdatei
+überschreiben, so beachten Sie bitte, dass die folgenden neuen
+Variablen hinzugekommen sind und von Ihnen manuell ergänzt werden
+sollten: $html2ps_bin, $ghostscript_bin, $pg_dump_exe und
+$pg_restore_exe. Die Variable '$jscalendar' kann hingegen entfernt
+werden, da sie nicht mehr benötigt wird.
+
+Die Standardwerte für diese Variablen finden Sie in der Datei
+"lx-erp.conf.default".
+
+ Neue Abhängigkeiten von Perl-Modulen
+ ------------------------------------
-Ein Upgrade von v2.4.0 auf v2.4.1 besteht aus zwei Teilen: den Dateien
-(einfaches Entpacken und Kopieren in das Installationsverzeichnis
-genügen) sowie dem Datenbankupgrade.
+Bitte beachten Sie auch die Liste der benötigten Perl-Module am Anfang
+der Datei "doc/INSTALL". Seit Version 2.4.0 sind die folgenden Module
+neu hinzugekommen:
+
+- Achive::Zip
+- IO::Wrap (aus dem Paket "IO::Stringy")
+- Template
+- Text::CSV_XS
+- Text::Iconv
+- Time::HiRes
+- YAML
+
+Nach Möglichkeit sollten auch die aktuellen Versionen der
+Datenbankpakete "DBI" und "DBD::Pg" installiert werden.
+
+ Datenbankupgrade
+ ----------------
+
+Das Datenbankupgrade wird automatisch gestartet, wenn sich der erste
+Benutzer nach dem Upgrade der Dateien an Lx-Office anmeldet.
+
+** BITTE FERTIGEN SIE VOR DEM UPGRADE EIN BACKUP IHRER DATENBANK(EN) AN! **
+
+
+Upgrade von v2.4.0 auf 2.4.1 sowie von 2.4.1 auf 2.4.2
+======================================================
+
+Ein Upgrade von v2.4.0 auf v2.4.1 oder von v2.4.1 auf v2.4.2 besteht
+aus zwei Teilen: den Dateien (einfaches Entpacken und Kopieren in das
+Installationsverzeichnis genügen) sowie dem Datenbankupgrade.
+
+Bitte beachten Sie auch die Liste der benötigten Perl-Module am Anfang
+der Datei "doc/INSTALL". Besonders nach einem Upgrade auf 2.4.2 muss
+sichergestellt werden, dass das Modul "YAML" installiert ist.
Das Datenbankupgrade wird automatisch gestartet, wenn sich der erste
Benutzer nach dem Upgrade der Dateien an Lx-Office anmeldet.
** BITTE FERTIGEN SIE VOR DEM UPGRADE EIN BACKUP IHRER DATENBANK(EN) AN! **
Anders als beim Upgrade auf 2.4.0 handelt es bei den Datenbankupgrades
-auf 2.4.1 nur um automatisch ablaufende Scripte, die keine
+auf 2.4.1 und 2.4.2 nur um automatisch ablaufende Scripte, die keine
Benutzereingaben erfordern.
Teilen: den Dateien (einfaches Entpacken und Kopieren in das
Installationsverzeichnis genügen) sowie dem Datenbankupgrade.
+Bitte beachten Sie auch die Liste der benötigten Perl-Module am Anfang
+der Datei "doc/INSTALL".
+
Das Datenbankupgrade wird automatisch gestartet, wenn sich der erste
Benutzer nach dem Upgrade der Dateien an Lx-Office anmeldet.
####################################\r
# Veraenderungen von Lx-Office ERP #\r
####################################\r
+\r
+\r
+2007-07-13 - Version 2.4.3\r
+\r
+ Neue Features und Verbesserungen:\r
+\r
+ - Zahlungskonditionen: Neue Variablen <%invtotal_wo_skonto%> und\r
+ <%total_wo_skonto%> hinzugefügt, die die Belegsumme bzw. die noch\r
+ offene Summe abzüglich des Skontobetrags beinhalten.\r
+ - Verkauf: Es wird der Ertrag (Marge) pro Position und gesamt\r
+ angezeigt.\r
+ - Bei allen Listenansichten/Berichten Buttons zum Export der Liste\r
+ als CSV- oder als PDF-Datei implementiert. Dieses PDF kann auch\r
+ direkt gedruckt werden. Zusätzlich wird die aktuelle\r
+ Sortierspalte und -richtung angezeigt.\r
+ - Eingangsrechnung: Als Rechnungsdatum wird das Datum der letzten\r
+ Eingangsrechnung vorausgewählt. Zusätzlich wird das\r
+ Fälligkeitsdatum in Abhängigkeit von den beim Lieferanten\r
+ ausgewählten Zahlungsbedingungen gesetzt.\r
+ - Kundenauftrag/Lieferantenbestellung: Wenn alle Positionen\r
+ vollständig geliefert wurden (also in allen Positionen der\r
+ Lagerein-/-ausgang == Anzahl ist), so wird beim Speichern das Flag\r
+ "Gelifert" automatisch gesetzt.\r
+ - Kunden-/Lieferantenstammdaten: Beim Ansprechpartner steht in der\r
+ Drop-Down-Box oben 'Neuer Ansprechpartner' anstelle eines leeren\r
+ Eintrages, damit der Benutzer besser weiß, was hier passiert.\r
+ - Neue Funktion "als bezahlt markieren" bei Rechnungen.\r
+ - Alle Rechnungsmasken: Unterhalb der Zahlungsein- und -ausgänge\r
+ werden die bisher gezahlte Summe und der noch ausstehende Betrag\r
+ angezeigt.\r
+ - Mahnwesen:\r
+ * Bei den Mahnungsübersichten wurden Checkboxen eingefügt, mit\r
+ denen alle Einträge an- und abgewählt werden können.\r
+ * Beim Anlegen von Mahnungen können automatisch\r
+ Debitorenrechnungen über die Mahngebühren und Zinsen angelegt\r
+ werden. Diese werden ebenfalls als PDF ausgedruckt.\r
+ * Beim Bericht über aktive Mahnungen können jetzt mehrere\r
+ Mahnungen und die dazugehörigen Rechnungen über Gebühren und\r
+ Zinsen gleichzeitig ausgedruckt werden.\r
+ * Mahnungen können wahlweise am Bildschirm oder direkt auf\r
+ Druckern ausgegeben werden. Zusätzlich können andere Sprachen\r
+ ausgewählt werden.\r
+ - Debitoren- und Kreditorenrechnungen können storniert werden.\r
+ - Beim Erstellen eines Lieferantenauftrages aus einem Kundenauftrag\r
+ wird überprüft, ob eine Lieferadresse ausgewählt oder eingegeben\r
+ war. Wenn ja, so wird der Benutzer gefragt, ob er diese\r
+ Lieferadresse beibehalten will, damit der Lieferant direkt an den\r
+ Kunden liefern kann.\r
+ - Datenbankadministration: Eine Backup- und eine\r
+ Wiederherstellungsfunktionen für einzelne Datenbanken\r
+ implementiert.\r
+ - In den Drop-Down-Boxen mit den Lieferanschriften werden nun der\r
+ Name, die Abteilung, die Straße und der Ort angezeigt, um\r
+ Lieferadressen besser unterscheiden zu können.\r
+ - Bei Einkaufs-/Verkaufsmasken sowie bei Debitoren- und\r
+ Kreditorenbuchungen wird ein Button angezeigt, der ein\r
+ Popupfenster öffnet, das zum ausgewählten Kunden/Lieferanten alle\r
+ Stammdaten inklusive Ansprechpartner und Lieferadressen anzeigt.\r
+ - Die Einkaufs- und Verkaufsmasken wurden etwas aufgeräumt und\r
+ übersichtlicher gestaltet.\r
+ - Dialogbuchen:\r
+ * Neue Checkbox "Details anzeigen", die einige Spalten verbirgt,\r
+ wenn sie nicht aktiv ist.\r
+ * Der in der ersten Zeile bei "Soll" eingetragene Wert wird\r
+ automatisch in die zweite Zeile bei "Haben" eingetragen.\r
+ * Es wird das Datum und die Nummer der letzten Buchung angezeigt.\r
+ - Wenn eine Datei 'lx-erp-local.conf' existiert, so wird diese nach\r
+ der 'lx-erp.conf' eingelesen.\r
+ - Unterstützung für andere Zeichensätze als ISO-8859-1 und\r
+ ISO-8859-15 (z.B. UTF-8) implementiert.\r
+ - Die Farbgebung des JavaScript-Menüs wurde an die Farbgebung des\r
+ CSS-Menüs angepasst.\r
+ - Die Masken zum Auflisten und Bearbeiten von Konten wurden\r
+ grundlegend überarbeitet und vereinfacht.\r
+ - Ein neues Feld 'Vorgangsbezeichnung' bei allen Einkaufs- und\r
+ Verkaufsmasken hinzugefügt.\r
+ - Das Kommandozeilentool 'scripts/dbupgrade2_tool.pl' kann jetzt\r
+ Datenbankupgrades einspielen.\r
+ - Bei den Listen der Einkaufs- und Verkaufsrechnungen wird in der\r
+ Spalte "Typ" noch genauer unterschieden.\r
+ - Die History-Funktion speichert nun auch Rechnungs-,\r
+ Angebotsnummern etc.\r
+ - Die Funktionen zum Bearbeiten der HTML- und LaTeX-Vorlagen wurden\r
+ komplett neu geschrieben. Es ist jetzt auch möglich, Vorlagen für\r
+ die vom Benutzer eingerichteten Sprachen und Drucker zu erstellen\r
+ und zu bearbeiten. Außerdem können die Vorlagen für alle\r
+ konfigurierten Mahnstufen bearbeitet werden.\r
+ - Beim Verschicken von Sammelrechnungen per Email wird der Name des\r
+ Anhangs besser gewählt (z.B. "Sammelrechnung_Datum.pdf").\r
+ - Bei Kundenaufträgen wird die Checkbox "geliefert" auch angezeigt,\r
+ bevor der Auftrag gespeichert wurde.\r
+ - Eingabefelder für Datumsangaben und Zahlen werden nun per\r
+ Javascript auf falsche Formate überprüft (noch nicht\r
+ flächendeckend implementiert).\r
+ - Wenn bei Einkaufs-/Verkaufs-/Debitoren- oder Kreditorenmasken der\r
+ Kunde/Lieferant per Drop-Down-Box gewechselt wird, so wird das\r
+ Formular automatisch erneuert.\r
+ - Kunden- und Lieferantenstammdatenberichte können jetzt nach\r
+ Kunden-/Lieferantentyp gefiltert werden.\r
+ - Bei Kunden- und Lieferantenstammdatenberichten werden\r
+ standardmäßig nur noch die gültigen Einträge angezeigt. Die\r
+ ungültigen können zusätzlich angezeigt werden.\r
+ - Bei Einkaufs- und Verkaufsmasken ist es nun möglich, keinen\r
+ Ansprechpartner auszuwählen.\r
+ - Kunden kann ein Verkäufer zugewiesen werden. In den\r
+ Verkaufsmasken kann jedem Beleg zusätzlich zum Bearbeiter ( =\r
+ aktueller Lx-Office-Benutzer) noch ein separater Verkäufer\r
+ zugeordnet werden, der mit dem beim Kunden hinterlegten Verkäufer\r
+ vorbelegt ist.\r
+ - Bei "Als neu speichern" wird nur dann eine neue Rechnungs-,\r
+ Angebotsnummer etc vergeben, wenn die bisherige Nummer nicht\r
+ manuell verändert wurde. Ansonsten wird die Eingabe des Benutzers\r
+ beibehalten.\r
+ - Einkaufs-/Verkaufsmasken: zur Berechnung des Fälligkeitsdatum\r
+ werden anstelle des nicht mehr existierenden Zahlungsziels die\r
+ ausgewählten Zahlungsbedingungen benutzt.\r
+\r
+ Bugfixes:\r
+\r
+ - Zahlungskonditionen: Die Variablen <%total%> und <%invtotal%>\r
+ waren nur bei Rechnungen gefüllt, nicht aber bei Angeboten und\r
+ Aufträgen.\r
+ - Es wurde verhindert, dass durch Manipulation von $form->{callback}\r
+ beliebiger Code ausgeführt werden kann.\r
+ - Webdav: Wenn eine Pfadkomponente Leerzeichen enthielt\r
+ (z.B. "Storno zu ..."), dann wurden komplett falsche Links erzeugt.\r
+ - Bei Einkaufsrechnungen wurde das falsche Datumsfeld zur Berechnung\r
+ der Steuern herangezogen, sodass für 2006 19% benutzt wurde.\r
+ - Beim Erfassen von Dienstleistungen wurde beim "Erneuern" die\r
+ Drop-Down-Box für die Zahlungskonditionen nicht erneut aufgebaut.\r
+ - Beim Aufrufen bestehender Dialogbuchungen wurde das Feld 'Beleg'\r
+ nicht aus der Datenbank geholt.\r
+ - Webdav: Beim Erstellen der Ordner werden Pfadtrennzeichen (also\r
+ '/' und '\') durch Unterstriche ersetzt.\r
+ - In der Buchungsliste wurden Buchungen zusammengefasst, wenn ihre\r
+ Beschreibungsfelder identisch waren, auch wenn sie aus\r
+ unterschiedlichen Buchungen stammten.\r
+ - Bei der Suche nach Artikeln wird nicht mehr zwischen Groß- und\r
+ Kleinschreibung unterschieden.\r
+ - Die Funktionen zum Buchen von Zahlungsein- und -ausgängen wurde\r
+ komplett neu geschrieben und bezieht seine Daten direkt aus der\r
+ Datenbank, um bisherige Zahlungsein- und -ausgänge vor dem Buchen\r
+ der neuen Einträge zu entfernen.\r
+ - Der Wechselkurscode wurde komplett überarbeitet.\r
+ - Datenbankadministration: Die Funktion zur Aktualisierung von\r
+ Datenbanken so angepasst, dass sie auch die Scripte in\r
+ sql/Pg-upgrade2 verarbeiten kann.\r
+ - Nullbuchungen ( = Buchungen in der Finanzbuchhaltung mit Wert 0)\r
+ werden nicht mehr zugelassen.\r
+ - Die GuV zeigt die echten Werte und nicht mehr Beträge an.\r
+ - Angebots-/Rechnungsnummern etc werden um Leerzeichen am Anfang und\r
+ Ende bereinigt, sodass verhindert wird, dass Lx-Office leere\r
+ Nummern erzeugt, die später in der Liste der Belege nicht\r
+ anwählbar sind.\r
+ - Beim Stornieren aller Belege werden die Daten aus der Datenbank\r
+ geladen und nicht die vom Benutzer im Formular eingetragenen Daten\r
+ benutzt.\r
+ - Beim Stornieren von Einkaufs- und Verkaufsrechnungen wurden die\r
+ bisherigen Zahlungsaus- und -eingänge auch in der neuen\r
+ Stornorechnung verzeichnet.\r
+ - Alle Systemaufrufe (z.B. "system") und Pfadangaben (z.B. bei\r
+ "open") werden vor Verwendung überprüft und bereinigt.\r
+ - Alle Datenbankanfragen wurden auf die Verwendung von\r
+ parametrisierten Queries umgestellt. Wo dies nicht möglich war,\r
+ wurden Werte richtig gequotet.\r
+ - Mahnwesen:\r
+ * Die Dokumentation zu den Vorlagenvariablen wurde um die im\r
+ Mahnungswesen verfügbaren Variablen erweitert.\r
+ * In der Liste der neu zu erstellenden Mahnungen wurden die\r
+ Gebühren und Zinsen falsch angezeigt.\r
+ * Bereits angemahnte Rechnungen wurden zu früh zur erneuten\r
+ Mahnung angeboten.\r
+ * Beim Anlegen wurde eine Mahnstufenkonfiguration für alle\r
+ Rechnungen benutzt, auch wenn unterschiedliche Stufen vom\r
+ Benutzer ausgewählt waren.\r
+ * Es konnten Mahnungen erstellt werden, die Rechnungen\r
+ verschiedener Kunden enthielten.\r
+ - Beim Anlegen neuer Rechnungen wurde das Kreditlimit der\r
+ Lieferanten nicht richtig berechnet.\r
+ - In den Einkaufs- und Verkaufsmasken wurde die Drop-Down-Box für\r
+ die Steuerzone bei jedem Aufbau auf "Inland" zurückgesetzt.\r
+ - Nummernkreise können jetzt auch Sonderzeichen wie\r
+ Gleichheitszeichen enthalten.\r
+ - Beim Umwandeln von Lieferantenaufträgen in Kundenaufträge und\r
+ umgekehrt wird die Auftragsnummer gelöscht, damit sie beim\r
+ Speichern automatisch aus dem richtigen Nummernkreis neu vergeben\r
+ oder vom Benutzer eingegeben werden kann.\r
+ - Stornierte Rechnungen werden bei den Listen der offenen\r
+ Forderungen und Verbindlichkeiten nicht mehr angezeigt.\r
+ - Einkaufs- und Verkaufsbelege werden beim Verschicken per Email nur\r
+ dann vorher gespeichert, wenn sie noch gar nicht gespeichert\r
+ waren. Außerdem werden die Zahlenformatierungen richtig beachtet.\r
+ - Kunden-/Lieferantennamen mit Zeilenumbrüchen im Namen werden\r
+ bereinigt.\r
+ - Lieferadressen werden nun nicht mehr doppelt gespeichert.\r
+ - Beim Bearbeiten von Lieferanschriften wurden die Abteilungs-Felder\r
+ der Rechnungsadresse nicht angezeigt.\r
+ - Wenn "Stuer im Preis inbegriffen" angeklickt war, dann wurden die\r
+ falschen Beträge beim Drucken in den Summenvariablen hinterlegt.\r
+ - Die Einheiten bei Erzeugnissen wurden in Einkaufs- und\r
+ Verkaufsrechnungen nicht richtig angezeigt.\r
+ - Große Teile toten Codes entfernt (u.a. zum Thema GIFI, customer\r
+ tax, vendor tax).\r
+ - Beim Erstellen von Aufträgen/Buchungen aus der\r
+ Kunden-/Lieferantenstammdatenmaske heraus wurden die Bemerkungen\r
+ des Kunden/Lieferanten nicht in die internen Bemerkung des neuen\r
+ Beleges übernommen.\r
+ - Bei Buchungen mit "Zahlung buchen" wird der Steuerschlüssel\r
+ richtig gespeichert.\r
+ - Dialogbuchen: Bei neu hinzugefügten Zeilen wird der\r
+ Steuerschlüssel richtig vorausgewählt.\r
+ - Tab-Indices wurden entfernt, weil sie unvollständig waren und\r
+ dadurch die Navigation per Tab-Taste unnötig erschwert wurde.\r
+ - Dialogbuchen, Debitorenbuchungen: Wird das Buchungsdatum\r
+ verändert, so wird der Steuerschlüssel unter Beibehaltung des\r
+ ausgewählten Kontos richtig gesetzt.\r
+ - Der Storno-Button wird nur angezeigt, wenn die Rechnung noch nicht\r
+ storniert wurde. Zusätzlich wurde das mehrmalige Stornieren\r
+ verhindert.\r
+ - Rechnungs- und Gutschriftsnummern werden nun direkt innerhalb der\r
+ Backend-Routinen innerhalb der gleichen Transaktion vergeben, in\r
+ der auch die eigentliche Rechnung etc gespeichert wird. Damit soll\r
+ besser verhindert werden, dass sich Löcher in den Nummernkreisen\r
+ ergeben.\r
+ - SKR 03: Mehrere falsche Einträge bezüglich der Steuerschlüssel\r
+ wurden behoben.\r
+ - Dialogbuchen: Beim Aufrufen bestehender Buchungen werden die\r
+ Projektnummern richtig in der Drop-Down-Box vorausgewählt.\r
+ - Bei Debitoren-, Kreditoren- und Dialogbuchungsmasken werden die\r
+ Steuerkonten richtig vorausgewählt, wenn die Masken geöffnet werden.\r
+ - Nachkommastellen bei Einkaufspreisen bei Dienstleistungen\r
+ verschwanden beim Speichern.\r
+ - Verbesserung des USTVA-Moduls für den Einsatz in Österreich\r
+ - Diverse Fehler im USTVA-Modul behoben\r
+\r
+ - Bugfix 713 - eMail als Interne Notiz in Verkaufs-/\r
+ Einkaufs-Dokumenten\r
+ - Bugfix 710 - Einkaufsrechnungen von 2006 werden mit 19% Steuer\r
+ verrechnet\r
+ - Bugfix 703 - Drucken eines Lieferantenauftrages erzeugt SQL-ERROR\r
+ - Bugfix 701 - Verkauf -> Auftrag erfassen -> Löschen\r
+ - Bugfix 700 - Verkauf -> Auftrag erfassen -> Rechnung\r
+ - Bugfix 691 - Es können beliebig viele Mahnungen erzeugt werden\r
+ - Bugfix 690 - keine Rechnung über 0,00€ möglich\r
+ - Bugfix 689 - Nach DB-Update kein weiter-Button\r
+ - Bugfix 686 - Historien-Button unter Stammdaten->Projekt erfassen\r
+ - Bugfix 685 - Stammdaten -> Dienstleistung erffassen\r
+ Zahlungskonditionen nach "Erneuern"\r
+ - Bugfix 684 - Stammdaten -> Dienstleistung erffassen Formel hat keine textarea\r
+ - Bugfix 681 - Debitorenbuchungen: Liste als PDF exportieren\r
+ - Bugfix 678 - Nummernkreise für selbst angelegte Kundentypen werden\r
+ nicht übernommen\r
+ - Bugfix 675 - zurück-button in "Lx-Office ERP\r
+ Datenbankadministration / Datenbank sichern" fehlt\r
+ - Bugfix 670 - Mahnung anlegen\r
+ - Bugfix 668 - Datenbankupdate schlägt fehl\r
+ - Bugfix 662 - Storno von Dialogbuchung erzeugt fehlermeldung\r
+ - Bugfix 661 - Einkaufsrechnung: Selectbox Lieferant ist falsch\r
+ sortiert oder unsortiert\r
+ - Bugfix 658 - Beim Aufrufen eines Belegs wird der Bearbeiter nicht\r
+ mehr angezeigt\r
+ - Bugfix 657 - Wenn für Kunden/Lieferanten keine Dropdownbox\r
+ angezeigt wird, steht die interne ID mit im Feld\r
+ - Bugfix 656 - Angebot löschen geht nicht\r
+ - Bugfix 655 - Verkaufsangebot bearbeiten: Währungseinheit EUR,\r
+ Wechselkurs: 0,000,\r
+ - Bugfix 654 - In der PDF Ausgabe von Verkaufsrechnungen fehlen\r
+ Kundendaten\r
+ - Bugfix 653 - Stammdaten Waren Suche nach Hersteller schlägt fehl\r
+ - Bugfix 652 - Datenbankadministration / Datenbank sichern per\r
+ Email: Ungültiges Passwort\r
+ - Bugfix 651 - Kreditorenbuchung, Debitorenbuchung:Zahlung erfassen:\r
+ Fehler Nullbuchung!\r
+ - Bugfix 650 - admin.pl: Benutzer ändern, speichern, Fehler\r
+ - Bugfix 646 - Dialogbuchungen: Storno von Stornobuchungen ist\r
+ möglich.\r
+ - Bugfix 645 - Kreditorenbuchung Historie funktioniert nicht\r
+ - Bugfix 644 - Der Javascriptcheck für Zahleneingaben bei Zahlungen\r
+ zeigt Fehler, wo keine sind.\r
+ - Bugfix 643 - Storno macht probleme bei kommazahlen in der Zahlung\r
+ - Bugfix 642 - Kreditorenbuchung Storno funktioniert nicht |\r
+ - Bugfix 641 - Debitorenbuchung Storno funktioniert nicht\r
+ - Bugfix 640 - Einkaufsrechnungen Storno funktioniert nicht\r
+ - Bugfix 639 - Ausgangsrechnungen: Checkbox Steuer im Preis\r
+ inbegriffen funktioniert nicht\r
+ - Bugfix 638 - Redirect übernimmt keine Mitarbeiter Filterkriterien\r
+ - Bugfix 637 - Es können Belege mit Leerzeichen als Belegnummer\r
+ angelegt werden\r
+ - Bugfix 636 - Keine Lagerveränderung bei Gutschrift\r
+ - Bugfix 633 - Mahnwesen stimmt Abstand zwischen verschiedenen\r
+ Mahnstufen nicht\r
+ - Bugfix 631 - Wenn Mahnungen für mehrere Kunden erzeugt werden,\r
+ haben alle die gleiche Adresse\r
+ - Bugfix 630 - Fehler beim anklicken einer Referenz bei Übersicht\r
+ Zahlungsein/ausgang\r
+ - Bugfix 629 - Buchungen werden in die Historie aufgenommen, obwohl\r
+ die Buchung noch nicht vollzogen wurde\r
+ - Bugfix 626 - Logout bei diversen Funktionsaufrufen\r
+ - Bugfix 625 - Fehler in WebDAV\r
+ - Bugfix 624 - Rückerstattungen erhöhen Aufwandskonten in GuV\r
+ anstatt sie zu verringern\r
+ - Bugfix 622 - UTF-8-Zeichensatz wird immer angezeigt\r
+ - Bugfix 619 - Rechnungsversand via eMail erzeugt 10fache\r
+ Positionsbeträge\r
+ - Bugfix 618 - Buchung mit verschiedenen Steuersätzen aufs gleiche\r
+ Konto schlägt fehl\r
+ - Bugfix 617 - GuV - Position Umsatzsteuer 7%\r
+ - Bugfix 614 - Drucken und Emailen von offener Rechnung erzeugt zwei\r
+ duplikate der Rechnung\r
+ - Bugfix 613 - Entwurf speichern geht nur bei neuen Rechnungen,\r
+ nicht bei bereits angelegten\r
+ - Bugfix 610 - Rechnung drucken erzeugt Postgresfehler\r
+ - Bugfix 609 - Longdescription wird nicht gequoted/escaped\r
+ - Bugfix 608 - Feld Titel bei Kunden > Ansprechpartner = zu kurz\r
+ - Bugfix 607 - Emailen von noch nicht gebuchten Rechnung bucht\r
+ Rechnung nicht\r
+ - Bugfix 603 - Interne Bemerkungen werden nicht weiter gegeben\r
+ - Bugfix 602 - Mahnungen werden falsch angezeigt nach Erstellung\r
+ - Bugfix 598 - Angebotsnummer bei "Angebot als neu speichern"\r
+ übernehmen\r
+ - Bugfix 596 - neue Zahlenformate wirken nicht auf alle Zahlen in\r
+ Formularen\r
+ - Bugfix 595 - Link fuer neues Fenster in der Uhrzeitlinie\r
+ - Bugfix 592 - eventual / alternativ im Angebot ermöglichen\r
+ - Bugfix 585 - USTVA - doppelt minus = plus |\r
+ - Bugfix 583 - Zahlungen werden ohne taxkey in der acc_trans\r
+ gespeichert\r
+ - Bugfix 582 - Verkaufsrechnung: Steuerschlüssel stimmen nicht mit\r
+ identischer Debitorenbuchung überein.\r
+ - Bugfix 581 - Debitorenbuchung: Steuerschlüssel stimmen nicht mit\r
+ identischer Verkaufsrechnung überein.\r
+ - Bugfix 579 - UStVA wird falsch berechnet\r
+ - Bugfix 578 - Rechnung erfassen - wenn artikel ein erzeugnis ist\r
+ die Einheit falsch\r
+ - Bugfix 577 - Debitorenbuchung: Falsches Konto wird ausgewählt nach\r
+ update\r
+ - Bugfix 576 - Nettosumme bei MwSt incl.\r
+ - Bugfix 575 - Diskrepanzen zwischen Storno einer Rechnung und\r
+ Originalrechnung\r
+ - Bugfix 574 - Links besser hervorheben\r
+ - Bugfix 573 - r2023- Dialogbuchung: Falsche Steuersätze werden\r
+ ausgewählt\r
+ - Bugfix 572 - Kreditorenbuchung nicht moeglich\r
+ - Bugfix 567 - Nachkommastellen vom Einkaufspreis verschwinden\r
+ - Bugfix 564 - Datev Export in Version 2.4.0, 2.4.1 rechnet immer\r
+ mit 19 Prozent Umsatzsteuer\r
+ - Bugfix 553 - neue Fehlermeldung im Mahnlauf\r
+ - Bugfix 543 - Keine Auftragsbearbeitung bei Kunden mit\r
+ Zeilenumbruch im Firmenname\r
+ - Bugfix 526 - Konto 1588 (Einfuhrumsatzsteuer) wird bei UStVA\r
+ ignoriert\r
+ - Bugfix 523 - Mehrfachstornierungen möglich\r
+ - Bugfix 473 - Fehler bei der Mahnungsausgabe\r
+ - Bugfix 472 - stornierte Rechnung taucht nicht in Buchungsjounal\r
+ auf\r
+ - Bugfix 435 - r1379:Datenbankupgrade über admin.pl schlägt fehl\r
+ - Bugfix 428 - Anzeige der Grafik einer Kontaktperson in\r
+ Kontaktpersonübersicht fehlerhaft\r
+ - Bugfix 414 - Dialogbuchen nicht vorhandenes Feld Projekt Bezug auf\r
+ Bug 149\r
+ - Bugfix 405 - Suchbegriffe mit Umlauten werden nicht gefunden\r
+ - Bugfix 342 - Datumsangaben werden nicht auf Korrektheit geprüft\r
+ - Bugfix 328 - Quoten auch in der ap, oder?\r
+ - Bugfix 324 - SQL-Fehler bei Zahlungsausgang\r
+ - Bugfix 313 - update wechselkurstabelle\r
+ - Bugfix 272 - syntax fehler in hidden-form-feldern\r
+ - Bugfix 269 - Buchungen lassen sich beliebig oft stornieren\r
+ - Bugfix 242 - Splittbuchen: Debitorenbuchung diverse Fehler\r
+ - Bugfix 211 - Debitoren und Kreditorenbuchung mit mehreren\r
+ Buchungszeilen\r
+ - Bugfix 208 - Buchungsjournal: Fehlbuchungen anzeigen\r
+ - Bugfix 172 - Zeilenumbruch in <%partnotes%> wird in Latex als ^M\r
+ dargestellt\r
+ - Bugfix 152 - Kein Projekt-Eingabefeld beim Dialogbuchen ...\r
+ - Bugfix 149 - projekt_id wird nicht in acc_trans eingetragen bei\r
+ Rechnungserstellung\r
+ - Bugfix 62 - Usability: Nach Dialogbuchung Formular wieder anzeigen\r
+ - Bugfix 93 - Keine negativen Konten in GuV\r
+\r
+2007-02-23 - Version 2.4.2\r
+\r
+ - USTVA Buchungsgruppe Inland: Konten angepasst und getestet\r
+ - USTVA IST und Soll Versteuerung: Querys angepasst und getestete\r
+ - USTVA Testscript\r
+ - Kontenplan: Mehr Informationen in die Tabelle gebracht. Darstellung in\r
+ HTML::Template realisiert.\r
+ - Betr. Steueranzeige unterhalb von Rechnungen, Angeboten, etc: an die neuen\r
+ Taxkeys angepasst.\r
+ - Unbalanced Ledger Fehlermeldung im Buchungsjournal wieder hinzugefuegt.\r
+ Das Buchungsjournal wird immer dargestellt. Im Falle eines Fehlers\r
+ (soll+vst) - (haben+ust) > 0.001\r
+ wird im Tabellenfuss die 'Unbalanced Ledger' Meldung ausgegeben mit dem\r
+ Bilanzfehlerbetrag.\r
+ - Einkaufs-, Verkaufs-, Debitoren- und Kreditorenrechnungen können\r
+ als Entwurf gespeichert und später weiter bearbeitet werden. Dabei\r
+ werden sie nicht gebucht.\r
+ - Vorlagenausdruck: Variablen "fax", "phone" und "email" bei\r
+ Kundenstammdaten werden nun auch als "customerfax",\r
+ "customerphone" und "customeremail" zur Verfügung gestellt.\r
+ - Globale Projektnummern bei Einkaufs- und Verkaufsbelegen hinzugefügt.\r
+ Nach Projektnummern kann gefiltert werden, und sie können in der Liste\r
+ mit angezeigt werden (auch in der Finanzbuchhaltung). Projektnummern\r
+ werden als Drop-Down-Box angezeigt.\r
+ - Bugfixes und Code-Reorganisierung beim "Webdav"-Feature. Beim\r
+ Anlegen von Verzeichnissen werden auch eventuell fehlende\r
+ Elternverzeichnisse angelegt. Bei jedem Neuaufbau der Maske wird\r
+ die Liste der vorhandenen Dateien aktualisiert, nicht nur beim\r
+ Speichern & Laden.\r
+ - Bei höheren Mahnstufen wurde die Rechnung mehrmals angezeigt\r
+ - In der Uebersicht der Mahnungen hat ein Klick auf die Rechnungsnummer\r
+ nicht die Rechnungsmaske geöffnet\r
+ - Kundenbericht liess sich nicht nach Adresse sortieren\r
+ - Bei Einkaufs- und Verkaufsmasken Felder für Angebots- und Auftragsdatum\r
+ hinzugefügt\r
+ - Keine Fehlermeldung beim Drucken von Proforma-Rechnungen mehr\r
+ - Mahnungen können nachträglich erneut ausgedruckt werden\r
+ - Zahlungskonditionen können für jede Sprache übersetzt werden\r
+ - Buchungsgruppen und Zahlungskonditionen können in den Systemeinstellungen\r
+ umsortiert werden (damit auch andere Standardbuchungsgruppe beim Anlegen\r
+ von Waren auswählbar)\r
+ - Debitoren- und Kreditorenbuchungen: Neue Funktion zum Buchen von\r
+ Zahlungsein- und ausgängen\r
+ - Debitoren- und Kreditorenbuchungen: Beim Aufrufen aus dem Buchungsjournal\r
+ werden die Gegenkonten richtig angezeigt\r
+ - In den Benutzereinstellungen können Standardwerte für den Ausgabekanal\r
+ und den Drucker eingestellt werden, die von Lx-Office vorselektiert werden\r
+ - Neues Flag "Geliefert" bei Auftragsbestätigungen und Lieferantenaufträgen\r
+ - Bei Einkaufsrechnungen gibt es einen "Erneuern"-Button, um\r
+ Zahlungsausgänge besser buchen zu können\r
+ - Bei Debitoren-/Kreditorenbuchungen sowie bei Dialogbuchungen wird\r
+ das vorbelegte Datum jetzt aus der richtigen Tabelle geholt\r
+ - Bei EUR wurden in der Kontenliste keine unbezahlten Rechnungen angezeigt\r
+ - EAN-Codes hinzugefügt\r
+ - Einkauf/Verkauf: Es werden jetzt auch Positionen gespeichert und\r
+ ausgedruckt, deren Anzahl 0 ist\r
+ - CSS-Menü funktioniert nun auch mit dem Internet Explorer\r
+ - Beim Verschicken per Email kann dem Anhang ein individueller Name gegeben\r
+ werden, der mit "Belegart_Belegnummer.ext" vorbelegt ist (z.B.\r
+ "Rechnung_5.pdf")\r
+ - Administration: Datenbankencodingoption Latin 9 (ISO-8859-15) hinzugefügt\r
+ - Beim Login wird überprüft, ob alle benötigten Perl-Module installiert\r
+ sind\r
+ - Funktion "Details anzeigen" hat auf einigen Browsern nicht richtig\r
+ funktioniert\r
+ - Beim Bearbeiten der Lieferadresse wird die Rechnungsadresse wieder\r
+ angezeigt\r
+ - Variable "terms" (Zahlungsziel in Tagen) wurde entfernt, weil es\r
+ mit Zahlungskonditionen ein wesentlich mächtigeres Werkzeug gibt\r
+ - Mehr Sonderzeichen werden in die richten LaTeX-Codes übersetzt\r
+ - USTVA Screens in HTML-Templates verlagert\r
+ - USTVA Taxbird kleinere Anpassungen zur Kompatibilität\r
+ - Bugfix 546 - sql/Pg-upgrade2 führt keine *.pl Updateskripte aus\r
+ - Bugfix 540 - Mahnungen\r
+ - Bugfix 537 - Fehler beim erzeugen eines Berichtes\r
+ - Bugfix 536 - Erfassung eines Kunden mit bereits bestehender Kundennummer\r
+ ergibt unverständliche Fehlermeldung\r
+ - Bugfix 534 - Mahnwesen funktioniert nicht richtig\r
+ - Bugfix 533 - "Swiss German" Kontenrahmen: Waren werden unter\r
+ Diesnstleistungen geführt\r
+ - Bugfix 535 - Auftrag in Englisch statt Deutsch\r
+ - Bugfix 529 - Dezimalstelle von Produktpreisen verschiebt sich\r
+ - Bugfix 526 - Konto 1588 (Einfuhrumsatzsteuer) wird bei UStVA ignoriert\r
+ - Bugfix 525 - Proformarechnung: Datum fehlt!\r
+ - Bugfix 522 - Bestelldatum in Rechnung\r
+ - Bugfix 519 - unterhalb von templates gibt es ein Verzeichnis webpages,\r
+ das da wohl nicht hingehören\r
+ - Bugfix 517 - Menüeinträge im CSS-Menü werden umgebrochen\r
+ - Bugfix 511 - Stammdaten-Kunden-Lieferungen\r
+ - Bugfix 471 - voreingestellter Ausgabekanal wird nicht übernommen\r
+ - Bugfix 455 - fehlerhafte Anzeige im Buchungsjournal bei unterschiedl.\r
+ Rechn.- und Bezahldaten\r
+ - Bugfix 361 - webdav Ansicht\r
+ - Bugfix 181 - Webdav Fehler bei Detailansicht einer Einkaufsrechnung\r
+\r
2007-01-19 - Version 2.4.1\r
- CSV-Import auf Verwendung von Buchungsgruppen angepasst\r
- Bei Einkaufs- und Verkaufsmasken lassen sich die zweiten Positionszeilen\r
- Bugfix 409 - Bericht Waren funktioniert nicht bei Bestellt, etc.\r
- Viele weitere Bugfixes\r
\r
-2006-03-07 - Version 2.2.2 (942 - 970) \r
+2006-03-07 - Version 2.2.2 (942 - 970)\r
- Bugfix 308 - falsches Quoten bei Kreditorenbuchungen\r
- Bugfix 306 - UStVa Vorschau vervollstaendigt\r
\r
\r
2006-02-03 - Version 2.2.0 - Revision testing (542 - 855)\r
\r
- - Neues Menü - horizontal Anordnung \r
+ - Neues Menü - horizontal Anordnung\r
- Splitbuchungen für Kreditoren-, Debitoren- und Dialogbuchungen\r
- Preisgruppen für Waren und Erzeugnisse\r
- Sammelbestellungen aus Aufträgen generieren\r
Quoting überarbeitet\r
Fix für Perl 5.6.x - Block Syntaxfehler\r
SQL-Performance "Raussuchen letzter Kunde" optimiert\r
- Fehlerhafte Seriennummernsuche bei Angeboten/Aufträgen \r
- DATEV Bug: Kein Timeout bei großen Exporten \r
+ Fehlerhafte Seriennummernsuche bei Angeboten/Aufträgen\r
+ DATEV Bug: Kein Timeout bei großen Exporten\r
DATEV Bug: Fehler bei negativen Umsätzen\r
BWA Bug: Fehler bei der Berechnung der Summen\r
- Kundenübersicht Auftragsnummer wurde nicht angezeigt \r
+ Kundenübersicht Auftragsnummer wurde nicht angezeigt\r
- Bugfixes Bugzilla\r
Bug#49: UStVa Rundungsfehler\r
Bug#124: UBL behoben\r
Bug#187: UBL im Buchungsjournal, wenn nicht alle ausgewählt war\r
Bug#189: Rundungsfehler behoben\r
Bug#190: Abteilung1/2 bei Lieferadresse konnten nicht gespeichert werden\r
- Bug#198: Rechnung nicht angezeigt nach Eingabe einer Lieferanschrift \r
+ Bug#198: Rechnung nicht angezeigt nach Eingabe einer Lieferanschrift\r
Bug#199: Speichern eines Lieferantenauftrages nicht möglich\r
Bug#204: Storno bei Splitbuchungen fehlerhaft\r
Bug#205: In Dialogbuchungen MwSt. bei Buchungen nicht berücksichtigt\r
<li><a href="dokumentenvorlagen-und-variablen.html#allgemein_stammdaten">
Stammdaten von Kunden und Lieferanten</a></li>
+ <li><a href="dokumentenvorlagen-und-variablen.html#allgemein_bearbeiter">
+ Informationen über den Bearbeiter</a></li>
+
<li><a href="dokumentenvorlagen-und-variablen.html#allgemein_verkaeufer">
Informationen über den Verkäufer</a></li>
</ol>
</li>
+ <li><a href="dokumentenvorlagen-und-variablen.html#dunning">
+ Variablen in Mahnungen und Rechnungen über Mahngebühren</a>
+
+ <ol>
+ <li><a href="dokumentenvorlagen-und-variablen.html#dunning_vorlagennamen">
+ Namen der Vorlagen</a></li>
+
+ <li><a href="dokumentenvorlagen-und-variablen.html#dunning_allgemein">
+ Allgemeine Variablen in Mahnungen</a></li>
+
+ <li><a href="dokumentenvorlagen-und-variablen.html#dunning_details">
+ Variablen für jede gemahnte Rechnung in einer Mahnung</a></li>
+
+ <li><a href="dokumentenvorlagen-und-variablen.html#dunning_invoice">
+ Variablen in automatisch erzeugten Rechnungen über Mahngebühren</a></li>
+ </ol>
+ </li>
+
<li><a href="dokumentenvorlagen-und-variablen.html#anderevorlagen">
Variablen in anderen Vorlagen</a></li>
</tr>
<tr>
<td><code>business</code></td>
- <td>Kundentyp</td>
+ <td>Kunden-/Lieferantentyp</td>
</tr>
<tr>
<td><code>city</code></td>
<td>Kreditlimit</td>
</tr>
<tr>
- <td><code>customernumber</code></td>
- <td>Kundennummer; nur für Kunden</td>
+ <td><code>customeremail</code></td>
+ <td>Email des Kunden; nur für Kunden</td>
+ </tr>
+ <tr>
+ <td><code>customerfax</code></td>
+ <td>Faxnummer des Kunden; nur für Kunden</td>
</tr>
<tr>
<td><code>customernotes</code></td>
<td>Bemerkungen beim Kunden; nur für Kunden</td>
</tr>
+ <tr>
+ <td><code>customernumber</code></td>
+ <td>Kundennummer; nur für Kunden</td>
+ </tr>
+ <tr>
+ <td><code>customerphone</code></td>
+ <td>Telefonnummer des Kunden; nur für Kunden</td>
+ </tr>
<tr>
<td><code>discount</code></td>
<td>Rabatt</td>
sondern schlicht Kopien der Lieferdatenvariablen sind
(z.B. <code>shiptocontact</code>).</p>
- <h3><a name="allgemein_verkaeufer">
- Informationen über den Verkäufer:</a></h3>
+ <h3><a name="allgemein_bearbeiter">
+ Informationen über den Bearbeiter:</a></h3>
<p>
<table border="1">
</table>
</p>
+ <h3><a name="allgemein_verkaeufer">
+ Informationen über den Verkäfer (nur bei Verkaufsmasken):</a></h3>
+
+ <p>
+ <table border="1">
+ <tr><th>Variablenname</th><th>Bedeutung</th></tr>
+ <tr>
+ <td><code>salesman_address</code></td>
+ <td>Adressfeld</td>
+ </tr>
+ <tr>
+ <td><code>salesman_businessnumber</code></td>
+ <td>Firmennummer</td>
+ </tr>
+ <tr>
+ <td><code>salesman_company</code></td>
+ <td>Firmenname</td>
+ </tr>
+ <tr>
+ <td><code>salesman_co_ustid</code></td>
+ <td>Usatzsteuer-Identifikationsnummer</td>
+ </tr>
+ <tr>
+ <td><code>salesman_duns</code></td>
+ <td>DUNS-Nummer</td>
+ </tr>
+ <tr>
+ <td><code>salesman_email</code></td>
+ <td>Email</td>
+ </tr>
+ <tr>
+ <td><code>salesman_fax</code></td>
+ <td>Fax</td>
+ </tr>
+ <tr>
+ <td><code>salesman_name</code></td>
+ <td>voller Name</td>
+ </tr>
+ <tr>
+ <td><code>salesman_signature</code></td>
+ <td>Signatur</td>
+ </tr>
+ <tr>
+ <td><code>salesman_taxnumber</code></td>
+ <td>Steuernummer</td>
+ </tr>
+ <tr>
+ <td><code>salesman_tel</code></td>
+ <td>Telefonnummer</td>
+ </tr>
+ </table>
+ </p>
+
<h3><a name="allgemein_steuern">
Variablen für die einzelnen Steuern:</a></h3>
<td><code>duedate</code></td>
<td>Fälligkeitsdatum</td>
</tr>
+ <tr>
+ <td><code>globalprojectnumber</code></td>
+ <td>Projektnummer des ganzen Beleges</td>
+ </tr>
<tr>
<td><code>intnotes</code></td>
<td>Interne Bemerkungen</td>
<td><code>notes</code></td>
<td>Bemerkungen der Rechnung</td>
</tr>
+ <tr>
+ <td><code>orddate</code></td>
+ <td>Auftragsdatum</td>
+ </tr>
<tr>
<td><code>ordnumber</code></td>
<td>Auftragsnummer, wenn die Rechnung aus einem Auftrag erstellt wurde</td>
<td><code>payment_terms</code></td>
<td>Zahlungskonditionen</td>
</tr>
+ <tr>
+ <td><code>quodate</code></td>
+ <td>Angebotsdatum</td>
+ </tr>
<tr>
<td><code>quonumber</code></td>
<td>Angebotsnummer</td>
<td><code>total</code></td>
<td>Restsumme der Rechnung (Summe abzüglich bereits bezahlter Posten)</td>
</tr>
+ <tr>
+ <td><code>transaction_description</code></td>
+ <td>Vorgangsbezeichnung</td>
+ </tr>
<tr>
<td><code>transdate</code></td>
<td>Auftragsdatum wenn die Rechnung aus einem Auftrag erstellt wurde</td>
zum Inhaltsverzeichnis</a></small><br>
<hr>
+ <h2><a name="dunning">Variablen in Mahnungen und Rechnungen über Mahngebühren</a></h2>
+
+ <h3><a name="dunning_vorlagennamen">Namen der Vorlagen</a></h3>
+
+ <p>Die Namen der Vorlagen werden im System-Menü vom Benutzer
+ eingegeben. Wird für ein Mahnlevel die Option zur automatischen
+ Erstellung einer Rechnung über die Mahngebühren und Zinsen
+ aktiviert, so wird der Name der Vorlage für diese Rechnung aus
+ dem Vorlagenname für diese Mahnstufe mit dem
+ Zusatz <code>_invoice</code> gebildet. Weiterhin werden die
+ Kürzel für die ausgewählte Sprache und den
+ ausgewählten Drucker angehängt.</p>
+
+ <h3><a name="dunning_allgemein">Allgemeine Variablen in Mahnungen:</a></h3>
+
+ <p>Die Variablen des Verkäufers stehen wie gewohnt
+ als <code>employee_...</code> zur Verfügung. Die Adressdaten des
+ Kunden stehen als Variablen <code>name</code>, <code>street</code>,
+ <code>zipcode</code>, <code>city</code>, <code>country</code>,
+ <code>department_1</code>, <code>department_2</code>, und
+ <code>email</code> zur Verfügung.
+ </p>
+
+ <p>Weitere Variablen beinhalten:</p>
+
+ <p>
+ <table border="1">
+ <tr><th>Variablenname</th><th>Bedeutung</th></tr>
+ <tr>
+ <td><code>dunning_date</code></td>
+ <td>Datum der Mahnung</td>
+ </tr>
+ <tr>
+ <td><code>dunning_duedate</code></td>
+ <td>Fälligkeitsdatum für diese Mahhnung</td>
+ </tr>
+ <tr>
+ <td><code>fee</code></td>
+ <td>Kummulative Mahngebühren</td>
+ </tr>
+ <tr>
+ <td><code>interest_rate</code></td>
+ <td>Zinssatz per anno in Prozent</td>
+ </tr>
+ <tr>
+ <td><code>total_amount</code></td>
+ <td>Gesamter noch zu zahlender Betrag als <code>fee</code> + <code>total_interest</code> + <code>total_open_amount</code></td>
+ </tr>
+ <tr>
+ <td><code>total_interest</code></td>
+ <td>Zinsen per anno über alle Rechnungen</td>
+ </tr>
+ <tr>
+ <td><code>total_open_amount</code></td>
+ <td>Summe über alle offene Beträge der Rechnungen</td>
+ </tr>
+ </table>
+ </p>
+
+ <h3><a name="dunning_details">
+ Variablen für jede gemahnte Rechnung in einer Mahnung:</a></h3>
+
+ <p>
+ <table border="1">
+ <tr><th>Variablenname</th><th>Bedeutung</th></tr>
+ <tr>
+ <td><code>dn_amount</code></td>
+ <td>Rechnungssumme (brutto)</td>
+ </tr>
+ <tr>
+ <td><code>dn_duedate</code></td>
+ <td>Originales Fälligkeitsdatum der Rechnung</td>
+ </tr>
+ <tr>
+ <td><code>dn_dunning_date</code></td>
+ <td>Datum der Mahnung</td>
+ </tr>
+ <tr>
+ <td><code>dn_dunning_duedate</code></td>
+ <td>Fälligkeitsdatum der Mahnung</td>
+ </tr>
+ <tr>
+ <td><code>dn_fee</code></td>
+ <td>Kummulative Mahngebühr</td>
+ </tr>
+ <tr>
+ <td><code>dn_interest</code></td>
+ <td>Zinsen per anno für diese Rechnung</td>
+ </tr>
+ <tr>
+ <td><code>dn_invnumber</code></td>
+ <td>Rechnungsnummer</td>
+ </tr>
+ <tr>
+ <td><code>dn_linetotal</code></td>
+ <td>Noch zu zahlender Betrag (ergibt sich aus <code>dn_open_amount + dn_fee + dn_interest</code>)</td>
+ </tr>
+ <tr>
+ <td><code>dn_netamount</code></td>
+ <td>Rechnungssumme (netto)</td>
+ </tr>
+ <tr>
+ <td><code>dn_open_amount</code></td>
+ <td>Offener Rechnungsbetrag</td>
+ </tr>
+ <tr>
+ <td><code>dn_ordnumber</code></td>
+ <td>Bestellnummer</td>
+ </tr>
+ <tr>
+ <td><code>dn_transdate</code></td>
+ <td>Rechnungsdatum</td>
+ </tr>
+ </table>
+ </p>
+
+ <h3><a name="dunning_invoice">Variablen in automatisch erzeugten
+ Rechnungen über Mahngebühren</a></h3>
+
+ <p>Die Variablen des Verkäufers stehen wie gewohnt
+ als <code>employee_...</code> zur Verfügung. Die Adressdaten des
+ Kunden stehen als Variablen <code>name</code>, <code>street</code>,
+ <code>zipcode</code>, <code>city</code>, <code>country</code>,
+ <code>department_1</code>, <code>department_2</code>, und
+ <code>email</code> zur Verfügung.
+ </p>
+
+ <p>Weitere Variablen beinhalten:</p>
+
+ <p>
+ <table border="1">
+ <tr><th>Variablenname</th><th>Bedeutung</th></tr>
+ <tr>
+ <td><code>duedate</code></td>
+ <td>Fälligkeitsdatum der Rechnung</td>
+ </tr>
+ <tr>
+ <td><code>dunning_id</code></td>
+ <td>Mahnungsnummer</td>
+ </tr>
+ <tr>
+ <td><code>fee</code></td>
+ <td>Mahngebühren</td>
+ </tr>
+ <tr>
+ <td><code>interest</code></td>
+ <td>Zinsen</td>
+ </tr>
+ <tr>
+ <td><code>invamount</code></td>
+ <td>Rechnungssumme (ergibt sich aus <code>fee + interest</code>)</td>
+ </tr>
+ <tr>
+ <td><code>invdate</code></td>
+ <td>Rechnungsdatum</td>
+ </tr>
+ <tr>
+ <td><code>invnumber</code></td>
+ <td>Rechnungsnummer</td>
+ </tr>
+ </table>
+ </p>
+
+ <small><a href="dokumentenvorlagen-und-variablen.html#inhaltsverzeichnis">
+ zum Inhaltsverzeichnis</a></small><br>
+ <hr>
+
<h2><a name="anderevorlagen">
Variablen in anderen Vorlagen</a></h2>
+++ /dev/null
-Aktuelle Installations- und Konfigurationshinweise:
-
-gibt es:
--auf der Lx-Office Homepage unter
- http://lx-office.org/index.php?id=dokumentation
--im Lx-Office-Wiki unter Dokumentation
- http://wiki.lx-office.org/index.php/Lx-Office_ERP
--im Lx-Office-Forum:
- http://www.lx-office.org/forum/
-
-Installationsanleitung:
-
-Folgende Pakete müssen installiert sein:
-- Webserver (Apache)
-- PostgreSQL - Datenbank
-- Perl-DBI, Perl-DBD, Perl-HTML-Template, Perl-CGI-Ajax, Perl-Class-Accessor
-Diese Pakete können bei den unterschiedlichen Distributionen anders heißen.
-(Debian: apache, postgresql, libdbi-perl, libdbd-pg-perl, libpgperl, libhtml-template-perl, libclass-accessor-perl)
-(Fedora: httpd, postgresql-server, perl-DBI, perl-DBD-Pg)
-(SuSE: apache2, postgresql-server, perl-DBI, perl-DBD-Pg)
-
-Da Perl-CGI-Ajax nicht als Paket für Distributionen bereit steht, muß es mit der CPAN-Shell installiert werden.
-Leider ist dazu nicht jeder in der Lage. LxO liefert daher das Paket im CGI-Verzeichnis mit. Das sollte als Fall-Back greifen.
-
-
-
-Die PostgreSQL Konfiguration muß angepasst werden.
-In der Datei postgresql.conf (/var/lib/pgsql/data/ oder /etc/postgresql/) muß folgender Wert verändert werden:
-
-TCPIP_SOCKET = 1 # Nur PostgreSQL < 8.0
-
-default_with_oids = on # Nur PostgreSQL >= 8.0
-
-In der Datei pg_hba.conf (/var/lib/pgsql/data/ oder /etc/postgresql/) müssen die Berichtigungen für den Zugriff geändert werden:
-
-alte Eintragung:
-local all all ident sameuser
-host all all 127.0.0.1 255.0.0.0 ident sameuser
-
-Änderung:
-local all all trust
-host all all 127.0.0.1 255.0.0.0 trust
-
-Besser:
-local all lxoffice password
-host all lxoffice 127.0.0.1 255.255.255.255 password
-
-
-Installation des Programmpaketes
-Die Lx-Office ERP Installationsdatei (lxoffice-erp-2.4.x.tgz) in den DocumentRoot des Webservers (/var/www/html/ oder /srv/www/htdocs oder /var/www/) entpacken.
-
-tar xvzf lxoffice-erp-2.4.x.tgz
-
-Verändern Sie evtl. noch den Namen des Verzeichnisses
-
-mv lxoffice-erp/ lx-erp/
-
-oder noch besser, Sie verwenden einen Alias in der Webserverkonfiguration.
-
-Das Verzeichnis muß dem Webserverbenutzer (Debian: www-data, Fedora: apache, SuSE: wwwrun) übergeben werden:
-
-chown -R www-data: lx-office-erp/
-
-Datenbankbenutzer anlegen
-
-Es sollte zum Zugriff auf die PostgreSQL Datenbank ein Datenbankbenutzer angelegt werden. Führen Sie dazu folgende Befehle nacheinander aus.
-
-su - postgres
-createuser -d lxoffice (ohne Passwort)
-oder besser
-createuser -d -P lxoffice (mit Passwort)
-
-Wenn Sie später einen Datenbankzugriff konfigurieren, verändern Sie den evtl. voreingestellten Benutzer "postgres" auf "lxoffice".
-
-PostgreSQL - Datenbank erweitern
-In der Datenbank "template1" sollte bevor die restliche Konfiguration von LxOffice ERP erfolgt noch folgende Funktion hinzugefügt werden:
-
-su postgres
-psql template1 (Zugriff über Admintool auf die Datenbank)
-create function plpgsql_call_handler ()
-returns opaque
-as '/usr/lib/pgsql/plpgsql.so'
-language 'c';
-
-create language 'plpgsql' handler plpgsql_call_handler
-lancompiler 'pl/pgsql';
-
-!!!! Bitte beachten Sie, das der Pfad zur Datei plpgsql.so und der Name von Distribution zu Distribution verschieden sein kann.
-Bei z.B. Debian befindet sie sich unter '/usr/lib/postgresql/lib/plpgsql.so'.
-
-Apache Konfiguration
-Der Zugriff auf das Programmverzeichnis muß in der Apache Webserver- konfiguration httpd.conf (/etc/httpd/conf/)
-[bei SuSE evtl. httpd2.conf, Debian: /etc/apache2/apache2.conf] konfiguriert werden:
-
-AddHandler cgi-script .pl
-Alias /lx-erp/ /var/www/lx-erp/
-<Directory /var/www/lx-erp>
- Options ExecCGI Includes FollowSymlinks
- DirectoryIndex login.pl # nicht mehr unbedingt nötig, da eine index.html mitgeliefert wird
-</Directory>
-<Directory /var/www/lx-erp/users>
- Order Deny,Allow
- Deny from All
-</Directory>
-!!!Vor den einzelnen Optionen muß bei einigen Distributionen ein Plus "+" gesetzt werden.
-
-Auf einigen Webservern werden manchmal die Grafiken und Style-Sheets nicht ausgeliefert. Daher die Apache-Konfig um diese Zeile erweitern:
-EnableSendfile Off
-
-Datenbank anlegen
-Das Administrationsmenü finden Sie unter:
-
-http://localhost/lx-erp/admin.pl
-
-Zuerst muß eine Datenbank angelegt werden. Anschließend ein Benutzer. Verwenden Sie für den Datenbankzugriff den eben angelegten Benutzer lxoffice.
-
-OpenDocument-Vorlagen
-Lx-Office unterstützt die Verwendung von Vorlagen im OpenDocument-Format, wie es OpenOffice.org ab Version 2 erzeugt. Lx-Office kann dabei sowohl neue OpenDocument-Dokumente als auch aus diesen direkt PDF-Dateien erzeugen. Um die Unterstützung von
-OpenDocument-Vorlagen zu aktivieren muss in der Datei "lx-erp.conf" die Variable "$opendocument_templates" auf "1" stehen. Dieses ist die Standardeinstellung.
-
-Weiterhin muss in der Datei "lx-erp.conf" die Variable "$dbcharset" auf die Zeichenkodierung gesetzt werden, die auch bei der Speicherung der Daten in der Datenbank verwendet wird. Diese ist in den meisten Fällen "ISO-8859-15".
-
-Während die Erzeugung von reinen OpenDocument-Dateien keinerlei weitere Software benötigt, wird zur Umwandlung dieser Dateien in PDF OpenOffice.org benötigt. Soll dieses Feature genutzt werden, so muss neben OpenOffice.org ab Version 2 auch der "X virtual frame buffer" (xvfb) installiert werden. Bei Debian ist er im Paket "xvfb" enthalten. Andere Distributionen enthalten ihn in anderen Paketen.
-
-Nach der Installation müssen in der Datei "lx-erp.conf" zwei weitere Variablen angepasst werden: "$openofficeorg_writer_bin" muss den vollständigen Pfad zur OpenOffice.org Writer-Anwendung enthalten.
-"$xvfb_run_bin" muss den Pfad zu einem Script enthalten, dass den "X virtual frame buffer" startet und direkt danach ein Programm in ihm startet, das dem Script als Parameter übergeben wird. Lx-Office enthält bereits ein solches Script namens "xvfb-run", das standardmäßig verwendet wird. Es handelt sich dabei um eine gestutzte Version des Scripts "xvfb-run" aus dem Debian-Paket "xvfb".
-
-Als letztes muss herausgefunden werden, welchen Namen OpenOffice.org Writer dem Verzeichnis mit den Benutzereinstellungen gibt. Unter Debian ist dies momentan "~/.openoffice.org2". Sollte der Name bei Ihrer OpenOffice.org-Installation anders sein, so muss das Verzeichnis "users/.openoffice.org2" entsprechend umbenannt werden. Ist der Name z.B. einfach nur ".openoffice", so wäre folgender Befehl auszuführen:
-
-mv users/.openoffice.org2 users/.openoffice
-
-Dieses Verzeichnis, wie auch das komplette "users"-Verzeichnis, muss vom Webserver beschreibbar sein. Dieses wurde in Schritt "Installation des Programmpakets" oben bereits erledigt, kann aber erneut überprüft werden, wenn die Konvertierung nach PDF fehlschlägt.
-
-Lx-Office ERP verwenden
-Einloggen können Sie sich unter:
- http://localhost/lx-office-erp/login.pl
-Die Adminseite erreichen Sie unter:
- http://localhost/lx-office-erp/admin.pl
\ No newline at end of file
oder
- if ($form->{"path"} eq "bin/mozilla") {
+ if ($form->{item_rows} > 0) {
...
}
<br />\r
<table bgcolor="lightgrey" width="100%">\r
<tr align="right" valign="bottom">\r
- <td align="left"><a class="help" href="ustva.pl?path=<%path%>&action=report&level=Reports&login=<%login%>&password=<%password%>">[zurück zur UStVa]</a></td><td><a class="help" href="#top">[Anfang/Inhalt]</a> <a class="help" href="#bottom">[Ende]</a>\r
+ <td align="left"><a class="help" href="ustva.pl?action=report&level=Reports&login=<%login%>&password=<%password%>">[zurück zur UStVa]</a></td><td><a class="help" href="#top">[Anfang/Inhalt]</a> <a class="help" href="#bottom">[Ende]</a>\r
</td>\r
</tr>\r
</table>\r
<br>\r
<table bgcolor="lightgrey" width="100%">\r
<tr align="right" valign="bottom">\r
- <td align="left"><a class="help" href="ustva.pl?path=<%path%>&action=report&level=Reports&login=<%login%>&password=<%password%>">[zurück zur UStVa]</a></td><td><a class="help" href="#top">[Anfang/Inhalt]</a> <a class="help" href="#bottom">[Ende]</a>\r
+ <td align="left"><a class="help" href="ustva.pl?action=report&level=Reports&login=<%login%>&password=<%password%>">[zurück zur UStVa]</a></td><td><a class="help" href="#top">[Anfang/Inhalt]</a> <a class="help" href="#bottom">[Ende]</a>\r
</td>\r
</tr>\r
</table>\r
<br />\r
<table bgcolor="lightgrey" width="100%">\r
<tr align="right" valign="bottom">\r
- <td align="left"><a class="help" href="ustva.pl?path=<%path%>&action=report&level=Reports&login=<%login%>&password=<%password%>">[zurück zur UStVa]</a></td><td><a class="help" href="#top">[Anfang/Inhalt]</a> <a class="help" href="#bottom">[Ende]</a>\r
+ <td align="left"><a class="help" href="ustva.pl?action=report&level=Reports&login=<%login%>&password=<%password%>">[zurück zur UStVa]</a></td><td><a class="help" href="#top">[Anfang/Inhalt]</a> <a class="help" href="#bottom">[Ende]</a>\r
</td>\r
</tr>\r
</table>\r
<br>\r
<table bgcolor="lightgrey" width="100%">\r
<tr align="right" valign="bottom">\r
- <td align="left"><a class="help" href="ustva.pl?path=<%path%>&action=report&level=Reports&login=<%login%>&password=<%password%>">[zurück zur UStVa]</a></td><td><a class="help" href="#top">[Anfang/Inhalt]</a> <a class="help" href="#bottom">[Ende]</a>\r
+ <td align="left"><a class="help" href="ustva.pl?action=report&level=Reports&login=<%login%>&password=<%password%>">[zurück zur UStVa]</a></td><td><a class="help" href="#top">[Anfang/Inhalt]</a> <a class="help" href="#bottom">[Ende]</a>\r
</td>\r
</tr>\r
</table>\r
<br>\r
<table bgcolor="lightgrey" width="100%">\r
<tr align="right" valign="bottom">\r
- <td align="left"><a class="help" href="ustva.pl?path=<%path%>&action=report&level=Reports&login=<%login%>&password=<%password%>">[zurück zur UStVa]</a></td><td><a class="help" href="#top">[Anfang/Inhalt]</a> <a class="help" href="#bottom">[Ende]</a>\r
+ <td align="left"><a class="help" href="ustva.pl?action=report&level=Reports&login=<%login%>&password=<%password%>">[zurück zur UStVa]</a></td><td><a class="help" href="#top">[Anfang/Inhalt]</a> <a class="help" href="#bottom">[Ende]</a>\r
</td>\r
</tr>\r
</table>\r
<br>\r
<table bgcolor="lightgrey" width="100%">\r
<tr align="right" valign="bottom">\r
- <td align="left"><a class="help" href="ustva.pl?path=<%path%>&action=report&level=Reports&login=<%login%>&password=<%password%>">[zurück zur UStVa]</a></td><td><a class="help" href="#top">[Anfang/Inhalt]</a> <a class="help" href="">[Ende]</a>\r
+ <td align="left"><a class="help" href="ustva.pl?action=report&level=Reports&login=<%login%>&password=<%password%>">[zurück zur UStVa]</a></td><td><a class="help" href="#top">[Anfang/Inhalt]</a> <a class="help" href="">[Ende]</a>\r
</td>\r
</tr>\r
</table>\r
--- /dev/null
+am.pl
\ No newline at end of file
--- /dev/null
+am.pl
\ No newline at end of file
--- /dev/null
+am.pl
\ No newline at end of file
--- /dev/null
+am.pl
\ No newline at end of file
--- /dev/null
+/*
+ Form Manager: A simple method of constructing complex dynamic forms.
+ Written by Twey, http://www.twey.co.uk/.
+ Use, copying, and modification allowed, so long as credit
+ remains intact, under the terms of the GNU General Public License,
+ version 2 or later. See http://www.gnu.org/copyleft/gpl.html for details.
+*/
+
+
+var FORM_MANAGER_CONDITION_SEPARATOR = " AND ";
+var FORM_MANAGER_POSSIBILITY_SEPARATOR = " OR ";
+var FORM_MANAGER_NAME_VALUE_SEPARATOR = " BEING ";
+var FORM_MANAGER_DEPENDS = "DEPENDS ON ";
+var FORM_MANAGER_CONFLICTS = "CONFLICTS WITH ";
+var FORM_MANAGER_EMPTY = "EMPTY";
+
+function addEvent(el, ev, f) {
+ if(el.addEventListener)
+ el.addEventListener(ev, f, false);
+ else if(el.attachEvent) {
+ var t = function() {
+ f.apply(el);
+ };
+ addEvent.events.push({'element': el, 'event': ev, 'handler': f});
+ el.attachEvent("on" + ev, t);
+ } else
+ el['on' + ev] = f;
+}
+
+function addEvents(els, evs, f) {
+ for(var i = 0; i < els.length; ++i)
+ for(var j = 0; j < evs.length; ++j)
+ addEvent(els[i], evs[j], f);
+}
+
+addEvent.events = [];
+
+if(typeof window.event !== "undefined")
+ addEvent(window, "unload", function() {
+ for(var i = 0, e = addEvent.events; i < e.length; ++i)
+ e[i].element.detachEvent("on" + e[i].event, e[i].handler);
+ }
+ );
+
+function getRadioValue(el) {
+ if(!el.length) return null;
+ for(var i = 0; i < el.length; ++i)
+ if(el[i].checked) return el[i].value;
+ return null;
+}
+
+function getSelectValue(el) {
+ if(!el.tagName || el.tagName.toLowerCase() !== "select")
+ return null;
+ return el.options[el.selectedIndex].value;
+}
+
+function isElementValue(el, v) {
+ if(v === FORM_MANAGER_EMPTY) v = '';
+ return (
+ getRadioValue(el) == v ||
+ getSelectValue(el) == v ||
+ (
+ el.tagName &&
+ el.tagName.toLowerCase() !== "select" &&
+ el.value == v
+ )
+ );
+}
+
+function setupDependencies() {
+ var showEl = function() {
+ this.style.display = "";
+ if(this.parentNode.tagName.toLowerCase() == "label")
+ this.parentNode.style.display = "";
+ };
+ var hideEl = function() {
+ this.style.display = "none";
+ if(typeof this.checked !== "undefined") this.checked = false;
+ else this.value = "";
+ if(this.parentNode.tagName.toLowerCase() == "label")
+ this.parentNode.style.display = "none";
+ this.hidden = true;
+ };
+ var calcDeps = function() {
+ for(var i = 0, e = this.elements; i < e.length; ++i) {
+ e[i].hidden = false;
+ for(var j = 0, f = e[i].className.split(FORM_MANAGER_CONDITION_SEPARATOR); j < f.length; ++j)
+ if(f[j].indexOf(FORM_MANAGER_DEPENDS) === 0) {
+ for(var k = 0, g = f[j].substr(FORM_MANAGER_DEPENDS.length).split(FORM_MANAGER_POSSIBILITY_SEPARATOR); k < g.length; ++k)
+ if(g[k].indexOf(FORM_MANAGER_NAME_VALUE_SEPARATOR) === -1) {
+ if(e[g[k]] && e[g[k]].checked) break;
+ else if(k + 1 == g.length)
+ e[i].hide();
+ } else {
+ var n = g[k].split(FORM_MANAGER_NAME_VALUE_SEPARATOR),
+ v = n[1];
+ n = n[0];
+ if(e[n])
+ if(isElementValue(e[n], v)) break;
+ else if(k + 1 == g.length) e[i].hide();
+ }
+ } else if(f[j].indexOf(FORM_MANAGER_CONFLICTS) === 0) {
+ if(f[j].indexOf(FORM_MANAGER_NAME_VALUE_SEPARATOR) === -1) {
+ if(e[f[j].substr(FORM_MANAGER_CONFLICTS.length)] && e[f[j].substr(FORM_MANAGER_CONFLICTS.length)].checked) {
+ e[i].hide();
+ break;
+ }
+ } else {
+ var n = f[j].substr(FORM_MANAGER_CONFLICTS.length).split(FORM_MANAGER_NAME_VALUE_SEPARATOR),
+ v = n[1];
+ n = n[0];
+ if(e[n]) {
+ if(isElementValue(e[n], v)) {
+ e[i].hide();
+ break;
+ }
+ }
+ }
+ }
+ if(!e[i].hidden) e[i].show();
+ }
+ };
+ var changeHandler = function() {
+ this.form.calculateDependencies();
+ return true;
+ };
+ for(var i = 0; i < arguments.length; ++i) {
+ for(var j = 0, e = window.document.forms[arguments[i]].elements; j < e.length; ++j) {
+ addEvents([e[j]], ["change", "keyup", "focus", "click", "keydown"], changeHandler);
+ e[j].hide = hideEl;
+ e[j].show = showEl;
+ }
+
+ (e = window.document.forms[arguments[i]]).calculateDependencies = calcDeps;
+ e.calculateDependencies();
+ }
+}
"action=" + action + "&" +
"login=" + encodeURIComponent(document.getElementsByName("login")[0].value) + "&" +
"password=" + encodeURIComponent(document.getElementsByName("password")[0].value) + "&" +
- "path=" + encodeURIComponent(document.getElementsByName("path")[0].value) + "&" +
"name=" + escape(name) + "&" +
"input_name=" + escape(input_name) + "&" +
"description=" + escape(description) + "&" +
--- /dev/null
+function checkbox_check_all(cb_name, prefix, start, end) {
+ var i;
+
+ var control = document.getElementsByName(cb_name)[0];
+ if (!control)
+ return;
+
+ var checked = control.checked;
+
+ for (i = start; i <= end; i++) {
+ control = document.getElementsByName(prefix + i)[0];
+ if (control)
+ control.checked = checked;
+ }
+}
+
+function setupPoints(numberformat, wrongFormat) {
+ decpoint = numberformat.substring((numberformat.substring(1, 2).match(/\.|\,/) ? 5 : 4), (numberformat.substring(1, 2).match(/\.|\,/) ? 6 : 5));
+ if (numberformat.substring(1, 2).match(/\.|\,/)) {
+ thpoint = numberformat.substring(1, 2);
+ }
+ else {
+ thpoint = null;
+ }
+ wrongNumberFormat = wrongFormat + " ( " + numberformat + " ) ";
+}
+
+function setupDateFormat(setDateFormat, setWrongDateFormat) {
+ dateFormat = setDateFormat;
+ wrongDateFormat = setWrongDateFormat + " ( " + setDateFormat + " ) ";
+ formatArray = new Array();
+ if(dateFormat.match(/^\w\w\W/)) {
+ seperator = dateFormat.substring(2,3);
+ }
+ else {
+ seperator = dateFormat.substring(4,5);
+ }
+}
+
function centerParms(width,height,extra) {
xPos = (screen.width - width) / 2;
yPos = (screen.height - height) / 2;
return string;
}
+function escape_more(s) {
+ s = escape(s);
+ return s.replace(/\+/g, '%2b');
+}
+
function set_longdescription_window(input_name) {
var parm = centerParms(600,500) + ",width=600,height=500,status=yes,scrollbars=yes";
var name = document.getElementsByName(input_name)[0].value;
"action=set_longdescription&" +
"login=" + encodeURIComponent(document.getElementsByName("login")[0].value)+ "&"+
"password=" + encodeURIComponent(document.getElementsByName("password")[0].value) + "&" +
- "path=" + encodeURIComponent(document.getElementsByName("path")[0].value) + "&" +
- "longdescription=" + escape(document.getElementsByName(input_name)[0].value) + "&" +
- "input_name=" + escape(input_name) + "&"
+ "longdescription=" + escape_more(document.getElementsByName(input_name)[0].value) + "&" +
+ "input_name=" + escape_more(input_name) + "&"
window.open(url, "_new_generic", parm);
+ }
+
+function check_right_number_format(input_name) {
+// if(thpoint) {
+// if(thpoint == ','){
+// var thnumbers = input_name.value.split(',');
+// thnumbers[thnumbers.length-1] = thnumbers[thnumbers.length-1].substring((thnumbers[thnumbers.length-1].lastIndexOf(".") !== -1 ? thnumbers[thnumbers.length-1].lastIndexOf(".") : thnumbers[thnumbers.length-1].length), 0);
+// }
+// else{
+// var thnumbers = input_name.value.split('.');
+// thnumbers[thnumbers.length-1] = thnumbers[thnumbers.length-1].substring((thnumbers[thnumbers.length-1].lastIndexOf(",") !== -1 ? thnumbers[thnumbers.length-1].lastIndexOf(",") : thnumbers[thnumbers.length-1].length), 0);
+// }
+//
+// for(var i = 0; i < thnumbers.length; i++) {
+// if(i == 0 && thnumbers[i].length > 3) {
+// return show_alert_and_focus(input_name, wrongNumberFormat);
+// }
+// if(i > 0 && thnumbers[i].length != 3) {
+// return show_alert_and_focus(input_name, wrongNumberFormat);
+// }
+// }
+// }
+ if(decpoint == thpoint) {
+ return show_alert_and_focus(input_name, wrongNumberFormat);
+ }
+ if(decpoint == ',') {
+ var decnumbers = input_name.value.split(',');
+ }
+ else {
+ var decnumbers = input_name.value.split('.');
+ }
+ if(decnumbers.length == 2) {
+ if(decnumbers[1].length > 2) {
+ return show_alert_and_focus(input_name, wrongNumberFormat);
+ }
+ }
+ else {
+ if(decnumbers.length > 2) {
+ return show_alert_and_focus(input_name, wrongNumberFormat);
+ }
+ if(!thpoint) {
+ if(decnumbers[0].match(/\D/)) {
+ return show_alert_and_focus(input_name, wrongNumberFormat);
+ }
+ }
+ }
+}
+
+function check_right_date_format(input_name) {
+ if(input_name.value == "") {
+ return true;
+ }
+ var matching = new RegExp(dateFormat.replace(/\w/g, '\\d') + "\$","ig");
+ if(!(dateFormat.lastIndexOf("y") == 3) && !matching.test(input_name.value)) {
+ matching = new RegExp(dateFormat.replace(/\w/g, '\\d') + '\\d\\d\$', "ig");
+ if(!matching.test(input_name.value)) {
+ return show_alert_and_focus(input_name, wrongDateFormat);
+ }
+ }
+ else {
+ if (dateFormat.lastIndexOf("y") == 3 && !matching.test(input_name.value)) {
+ return show_alert_and_focus(input_name, wrongDateFormat);
+ }
+ }
+}
+
+function validate_dates(input_name_1, input_name_2) {
+ var tempArray1 = new Array();
+ var tempArray2 = new Array();
+ tempArray1 = getDateArray(input_name_1);
+ tempArray2 = getDateArray(input_name_2);
+ if(check_right_date_format(input_name_1) && check_right_date_format(input_name_2)) {
+ if(!((new Date(tempArray2[0], tempArray2[1], tempArray2[2])).getTime() >= (new Date(tempArray1[0], tempArray1[1], tempArray1[2])).getTime())) {
+ show_alert_and_focus(input_name_1, wrongDateFormat);
+ return show_alert_and_focus(input_name_2, wrongDateFormat);
+ }
+ if(!((new Date(tempArray2[0], tempArray2[1], tempArray2[2])).getTime() >= (new Date(1900, 1, 1)).getTime())) {
+ show_alert_and_focus(input_name_1, wrongDateFormat);
+ return show_alert_and_focus(input_name_2, wrongDateFormat);
+ }
+ }
+}
+
+function getDateArray(input_name) {
+ formatArray[2] = input_name.value.substring(dateFormat.indexOf("d"), 2);
+ formatArray[1] = input_name.value.substring(dateFormat.indexOf("m"), 2);
+ formatArray[0] = input_name.value.substring(dateFormat.indexOf("y"), (dateFormat.length == 10 ? 4 : 2));
+ if(dateFormat.length == 8) {
+ formatArray[0] += (formatArray[0] < 70 ? 2000 : 1900);
+ }
+ return formatArray;
+}
+
+function show_alert_and_focus(input_name, errorMessage) {
+ input_name.select();
+ alert(errorMessage + "\n\r\n\r--> " + input_name.value);
+ input_name.focus();
+ return false;
}
+
"action=delivery_customer_selection&" +
"login=" + escape(document.getElementsByName("login")[0].value) + "&" +
"password=" + escape(document.getElementsByName("password")[0].value) + "&" +
- "path=" + escape(document.getElementsByName("path")[0].value) + "&" +
"name=" + escape(name) + "&" +
"input_name=" + escape(input_name) + "&" +
"input_id=" + escape(input_id)
function set_email_window(input_subject, input_body, input_attachment) {
- var parm = centerParms(600,500) + ",width=600,height=500,status=yes,scrollbars=yes";
+ var parm = centerParms(800,600) + ",width=800,height=600,status=yes,scrollbars=yes";
var url = "dn.pl?" +
"action=set_email&" +
"login=" + encodeURIComponent(document.getElementsByName("login")[0].value)+ "&"+
"password=" + encodeURIComponent(document.getElementsByName("password")[0].value) + "&" +
- "path=" + encodeURIComponent(document.getElementsByName("path")[0].value) + "&" +
- "email_subject=" + escape(document.getElementsByName(input_subject)[0].value) + "&" +
- "email_body=" + escape(document.getElementsByName(input_body)[0].value) + "&" +
- "email_attachment=" + escape(document.getElementsByName(input_attachment)[0].value) + "&" +
- "input_subject=" + escape(input_subject) + "&" +
- "input_body=" + escape(input_body) + "&" +
- "input_attachment=" + escape(input_attachment);
+ "email_subject=" + escape_more(document.getElementsByName(input_subject)[0].value) + "&" +
+ "email_body=" + escape_more(document.getElementsByName(input_body)[0].value) + "&" +
+ "email_attachment=" + escape_more(document.getElementsByName(input_attachment)[0].value) + "&" +
+ "input_subject=" + escape_more(input_subject) + "&" +
+ "input_body=" + escape_more(input_body) + "&" +
+ "input_attachment=" + escape_more(input_attachment);
window.open(url, "_new_generic", parm);
}
"action=parts_language_selection&" +
"login=" + escape(document.ic.login.value) + "&" +
"password=" + escape(document.ic.password.value) + "&" +
- "path=" + escape(document.ic.path.value) + "&" +
"id=" + escape(document.ic.id.value) + "&" +
"language_values=" + escape(document.ic.language_values.value) + "&" +
"name=" + escape(name) + "&" +
--- /dev/null
+function set_history_uri() {
+ document.location.href = "am.pl?" +
+ "action=show_am_history&" +
+ "login=" + encodeURIComponent(document.getElementsByName("login")[0].value)+ "&"+
+ "password=" + encodeURIComponent(document.getElementsByName("password")[0].value) + "&" +
+ "longdescription=" + "&" +
+ "einschraenkungen=" + document.getElementById("einschraenkungen").value + "&" +
+ "transdate=" + document.getElementById("transdate_hidden").value + "&" +
+ "regdate=" + document.getElementById("reqdate_hidden").value + "&" +
+ "what2search=" + document.getElementById("what2search").value + "&" +
+ "searchid=" + document.getElementById("searchid").value + "&" +
+ "mitarbeiter=" + document.getElementById("mitarbeiter_hidden").value + "&";
+}
--- /dev/null
+function centerParms(width,height,extra) {
+ xPos = (screen.width - width) / 2;
+ yPos = (screen.height - height) / 2;
+
+ string = "left=" + xPos + ",top=" + yPos;
+
+ if (extra)
+ string += "width=" + width + ",height=" + height;
+
+ return string;
+}
+
+function set_history_window(id) {
+ var parm = centerParms(800,500) + ",width=800,height=500,status=yes,scrollbars=yes";
+ var name = "History";
+ url = "common.pl?" +
+ "action=show_history&" +
+ "login=" + encodeURIComponent(document.getElementsByName("login")[0].value)+ "&"+
+ "password=" + encodeURIComponent(document.getElementsByName("password")[0].value) + "&" +
+ "longdescription=" + "&" +
+ "input_name=" + escape(id) + "&"
+ window.open(url, "_new_generic", parm);
+}
--- /dev/null
+function show_vc_details(vc) {
+ var width = 750;
+ var height = 550;
+ var parm = centerParms(width, height) + ",width=" + width + ",height=" + height + ",status=yes,scrollbars=yes";
+ var vc_id = document.getElementsByName(vc + "_id");
+ if (vc_id)
+ vc_id = vc_id[0].value;
+ url = "common.pl?" +
+ "action=show_vc_details&" +
+ "login=" + escape(document.getElementsByName("login")[0].value) + "&" +
+ "password=" + escape(document.getElementsByName("password")[0].value) + "&" +
+ "vc=" + escape(vc) + "&" +
+ "vc_id=" + escape(vc_id)
+ //alert(url);
+ window.open(url, "_new_generic", parm);
+}
"action=vendor_selection&" +
"login=" + escape(document.getElementsByName("login")[0].value) + "&" +
"password=" + escape(document.getElementsByName("password")[0].value) + "&" +
- "path=" + escape(document.getElementsByName("path")[0].value) + "&" +
"name=" + escape(name) + "&" +
"input_name=" + escape(input_name) + "&" +
"input_id=" + escape(input_id)
#!/usr/bin/perl
#
+BEGIN {
+ push(@INC, "modules");
+}
+
use SL::LXDebug;
$lxdebug = LXDebug->new();
use SL::Form;
+use SL::Locale;
eval { require "lx-erp.conf"; };
--- /dev/null
+am.pl
\ No newline at end of file
--- /dev/null
+Order Allow,Deny
+Deny from all
--- /dev/null
+$self->{texts} = {
+ 'Database update error:' => 'Fehler beim Datenbankupgrade:',
+};
+
+$self->{subs} = {
+ 'create_tables' => 'create_tables',
+ 'do_copy' => 'do_copy',
+ 'do_query' => 'do_query',
+ 'mydberror' => 'mydberror',
+};
+
+1;
$self->{texts} = {
- 'Access Control' => 'Zugriffkontrolle',
+ 'A temporary directory could not be created:' => 'Ein temporäres Verzeichnis konnte nicht erstellt werden:',
+ 'A temporary file could not be created:' => 'Eine temporäre Datei konnte nicht erstellt werden:',
+ 'ADDED' => 'Hinzugefügt',
'Add User' => 'Benutzer erfassen',
'Address' => 'Adresse',
'Administration' => 'Administration',
- 'Administrator' => 'Administrator',
- 'All Datasets up to date!' => 'Alle Datenbanken sind auf aktuellem Stand.',
- 'Back' => 'Zurück',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
+ 'Backup Dataset' => 'Datenbank sichern',
+ 'Bcc' => 'Bcc',
+ 'Bin List' => 'Lagerliste',
+ 'CANCELED' => 'Storniert',
'Cannot create Lock!' => 'System kann nicht gesperrt werden!',
+ 'Cc' => 'Cc',
'Change Admin Password' => 'Administratorpasswort ändern',
- 'Change Password' => 'Passwort ändern',
- 'Character Set' => 'Zeichensatz',
- 'Click on login name to edit!' => 'Zum Bearbeiten den Zugriffsnamen anklicken!',
- 'Company' => 'Firma',
- 'Connect to' => 'Als Vorlage verwenden',
- 'Continue' => 'Weiter',
- 'Create Chart of Accounts' => 'Kontenplan anlegen',
+ 'Confirmation' => 'Auftragsbestätigung',
'Create Dataset' => 'Datenbank anlegen',
- 'DBI not installed!' => 'DBI ist nicht installiert!',
- 'DUNS-Nr' => 'DUNS-Nr.',
- 'Database' => 'Datenbank',
+ 'Credit Note' => 'Gutschrift',
+ 'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
'Database Administration' => 'Datenbankadministration',
- 'Database Driver not checked!' => 'Kein Datenbanktreiber ausgewählt!',
'Database User missing!' => 'Datenbankbenutzer fehlt!',
- 'Dataset' => 'Datenbank',
+ 'Database backups and restorations are disabled in lx-erp.conf.' => 'Datenbanksicherungen und -wiederherstellungen sind in der lx-erp.conf deaktiviert.',
'Dataset missing!' => 'Datenbank fehlt!',
- 'Dataset updated!' => 'Datenbank erneuert!',
'Dataset upgrade' => 'Datenbankaktualisierung',
- 'Date Format' => 'Datumsformat',
- 'Delete' => 'Löschen',
+ 'Date' => 'Datum',
'Delete Dataset' => 'Datenbank löschen',
'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Directory' => 'Verzeichnis',
- 'Driver' => 'Treiber',
- 'Dropdown Limit' => 'Auswahllistenbegrenzung',
- 'E-mail' => 'eMail',
+ 'ELSE' => 'Zusatz',
'Edit User' => 'Benutzerdaten bearbeiten',
+ 'Enter longdescription' => 'Langtext eingeben',
'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
- 'Existing Datasets' => 'existierende Datenbanken',
- 'Fax' => 'Fax',
+ 'File' => 'Datei',
'File locked!' => 'Datei gesperrt!',
- 'Host' => 'Datenbankcomputer',
- 'Hostname missing!' => 'Computername fehlt!',
+ 'History' => 'Historie',
'Incorrect Password!' => 'Ungültiges Passwort!',
- 'Language' => 'Sprache',
- 'Leave host and port field empty unless you want to make a remote connection.' => 'Für lokale Verbindungen "Rechner" und "Port" freilassen.',
- 'Lock System' => 'System sperren',
+ 'Invoice' => 'Rechnung',
'Lockfile created!' => 'System gesperrt!',
'Lockfile removed!' => 'System entsperrt!',
- 'Login' => 'Anmeldung',
'Login name missing!' => 'Loginname fehlt.',
- 'Manager' => 'Manager',
+ 'MAILED' => 'Gesendet',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
+ 'Message' => 'Nachricht',
'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
- 'Multibyte Encoding' => 'Schriftsatz',
'Name' => 'Name',
- 'New Templates' => 'neue Vorlagen',
+ 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
'No Database Drivers available!' => 'Kein Datenbanktreiber verfügbar!',
'No Dataset selected!' => 'Keine Datenbank ausgewählt!',
+ 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No backup file has been uploaded.' => 'Es wurde keine Sicherungsdatei hochgeladen.',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
+ 'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
+ 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
+ 'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'Nothing to delete!' => 'Es konnte nichts gelöscht werden!',
- 'Number Format' => 'Zahlenformat',
- 'Old (on the side)' => 'Alt (seitlich)',
- 'Oracle Database Administration' => 'Oracle Datenbankadministration',
- 'Password' => 'Passwort',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
+ 'Part Number' => 'Artikelnummer',
+ 'Part description' => 'Artikelbeschreibung',
'Password changed!' => 'Passwort geändert!',
- 'Pg Database Administration' => 'Datenbankadministration',
- 'Phone' => 'Telefon',
- 'Port' => 'Port',
- 'Port missing!' => 'Portangabe fehlt!',
- 'Printer' => 'Drucker',
- 'Repeat the password' => 'Passwort wiederholen',
- 'Save' => 'Speichern',
- 'Setup Menu' => 'Menüsetup',
- 'Setup Templates' => 'Vorlagen auswählen',
- 'Signature' => 'Unterschrift',
- 'Stylesheet' => 'Stilvorlage',
- 'Supervisor' => 'Supervisor',
- 'Tax number' => 'Steuernummer',
- 'Templates' => 'Vorlagen',
+ 'Pick List' => 'Sammelliste',
+ 'Please enter values' => 'Bitte Werte eingeben',
+ 'Proforma Invoice' => 'Proformarechnung',
+ 'Project Number' => 'Projektnummer',
+ 'Project description' => 'Projektbeschreibung',
+ 'Purchase Order' => 'Lieferantenauftrag',
+ 'Quotation' => 'Angebot',
+ 'RFQ' => 'Anfrage',
+ 'Restore Dataset' => 'Datenbank wiederherstellen',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
+ 'Select a Customer' => 'Endkunde auswählen',
+ 'Select a part' => 'Artikel auswählen',
+ 'Select a project' => 'Projekt auswählen',
+ 'Select an employee' => 'Angestellten auswählen',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
+ 'Subject' => 'Betreff',
'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
- 'The following Datasets are not in use and can be deleted' => 'Die folgenden Datenbanken sind nicht in Verwendung und können gelöscht werden',
- 'The following Datasets need to be updated' => 'Folgende Datenbanken müssen aktualisiert werden',
+ 'The dataset name is missing.' => 'Der Datenbankname fehlt.',
+ 'The directory %s does not exist.' => 'Das Verzeichnis %s existiert nicht.',
+ 'The email address is missing.' => 'Die Emailadresse fehlt.',
+ 'The login is missing.' => 'Das Login fehlt.',
'The passwords do not match.' => 'Die Passwörter stimmen nicht überein.',
- 'This is a preliminary check for existing sources. Nothing will be created or deleted at this stage!' => 'In diesem Schritt werden bestehende Datenbanken gesucht. Es werden noch keine Änderungen vorgenommen!',
- 'To add a user to a group edit a name, change the login name and save. A new user with the same variables will then be saved under the new login name.' => 'Um einer Gruppe einen neuen Benutzer hinzuzufügen, ändern und speichern Sie am einfachsten einen bestehen den Zugriffsnamen. Unter dem neuen Namen wird dann ein Benutzer mit denselben Einstellungen angelegt.',
- 'Top (CSS)' => 'Oben (mit CSS)',
- 'Top (Javascript)' => 'Oben (mit Javascript)',
+ 'The pg_dump process could not be started.' => 'Der pg_dump-Prozess konnte nicht gestartet werden.',
+ 'The pg_restore process could not be started.' => 'Der pg_restore-Prozess konnte nicht gestartet werden.',
+ 'To (email)' => 'An',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
+ 'Unit' => 'Einheit',
'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
- 'Unlock System' => 'System entsperren',
'Update Dataset' => 'Datenbank aktualisieren',
- 'Use Templates' => 'benutze Vorlagen',
- 'User' => 'Benutzer',
'User deleted!' => 'Benutzer gelöscht!',
'User saved!' => 'Benutzer gespeichert!',
- 'Ust-IDNr' => 'USt-IdNr.',
- 'Version' => 'Version',
- 'WEBDAV-Zugriff' => 'WEBDAV-Zugriff',
- 'You must enter a host and port for local and remote connections!' => '"Rechner" und "Port" müssen für lokale und externe Verbindungen eingetragen werden!',
- 'does not exist' => 'existiert nicht',
+ 'Value' => 'Wert',
+ 'Variable' => 'Variable',
+ 'Vendor details' => 'Lieferantendetails',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
+ 'invoice' => 'Rechnung',
'is already a member!' => 'ist bereits ein Mitglied!',
- 'localhost' => 'lokaler Rechner',
- 'successfully created!' => 'wurde erfolgreich erstellt',
- 'successfully deleted!' => 'wurde erfolgreich gelöscht',
- 'website' => 'Webseite',
+ 'no' => 'nein',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
+ 'yes' => 'ja',
};
$self->{subs} = {
+ 'E' => 'E',
+ 'H' => 'H',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
'add_user' => 'add_user',
'adminlogin' => 'adminlogin',
+ 'back' => 'back',
+ 'backup_dataset' => 'backup_dataset',
+ 'backup_dataset_start' => 'backup_dataset_start',
+ 'build_std_url' => 'build_std_url',
+ 'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'change_admin_password' => 'change_admin_password',
'change_password' => 'change_password',
'check_password' => 'check_password',
'create_dataset' => 'create_dataset',
'dbcreate' => 'dbcreate',
'dbdelete' => 'dbdelete',
- 'dbdriver_defaults' => 'dbdriver_defaults',
'dbselect_source' => 'dbselect_source',
'dbupdate' => 'dbupdate',
'delete' => 'delete',
'delete_dataset' => 'delete_dataset',
+ 'delivery_customer_selection' => 'delivery_customer_selection',
'edit' => 'edit',
- 'form_footer' => 'form_footer',
- 'form_header' => 'form_header',
+ 'edit_user_form' => 'edit_user_form',
+ 'employee_selection_internal' => 'employee_selection_internal',
+ 'format_dates' => 'format_dates',
'get_value' => 'get_value',
'list_users' => 'list_users',
'lock_system' => 'lock_system',
'login' => 'login',
'login_name' => 'login_name',
- 'oracle_database_administration' => 'oracle_database_administration',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
+ 'part_selection_internal' => 'part_selection_internal',
'pg_database_administration' => 'pg_database_administration',
+ 'project_selection_internal' => 'project_selection_internal',
+ 'reformat_numbers' => 'reformat_numbers',
+ 'restore_dataset' => 'restore_dataset',
+ 'restore_dataset_start' => 'restore_dataset_start',
'save' => 'save',
+ 'select_employee' => 'select_employee',
+ 'select_employee_internal' => 'select_employee_internal',
+ 'select_part' => 'select_part',
+ 'select_part_internal' => 'select_part_internal',
+ 'set_longdescription' => 'set_longdescription',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
'unlock_system' => 'unlock_system',
'update_dataset' => 'update_dataset',
+ 'vendor_selection' => 'vendor_selection',
'benutzer_erfassen' => 'add_user',
+ 'zurück' => 'back',
+ 'datenbank_sichern' => 'backup_dataset',
'administratorpasswort_ändern' => 'change_admin_password',
'passwort_ändern' => 'change_password',
'weiter' => 'continue',
'datenbank_löschen' => 'delete_dataset',
'system_sperren' => 'lock_system',
'anmeldung' => 'login',
- 'oracle_datenbankadministration' => 'oracle_database_administration',
'datenbankadministration' => 'pg_database_administration',
+ 'datenbank_wiederherstellen' => 'restore_dataset',
'speichern' => 'save',
'system_entsperren' => 'unlock_system',
'datenbank_aktualisieren' => 'update_dataset',
' Date missing!' => ' Datum fehlt!',
' Number' => ' Nummer',
' Part Number missing!' => ' Artikelnummer fehlt!',
- ' Payment posted!' => 'Zahlung gebucht!',
' missing!' => ' fehlt!',
+ '<%account_number%> -- Your account number' => '<%account_number%> -- Ihre Kontonummer',
+ '<%bank%> -- Your bank' => '<%bank%> -- Der Name Ihrer Bank',
+ '<%bank_code%> -- Your bank code' => '<%bank_code%> -- Die Bankleitzahl Ihrer Bank',
+ '<%currency%> -- The selected currency' => '<%currency%> -- Die ausgewählte Währung',
+ '<%invtotal%> -- Invoice total' => '<%invtotal%> -- Die Rechnungssumme',
+ '<%invtotal_wo_skonto%> -- Invoice total less discount' => '<%invtotal_wo_skonto%> -- Rechnungssumme abzüglich Skonto',
+ '<%netto_date%> -- Date the payment is due in full' => '<%netto_date%> -- Das Datum, bis die Rechnung in voller Höhe bezahlt werden muss',
+ '<%skonto_amount%> -- The deductible amount' => '<%skonto_amount%> -- Der abziehbare Skontobetrag',
+ '<%skonto_date%> -- Date the payment is due with discount' => '<%skonto_date%> -- Das Datum, bis die Rechnung unter Abzug von Skonto bezahlt werden kann',
+ '<%terms_netto%> -- The number of days for full payment' => '<%terms_netto%> -- Die Anzahl Tage, bis die Rechnung in voller Höhe bezahlt werden muss',
+ '<%total%> -- Amount payable' => '<%total%> -- Noch zu bezahlender Betrag',
+ '<%total_wo_skonto%> -- Amount payable less discount' => '<%total_wo_skonto%> -- Noch zu bezahlender Betrag abzüglich Skonto',
'*/' => '*/',
'...done' => '...fertig',
'1. Quarter' => '1. Quartal',
- '1000,00 or 1000.00' => '1000,00 oder 1000.00',
'2. Quarter' => '2. Quartal',
'3. Quarter' => '3. Quartal',
'4. Quarter' => '4. Quartal',
+ '<b>What</b> do you want to look for?' => '<b>Wonach</b> wollen Sie suchen?',
'A Buchungsgruppe consists of a descriptive name and the account numbers for the income and expense accounts for those four tax zones as well as the inventory account number.' => 'Eine Buchungsgruppe besteht aus einem deskriptiven Namen, den Erlös- und Aufwandskonten für diese vier Steuerzonen sowie aus einem Inventarkonto.',
+ 'A temporary directory could not be created:' => 'Ein temporäres Verzeichnis konnte nicht erstellt werden:',
+ 'A temporary file could not be created:' => 'Eine temporäre Datei konnte nicht erstellt werden:',
'A unit with this name does already exist.' => 'Eine Einheit mit diesem Namen existiert bereits.',
+ 'ADDED' => 'Hinzugefügt',
'AP' => 'Einkauf',
'AP Aging' => 'Offene Verbindlichkeiten',
'AP Transaction' => 'Kreditorenbuchung',
+ 'AP Transaction (abbreviation)' => 'K',
'AP Transactions' => 'Kreditorenbuchungen',
'AR' => 'Verkauf',
'AR Aging' => 'Offene Forderungen',
'AR Transaction' => 'Debitorenbuchung',
+ 'AR Transaction (abbreviation)' => 'D',
'AR Transactions' => 'Debitorenbuchungen',
'About' => 'über',
'Abrechnungsnummer' => 'Abrechnungsnummer',
'Abteilung' => 'Abteilung',
'Access Control' => 'Zugriffkontrolle',
'Account' => 'Konto',
+ 'Account Category A' => 'Aktiva/Mittelverwendung',
+ 'Account Category C' => 'Kosten',
+ 'Account Category E' => 'Aufwandskonto',
+ 'Account Category G' => '?Gegenkonto?',
+ 'Account Category I' => 'Erlöskonto',
+ 'Account Category L' => 'Passiva/Mittelherkunft',
+ 'Account Category Q' => 'Passiva',
+ 'Account Description missing!' => 'Beschreibung fehlt!',
+ 'Account Link AP' => 'Einkauf',
+ 'Account Link AP_amount' => 'Verbindlichkeiten Aufwand/Anlagen',
+ 'Account Link AP_paid' => 'Verbindlichkeiten Zahlungsausgang',
+ 'Account Link AP_tax' => 'Verbindlichkeiten Steuer',
+ 'Account Link AR' => 'Verkauf',
+ 'Account Link AR_amount' => 'Forderungen Erlöskonto',
+ 'Account Link AR_paid' => 'Forderungen Zahlungseingang',
+ 'Account Link AR_tax' => 'Forderungen Steuer',
+ 'Account Link CT_tax' => 'Kunde/Lieferant Steuer',
+ 'Account Link IC' => 'Inventar',
+ 'Account Link IC_cogs' => 'Warenliste Aufwandskonto',
+ 'Account Link IC_expense' => 'Dienstleistungen Aufwandskonto',
+ 'Account Link IC_income' => 'Dienstleistungen Erlöskonto',
+ 'Account Link IC_sale' => 'Warenliste Erlöskonto',
+ 'Account Link IC_taxpart' => 'Warenliste Steuer',
+ 'Account Link IC_taxservice' => 'Dienstleistungen Steuer',
'Account Number' => 'Kontonummer',
'Account Number missing!' => 'Kontonummer fehlt!',
'Account Nummer' => 'Kontonummer',
'Account Type' => 'Kontoart',
'Account Type missing!' => 'Kontoart fehlt!',
'Account deleted!' => 'Konto gelöscht!',
+ 'Account for fees' => 'Konto für Gebühren',
+ 'Account for interest' => 'Konto für Zinsen',
'Account saved!' => 'Konto gespeichert!',
+ 'Accounting Group deleted!' => 'Buchungsgruppe gelöscht!',
+ 'Accounting Group saved!' => 'Buchungsgruppe gespeichert!',
'Accounting Menu' => 'Kontoverwaltung',
'Accrual' => 'Bilanzierung',
'Active' => 'Aktiv',
'Add AP Transaction' => 'Kreditorenbuchung',
'Add AR Transaction' => 'Debitorenbuchung',
'Add Account' => 'Konto erfassen',
+ 'Add Accounting Group' => 'Buchungsgruppe erfassen',
'Add Accounts Payables Transaction' => 'Kreditorenbuchung erfassen',
'Add Accounts Receivables Transaction' => 'Debitorenbuchung erfassen',
'Add Assembly' => 'Erzeugnis erfassen',
'Add Buchungsgruppe' => 'Buchungsgruppe erfassen',
- 'Add Business' => 'Kundentyp erfassen',
+ 'Add Business' => 'Kunden-/Lieferantentyp erfassen',
'Add Credit Note' => 'Gutschrift erfassen',
'Add Customer' => 'Kunde erfassen',
'Add Department' => 'Abteilung erfassen',
'Add Dunning' => 'Mahnung erzeugen',
'Add Exchangerate' => 'Wechselkurs erfassen',
- 'Add GIFI' => 'GIFI erfassen',
'Add General Ledger Transaction' => 'Dialogbuchen',
'Add Group' => 'Warengruppe erfassen',
'Add Language' => 'Sprache hinzufügen',
'Add Quotation' => 'Angebot erfassen',
'Add RFQ' => 'Neue Preisanfrage',
'Add Request for Quotation' => 'Anfrage erfassen',
- 'Add SIC' => 'SIC erfassen',
'Add Sales Invoice' => 'Rechnung erfassen',
'Add Sales Order' => 'Auftrag erfassen',
'Add Service' => 'Dienstleistung erfassen',
'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',
'Administration' => 'Administration',
- 'Administrator' => 'Administrator',
+ 'Aktion' => 'Aktion',
'All' => 'Alle',
'All Accounts' => 'Alle Konten',
'All Datasets up to date!' => 'Alle Datenbanken sind auf aktuellem Stand.',
'All changes in that file have been reverted.' => 'Alle Änderungen in dieser Datei wurden rückgängig gemacht.',
+ 'All database upgrades have been applied.' => 'Alle Datenbankupdates wurden eingespielt.',
'Amended Advance Turnover Tax Return' => 'Berichtigte Anmeldung',
'Amended Advance Turnover Tax Return (Nr. 10)' => 'Ist dies eine berichtigte Anmeldung? (Nr. 10/Zeile 15 Steuererklärung)',
'Amount' => 'Betrag',
'Amount Due' => 'Betrag fällig',
- 'Ansprechpartner' => '',
+ 'Ansprechpartner' => 'Ansprechpartner',
'Application Error. No Format given' => 'Fehler in der Anwendung. Das Ausgabeformat fehlt.',
'Application Error. Wrong Format' => 'Fehler in der Anwendung. Falsches Format: ',
'Applying <TMPL_VAR file ESCAPE=HTML>:' => 'Führe <TMPL_VAR file ESCAPE=HTML> aus:',
'Article Code' => 'Artikelkürzel',
'Article Code missing!' => 'Artikelkürzel fehlt',
'Assemblies' => 'Erzeugnisse',
- 'Assemblies restocked!' => 'Erzeugnisse sind im Lager!',
'Assembly Number missing!' => 'Erzeugnisnummer fehlt!',
'Asset' => 'Aktiva/Mittelverwendung',
'Assign new units' => 'Neue Einheiten zuweisen',
'Assign units' => 'Einheiten zuweisen',
'Assume Tax Consultant Data in Tax Computation?' => 'Beraterdaten in UStVA übernehmen?',
+ 'At least one Perl module that Lx-Office ERP requires for running is not installed on your system.' => 'Mindestes ein Perl-Modul, das Lx-Office ERP zur Ausführung benötigt, ist auf Ihrem System nicht installiert.',
'Attach PDF:' => 'PDF anhängen',
'Attachment' => 'als Anhang',
+ 'Attachment name' => 'Name des Anhangs',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
'Audit Control' => 'Bücherkontrolle',
- 'Aufwand Ausland' => '',
- 'Aufwand EU m UStId' => '',
- 'Aufwand EU m. UStId' => '',
- 'Aufwand EU o. UStId' => '',
- 'Aufwand Inland' => '',
'Aug' => 'Aug',
'August' => 'August',
'Auto Send?' => 'Auto. Versand?',
- 'BG anzeigen' => 'BG anzeigen',
- 'BG hinzufügen' => 'BG hinzufügen',
+ 'Automatically created invoice for fee and interest for dunning %s' => 'Automatisch erzeugte Rechnung für Gebühren und Zinsen zu Mahnung %s',
'BOM' => 'Stückliste',
'BWA' => 'BWA',
- 'Back' => 'Zurück',
- 'Backup sent to' => 'Eine Sicherungskopie wurde gesandt an',
+ 'Back' => 'Zurück',
+ 'Backup Dataset' => 'Datenbank sichern',
+ 'Backup file' => 'Sicherungsdatei',
+ 'Backup of dataset' => 'Sicherung der Datenbank',
'Balance' => 'Bilanz',
'Balance Sheet' => 'Bilanz',
'Bank' => 'Bank',
- 'Bank Code' => 'BLZ: ',
+ 'Bank Code' => 'BLZ',
'Bank Code (long)' => 'Bankleitzahl (BLZ)',
'Bank Code Number' => 'Bankleitzahl',
- 'Bank Connection' => 'Bankverbindung',
'Bank Connection Tax Office' => 'Bankverbindung des Finanzamts',
+ 'Bank Connections' => 'Bankverbindungen',
'Base unit' => 'Basiseinheit',
'Batch Printing' => 'Druck',
'Bcc' => 'Bcc',
'Belegnummer' => 'Buchungsnummer',
'Beratername' => 'Beratername',
'Beraternummer' => 'Beraternummer',
- 'Bestandskonto' => '',
+ 'Bestandskonto' => 'Bestandskonto',
'Bilanz' => 'Bilanz',
'Billing Address' => 'Rechnungsadresse',
'Bin' => 'Lagerplatz',
'Bis Konto: ' => 'bis Konto: ',
'Body:' => 'Text:',
'Books are open' => 'Die Bücher sind geöffnet.',
+ 'Both' => 'Sowohl als auch',
+ 'Bottom' => 'Unten',
'Bought' => 'Gekauft',
'Buchungsdatum' => 'Buchungsdatum',
'Buchungsgruppe' => 'Buchungsgruppe',
- 'Buchungsgruppe bearbeiten' => 'Buchungsgruppe bearbeiten',
- 'Buchungsgruppe gelöscht!' => 'Buchungsgruppe gelöscht!',
- 'Buchungsgruppe gespeichert!' => 'Buchungsgruppe gespeichert!',
- 'Buchungsgruppe hinzufügen' => 'Buchungsgruppe hinzufügen',
'Buchungsgruppen' => 'Buchungsgruppen',
- 'Buchungsjournal' => 'Buchungsjournal',
- 'Business' => 'Firma',
+ 'Buchungsnummer' => 'Buchungsnummer',
'Business Number' => 'Firmennummer',
+ 'Business Volume' => 'Geschäftsvolumen',
'Business deleted!' => 'Firma gelöscht.',
'Business saved!' => 'Firma gespeichert.',
- 'C' => 'G',
+ 'CANCELED' => 'Storniert',
+ 'CSV export -- options' => 'CSV-Export -- Optionen',
'Calculate' => 'Berechnen',
+ 'Cancel Accounts Payables Transaction' => 'Kreditorenbuchung stornieren',
+ 'Cancel Accounts Receivables Transaction' => 'Debitorenbuchung stornieren',
'Cannot create Lock!' => 'System kann nicht gesperrt werden!',
'Cannot delete account!' => 'Konto kann nicht gelöscht werden!',
'Cannot delete customer!' => 'Kunde kann nicht gelöscht werden!',
'Cannot save order!' => 'Auftrag kann nicht gespeichert werden!',
'Cannot save preferences!' => 'Benutzereinstellungen können nicht gespeichert werden!',
'Cannot save quotation!' => 'Angebot kann nicht gespeichert werden!',
- 'Cannot stock assemblies!' => 'Erzeugnisse können nicht ins Lager!',
'Cannot storno storno invoice!' => 'Kann eine Stornorechnung nicht stornieren',
+ 'Carry over shipping address' => 'Lieferadresse übernehmen',
'Cash' => 'Zahlungsverkehr',
'Cc' => 'Cc',
'Change Admin Password' => 'Administratorpasswort ändern',
'Change Password' => 'Passwort ändern',
- 'Character Set' => 'Zeichensatz',
+ 'Chart Type' => 'Kontentyp',
'Chart of Accounts' => 'Kontenübersicht',
'Chart of accounts' => 'Kontenrahmen',
+ 'Chartaccounts connected to this Tax:' => 'Konten, die mit dieser Steuer verknüpft sind:',
+ 'Check' => 'Scheck',
'Check Details' => 'Bitte Angaben überprüfen',
'Checks' => 'Schecks',
'Choose Customer' => 'Endkunde wählen:',
'Close' => 'Übernehmen',
'Close Books up to' => 'Die Bücher abschließen bis zum',
'Closed' => 'Geschlossen',
- 'Code' => 'kode',
- 'Code missing!' => 'kode fehlt!',
'Collective Orders only work for orders from one customer!' => 'Sammelaufträge funktionieren nur für Aufträge von einem Kunden!',
'Comment' => 'Kommentar',
'Company' => 'Firma',
'Compare to' => 'Gegenüberstellen zu',
'Confirm!' => 'Bestätigen Sie!',
'Confirmation' => 'Auftragsbestätigung',
- 'Connect to' => 'Als Vorlage verwenden',
'Contact' => 'Kontakt',
'Contact Person' => 'Ansprechpartner',
'Contacts' => 'Kontakte',
'Continue' => 'Weiter',
'Contra' => 'gegen',
'Copies' => 'Kopien',
- 'Copy to COA' => 'In Kontenplan kopieren',
'Cost Center' => 'Kostenstelle',
'Costs' => 'Kosten',
'Could not copy %s to %s. Reason: %s' => 'Die Datei "%s" konnte nicht nach "%s" kopiert werden. Grund: %s',
'Could not open the file users/members.' => 'Die Datei "users/members" konnte nicht geöffnet werden.',
+ 'Could not print dunning.' => 'Die Mahnungen konnten nicht gedruckt werden.',
'Could not rename %s to %s. Reason: %s' => 'Die Datei "%s" konnte nicht in "%s" umbenannt werden. Grund: %s',
- 'Could not save!' => 'Konnte nicht speichern!',
- 'Could not transfer Inventory!' => 'Konnte Waren nicht umlagern!',
+ 'Could not spawn ghostscript.' => 'Die Anwendung "ghostscript" konnte nicht gestartet werden.',
+ 'Could not spawn html2ps or GhostScript.' => 'html2ps oder GhostScript konnte nicht gestartet werden.',
+ 'Could not spawn the printer command.' => 'Die Druckanwendung konnte nicht gestartet werden.',
'Could not update prices!' => 'Preise konnten nicht aktualisiert werden!',
+ 'Could not write the html2ps config file.' => 'Die temporäre html2ps-Konfigurationsdatei konnte nicht geschrieben werden.',
+ 'Could not write the temporary HTML file.' => 'Eine temporäre HTML-Datei konnte nicht geschrieben werden.',
'Country' => 'Land',
'Create Buchungsgruppen' => 'Buchungsgruppe erfassen',
'Create Chart of Accounts' => 'Kontenplan anlegen',
'Create Dataset' => 'Datenbank anlegen',
+ 'Create invoice?' => 'Rechnung erstellen?',
+ 'Create new' => 'Neu erfassen',
'Credit' => 'Haben',
'Credit Account' => 'Habenkonto',
'Credit Limit' => 'Kreditlimit',
'Customer Number' => 'Kundennummer',
'Customer Order Number' => 'Bestellnummer des Kunden',
'Customer deleted!' => 'Kunde gelöscht!',
+ 'Customer details' => 'Kundendetails',
'Customer missing!' => 'Kundenname fehlt!',
+ 'Customer not on file or locked!' => 'Dieser Kunde existiert nicht oder ist gesperrt.',
'Customer not on file!' => 'Kunde ist nicht in der Datenbank!',
'Customer saved!' => 'Kunde gespeichert!',
+ 'Customer type' => 'Kundentyp',
'Customername' => 'Kundenname',
- 'Customernumberinit' => 'Kundennummernkreis',
+ 'Customernumberinit' => 'Kunden-/Lieferantennummernkreis',
'Customers' => 'Kunden',
'Customized Report' => 'Vorgewählte Zeiträume',
'DATEV - Export Assistent' => 'DATEV-Exportassistent',
'DATEV Angaben' => 'DATEV-Angaben',
'DATEX - Export Assistent' => 'DATEV-Exportassistent',
- 'DBI not installed!' => 'DBI ist nicht installiert!',
+ 'DELETED' => 'Gelöscht',
'DFV-Kennzeichen' => 'DFV-Kennzeichen',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
'DUNS-Nr' => 'DUNS-Nr.',
'Database' => 'Datenbank',
'Database Administration' => 'Datenbankadministration',
- 'Database Driver not checked!' => 'Kein Datenbanktreiber ausgewählt!',
'Database Host' => 'Datenbankcomputer',
'Database User missing!' => 'Datenbankbenutzer fehlt!',
+ 'Database backups and restorations are disabled in lx-erp.conf.' => 'Datenbanksicherungen und -wiederherstellungen sind in der lx-erp.conf deaktiviert.',
+ 'Database template' => 'Datenbankvorlage',
'Database update error:' => 'Fehler beim Datenbankupgrade:',
'Dataset' => 'Datenbank',
'Dataset missing!' => 'Datenbank fehlt!',
- 'Dataset updated!' => 'Datenbank erneuert!',
+ 'Dataset name' => 'Datenbankname',
'Dataset upgrade' => 'Datenbankaktualisierung',
'Date' => 'Datum',
'Date Format' => 'Datumsformat',
'Date Paid' => 'Zahlungsdatum',
- 'Date Received' => 'Empfangsdatum',
'Date missing!' => 'Datum fehlt!',
- 'Date received missing!' => 'Empfangsdatum fehlt!',
- 'Datenträgernummer' => 'Datenträgernummer',
+ 'Datevautomatik' => 'Datevexport',
'Datum von' => 'Datum von',
'Debit' => 'Soll',
'Debit Account' => 'Sollkonto',
'December' => 'Dezember',
'Decimalplaces' => 'Dezimalstellen',
'Decrease' => 'Verringern',
+ 'Default output medium' => 'Standardausgabekanal',
+ 'Default printer' => 'Standarddrucker',
'Default template format' => 'Standardvorlagenformat',
'Delete' => 'Löschen',
'Delete Account' => 'Konto löschen',
'Delete Dataset' => 'Datenbank löschen',
+ 'Delete drafts' => 'Entwürfe löschen',
+ 'Delivered' => 'Geliefert',
'Delivery Date' => 'Lieferdatum',
'Department' => 'Abteilung',
'Department deleted!' => 'Abteilung gelöscht.',
'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Deposit' => 'Gutschrift',
'Description' => 'Beschreibung',
+ 'Description (Click on Description for details)' => 'Beschreibung (Klick
+ öffnet einzelne Kontendetails)',
'Description missing!' => 'Beschreibung fehlt.',
'Description must not be empty!' => 'Beschreibung darf nicht leer sein',
'Difference' => 'Differenz',
'Dimension units' => 'Maßeinheiten',
'Directory' => 'Verzeichnis',
'Discount' => 'Rabatt',
+ 'Display' => 'Anzeigen',
+ 'Display file' => 'Datei anzeigen',
+ 'Do you want to <b>limit</b> your search?' => 'Wollen Sie Ihre Suche <b>spezialisieren</b>?',
+ 'Do you want to carry this shipping address over to the new purchase order so that the vendor can deliver the goods directly to your customer?' => 'Wollen Sie diese Lieferadresse in den neuen Lieferantenauftrag übernehmen, damit der Händler die Waren direkt an Ihren Kunden liefern kann?',
'Done' => 'Fertig',
+ 'Download the backup' => 'Die Sicherungsdatei herunterladen',
+ 'Draft saved.' => 'Entwurf gespeichert.',
'Drawing' => 'Zeichnung',
'Driver' => 'Treiber',
'Dropdown Limit' => 'Auswahllistenbegrenzung',
'Dunning Level' => 'Mahnlevel',
'Dunning Level missing in row ' => 'Mahnlevel fehlt in ',
'Dunning Process Config saved!' => 'Mahnwesenkonfiguration gespeichert!',
- 'Dunning Process started for selected invoices!' => 'Mahnprozess für selektierte Rechnungen
-gestartet',
+ 'Dunning Process started for selected invoices!' => 'Mahnprozess für selektierte Rechnungen gestartet',
+ 'Dunning number' => 'Mahnungsnummer',
'Dunning overview' => 'Mahnungsübersicht',
'Dunnings' => 'Mahnungen',
'E-mail' => 'eMail',
'E-mail Statement to' => 'Fälligkeitsabrechnung als eMail an',
'E-mail address missing!' => 'E-Mail-Adresse fehlt!',
- 'E-mailed' => 'eMail gesendet.',
+ 'EAN' => 'EAN',
+ 'EAN-Code' => 'EAN-Code',
+ 'EK' => 'EK',
+ 'ELSE' => 'Zusatz',
'ELSTER Export (Taxbird)' => 'ELSTER-Export nach Taxbird',
'ELSTER Export (Winston)' => 'ELSTER Export nach Winston',
'ELSTER Export nach Winston' => 'ELSTER Export nach Winston',
- 'ELSTER Tax Number' => 'ELSTER-Steuernummer: ',
+ 'ELSTER Tax Number' => 'ELSTER-Steuernummer',
'EU with VAT ID' => 'EU mit UstId-Nummer',
'EU without VAT ID' => 'EU ohne UstId-Nummer',
'EUER' => 'Einnahmen-/Überschussrechnung',
'Edit' => 'Bearbeiten',
'Edit ' => 'Bearbeiten',
'Edit Account' => 'Kontodaten bearbeiten',
+ 'Edit Accounting Group' => 'Buchungsgruppe bearbeiten',
'Edit Accounts Payables Transaction' => 'Kreditorenbuchung bearbeiten',
'Edit Accounts Receivables Transaction' => 'Debitorenbuchung bearbeiten',
'Edit Assembly' => 'Erzeugnis bearbeiten',
'Edit Buchungsgruppe' => 'Buchungsgruppe bearbeiten',
- 'Edit Business' => 'Kundentyp bearbeiten',
+ 'Edit Business' => 'Kunden-/Lieferantentyp bearbeiten',
'Edit Credit Note' => 'Gutschrift bearbeiten',
'Edit Customer' => 'Kunde editieren',
'Edit Department' => 'Abteilung bearbeiten',
'Edit Dunning' => 'Mahnungen konfigurieren',
'Edit Dunning Process Config' => 'Mahnwesenkonfiguration bearbeiten',
- 'Edit GIFI' => 'GIFI editieren',
'Edit General Ledger Transaction' => 'Buchung im Hauptbuch bearbeiten',
'Edit Group' => 'Warengruppe editieren',
'Edit Language' => 'Sprache bearbeiten',
'Edit Purchase Order' => 'Lieferantenaufrag bearbeiten',
'Edit Quotation' => 'Angebot bearbeiten',
'Edit Request for Quotation' => 'Anfrage bearbeiten',
- 'Edit SIC' => 'SIC bearbeiten',
'Edit Sales Invoice' => 'Rechnung bearbeiten',
'Edit Sales Order' => 'Auftrag bearbeiten',
'Edit Service' => 'Dienstleistung bearbeiten',
'Edit Storno Credit Note' => 'Storno Gutschrift bearbeiten',
'Edit Storno Invoice' => 'Stornorechnung bearbeiten',
- 'Edit Template' => 'Vorlage bearbeiten',
'Edit User' => 'Benutzerdaten bearbeiten',
'Edit Vendor' => 'Lieferant editieren',
'Edit Vendor Invoice' => 'Einkaufsrechnung bearbeiten',
- 'Edit Warehouse' => 'Lager bearbeiten',
+ 'Edit file' => 'Datei bearbeiten',
+ 'Edit templates' => 'Vorlage bearbeiten',
'Edit the purchase_order' => 'Bearbeiten des Lieferantenauftrags',
'Edit the request_quotation' => 'Bearbeiten der Preisanfrage',
'Edit the sales_order' => 'Bearbeiten des Auftrags',
'Edit the sales_quotation' => 'Bearbeiten des Angebots',
+ 'Edit the stylesheet' => 'Stilvorlage bearbeiten',
'Edit units' => 'Einheiten bearbeiten',
'Employee' => 'Bearbeiter',
+ 'Empty transaction!' => 'Buchung ist leer!',
'Enforce transaction reversal for all dates' => 'Gegenbuchungen für jeden Zeitraum aktualisieren',
+ 'Enter a description for this new draft.' => 'Geben Sie eine Beschreibung für diesen Entwurf ein.',
'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)',
'Equity' => 'Passiva',
- 'Erlöse Ausland' => 'Erlöse Ausland',
- 'Erlöse EU m. UStId' => 'Erlöse EU m. UStId',
- 'Erlöse EU o. UStId' => 'Erlöse EU o. UStId',
- 'Erlöse Inland' => 'Erlöse Inland',
'Error' => 'Fehler',
'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
'Error!' => 'Fehler!',
+ 'Ertrag' => 'Ertrag',
+ 'Ertrag prozentual' => 'Ertrag prozentual',
+ 'Escape character' => 'Escape-Zeichen',
'Exch' => 'Wechselkurs.',
'Exchangerate' => 'Wechselkurs',
'Exchangerate Difference' => 'Wechselkursunterschied',
'Expense Account' => 'Aufwandskonto',
'Expense accno' => 'Aufwandskonto',
'Expense/Asset' => 'Aufwand/Anlagen',
+ 'Expenses EU with UStId' => 'Aufwand EU m. UStId',
+ 'Expenses EU without UStId' => 'Erlöse EU o. UStId',
'Expired licenses' => 'Abgelaufene Lizenzen',
'Expiring in x month(s)' => 'Die in x Monat(en) ablaufen',
'Export Buchungsdaten' => 'Export Buchungsdaten',
'Export Stammdaten' => 'Export Stammdaten',
+ 'Export as CSV' => 'Als CSV exportieren',
+ 'Export as PDF' => 'Als PDF exportieren',
'Extended' => 'Gesamt',
'Extension Of Time' => 'Dauerfristverlängerung',
'Factor' => 'Faktor',
+ 'Falsches Datumsformat!' => 'Falsches Datumsformat!',
'Fax' => 'Fax',
'Feb' => 'Feb',
'February' => 'Februar',
'Fee' => 'Gebühr',
+ 'File' => 'Datei',
'File locked!' => 'Datei gesperrt!',
+ 'Files created by Lx-Office\'s "Backup Dataset" function are such files.' => 'Dateien, die von Lx-Office\' Funktion "Datenbank sichern" erstellt wurden, erfüllen diese Kriterien.',
'Folgekonto' => 'Folgekonto',
+ 'Font size' => 'Schriftgröße',
'For each unit there\'s either no or exactly one base unit. If you chose a base unit then you also have to chose a factor. That way the new unit will be defined as a multiple of the base unit. The base unit must be the "smaller" one. A factor may not be less than 1. Therefore you may define "kg" with the base unit "g" and a factor of "1", but not the other way round.' => 'Einheiten haben entweder keine oder genau eine Basiseinheit, von der sie ein Vielfaches sind. Wenn Sie eine Basiseinheit auswählen, dann müssen Sie auch einen Faktor eingeben. Sie müssen Einheiten als ein Vielfaches einer kleineren Einheit eingeben. So ist die Definition von "kg" mit der Basiseinheit "g" und dem Faktor 1000 zulässig, die Definition von "g" mit der Basiseinheit "kg" und dem Faktor "0,001" hingegen nicht.',
'Foreign Exchange Gain' => 'Wechselkurserträge',
'Foreign Exchange Loss' => 'Wechselkursaufwendungen',
+ 'Foreign Expenses' => 'Aufwand Ausland',
+ 'Foreign Revenues' => 'Erlöse Ausland',
'Form details (second row)' => 'Formulardetails (zweite Positionszeile)',
'Formula' => 'Formel',
'Free report period' => 'Freier Zeitraum',
'Fristsetzung' => 'Fristsetzung',
'From' => 'Von',
- 'GIFI' => 'GIFI',
- 'GIFI deleted!' => 'GIFI gelöscht!',
- 'GIFI missing!' => 'GIFI fehlt!',
- 'GIFI saved!' => 'GIFI gespeichert!',
'GL Transaction' => 'Dialogbuchung',
'General Ledger' => 'Finanzbuchhaltung',
- 'Geschäftsvolumen' => 'Geschäftsvolumen',
'Given Name' => 'Vorname',
'Greeting' => 'Anrede',
'Group' => 'Warengruppe',
'Group missing!' => 'Warengruppe fehlt!',
'Group saved!' => 'Warengruppe gespeichert!',
'Groups' => 'Warengruppen',
- 'Gültig ab' => 'Gültig ab',
'HTML' => 'HTML',
+ 'HTML Templates' => 'HTML-Vorlagen',
+ 'Header' => 'Überschrift',
'Heading' => 'Überschrift',
'Help' => 'Hilfe',
+ 'Here\'s an example command line:' => 'Hier ist eine Kommandozeile, die als Beispiel dient:',
'Hide by default' => 'Standardmäßig verstecken',
- 'Hint-Missing-Preferences' => 'Bitte fehlende USTVA Einstellungen ergänzen (Menüpunkt: Programm)',
+ 'Hint-Missing-Preferences' => 'Bitte fehlende USTVA Einstellungen ergänzen (Menüpunkt: System-> UStVA Einstellungen)',
'Hints' => 'Hinweise',
+ 'History' => 'Historie',
+ 'History Search' => 'Historien Suche',
+ 'History Search Engine' => 'Historien Suchmaschine',
'Homepage' => 'Homepage',
'Host' => 'Datenbankcomputer',
- 'Hostname missing!' => 'Computername fehlt!',
'I' => 'I',
'ID' => 'Buchungsnummer',
+ 'ID-Nummer' => 'ID-Nummer (intern)',
'II' => 'II',
'III' => 'III',
'IV' => 'IV',
+ 'If the automatic creation of invoices for fees and interest is switched on for a dunning level then the following accounts will be used for the invoice.' => 'Wenn das automatische Erstellen einer Rechnung über Mahngebühren und Zinsen für ein Mahnlevel aktiviert ist, so werden die folgenden Konten für die Rechnung benutzt.',
'If you see this message, you most likely just setup your LX-Office and haven\'t added any entry types. If this is the case, the option is accessible for administrators in the System menu.' => 'Wenn Sie diese Meldung sehen haben Sie wahrscheinlich ein frisches LX-Office Setup und noch keine Buchungsgruppen eingerichtet. Ein Administrator kann dies im Systemmenü erledigen.',
+ 'If you want to delete such a dataset you have to edit the user(s) that are using the dataset in question and have them use another dataset.' => 'Wenn Sie eine solche Datenbank löschen wollen, so müssen Sie zuerst die Benutzer bearbeiten, die die fragliche Datenbank benutzen, und sie so ändern, dass sie eine andere Datenbank benutzen.',
'Image' => 'Grafik',
- 'Import CSV' => '',
+ 'Import CSV' => 'CSV-Import',
'In Lx-Office 2.4.0 the administrator has to enter a list of units in the administrative section.' => 'In Lx-Office 2.4.0 muss der Administrator in den Systemeinstellungen eine Liste von verwendbaren Einheiten angeben.',
'In-line' => 'im Text',
+ 'Inactive' => 'Inaktiv',
'Include Exchangerate Difference' => 'Wechselkursunterschied einbeziehen',
+ 'Include column headings' => 'Spaltenüberschriften erzeugen',
'Include in Report' => 'In Bericht aufnehmen',
'Include in drop-down menus' => 'In Aufklappmenü aufnehmen',
'Income Statement' => 'GuV',
'Income accno' => 'Erlöskonto',
'Incoming Payments' => 'Zahlungseingänge',
+ 'Incoming invoice number' => 'Eingangsrechnungsnummer',
'Incorrect Password!' => 'Ungültiges Passwort!',
'Incorrect username or password!' => 'Ungültiger Benutzername oder falsches Passwort!',
'Increase' => 'Erhöhen',
'Individual Items' => 'Einzelteile',
'Information' => 'Information',
- 'Input Number Format' => 'Zahlenformat (Eingabe)',
+ 'Interest' => 'Zinsen',
'Interest Rate' => 'Zinssatz',
'Internal Notes' => 'interne Bemerkungen',
'International' => 'Ausland',
'Invdate from' => 'Rechnungen von',
'Inventory' => 'Inventar',
'Inventory Account' => 'Warenbestand',
- 'Inventory quantity must be zero before you can set this assembly obsolete!' => 'Bevor dieses Erzeugnis als ungültig markiert werden kann, muÃ\9f das Inventar auf Null sein!',
- 'Inventory quantity must be zero before you can set this part obsolete!' => 'Bevor diese Ware als ungültig markiert werden kann, muÃ\9f das Inventar Null sein!',
- 'Inventory saved!' => 'Inventar gespeichert.',
- 'Inventory transferred!' => 'Inventar umgelagert.',
+ 'Inventory quantity must be zero before you can set this assembly obsolete!' => 'Bevor dieses Erzeugnis als ungültig markiert werden kann, muß das Inventar auf Null sein!',
+ 'Inventory quantity must be zero before you can set this part obsolete!' => 'Bevor diese Ware als ungültig markiert werden kann, muß das Inventar Null sein!',
'Invetory' => 'Inventar',
'Invno.' => 'Rg. Nr.',
'Invnumber' => 'Rechnungsnummer',
'Invoice Number' => 'Rechnungsnummer',
'Invoice Number missing!' => 'Rechnungsnummer fehlt!',
'Invoice deleted!' => 'Rechnung gelöscht!',
+ 'Invoice has already been storno\'d!' => 'Diese Rechnung wurde bereits storniert.',
+ 'Invoice with Storno (abbreviation)' => 'R(S)',
'Invoices' => 'Rechnungen',
'Is this a summary account to record' => 'Buchungskonto in',
'It is possible to do this automatically for some Buchungsgruppen, but not for all.' => 'Es ist möglich, dies für einige, aber nicht für alle Buchungsgruppen automatisch zu erledigen.',
'It is possible to do this automatically for some units, but for others the user has to chose the new unit.' => 'Das ist für einige Einheiten automatisch möglich, aber bei anderen muss der Benutzer die neue Einheit auswählen.',
+ 'It may optionally be compressed with "gzip".' => 'Sie darf optional mit "gzip" komprimiert sein.',
'Item deleted!' => 'Artikel gelöscht!',
'Item not on file!' => 'Dieser Artikel ist nicht in der Datenbank!',
'Jan' => 'Jan',
'Journal' => 'Buchungsjournal',
'Jul' => 'Jul',
'July' => 'Juli',
+ 'Jump to' => 'Springe zu',
'Jun' => 'Jun',
'June' => 'Juni',
'KNE-Export erfolgreich!' => 'KNE-Export erfolgreich!',
'KNr. beim Kunden' => 'KNr. beim Kunden',
+ 'Keine Suchergebnisse gefunden!' => 'Keine Suchergebnisse gefunden!',
'Konten' => 'Konten',
'Kontonummernerweiterung (KNE)' => 'Kontonummernerweiterung (KNE)',
'Korrektur' => 'Korrektur',
'Kundennummer' => 'Kundennummer',
'L' => 'L',
+ 'LP' => 'LP',
+ 'LaTeX Templates' => 'LaTeX-Vorlagen',
+ 'Landscape' => 'Querformat',
'Language' => 'Sprache',
'Language Values' => 'Sprachübersetzungen',
'Language deleted!' => 'Sprache gelöscht!',
'Last Customer Number' => 'Letzte Kundennummer',
'Last Invoice Number' => 'Letzte Rechnungsnummer',
'Last Numbers & Default Accounts' => 'Laufende Zähler und Standardkonten',
- 'Last Purchase Order Number' => 'Letzte Lieferantenbestellnummer',
+ 'Last Purchase Order Number' => 'Letzte Lieferantenautragsnummer',
'Last RFQ Number' => 'Letzte Anfragenummer',
- 'Last Sales Order Number' => 'Letzte Kundenbestellnummer',
+ 'Last Sales Order Number' => 'Letzte Auftragsnummer',
'Last Sales Quotation Number' => 'Letzte Angebotsnummer',
'Last Service Number' => 'Letzte Dienstleistungsnr.',
'Last Vendor Number' => 'Letzte Lieferantennummer',
'Lead' => 'Kundenquelle',
- 'Leave host and port field empty unless you want to make a remote connection.' => 'Für lokale Verbindungen "Rechner" und "Port" freilassen.',
+ 'Leave host and port field empty unless you want to make a remote connection.' => 'Für lokale Verbindungen "Rechner" und "Port" freilassen.',
+ 'Left' => 'Links',
'Liability' => 'Passiva/Mittelherkunft',
'License' => 'Lizenz',
'License key' => 'Lizenzschlüssel',
'Licenses' => 'Lizenzen',
'Lieferungen' => 'Lieferungen',
'Line Total' => 'Zeilensumme',
- 'Link' => 'Verknüpfungen',
+ 'Line endings' => 'Zeilenumbrüche',
+ 'List Accounting Groups' => 'Buchungsgruppen anzeigen',
'List Accounts' => 'Konten anzeigen',
- 'List Businesses' => 'Kundentypen anzeigen',
+ 'List Businesses' => 'Kunden-/Lieferantentypen anzeigen',
'List Departments' => 'Abteilungen anzeigen',
'List Groups' => 'Warengruppen anzeigen',
'List Languages' => 'Sprachen anzeigen',
'List Price' => 'Listenpreis',
'List Pricegroups' => 'Preisgruppen anzeigen',
'List Printer' => 'Drucker anzeigen',
+ 'List Tax' => 'Bearbeiten',
'List Transactions' => 'Buchungsliste',
+ 'Load draft' => 'Entwurf laden',
'Local Tax Office Preferences' => 'Angaben zum Finanzamt',
'Lock System' => 'System sperren',
'Lockfile created!' => 'System gesperrt!',
'Long Description' => 'Langtext',
'Lx-Office 2.4.0 introduces two new concepts: tax zones and Buchungsgruppen.' => 'Lx-Office 2.4.0 führt zwei neue Konzepte ein: Steuerzonen und Buchungsgruppen.',
'Lx-Office is about to update the database <b><TMPL_VAR dbname ESCAPE=HTML></b>. You should create a backup of the database before proceeding because the backup might not be reversible.' => 'Lx-Office wird gleich die Datenbank <b><TMPL_VAR dbname ESCAPE=HTML></b> aktualisieren. Sie sollten eine Sicherungskopie der Datenbank erstellen, bevor Sie fortfahren, da die Aktualisierung unter Umständen nicht umkehrbar ist.',
+ 'Lx-Office website' => 'Lx-Office-Webseite',
+ 'MAILED' => 'Gesendet',
+ 'MSG_BROWSER_DOES_NOT_SUPPORT_IFRAMES' => 'Ihr Browser kann leider keine eingebetteten Frames anzeigen. Bitte wählen Sie ein anderes Menü in der Benutzerkonfiguration im Administrationsmenü aus.',
+ 'Main Preferences' => 'Grundeinstellungen',
'Make' => 'Hersteller',
- 'Manager' => 'Manager',
'Mandantennummer' => 'Mandantennummer',
'Mar' => 'März',
'March' => 'März',
+ 'Margins' => 'Seitenränder',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
'Marked entries printed!' => 'Markierte Einträge wurden gedruckt!',
'Master Data' => 'Stammdaten',
'Max. Dunning Level' => 'höchste Mahnstufe',
'May' => 'Mai',
'May ' => 'Mai',
+ 'Medium Number' => 'Datenträgernummer',
'Memo' => 'Memo',
'Message' => 'Nachricht',
'Method' => 'Verfahren',
'Missing Method!' => 'Fehlender Voranmeldungszeitraum',
'Missing Preferences: Outputroutine disabled' => 'Die Ausgabefunktionen sind wegen unzureichender Voreinstellungen deaktiviert!',
'Missing Tax Authoritys Preferences' => 'Fehlende Angaben zum Finanzamt!',
+ 'Missing amount' => 'Fehlbetrag',
'Mitarbeiter' => 'Mitarbeiter',
'Mobile1' => 'Mobile 1',
'Mobile2' => 'Mobile 2',
'Model' => 'Modell',
+ 'Module home page' => 'Modul-Webseite',
+ 'Module name' => 'Modulname',
'Monat' => 'Monat',
'Monthly' => 'monatlich',
'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
'Multibyte Encoding' => 'Schriftsatz',
'MwSt. inkl.' => 'MwSt. inkl.',
- 'N/A' => 'N.Z.',
'Name' => 'Name',
'Name missing!' => 'Name fehlt!',
'National' => 'Inand',
+ 'National Expenses' => 'Aufwand Inland',
+ 'National Revenues' => 'Erlöse Inland',
'Netto Terms' => 'Zahlungsziel netto',
'New Buchungsgruppe <TMPL_VAR __counter__>' => 'Neue Buchungsgruppe <TMPL_VAR __counter__>',
'New Templates' => 'neue Vorlagen',
+ 'New assembly' => 'Neues Erzeugnis',
+ 'New contact' => 'Neuer Ansprechpartner',
+ 'New customer' => 'Neuer Kunde',
+ 'New part' => 'Neue Ware',
+ 'New sales order' => 'Neuer Auftrag',
+ 'New service' => 'Neue Dienstleistung',
'New unit' => 'Neue Einheit',
+ 'New vendor' => 'Neuer Lieferant',
'Next Dunning Level' => 'Nächste Mahnstufe',
'No' => 'Nein',
'No Company Address given' => 'Keine Firmenadresse hinterlegt!',
'No Database Drivers available!' => 'Kein Datenbanktreiber verfügbar!',
'No Dataset selected!' => 'Keine Datenbank ausgewählt!',
'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
- 'No email address for' => 'Keine eMailaddresse für',
+ 'No backup file has been uploaded.' => 'Es wurde keine Sicherungsdatei hochgeladen.',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
+ 'No data was found.' => 'Es wurden keine Daten gefunden.',
+ 'No databases have been found on this server.' => 'Auf diesem Server wurden keine Datenbanken gefunden.',
+ 'No datasets have been selected.' => 'Es wurden keine Datenbanken ausgewählt.',
+ 'No dunnings have been selected for printing.' => 'Es wurden keine Mahnungen zum Drucken ausgewählt.',
'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
'No entries were found which had no unit assigned to them.' => 'Es wurden keine Einträge gefunden, denen keine Einheit zugeordnet war.',
'No licenses were found that match the search criteria.' => 'Es wurden keine Lizenzen gefunden, auf die die Suchkriterien zutreffen.',
'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
'No unknown units where found.' => 'Es wurden keine unbekannten Einheiten gefunden.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'No.' => 'Position',
'Non-taxable Purchases' => 'Nicht zu versteuernde Einkäufe',
'Non-taxable Sales' => 'Nicht zu versteuernde Verkäufe',
+ 'None' => 'Kein',
'Not Discountable' => 'Nicht rabattierfähig',
+ 'Not delivered' => 'Nicht geliefert',
+ 'Not obsolete' => 'Gültig',
'Notes' => 'Bemerkungen',
- 'Nothing entered!' => 'Es wurde nichts eingegeben.',
'Nothing selected!' => 'Es wurde nichts ausgewählt!',
'Nothing to delete!' => 'Es konnte nichts gelöscht werden!',
- 'Nothing to transfer!' => 'Es gibt nichts zum Umlagern!',
'Nov' => 'Nov',
'November' => 'November',
'Now the user must select a single Buchungsgruppe for each part instead of three distinct accounts.' => 'Der Benutzer muss nun für jeden Artikel nur noch die Buchungsgruppe anstelle der drei einzelnen Konten auswählen.',
'Number Format' => 'Zahlenformat',
'Number missing in Row' => 'Nummer fehlt in Zeile',
'Number of copies' => 'Anzahl Kopien',
- 'O' => 'O',
+ 'Number pages' => 'Seiten nummerieren',
'OBE-Export erfolgreich!' => 'OBE-Export erfolgreich!',
'Obsolete' => 'Ungültig',
'Oct' => 'Okt',
'October' => 'Oktober',
+ 'Off' => 'Aus',
'Old (on the side)' => 'Alt (seitlich)',
+ 'On' => 'An',
'On Hand' => 'Auf Lager',
'On Order' => 'Ist bestellt',
+ 'One or more Perl modules missing' => 'Ein oder mehr Perl-Module fehlen',
'Open' => 'Offen',
'OpenDocument/OASIS' => 'OpenDocument/OASIS',
'Openings' => 'Öffnungszeiten',
- 'Oracle Database Administration' => 'Oracle Datenbankadministration',
+ 'Options' => 'Optionen',
'Order' => 'Auftrag',
'Order Date' => 'Auftragsdatum',
'Order Date missing!' => 'Auftragsdatum fehlt!',
'Order Number missing!' => 'Auftragsnummer fehlt!',
'Order deleted!' => 'Auftrag gelöscht!',
'Ordered' => 'Vom Kunde bestellt',
- 'Orders' => 'Aufträge',
+ 'Orientation' => 'Seitenformat',
'Orphaned' => 'Nie benutzt',
'Out of balance transaction!' => 'Buchung ist nicht ausgeglichen!',
'Out of balance!' => 'Summen stimmen nicht berein!',
'Output Number Format' => 'Zahlenformat (Ausgabe)',
'Outputformat' => 'Ausgabeformat',
'Own Product' => 'eigenes Produkt',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
'PDF' => 'PDF',
'PDF (OpenDocument/OASIS)' => 'PDF (OpenDocument/OASIS)',
+ 'PDF export -- options' => 'PDF-Export -- Optionen',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
'Packing List' => 'Lieferschein',
'Packing List Date missing!' => 'Datum für Verpackungsliste fehlt!',
'Packing List Number missing!' => 'Verpackungslistennummer fehlt!',
'Password changed!' => 'Passwort geändert!',
'Payables' => 'Verbindlichkeiten',
'Payment' => 'Zahlungsausgang',
+ 'Payment Reminder' => 'Zahlungserinnerung',
'Payment Terms' => 'Zahlungskonditionen',
'Payment Terms missing in row ' => 'Zahlungsfrist fehlt in Zeile ',
'Payment Terms saved!' => 'Zahlungskonditionen gespeichert!',
'Payment date missing!' => 'Tag der Zahlung fehlt!',
'Payment posted!' => 'Zahlung gebucht!',
'Payment terms deleted!' => 'Zahlungskonditionen gelöscht!',
- 'Payment until' => 'Zahlungseingänge bis',
'Payments' => 'Zahlungsausgänge',
+ 'Period' => 'Zeitraum',
'Pg Database Administration' => 'Datenbankadministration',
'Phone' => 'Telefon',
'Phone1' => 'Telefon 1 ',
'Pick List' => 'Sammelliste',
'Please enter a license key.' => 'Bitte geben Sie einen Lizenzschlüssel an.',
'Please enter a number of licenses.' => 'Bitte geben Sie die Anzahl Lizenzschlüssel an.',
+ 'Please enter the name of the dataset you want to restore the backup in.' => 'Bitte geben Sie den Namen der Datenbank ein, in der Sie die Sicherung wiederherstellen wollen.',
'Please enter values' => 'Bitte Werte eingeben',
'Please insert object dimensions below.' => 'Bitte geben Sie die Abmessungen unten ein',
'Please insert your language values below' => 'Bitte die Übersetzungen unten eintragen',
'Please insert your longdescription below' => 'Bitte den Langtext eingeben',
+ 'Please install the below listed modules or ask your system administrator to.' => 'Bitte installieren Sie die unten aufgeführten Module, oder bitten Sie Ihren Administrator darum.',
'Please select a customer from the list below.' => 'Bitte einen Endkunden aus der Liste auswählen',
'Please select a vendor from the list below.' => 'Bitte einen Händler aus der Liste auswählen',
'Please select the chart of accounts this installation is using from the list below.' => 'Bitte wählen Sie den Kontenrahmen aus, der bei dieser Installation verwendet wird.',
+ 'Please select the database you want to backup' => 'Bitte wählen Sie die zu sichernde Datenbank gefunden',
+ 'Please seletct the dataset you want to delete:' => 'Bitte wählen Sie die zu löschende Datenbank aus:',
'Plural' => 'Plural',
'Port' => 'Port',
- 'Port missing!' => 'Portangabe fehlt!',
+ 'Portrait' => 'Hochformat',
'Post' => 'Buchen',
'Post Payment' => 'Zahlung buchen',
- 'Post as new' => 'Neu buchen',
'Postscript' => 'Postscript',
+ 'Posustva_coa' => 'USTVA Kennz.',
'Preferences' => 'Benutzereinstellungen',
'Preferences saved!' => 'Einstellungen gespeichert!',
'Preis' => 'Preis',
'Preisklasse' => 'Preisgruppe',
'Prepayment' => 'Vorauszahlung',
'Preview' => 'Druckvorschau',
+ 'Previous transdate text' => 'wurde gespeichert am',
+ 'Previous transnumber text' => 'Letzte Buchung mit der Buchungsnummer',
'Price' => 'Preis',
'Pricegroup' => 'Preisgruppe',
'Pricegroup deleted!' => 'Preisgruppe gelöscht!',
'Pricegroups' => 'Preisgruppen',
'Print' => 'Drucken',
'Print and Post' => 'Drucken und Buchen',
+ 'Print dunnings' => 'Mahnungen drucken',
+ 'Print list' => 'Liste ausdrucken',
'Print options' => 'Druckoptionen',
- 'Printed' => 'gedruckt.',
'Printer' => 'Drucker',
'Printer Command' => 'Druckbefehl',
'Printer Command missing!' => 'Druckbefehl fehlt',
'Project' => 'Projekt',
'Project Number' => 'Projektnummer',
'Project Number missing!' => 'Projektnummer fehlt!',
+ 'Project Numbers' => 'Projektnummern',
'Project Transactions' => 'Projektbuchungen',
'Project deleted!' => 'Projekt gelöscht!',
'Project description' => 'Projektbeschreibung',
'Project saved!' => 'Projekt gespeichert!',
'Projects' => 'Projekte',
'Projecttransactions' => 'Projektbuchungen',
- 'Prozentual/Absolut' => '',
+ 'Prozentual/Absolut' => 'Prozentual/Absolut',
'Purchase Order' => 'Lieferantenauftrag',
'Purchase Orders' => 'Lieferantenaufträge',
'Qty' => 'Menge',
'Quarter' => 'Quartal',
'Quarterly' => 'quartalsweise',
'Queue' => 'Warteschlange',
- 'Queued' => 'In Warteschlange eingereiht.',
'Quotation' => 'Angebot',
'Quotation Date' => 'Angebotsdatum',
'Quotation Date missing!' => 'Angebotsdatum fehlt!',
'Quotation Number missing!' => 'Angebotsnummer fehlt!',
'Quotation deleted!' => 'Angebot wurde gelöscht.',
'Quotations' => 'Angebote',
+ 'Quote chararacter' => 'Anführungszeichen',
'Quoted' => 'Angeboten',
'RFQ' => 'Anfrage',
'RFQ Number' => 'Anfragenummer',
- 'RFQs' => 'Anfragen',
+ 'RFQs' => 'Preisanfragen',
'ROP' => 'Mindestlagerbestand',
'Rate' => 'Rate',
- 'Recd' => 'erhalten',
'Receipt' => 'Zahlungseingang',
'Receipt posted!' => 'Beleg gebucht!',
'Receipts' => 'Zahlungseingänge',
'Receivables' => 'Forderungen',
- 'Receive Merchandise' => 'Waren einlagern',
+ 'Rechnungsnummer' => 'Rechnungsnummer',
'Reconciliation' => 'Kontenabgleich',
'Record in' => 'Buchen auf',
'Reference' => 'Referenz',
'Reference missing!' => 'Referenz fehlt!',
'Remaining' => 'Rest',
'Remove' => 'entfernen',
+ 'Remove Draft' => 'Entwurf löschen',
+ 'Remove draft when posting' => 'Entwurf beim Buchen löschen',
'Removed spoolfiles!' => 'Druckdateien entfernt!',
'Removing marked entries from queue ...' => 'Markierte Einträge werden von der Warteschlange entfernt ...',
'Repeat the password' => 'Passwort wiederholen',
+ 'Report Positions' => 'Berichte',
+ 'Report and misc. Preferences' => 'Sonstige Einstellungen',
'Report for' => 'Bericht für',
'Reports' => 'Berichte',
'Reqdate' => 'Lieferdatum',
'Request for Quotation' => 'Anfrage',
'Request for Quotations' => 'Anfragen',
'Required by' => 'Lieferdatum',
+ 'Restore Dataset' => 'Datenbank wiederherstellen',
'Revenue' => 'Erlöskonto',
'Revenue Account' => 'Erlöskonto',
+ 'Revenues EU with UStId' => 'Erlöse EU m. UStId',
+ 'Revenues EU without UStId' => 'Erlöse EU o. UStId',
+ 'Right' => 'Rechts',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
'SIC' => 'SIC',
- 'SIC deleted!' => 'SIC gelöscht',
- 'SIC saved!' => 'SIC gespeichert',
'Sales Invoice' => 'Rechnung',
'Sales Invoices' => 'Kundenrechnung',
'Sales Order' => 'Kundenauftrag',
'Sales Orders' => 'Aufträge',
- 'Salesman' => 'Vertreter',
- 'Salesman missing!' => 'Vertreter fehlt!',
+ 'Sales invoice number' => 'Ausgangsrechnungsnummer',
+ 'Salesman' => 'Verkäufer/in',
'Salesperson' => 'Verkäufer',
+ 'Same as the quote character' => 'Wie Anführungszeichen',
'Sat. Fax' => 'Sat. Fax',
'Sat. Phone' => 'Sat. Tel.',
'Save' => 'Speichern',
+ 'Save account first to insert taxkeys' => 'Einstellungen sind nach
+ dem Speichern des Kontos verfügbar...',
'Save and AP Transaction' => 'Speichern und Kreditorenbuchung erfassen',
'Save and AR Transaction' => 'Speichern und Debitorenbuchung erfassen',
'Save and Close' => 'Speichern und schließen',
'Save and Order' => 'Speichern und Auftrag erfassen',
'Save and Quotation' => 'Speichern und Angebot',
'Save and RFQ' => 'Speichern und Lieferantenanfrage',
+ 'Save and close' => 'Speichern und schließen',
'Save as new' => 'als neu speichern',
+ 'Save draft' => 'Entwurf speichern',
+ 'Saving the file \'%s\' failed. OS error message: %s' => 'Das Speichern der Datei \'%s\' schlug fehl. Fehlermeldung des Betriebssystems: %s',
'Screen' => 'Bildschirm',
'Search Dunning' => 'Mahnung suchen',
'Select' => 'auswählen',
'Select postscript or PDF!' => 'Postscript oder PDF auswählen!',
'Select the chart of accounts in use' => 'Benutzten Kontenrahmen auswählen',
'Sell Price' => 'Verkaufspreis',
+ 'Send the backup via Email' => 'Die Sicherungsdatei per Email verschicken',
'Sep' => 'Sep',
+ 'Separator chararacter' => 'Feldtrennzeichen',
'September' => 'September',
'Serial No.' => 'Seriennummer',
'Serial Number' => 'Seriennummer',
'Setup Menu' => 'Menüsetup',
'Setup Templates' => 'Vorlagen auswählen',
'Ship' => 'Lagerausgang',
- 'Ship Merchandise' => 'Waren versenden',
+ 'Ship rcvd' => 'Lagereingang',
'Ship to' => 'Lieferadresse',
'Ship via' => 'Transportmittel',
'Shipping Address' => 'Lieferadresse',
- 'Shipping Date' => 'Lieferdatum',
- 'Shipping Date missing!' => 'Lieferdatum fehlt.',
'Shipping Point' => 'Versandort',
'Shipto' => 'Lieferanschriften',
'Shopartikel' => 'Shopartikel',
- 'Short' => 'kurz',
+ 'Short' => 'Knapp',
'Show' => 'Zeigen',
'Show by default' => 'Standardmäßig anzeigen',
'Show details' => 'Details anzeigen',
'Show old dunnings' => 'Alte Mahnungen anzeigen',
'Signature' => 'Unterschrift',
+ 'Skip' => 'Überspringen',
'Skonto' => 'Skonto',
'Skonto Terms' => 'Zahlungsziel Skonto',
'Sold' => 'Verkauft',
'Source' => 'Beleg',
'Spoolfile' => 'Druckdatei',
- 'Standard Industrial Codes' => 'SIC',
'Start Dunning Process' => 'Mahnprozess starten',
+ 'Startdate_coa' => 'Gültig ab',
'Statement' => 'Sammelrechnung',
'Statement Balance' => 'Sammelrechnungsbilanz',
'Statement sent to' => 'Sammelrechnung verschickt an',
'Step 3 of 3: Default units' => 'Schritt 3 von 3: Standardeinheiten',
'Steuersatz' => 'Steuersatz',
'Stock' => 'einlagern',
- 'Stock Assembly' => 'Erzeugnis einlagern',
'Storno' => 'Storno',
'Storno (one letter abbreviation)' => 'S',
'Storno Invoice' => 'Stornorechnung',
'Subject' => 'Betreff',
'Subject:' => 'Betreff:',
'Subtotal' => 'Zwischensumme',
- 'Supervisor' => 'Supervisor',
'System' => 'System',
'TOP100' => 'Top 100',
'Tax' => 'Steuer',
'Tax Number / SSN' => 'Steuernummer',
'Tax Office' => 'Finanzamt',
'Tax Office Preferences' => 'Finanzamt - Einstellungen',
+ 'Tax Percent is a number between 0 and 100' => 'Prozentsatz muss zwischen
+ 1% und 100% liegen',
'Tax Period' => 'Voranmeldungszeitraum',
'Tax collected' => 'vereinnahmte Steuer',
+ 'Tax deleted!' => 'Steuer gelöscht!',
'Tax number' => 'Steuernummer',
'Tax paid' => 'Vorsteuer',
- 'Taxable' => 'Steuerpflichtig',
+ 'Tax saved!' => 'Steuer gespeichert!',
+ 'Tax-O-Matic' => 'Steuer',
+ 'Tax-o-matic Account' => 'Automatikbuchung auf Konto',
+ 'Taxaccount_coa' => 'Automatikkonto',
'Taxation' => 'Versteuerungs Verfahren',
+ 'Taxdescription missing!' => 'Steuername fehlt!',
+ 'Taxdescription_coa' => 'Steuer',
+ 'Taxes' => 'Steuern',
'Taxkey' => 'Steuerschlüssel',
+ 'Taxkey missing!' => 'Steuerschlüssel fehlt!',
+ 'Taxkey_coa' => 'Steuerschlüssel',
+ 'Taxkeys and Taxreport Preferences' => 'Steuerautomatik und UStVA',
+ 'Taxlink_coa' => 'Steuerautomatik',
+ 'Taxrate missing!' => 'Prozentsatz fehlt!',
'Tel' => 'Tel',
+ 'Tel.' => 'Telefon',
'Telephone' => 'Telefon',
'Template' => 'Druckvorlage',
'Template Code' => 'Vorlagenkürzel',
'Template Code missing!' => 'Vorlagenkürzel fehlt!',
- 'Template saved!' => 'Schablone gespeichert!',
'Templates' => 'Vorlagen',
'Terms missing in row ' => '+Tage fehlen in Zeile ',
'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'The backup you upload here has to be a file created with "pg_dump -o -Ft".' => 'Die von Ihnen hochzuladende Sicherungsdatei muss mit dem Programm und den Parametern "pg_dump -o -Ft" erstellt worden sein.',
'The base unit does not exist or it is about to be deleted in row %d.' => 'Die Basiseinheit in Zeile %d existiert nicht oder soll gelöscht werden.',
'The base unit does not exist.' => 'Die Basiseinheit existiert nicht.',
'The base unit relations must not contain loops (e.g. by saying that unit A\'s base unit is B, B\'s base unit is C and C\'s base unit is A) in row %d.' => 'Die Beziehungen der Einheiten dürfen keine Schleifen beinhalten (z.B. wenn gesagt wird, dass Einheit As Basiseinheit B, Bs Basiseinheit C und Cs Basiseinheit A ist) in Zeile %d.',
+ 'The columns "Dunning Duedate", "Total Fees" and "Interest" show data for the previous dunning created for this invoice.' => 'Die Spalten "Zahlbar bis", "Kumulierte Gebühren" und "Zinsen" zeigen Daten der letzten für diese Rechnung erzeugten Mahnung.',
+ 'The database [% HTML.escape(db) %] has been successfully deleted.' => 'Die Datenbank [% HTML.escape(db) %] wurde erfolgreich gelöscht.',
'The database update/creation did not succeed. The file <TMPL_VAR file ESCAPE=HTML> contained the following error:' => 'Die Datenbankaktualisierung/erstellung schlug fehl. Die Datei <TMPL_VAR file ESCAPE=HTML> enthielt den folgenden Fehler:',
'The database upgrade for the introduction of Buchungsgruppen is now complete.' => 'Das Datenbankupgrade für die Einführung von Buchungsgruppen ist jetzt beendet.',
'The database upgrade for the introduction of units is now complete.' => 'Das Datenbankupgrade zwecks Einführung von Einheiten ist nun beendet.',
+ 'The dataset [% HTML.escape(db) %] has been successfully created.' => 'Die Datenbank [% HTML.escape(db) %] wurde erfolgreich angelegt.',
+ 'The dataset backup has been sent via email to [% HTML.escape(to) %].' => 'Die Datenbanksicherung wurde per Email an [% HTML.escape(to) %] verschickt.',
+ 'The dataset has to exist before a restoration can be started.' => 'Die Datenbank muss vor der Wiederherstellung bereits angelegt worden sein.',
+ 'The dataset name is missing.' => 'Der Datenbankname fehlt.',
+ 'The directory %s does not exist.' => 'Das Verzeichnis %s existiert nicht.',
'The dunning process started' => 'Der Mahnprozess ist gestartet.',
+ 'The dunnings have been printed.' => 'Die Mahnung(en) wurden gedruckt.',
+ 'The email address is missing.' => 'Die Emailadresse fehlt.',
'The factor is missing in row %d.' => 'Der Faktor fehlt in Zeile %d.',
'The factor is missing.' => 'Der Faktor fehlt.',
'The following Buchungsgruppen have already been created:' => 'Die folgenden Buchungsgruppen wurden bereits angelegt:',
- 'The following Datasets are not in use and can be deleted' => 'Die folgenden Datenbanken sind nicht in Verwendung und können gelöscht werden',
'The following Datasets need to be updated' => 'Folgende Datenbanken müssen aktualisiert werden',
+ 'The following drafts have been saved and can be loaded.' => 'Die folgenden Entwürfe wurden gespeichert und können geladen werden.',
'The following units are unknown.' => 'Die folgenden Einheiten sind unbekannt.',
'The following units exist already:' => 'Die folgenden Einheiten existieren bereits:',
'The following warnings occured during an upgrade to the document templates:' => 'Die folgenden Warnungen traten während einer Aktualisierung der Dokumentenvorlagen auf:',
'The formula needs the following syntax:<br>For regular article:<br>Variablename= Variable Unit;<br>Variablename2= Variable2 Unit2;<br>...<br>###<br>Variable + ( Variable2 / Variable )<br><b>Please be beware of the spaces in the formula</b><br>' => 'Die Formeln müssen in der folgenden Syntax eingegeben werden:<br>Bei normalen Artikeln:<br>Variablenname= Variable Einheit;<br>Variablenname2= Variable2 Einheit2;<br>...<br>###<br>Variable + Variable2 * ( Variable - Variable2 )<br>Bitte achten Sie auf die Leerzeichen in der Formel<br>Es muss jeweils die Gesamte Zeile eingegeben werden',
'The licensing module has been deactivated in lx-erp.conf.' => 'Das Lizenzverwaltungsmodul wurde in lx-erp.conf deaktiviert.',
+ 'The list has been printed.' => 'Die Liste wurde ausgedruckt.',
+ 'The login is missing.' => 'Das Login fehlt.',
'The name in row %d has already been used before.' => 'Der Name in Zeile %d wurde vorher bereits benutzt.',
'The name is missing in row %d.' => 'Der Name fehlt in Zeile %d.',
'The name is missing.' => 'Der Name fehlt.',
'The passwords do not match.' => 'Die Passwörter stimmen nicht überein.',
+ 'The pg_dump process could not be started.' => 'Der pg_dump-Prozess konnte nicht gestartet werden.',
+ 'The pg_restore process could not be started.' => 'Der pg_restore-Prozess konnte nicht gestartet werden.',
+ 'The preferred one is to install packages provided by your operating system distribution (e.g. Debian or RPM packages).' => 'Die bevorzugte Art, ein Perl-Modul zu installieren, ist durch Installation eines von Ihrem Betriebssystem zur Verfügung gestellten Paketes (z.B. Debian-Pakete oder RPM).',
+ 'The program\'s exit code was [% HTML.escape(retval) %] ("0" usually means that everything went OK).' => 'Der Exitcode des Programms war [% HTML.escape(retval) %] ("0" bedeutet normalerweise, dass die Wiederherstellung erfolgreich war).',
+ 'The restoration process has started. Here\'s the output of the "pg_restore" command:' => 'Der Wiederherstellungsprozess wurde gestartet. Hier ist die Ausgabe des "pg_restore"-Programmes:',
+ 'The restoration process is complete. Please review "pg_restore"\'s output to find out if the restoration was successful.' => 'Die Wiederherstellung ist abgeschlossen. Bitte sehen Sie sich die Ausgabe von "pg_restore" an, um festzustellen, ob die Wiederherstellung erfolgreich war.',
+ 'The second way is to use Perl\'s CPAN module and let it download and install the module for you.' => 'Die zweite Variante besteht darin, Perls CPAN-Modul zu benutzen und es das Modul für Sie installieren zu lassen.',
+ 'The tabulator character' => 'Das Tabulator-Symbol',
+ 'The third way is to download the module from the above mentioned URL and to install the module manually following the installations instructions contained in the source archive.' => 'Die dritte Variante besteht darin, das Paket von der oben genannten URL herunterzuladen und es manuell zu installieren. Beachten Sie dabei die im Paket enthaltenen Installationsanweisungen.',
'The unit has been saved.' => 'Die Einheit wurde gespeichert.',
'The unit in row %d has been deleted in the meantime.' => 'Die Einheit in Zeile %d ist in der Zwischentzeit gelöscht worden.',
'The unit in row %d has been used in the meantime and cannot be changed anymore.' => 'Die Einheit in Zeile %d wurde in der Zwischenzeit benutzt und kann nicht mehr geändert werden.',
'The units have been saved.' => 'Die Einheiten wurden gespeichert.',
'There are four tax zones.' => 'Es gibt vier Steuerzonen.',
'There are still entries in the database for which no unit has been assigned.' => 'Es gibt noch Einträge in der Datenbank, für die keine Einheit zugeordnet ist.',
+ 'There are usually three ways to install Perl modules.' => 'Es gibt normalerweise drei Arten, ein Perlmodul zu installieren.',
'There is nothing to do in this step.' => 'In diesem Schritt gibt es nichts mehr zu tun.',
'Therefore there\'s no need to create the same article more than once if it is sold or bought in/from another tax zone.' => 'Deswegen muss man den gleichen Artikel nicht mehr mehrmals anlegen, wenn er in verschiedenen Steuerzonen gehandelt werden soll.',
'These units can be based on other units so that Lx-Office can convert prices when the user switches from one unit to another.' => 'Diese Einheiten können auf anderen Einheiten basieren, sodass Lx-Office Preise umrechnen kann, wenn der Benutzer von einer Einheit zu einer anderen Wechselt.',
- 'This is a preliminary check for existing sources. Nothing will be created or deleted at this stage!' => 'In diesem Schritt werden bestehende Datenbanken gesucht. Es werden noch keine Änderungen vorgenommen!',
+ 'This customer number is already in use.' => 'Diese Kundennummer wird bereits verwendet.',
+ 'This is a preliminary check for existing sources. Nothing will be created or deleted at this stage!' => 'In diesem Schritt werden bestehende Datenbanken gesucht. Es werden noch keine Änderungen vorgenommen!',
'This upgrade script tries to map all existing parts in the database to the newly created Buchungsgruppen.' => 'Dieses Upgradescript versucht, bei allen bestehenden Artikeln neu erstellte Buchungsgruppen zuzuordnen.',
'This upgrade script tries to map all existing units in the database to the newly created units.' => 'Dieses Update-Script versucht, alle bestehenden Einheiten automatisch in die neuen Einheiten umzuwandeln.',
+ 'This vendor number is already in use.' => 'Diese Lieferantennummer wird bereits verwendet.',
'Title' => 'Titel',
'To' => 'An',
+ 'To (email)' => 'An',
'To (time)' => 'Bis',
- 'To add a user to a group edit a name, change the login name and save. A new user with the same variables will then be saved under the new login name.' => 'Um einer Gruppe einen neuen Benutzer hinzuzufügen, ändern und speichern Sie am einfachsten einen bestehen den Zugriffsnamen. Unter dem neuen Namen wird dann ein Benutzer mit denselben Einstellungen angelegt.',
+ 'To add a user to a group edit a name, change the login name and save. A new user with the same variables will then be saved under the new login name.' => 'Um einer Gruppe einen neuen Benutzer hinzuzufügen, ändern und speichern Sie am einfachsten einen bestehen den Zugriffsnamen. Unter dem neuen Namen wird dann ein Benutzer mit denselben Einstellungen angelegt.',
+ 'Top' => 'Oben',
'Top (CSS)' => 'Oben (mit CSS)',
'Top (Javascript)' => 'Oben (mit Javascript)',
'Top 100' => 'Top 100',
'Top Level' => 'Hauptartikelbezeichnung',
'Total' => 'Summe',
'Total Fees' => 'Kumulierte Gebühren',
- 'Total Interest' => 'Kumulierte Zinsen',
'Trade Discount' => 'Rabatt',
+ 'Transaction %d cancelled.' => 'Buchung %d erfolgreich storniert.',
'Transaction Date missing!' => 'Buchungsdatum fehlt!',
'Transaction deleted!' => 'Buchung gelöscht!',
+ 'Transaction description' => 'Vorgangsbezeichnung',
+ 'Transaction has already been cancelled!' => 'Diese Buchung wurde bereits storniert.',
'Transaction posted!' => 'Buchung verbucht!',
'Transaction reversal enforced for all dates' => 'Fehleintragungen müssen für jeden Zeitraum mit einer Kontraeintragung ausgebessert werden',
'Transaction reversal enforced up to' => 'Fehleintragungen können bis zu dem angegebenen Zeitraum nur mit einer Kontraeintragung ausgebessert werden!',
- 'Transfer' => 'Umlagerung',
- 'Transfer Inventory' => 'Ware umlagern',
- 'Transfer to' => 'umlagern nach',
+ 'Translation (%s)' => 'Übersetzung (%s)',
'Trial Balance' => 'Saldenbilanz',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
'Type' => 'Typ',
- 'Type of Business' => 'Kundentyp',
+ 'Type of Business' => 'Kunden-/Lieferantentyp',
+ 'USTVA' => 'USTVA',
+ 'USTVA 2004' => 'USTVA 2004',
+ 'USTVA 2005' => 'USTVA 2005',
+ 'USTVA 2006' => 'USTVA 2006',
+ 'USTVA 2007' => 'USTVA 2007',
'USTVA-Hint: Method' => 'Wenn Sie Ist-Versteuert sind, wählen Sie die Einnahmen-/Überschuß-Rechnung aus. Sind Sie Soll-Versteuert und bilanzverpflichtet, dann wählen Sie Bilanz aus.',
'USTVA-Hint: Tax Authoritys' => 'Bitte das Bundesland UND die Stadt bzw. den Einzugsbereich Ihres zuständigen Finanzamts auswählen.',
'USt-IdNr.' => 'USt-IdNr.',
'UStVA' => 'UStVA',
'UStVA (PDF-Dokument)' => 'UStVa als PDF-Dokument',
- 'UStVA-Nr. 35' => 'Kz. 35',
- 'UStVA-Nr. 36' => 'Kz. 36',
- 'UStVA-Nr. 39' => 'Kz. 37',
- 'UStVA-Nr. 41' => 'Kz. 41',
- 'UStVA-Nr. 42' => 'Kz. 42',
- 'UStVA-Nr. 43' => 'Kz. 43',
- 'UStVA-Nr. 44' => 'Kz. 44',
- 'UStVA-Nr. 45' => 'Kz. 45',
- 'UStVA-Nr. 48' => 'Kz. 48',
- 'UStVA-Nr. 49' => 'Kz. 49',
- 'UStVA-Nr. 51 left' => 'Kz. 51 links',
- 'UStVA-Nr. 51 right' => 'Kz. 51 rechts',
- 'UStVA-Nr. 52' => 'Kz. 52',
- 'UStVA-Nr. 53' => 'Kz. 53',
- 'UStVA-Nr. 59' => 'Kz. 59',
- 'UStVA-Nr. 60' => 'Kz. 60',
- 'UStVA-Nr. 61' => 'Kz. 61',
- 'UStVA-Nr. 62' => 'Kz. 62',
- 'UStVA-Nr. 63' => 'Kz. 63',
- 'UStVA-Nr. 64' => 'Kz. 64',
- 'UStVA-Nr. 65' => 'Kz. 65',
- 'UStVA-Nr. 66' => 'Kz. 66',
- 'UStVA-Nr. 67' => 'Kz. 67',
- 'UStVA-Nr. 69' => 'Kz. 69',
- 'UStVA-Nr. 73' => 'Kz. 73',
- 'UStVA-Nr. 74' => 'Kz. 74',
- 'UStVA-Nr. 76' => 'Kz. 76',
- 'UStVA-Nr. 77' => 'Kz. 77',
- 'UStVA-Nr. 80' => 'Kz. 80',
- 'UStVA-Nr. 84' => 'Kz. 84',
- 'UStVA-Nr. 85' => 'Kz. 85',
- 'UStVA-Nr. 86 left' => 'Kz. 86 links',
- 'UStVA-Nr. 86 right' => 'Kz. 86 rechts',
- 'UStVA-Nr. 91' => 'Kz. 91',
- 'UStVA-Nr. 93 left' => 'Kz. 93 left',
- 'UStVA-Nr. 93 right' => 'Kz. 93 right',
- 'UStVA-Nr. 94' => 'Kz. 94',
- 'UStVA-Nr. 95' => 'Kz. 95',
- 'UStVA-Nr. 96' => 'Kz. 96',
- 'UStVA-Nr. 97 links' => 'Kz. 97 links',
- 'UStVA-Nr. 97 rechts' => 'Kz. 97 rechts',
- 'UStVA-Nr. 98' => 'Kz. 98',
'UStVa' => 'UStVa',
'UStVa Einstellungen' => 'UStVa Einstellungen',
- 'Umsatzsteuervoranmeldung' => 'Umsatzsteuervoranmeldung',
+ 'Unbalanced Ledger' => 'Bilanzfehler',
'Unit' => 'Einheit',
'Unit of measure' => 'Maßeinheit',
'Units' => 'Einheiten',
+ 'Unknown Category' => 'Unbekannte Kategorie',
+ 'Unknown Link' => 'Unbekannte Verknüpfung',
'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
'Unlock System' => 'System entsperren',
'Until' => 'Bis',
'Update Prices' => 'Preise aktualisieren',
'Update complete' => 'Update beendet.',
'Update prices' => 'Preise aktualisieren',
+ 'Update?' => 'Aktualisieren?',
'Updated' => 'Erneuert am',
'Use As Template' => 'Als Vorlage verwenden',
'Use Templates' => 'benutze Vorlagen',
'User Config' => 'Benutzereinstellungen',
'User deleted!' => 'Benutzer gelöscht!',
'User saved!' => 'Benutzer gespeichert!',
- 'Username' => 'Benutzername',
'Ust-IDNr' => 'USt-IdNr.',
+ 'Valid from' => 'Gültig ab',
'Valid until' => 'gültig bis',
'Value' => 'Wert',
'Variable' => 'Variable',
'Vendor Invoices' => 'Einkaufsrechnungen',
'Vendor Number' => 'Lieferantennummer',
'Vendor deleted!' => 'Lieferant gelöscht!',
+ 'Vendor details' => 'Lieferantendetails',
'Vendor missing!' => 'Lieferant fehlt!',
+ 'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!',
'Vendor saved!' => 'Lieferant gespeichert!',
+ 'Vendor type' => 'Lieferantentyp',
'Vendors' => 'Lieferanten',
'Verrechnungseinheit' => 'Verrechnungseinheit',
'Version' => 'Version',
'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',
+ 'WEBDAV access' => 'WEBDAV-Zugriff',
'Warnings during template upgrade' => 'Warnungen bei Aktualisierung der Dokumentenvorlagen',
'Weight' => 'Gewicht',
'What type of item is this?' => 'Was ist dieser Artikel?',
+ 'What\'s the <b>term</b> you\'re looking for?' => 'Nach welchem <b>Begriff</b> wollen Sie suchen?',
'With Extension Of Time' => 'mit Dauerfristverlängerung',
'Workflow purchase_order' => 'Workflow Lieferantenauftrag',
'Workflow request_quotation' => 'Workflow Preisanfrage',
'Workflow sales_order' => 'Workflow Auftrag',
'Workflow sales_quotation' => 'Workflow Angebot',
'Wrong Period' => 'Falscher Zeitraum',
+ 'Wrong date format!' => 'Falsches Datumsformat!',
'YYYY' => 'JJJJ',
'Year' => 'Jahr',
'Year End' => 'Jahresende',
'Yes' => 'Ja',
'You are logged out!' => 'Auf Wiedersehen!',
'You can also create new units now.' => 'Sie können jetzt auch neue Einheiten anlegen.',
+ 'You can create a missing dataset by going back and chosing "Create Dataset".' => 'Sie können eine fehlende Datenbank erstellen, indem Sie jetzt zuück gehen und den Punkt "Datenbank anlegen" wählen.',
+ 'You can only delete datasets that are not in use.' => 'Sie können nur Datenbanken löschen, die momentan nicht in Benutzung sind.',
+ '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:',
+ 'You cannot continue before all required modules are installed.' => 'Sie können nicht fortfahren, bevor alle benötigten Pakete installiert sind.',
'You cannot continue until all unknown units have been mapped to known ones.' => 'Sie können nicht fortfahren, bis alle unbekannten Einheiten in neue Einheiten umgewandelt wurden.',
'You did not enter a name!' => 'Sie haben keinen Namen eingegeben!',
+ 'You have entered or selected the following shipping address for this customer:' => 'Sie haben die folgende Lieferadresse eingegeben oder ausgewählt:',
'You have to chose a dimension unit and a service unit which will then be assigned to those entries.' => 'Sie müssen eine Maß- und eine Dienstleistungseinheit auswählen, die diesen Waren und Dienstleistungen, denen noch keine Einheit zugeordnet ist, zugeordnet wird.',
'You have to chose which unit to save for each of them.' => 'Sie müssen für jeden Artikel die neue Einheit auswählen.',
'You have to create new Buchungsgruppen for all the combinations of inventory, income and expense accounts that have been used already.' => 'Sie müssen neue Buchungsgruppen für alle Kombinationen aus Inventar-, Erlös- und Aufwandskonto, die bereits benutzt wurden.',
- 'You must enter a host and port for local and remote connections!' => '"Rechner" und "Port" müssen für lokale und externe Verbindungen eingetragen werden!',
+ 'You\'re not editing a file.' => 'Sie bearbeiten momentan keine Datei.',
+ 'You\'ve already chosen the following limitations:' => 'Sie haben bereits die folgenden Einschränkungen vorgenommen:',
+ 'Zeitpunkt' => 'Zeitpunkt',
'Zeitraum' => 'Zeitraum',
+ 'Zero amount posting!' => 'Buchung ohne Wert',
'Zip, City' => 'PLZ, Ort',
'Zipcode' => 'PLZ',
+ 'Zusatz' => 'Zusatz',
+ '[email]' => '[email]',
+ 'account_description' => 'Beschreibung',
'accrual' => 'Bilanzierung (Soll-Versteuerung)',
+ 'ap_aging_list' => 'liste_offene_verbindlichkeiten',
+ 'ar_aging_list' => 'liste_offene_forderungen',
'as at' => 'zum Stand',
+ 'assembly_list' => 'erzeugnisliste',
'back' => 'zurück',
+ 'bin_list' => 'Lagerliste',
'bis' => 'bis',
'button' => '?',
'cash' => 'E/Ü-Rechnung (Ist-Versteuerung)',
+ 'chart_of_accounts' => 'kontenuebersicht',
'choice' => 'auswählen',
'choice part' => 'Artikel auswählen',
+ 'close' => 'schließen',
'config' => 'Konfiguration',
'continue' => 'weiter',
+ 'customer_list' => 'kundenliste',
'customernumber not unique!' => 'Die Kundennummer ist schon vergeben',
'debug' => 'Debug',
+ 'delete' => 'Löschen',
'deliverydate' => 'Lieferdatum',
'dimension units' => 'Maßeinheiten',
- 'does not exist' => 'existiert nicht',
'done' => 'erledigt',
+ 'down' => 'runter',
+ 'drucken' => 'drucken',
+ 'dunning_list' => 'mahnungsliste',
'eMail Send?' => 'eMail-Versand?',
'eMail?' => 'eMail?',
'ea' => 'St.',
'emailed to' => 'gemailt an',
- 'equal Outputformat' => 'wie Ausgabeformat',
'for Period' => 'für den Zeitraum',
+ 'from (time)' => 'von',
+ 'general_ledger_list' => 'buchungsjournal',
+ 'history' => 'Historie',
+ 'history search engine' => 'Historien Suchmaschine',
+ 'invoice' => 'Rechnung',
+ 'invoice_list' => 'debitorenbuchungsliste',
'is already a member!' => 'ist bereits ein Mitglied!',
'lead deleted!' => 'Kundenquelle gelöscht',
'lead saved!' => 'Kundenquelle geichert',
'list' => 'auflisten',
+ 'list_of_payments' => 'zahlungsausgaenge',
+ 'list_of_receipts' => 'zahlungseingaenge',
+ 'list_of_transactions' => 'buchungsliste',
'localhost' => 'lokaler Rechner',
- 'month' => 'monatliche Abgabe',
+ 'logout' => 'abmelden',
+ 'mark as paid' => 'als bezahlt markieren',
+ 'month' => 'Monatliche Abgabe',
+ 'new Window' => 'neues Fenster',
+ 'no' => 'nein',
'none (pricegroup)' => 'keine',
'number' => 'Nummer',
+ 'order' => 'Reihenfolge',
+ 'packing_list' => 'Versandliste',
+ 'part_list' => 'warenliste',
+ 'pick_list' => 'Entnahmeliste',
'plural first char' => 'P',
+ 'pos_bilanz' => 'Bilanz',
+ 'pos_bwa' => 'BWA',
+ 'pos_eur' => 'E/ÜR',
+ 'pos_ustva' => 'UStVA',
'posted!' => 'gebucht',
'prices updated!' => ' Preise aktualisiert!',
- 'quarter' => 'vierteljährliche (quartalsweise) Abgabe',
- 's' => 's',
- 'save' => 'speichern',
+ 'print' => 'drucken',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'purchase_order_list' => 'lieferantenauftragsliste',
+ 'quarter' => 'Vierteljährliche (quartalsweise) Abgabe',
+ 'quotation_list' => 'angebotsliste',
+ 'report_generator_dispatch_to is not defined.' => 'report_generator_dispatch_to ist nicht definiert.',
+ 'report_generator_nextsub is not defined.' => 'report_generator_nextsub ist nicht definiert.',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'reset' => 'zurücksetzen',
+ 'rfq_list' => 'anfragenliste',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_order_list' => 'auftragsliste',
+ 'sales_quotation' => 'Verkaufsangebot',
'saved' => 'gespeichert',
'saved!' => 'gespeichert',
'sent' => 'gesendet',
'sent to printer' => 'an Drucker geschickt',
'service units' => 'Dienstleistungseinheiten',
+ 'service_list' => 'dienstleistungsliste',
'singular first char' => 'S',
'soldtotal' => 'Verkaufte Anzahl',
- 'successfully created!' => 'wurde erfolgreich erstellt',
- 'successfully deleted!' => 'wurde erfolgreich gelöscht',
+ 'submit' => 'abschicken',
+ 'tax_chartaccno' => 'Automatikkonto',
+ 'tax_percent' => 'Prozentsatz',
+ 'tax_rate' => 'Prozent',
+ 'tax_taxdescription' => 'Steuername',
+ 'tax_taxkey' => 'Steuerschlüssel',
+ 'taxnumber' => 'Automatikkonto',
'to (date)' => 'bis',
+ 'to (time)' => 'bis',
+ 'up' => 'hoch',
'use program settings' => 'benutze Programmeinstellungen',
'ustva' => 'UStVA',
- 'website' => 'Webseite',
+ 'valid from' => 'Gültig ab',
+ 'vendor_list' => 'lieferantenliste',
'winston_export' => 'Winston-Export',
+ 'wrongformat' => 'Falsches Format',
+ 'yes' => 'ja',
};
1;
$self->{texts} = {
- '1000,00 or 1000.00' => '1000,00 oder 1000.00',
+ '<%account_number%> -- Your account number' => '<%account_number%> -- Ihre Kontonummer',
+ '<%bank%> -- Your bank' => '<%bank%> -- Der Name Ihrer Bank',
+ '<%bank_code%> -- Your bank code' => '<%bank_code%> -- Die Bankleitzahl Ihrer Bank',
+ '<%currency%> -- The selected currency' => '<%currency%> -- Die ausgewählte Währung',
+ '<%invtotal%> -- Invoice total' => '<%invtotal%> -- Die Rechnungssumme',
+ '<%invtotal_wo_skonto%> -- Invoice total less discount' => '<%invtotal_wo_skonto%> -- Rechnungssumme abzüglich Skonto',
+ '<%netto_date%> -- Date the payment is due in full' => '<%netto_date%> -- Das Datum, bis die Rechnung in voller Höhe bezahlt werden muss',
+ '<%skonto_amount%> -- The deductible amount' => '<%skonto_amount%> -- Der abziehbare Skontobetrag',
+ '<%skonto_date%> -- Date the payment is due with discount' => '<%skonto_date%> -- Das Datum, bis die Rechnung unter Abzug von Skonto bezahlt werden kann',
+ '<%terms_netto%> -- The number of days for full payment' => '<%terms_netto%> -- Die Anzahl Tage, bis die Rechnung in voller Höhe bezahlt werden muss',
+ '<%total%> -- Amount payable' => '<%total%> -- Noch zu bezahlender Betrag',
+ '<%total_wo_skonto%> -- Amount payable less discount' => '<%total_wo_skonto%> -- Noch zu bezahlender Betrag abzüglich Skonto',
'A unit with this name does already exist.' => 'Eine Einheit mit diesem Namen existiert bereits.',
- 'AP' => 'Einkauf',
- 'AR' => 'Verkauf',
+ 'ADDED' => 'Hinzugefügt',
'Account' => 'Konto',
- 'Account Number' => 'Kontonummer',
+ 'Account Category A' => 'Aktiva/Mittelverwendung',
+ 'Account Category C' => 'Kosten',
+ 'Account Category E' => 'Aufwandskonto',
+ 'Account Category G' => '?Gegenkonto?',
+ 'Account Category I' => 'Erlöskonto',
+ 'Account Category L' => 'Passiva/Mittelherkunft',
+ 'Account Category Q' => 'Passiva',
+ 'Account Description missing!' => 'Beschreibung fehlt!',
+ 'Account Link AP' => 'Einkauf',
+ 'Account Link AP_amount' => 'Verbindlichkeiten Aufwand/Anlagen',
+ 'Account Link AP_paid' => 'Verbindlichkeiten Zahlungsausgang',
+ 'Account Link AP_tax' => 'Verbindlichkeiten Steuer',
+ 'Account Link AR' => 'Verkauf',
+ 'Account Link AR_amount' => 'Forderungen Erlöskonto',
+ 'Account Link AR_paid' => 'Forderungen Zahlungseingang',
+ 'Account Link AR_tax' => 'Forderungen Steuer',
+ 'Account Link CT_tax' => 'Kunde/Lieferant Steuer',
+ 'Account Link IC' => 'Inventar',
+ 'Account Link IC_cogs' => 'Warenliste Aufwandskonto',
+ 'Account Link IC_expense' => 'Dienstleistungen Aufwandskonto',
+ 'Account Link IC_income' => 'Dienstleistungen Erlöskonto',
+ 'Account Link IC_sale' => 'Warenliste Erlöskonto',
+ 'Account Link IC_taxpart' => 'Warenliste Steuer',
+ 'Account Link IC_taxservice' => 'Dienstleistungen Steuer',
'Account Number missing!' => 'Kontonummer fehlt!',
- 'Account Type' => 'Kontoart',
'Account Type missing!' => 'Kontoart fehlt!',
'Account deleted!' => 'Konto gelöscht!',
'Account saved!' => 'Konto gespeichert!',
- 'Accounting Menu' => 'Kontoverwaltung',
+ 'Accounting Group deleted!' => 'Buchungsgruppe gelöscht!',
+ 'Accounting Group saved!' => 'Buchungsgruppe gespeichert!',
'Add' => 'Erfassen',
'Add Account' => 'Konto erfassen',
+ 'Add Accounting Group' => 'Buchungsgruppe erfassen',
'Add Buchungsgruppe' => 'Buchungsgruppe erfassen',
- 'Add Business' => 'Kundentyp erfassen',
+ 'Add Business' => 'Kunden-/Lieferantentyp erfassen',
'Add Department' => 'Abteilung erfassen',
- 'Add GIFI' => 'GIFI erfassen',
'Add Language' => 'Sprache hinzufügen',
'Add Lead' => 'Kundenquelle erfassen',
'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',
'Article Code missing!' => 'Artikelkürzel fehlt',
'Asset' => 'Aktiva/Mittelverwendung',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
'Audit Control' => 'Bücherkontrolle',
- 'Aufwand Ausland' => 'Aufwand Ausland',
- 'Aufwand EU m UStId' => 'Aufwand EU m UStId',
- 'Aufwand EU m. UStId' => 'Aufwand EU m. UStId',
- 'Aufwand EU o. UStId' => 'Aufwand EU o. UStId',
- 'Aufwand Inland' => 'Aufwand Inland',
- 'BWA' => 'BWA',
- 'Backup sent to' => 'Eine Sicherungskopie wurde gesandt an',
+ 'Bcc' => 'Bcc',
'Bestandskonto' => 'Bestandskonto',
- 'Bilanz' => 'Bilanz',
+ 'Bin List' => 'Lagerliste',
'Books are open' => 'Die Bücher sind geöffnet.',
'Buchungsgruppe' => 'Buchungsgruppe',
- 'Buchungsgruppe bearbeiten' => 'Buchungsgruppe bearbeiten',
- 'Buchungsgruppe gelöscht!' => 'Buchungsgruppe gelöscht!',
- 'Buchungsgruppe gespeichert!' => 'Buchungsgruppe gespeichert!',
- 'Buchungsgruppe hinzufügen' => 'Buchungsgruppe hinzufügen',
'Buchungsgruppen' => 'Buchungsgruppen',
'Business Number' => 'Firmennummer',
'Business deleted!' => 'Firma gelöscht.',
'Business saved!' => 'Firma gespeichert.',
+ 'CANCELED' => 'Storniert',
'Cannot delete account!' => 'Konto kann nicht gelöscht werden!',
'Cannot delete default account!' => 'Das Standard-Konto kann nicht gelöscht werden!',
'Cannot save account!' => 'Konto kann nicht gespeichert werden!',
'Cannot save preferences!' => 'Benutzereinstellungen können nicht gespeichert werden!',
+ 'Cc' => 'Cc',
'Chart of Accounts' => 'Kontenübersicht',
'Close Books up to' => 'Die Bücher abschließen bis zum',
- 'Code' => 'kode',
- 'Code missing!' => 'kode fehlt!',
'Company' => 'Firma',
+ 'Confirmation' => 'Auftragsbestätigung',
'Continue' => 'Weiter',
- 'Copy to COA' => 'In Kontenplan kopieren',
'Cost Center' => 'Kostenstelle',
'Costs' => 'Kosten',
- 'Credit' => 'Haben',
+ 'Credit Note' => 'Gutschrift',
'Customer Number' => 'Kundennummer',
- 'Customernumberinit' => 'Kundennummernkreis',
+ 'Customer details' => 'Kundendetails',
+ 'Customernumberinit' => 'Kunden-/Lieferantennummernkreis',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
'Dataset upgrade' => 'Datenbankaktualisierung',
+ 'Date' => 'Datum',
'Date Format' => 'Datumsformat',
- 'Debit' => 'Soll',
+ 'Default output medium' => 'Standardausgabekanal',
+ 'Default printer' => 'Standarddrucker',
'Default template format' => 'Standardvorlagenformat',
'Delete' => 'Löschen',
'Delete Account' => 'Konto löschen',
'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Description' => 'Beschreibung',
'Description missing!' => 'Beschreibung fehlt.',
+ 'Directory' => 'Verzeichnis',
'Discount' => 'Rabatt',
'Dropdown Limit' => 'Auswahllistenbegrenzung',
'E-mail' => 'eMail',
- 'EUER' => 'Einnahmen-/Überschussrechnung',
+ 'ELSE' => 'Zusatz',
'Edit' => 'Bearbeiten',
'Edit Account' => 'Kontodaten bearbeiten',
+ 'Edit Accounting Group' => 'Buchungsgruppe bearbeiten',
'Edit Buchungsgruppe' => 'Buchungsgruppe bearbeiten',
- 'Edit Business' => 'Kundentyp bearbeiten',
+ 'Edit Business' => 'Kunden-/Lieferantentyp bearbeiten',
'Edit Department' => 'Abteilung bearbeiten',
- 'Edit GIFI' => 'GIFI editieren',
'Edit Language' => 'Sprache bearbeiten',
'Edit Lead' => 'Kundenquelle bearbeiten',
'Edit Payment Terms' => 'Zahlungskonditionen bearbeiten',
'Edit Preferences for' => 'Benutzereinstellungen für',
'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)',
'Equity' => 'Passiva',
- 'Erlöse Ausland' => 'Erlöse Ausland',
- 'Erlöse EU m. UStId' => 'Erlöse EU m. UStId',
- 'Erlöse EU o. UStId' => 'Erlöse EU o. UStId',
- 'Erlöse Inland' => 'Erlöse Inland',
'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
'Expense' => 'Aufwandskonto',
'Expense Account' => 'Aufwandskonto',
- 'Expense/Asset' => 'Aufwand/Anlagen',
+ 'Expenses EU with UStId' => 'Aufwand EU m. UStId',
+ 'Expenses EU without UStId' => 'Erlöse EU o. UStId',
'Fax' => 'Fax',
- 'Folgekonto' => 'Folgekonto',
+ 'File' => 'Datei',
'Foreign Exchange Gain' => 'Wechselkurserträge',
'Foreign Exchange Loss' => 'Wechselkursaufwendungen',
+ 'Foreign Expenses' => 'Aufwand Ausland',
+ 'Foreign Revenues' => 'Erlöse Ausland',
'Form details (second row)' => 'Formulardetails (zweite Positionszeile)',
- 'GIFI' => 'GIFI',
- 'GIFI deleted!' => 'GIFI gelöscht!',
- 'GIFI missing!' => 'GIFI fehlt!',
- 'GIFI saved!' => 'GIFI gespeichert!',
- 'Gültig ab' => 'Gültig ab',
- 'Heading' => 'Überschrift',
+ 'Header' => 'Überschrift',
'Hide by default' => 'Standardmäßig verstecken',
- 'Include in drop-down menus' => 'In Aufklappmenü aufnehmen',
- 'Input Number Format' => 'Zahlenformat (Eingabe)',
+ 'History' => 'Historie',
+ 'History Search' => 'Historien Suche',
'Inventory' => 'Inventar',
'Inventory Account' => 'Warenbestand',
- 'Is this a summary account to record' => 'Buchungskonto in',
+ 'Invoice' => 'Rechnung',
'Language' => 'Sprache',
'Language deleted!' => 'Sprache gelöscht!',
'Language missing!' => 'Sprache fehlt!',
'Last Customer Number' => 'Letzte Kundennummer',
'Last Invoice Number' => 'Letzte Rechnungsnummer',
'Last Numbers & Default Accounts' => 'Laufende Zähler und Standardkonten',
- 'Last Purchase Order Number' => 'Letzte Lieferantenbestellnummer',
+ 'Last Purchase Order Number' => 'Letzte Lieferantenautragsnummer',
'Last RFQ Number' => 'Letzte Anfragenummer',
- 'Last Sales Order Number' => 'Letzte Kundenbestellnummer',
+ 'Last Sales Order Number' => 'Letzte Auftragsnummer',
'Last Sales Quotation Number' => 'Letzte Angebotsnummer',
'Last Service Number' => 'Letzte Dienstleistungsnr.',
'Last Vendor Number' => 'Letzte Lieferantennummer',
'Lead' => 'Kundenquelle',
'Liability' => 'Passiva/Mittelherkunft',
- 'Link' => 'Verknüpfungen',
'Long Dates' => 'Lange Monatsnamen',
'Long Description' => 'Langtext',
+ 'MAILED' => 'Gesendet',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
+ 'Message' => 'Nachricht',
'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
'Name' => 'Name',
+ 'National Expenses' => 'Aufwand Inland',
+ 'National Revenues' => 'Erlöse Inland',
'Netto Terms' => 'Zahlungsziel netto',
'No' => 'Nein',
'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
- 'No email address for' => 'Keine eMailaddresse für',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
+ 'None' => 'Kein',
'Number' => 'Nummer',
'Number Format' => 'Zahlenformat',
'Number of copies' => 'Anzahl Kopien',
+ 'Off' => 'Aus',
'Old (on the side)' => 'Alt (seitlich)',
+ 'On' => 'An',
'OpenDocument/OASIS' => 'OpenDocument/OASIS',
'Output Number Format' => 'Zahlenformat (Ausgabe)',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
'PDF' => 'PDF',
'PDF (OpenDocument/OASIS)' => 'PDF (OpenDocument/OASIS)',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
'Part Number' => 'Artikelnummer',
'Part description' => 'Artikelbeschreibung',
- 'Parts Inventory' => 'Warenliste',
'Password' => 'Passwort',
- 'Payables' => 'Verbindlichkeiten',
- 'Payment' => 'Zahlungsausgang',
'Payment Terms' => 'Zahlungskonditionen',
'Payment Terms saved!' => 'Zahlungskonditionen gespeichert!',
'Payment terms deleted!' => 'Zahlungskonditionen gelöscht!',
'Phone' => 'Telefon',
+ 'Pick List' => 'Sammelliste',
'Please enter values' => 'Bitte Werte eingeben',
'Postscript' => 'Postscript',
'Preferences saved!' => 'Einstellungen gespeichert!',
'Printer deleted!' => 'Drucker gelöscht!',
'Printer saved!' => 'Drucker gespeichert!',
'Profit Center' => 'Erfolgsbereich',
+ 'Proforma Invoice' => 'Proformarechnung',
'Project Number' => 'Projektnummer',
'Project description' => 'Projektbeschreibung',
+ 'Purchase Order' => 'Lieferantenauftrag',
+ 'Queue' => 'Warteschlange',
+ 'Quotation' => 'Angebot',
+ 'RFQ' => 'Anfrage',
'Rate' => 'Rate',
- 'Receipt' => 'Zahlungseingang',
- 'Receivables' => 'Forderungen',
'Revenue' => 'Erlöskonto',
'Revenue Account' => 'Erlöskonto',
- 'SIC deleted!' => 'SIC gelöscht',
- 'SIC saved!' => 'SIC gespeichert',
- 'Salesman' => 'Vertreter',
+ 'Revenues EU with UStId' => 'Erlöse EU m. UStId',
+ 'Revenues EU without UStId' => 'Erlöse EU o. UStId',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
'Save' => 'Speichern',
+ 'Screen' => 'Bildschirm',
'Select a Customer' => 'Endkunde auswählen',
'Select a part' => 'Artikel auswählen',
'Select a project' => 'Projekt auswählen',
'Select an employee' => 'Angestellten auswählen',
- 'Service Items' => 'Dienstleistungen',
'Setup Menu' => 'Menüsetup',
'Show by default' => 'Standardmäßig anzeigen',
'Signature' => 'Unterschrift',
'Skonto' => 'Skonto',
'Skonto Terms' => 'Zahlungsziel Skonto',
- 'Standard Industrial Codes' => 'SIC',
- 'Steuersatz' => 'Steuersatz',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
'Stylesheet' => 'Stilvorlage',
- 'Tax' => 'Steuer',
+ 'Subject' => 'Betreff',
'Tax Accounts' => 'Steuerkonto',
+ 'Tax Percent is a number between 0 and 100' => 'Prozentsatz muss zwischen
+ 1% und 100% liegen',
+ 'Tax deleted!' => 'Steuer gelöscht!',
+ 'Tax saved!' => 'Steuer gespeichert!',
+ 'Tax-O-Matic' => 'Steuer',
+ 'Tax-o-matic Account' => 'Automatikbuchung auf Konto',
+ 'Taxdescription missing!' => 'Steuername fehlt!',
+ 'Taxkey missing!' => 'Steuerschlüssel fehlt!',
+ 'Taxrate missing!' => 'Prozentsatz fehlt!',
'Template Code' => 'Vorlagenkürzel',
'Template Code missing!' => 'Vorlagenkürzel fehlt!',
- 'Template saved!' => 'Schablone gespeichert!',
'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
'The base unit does not exist or it is about to be deleted in row %d.' => 'Die Basiseinheit in Zeile %d existiert nicht oder soll gelöscht werden.',
'The base unit does not exist.' => 'Die Basiseinheit existiert nicht.',
'The unit in row %d has been deleted in the meantime.' => 'Die Einheit in Zeile %d ist in der Zwischentzeit gelöscht worden.',
'The unit in row %d has been used in the meantime and cannot be changed anymore.' => 'Die Einheit in Zeile %d wurde in der Zwischenzeit benutzt und kann nicht mehr geändert werden.',
'The units have been saved.' => 'Die Einheiten wurden gespeichert.',
+ 'To (email)' => 'An',
'Top (CSS)' => 'Oben (mit CSS)',
'Top (Javascript)' => 'Oben (mit Javascript)',
'Transaction reversal enforced for all dates' => 'Fehleintragungen müssen für jeden Zeitraum mit einer Kontraeintragung ausgebessert werden',
'Transaction reversal enforced up to' => 'Fehleintragungen können bis zu dem angegebenen Zeitraum nur mit einer Kontraeintragung ausgebessert werden!',
- 'Type of Business' => 'Kundentyp',
- 'UStVA-Nr. 35' => 'Kz. 35',
- 'UStVA-Nr. 36' => 'Kz. 36',
- 'UStVA-Nr. 39' => 'Kz. 37',
- 'UStVA-Nr. 41' => 'Kz. 41',
- 'UStVA-Nr. 42' => 'Kz. 42',
- 'UStVA-Nr. 43' => 'Kz. 43',
- 'UStVA-Nr. 44' => 'Kz. 44',
- 'UStVA-Nr. 45' => 'Kz. 45',
- 'UStVA-Nr. 48' => 'Kz. 48',
- 'UStVA-Nr. 49' => 'Kz. 49',
- 'UStVA-Nr. 51 left' => 'Kz. 51 links',
- 'UStVA-Nr. 51 right' => 'Kz. 51 rechts',
- 'UStVA-Nr. 52' => 'Kz. 52',
- 'UStVA-Nr. 53' => 'Kz. 53',
- 'UStVA-Nr. 59' => 'Kz. 59',
- 'UStVA-Nr. 60' => 'Kz. 60',
- 'UStVA-Nr. 61' => 'Kz. 61',
- 'UStVA-Nr. 62' => 'Kz. 62',
- 'UStVA-Nr. 63' => 'Kz. 63',
- 'UStVA-Nr. 64' => 'Kz. 64',
- 'UStVA-Nr. 65' => 'Kz. 65',
- 'UStVA-Nr. 66' => 'Kz. 66',
- 'UStVA-Nr. 67' => 'Kz. 67',
- 'UStVA-Nr. 69' => 'Kz. 69',
- 'UStVA-Nr. 73' => 'Kz. 73',
- 'UStVA-Nr. 74' => 'Kz. 74',
- 'UStVA-Nr. 76' => 'Kz. 76',
- 'UStVA-Nr. 77' => 'Kz. 77',
- 'UStVA-Nr. 80' => 'Kz. 80',
- 'UStVA-Nr. 84' => 'Kz. 84',
- 'UStVA-Nr. 85' => 'Kz. 85',
- 'UStVA-Nr. 86 left' => 'Kz. 86 links',
- 'UStVA-Nr. 86 right' => 'Kz. 86 rechts',
- 'UStVA-Nr. 91' => 'Kz. 91',
- 'UStVA-Nr. 93 left' => 'Kz. 93 left',
- 'UStVA-Nr. 93 right' => 'Kz. 93 right',
- 'UStVA-Nr. 94' => 'Kz. 94',
- 'UStVA-Nr. 95' => 'Kz. 95',
- 'UStVA-Nr. 96' => 'Kz. 96',
- 'UStVA-Nr. 97 links' => 'Kz. 97 links',
- 'UStVA-Nr. 97 rechts' => 'Kz. 97 rechts',
- 'UStVA-Nr. 98' => 'Kz. 98',
- 'Umsatzsteuervoranmeldung' => 'Umsatzsteuervoranmeldung',
+ 'Translation (%s)' => 'Übersetzung (%s)',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
+ 'Type of Business' => 'Kunden-/Lieferantentyp',
'Unit' => 'Einheit',
+ 'Unknown Category' => 'Unbekannte Kategorie',
+ 'Unknown Link' => 'Unbekannte Verknüpfung',
'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',
+ 'Vendor details' => 'Lieferantendetails',
'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:',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
'dimension units' => 'Maßeinheiten',
- 'equal Outputformat' => 'wie Ausgabeformat',
+ 'down' => 'runter',
+ 'invoice' => 'Rechnung',
'lead deleted!' => 'Kundenquelle gelöscht',
'lead saved!' => 'Kundenquelle geichert',
+ 'no' => 'nein',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
'service units' => 'Dienstleistungseinheiten',
+ 'up' => 'hoch',
'use program settings' => 'benutze Programmeinstellungen',
+ 'yes' => 'ja',
};
$self->{subs} = {
+ 'E' => 'E',
'H' => 'H',
- 'acc_menu' => 'acc_menu',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
+ '_get_taxaccount_selection{
+' => '_get_taxaccount_selection{
+',
'account_header' => 'account_header',
'add' => 'add',
'add_account' => 'add_account',
'add_buchungsgruppe' => 'add_buchungsgruppe',
'add_business' => 'add_business',
'add_department' => 'add_department',
- 'add_gifi' => 'add_gifi',
'add_language' => 'add_language',
'add_lead' => 'add_lead',
'add_payment' => 'add_payment',
'add_printer' => 'add_printer',
- 'add_sic' => 'add_sic',
+ 'add_tax' => 'add_tax',
'add_unit' => 'add_unit',
- 'add_warehouse' => 'add_warehouse',
'audit_control' => 'audit_control',
- 'backup' => 'backup',
'buchungsgruppe_header' => 'buchungsgruppe_header',
+ 'build_std_url' => 'build_std_url',
'business_header' => 'business_header',
'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'config' => 'config',
'continue' => 'continue',
- 'copy_to_coa' => 'copy_to_coa',
'delete' => 'delete',
'delete_account' => 'delete_account',
'delete_buchungsgruppe' => 'delete_buchungsgruppe',
'delete_business' => 'delete_business',
'delete_department' => 'delete_department',
- 'delete_gifi' => 'delete_gifi',
'delete_language' => 'delete_language',
'delete_lead' => 'delete_lead',
'delete_payment' => 'delete_payment',
'delete_printer' => 'delete_printer',
- 'delete_sic' => 'delete_sic',
- 'delete_warehouse' => 'delete_warehouse',
+ 'delete_tax' => 'delete_tax',
'delivery_customer_selection' => 'delivery_customer_selection',
'department_header' => 'department_header',
- 'display' => 'display',
- 'display_form' => 'display_form',
- 'display_stylesheet' => 'display_stylesheet',
'doclose' => 'doclose',
'edit' => 'edit',
'edit_account' => 'edit_account',
'edit_buchungsgruppe' => 'edit_buchungsgruppe',
'edit_business' => 'edit_business',
'edit_department' => 'edit_department',
- 'edit_gifi' => 'edit_gifi',
'edit_language' => 'edit_language',
'edit_lead' => 'edit_lead',
'edit_payment' => 'edit_payment',
'edit_printer' => 'edit_printer',
- 'edit_sic' => 'edit_sic',
- 'edit_template' => 'edit_template',
+ 'edit_tax' => 'edit_tax',
'edit_units' => 'edit_units',
- 'edit_warehouse' => 'edit_warehouse',
'employee_selection_internal' => 'employee_selection_internal',
'form_footer' => 'form_footer',
'format_dates' => 'format_dates',
- 'gifi_footer' => 'gifi_footer',
- 'gifi_header' => 'gifi_header',
+ 'get_employee_id' => 'get_employee_id',
'language_header' => 'language_header',
'lead_header' => 'lead_header',
'list_account' => 'list_account',
+ 'list_account_details' => 'list_account_details',
'list_buchungsgruppe' => 'list_buchungsgruppe',
'list_business' => 'list_business',
'list_department' => 'list_department',
- 'list_gifi' => 'list_gifi',
'list_language' => 'list_language',
'list_lead' => 'list_lead',
'list_payment' => 'list_payment',
'list_printer' => 'list_printer',
- 'list_sic' => 'list_sic',
- 'list_warehouse' => 'list_warehouse',
+ 'list_tax' => 'list_tax',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
'part_selection_internal' => 'part_selection_internal',
'payment_header' => 'payment_header',
'printer_header' => 'printer_header',
'project_selection_internal' => 'project_selection_internal',
'reformat_numbers' => 'reformat_numbers',
- 'restore_form' => 'restore_form',
'save' => 'save',
'save_account' => 'save_account',
'save_buchungsgruppe' => 'save_buchungsgruppe',
'save_business' => 'save_business',
'save_department' => 'save_department',
- 'save_form' => 'save_form',
- 'save_gifi' => 'save_gifi',
'save_language' => 'save_language',
'save_lead' => 'save_lead',
'save_payment' => 'save_payment',
'save_preferences' => 'save_preferences',
'save_printer' => 'save_printer',
- 'save_sic' => 'save_sic',
- 'save_template' => 'save_template',
+ 'save_tax' => 'save_tax',
'save_unit' => 'save_unit',
- 'save_warehouse' => 'save_warehouse',
- 'section_menu' => 'section_menu',
'select_employee' => 'select_employee',
'select_employee_internal' => 'select_employee_internal',
'select_part' => 'select_part',
'select_part_internal' => 'select_part_internal',
'set_longdescription' => 'set_longdescription',
'set_unit_languages' => 'set_unit_languages',
- 'sic_header' => 'sic_header',
+ 'show_am_history' => 'show_am_history',
+ 'show_history' => 'show_history',
+ 'show_history_search' => 'show_history_search',
+ 'show_vc_details' => 'show_vc_details',
+ 'swap_buchungsgruppen' => 'swap_buchungsgruppen',
+ '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',
- 'in_kontenplan_kopieren' => 'copy_to_coa',
'löschen' => 'delete',
- 'bearbeiten' => 'edit',
'kontodaten_bearbeiten' => 'edit_account',
'speichern' => 'save',
};
--- /dev/null
+$self->{texts} = {
+ 'ADDED' => 'Hinzugefügt',
+ 'Address' => 'Adresse',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
+ 'BWA' => 'BWA',
+ 'Balance Sheet' => 'Bilanz',
+ 'Bcc' => 'Bcc',
+ 'Bin List' => 'Lagerliste',
+ 'CANCELED' => 'Storniert',
+ 'Cc' => 'Cc',
+ 'Check' => 'Scheck',
+ 'Confirmation' => 'Auftragsbestätigung',
+ 'Credit Note' => 'Gutschrift',
+ 'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
+ 'Date' => 'Datum',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
+ 'Directory' => 'Verzeichnis',
+ 'ELSE' => 'Zusatz',
+ 'Edit templates' => 'Vorlage bearbeiten',
+ 'Edit the stylesheet' => 'Stilvorlage bearbeiten',
+ 'Enter longdescription' => 'Langtext eingeben',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
+ 'File' => 'Datei',
+ 'History' => 'Historie',
+ 'Income Statement' => 'GuV',
+ 'Invoice' => 'Rechnung',
+ 'MAILED' => 'Gesendet',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
+ 'Message' => 'Nachricht',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
+ 'Name' => 'Name',
+ 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
+ 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
+ 'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
+ 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
+ 'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
+ 'Part Number' => 'Artikelnummer',
+ 'Part description' => 'Artikelbeschreibung',
+ 'Payment Reminder' => 'Zahlungserinnerung',
+ 'Pick List' => 'Sammelliste',
+ 'Please enter values' => 'Bitte Werte eingeben',
+ 'Proforma Invoice' => 'Proformarechnung',
+ 'Project Number' => 'Projektnummer',
+ 'Project description' => 'Projektbeschreibung',
+ 'Purchase Order' => 'Lieferantenauftrag',
+ 'Quotation' => 'Angebot',
+ 'RFQ' => 'Anfrage',
+ 'Receipt' => 'Zahlungseingang',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
+ 'Saving the file \'%s\' failed. OS error message: %s' => 'Das Speichern der Datei \'%s\' schlug fehl. Fehlermeldung des Betriebssystems: %s',
+ 'Select a Customer' => 'Endkunde auswählen',
+ 'Select a part' => 'Artikel auswählen',
+ 'Select a project' => 'Projekt auswählen',
+ 'Select an employee' => 'Angestellten auswählen',
+ 'Statement' => 'Sammelrechnung',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
+ 'Subject' => 'Betreff',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'To (email)' => 'An',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
+ 'USTVA' => 'USTVA',
+ 'USTVA 2004' => 'USTVA 2004',
+ 'USTVA 2005' => 'USTVA 2005',
+ 'USTVA 2006' => 'USTVA 2006',
+ 'USTVA 2007' => 'USTVA 2007',
+ 'Unit' => 'Einheit',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
+ 'Value' => 'Wert',
+ 'Variable' => 'Variable',
+ 'Vendor details' => 'Lieferantendetails',
+ 'You\'re not editing a file.' => 'Sie bearbeiten momentan keine Datei.',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
+ 'invoice' => 'Rechnung',
+ 'no' => 'nein',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
+ 'yes' => 'ja',
+};
+
+$self->{subs} = {
+ 'E' => 'E',
+ 'H' => 'H',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
+ 'build_std_url' => 'build_std_url',
+ 'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
+ 'delivery_customer_selection' => 'delivery_customer_selection',
+ 'display' => 'display',
+ 'display_template' => 'display_template',
+ 'display_template_form' => 'display_template_form',
+ 'edit' => 'edit',
+ 'edit_template' => 'edit_template',
+ 'employee_selection_internal' => 'employee_selection_internal',
+ 'format_dates' => 'format_dates',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
+ 'part_selection_internal' => 'part_selection_internal',
+ 'project_selection_internal' => 'project_selection_internal',
+ 'reformat_numbers' => 'reformat_numbers',
+ 'save' => 'save',
+ 'save_template' => 'save_template',
+ 'select_employee' => 'select_employee',
+ 'select_employee_internal' => 'select_employee_internal',
+ 'select_part' => 'select_part',
+ 'select_part_internal' => 'select_part_internal',
+ 'set_longdescription' => 'set_longdescription',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
+ 'vendor_selection' => 'vendor_selection',
+ 'weiter' => 'continue',
+ 'anzeigen' => 'display',
+ 'bearbeiten' => 'edit',
+ 'speichern' => 'save',
+};
+
+1;
$self->{texts} = {
- 'AP Transaction' => 'Kreditorenbuchung',
+ 'ADDED' => 'Hinzugefügt',
+ 'AP Transaction (abbreviation)' => 'K',
'AP Transactions' => 'Kreditorenbuchungen',
'Account' => 'Konto',
- 'Accounting Menu' => 'Kontoverwaltung',
'Add Accounts Payables Transaction' => 'Kreditorenbuchung erfassen',
'Address' => 'Adresse',
'Amount' => 'Betrag',
'Apr' => 'Apr',
'April' => 'April',
'Are you sure you want to delete Transaction' => 'Buchung wirklich löschen?',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
'Aug' => 'Aug',
'August' => 'August',
+ 'Bcc' => 'Bcc',
+ 'Bin List' => 'Lagerliste',
'Bis' => 'bis',
+ 'CANCELED' => 'Storniert',
+ 'CSV export -- options' => 'CSV-Export -- Optionen',
+ 'Cancel Accounts Payables Transaction' => 'Kreditorenbuchung stornieren',
'Cannot delete transaction!' => 'Buchung kann nicht gelöscht werden!',
'Cannot post payment for a closed period!' => 'Es können keine Zahlungen für abgeschlossene Bücher gebucht werden!',
+ 'Cannot post payment!' => 'Zahlung kann nicht gebucht werden!',
'Cannot post transaction for a closed period!' => 'Für einen bereits abgeschlossenen Zeitraum kann keine Buchung angelegt werden!',
'Cannot post transaction!' => 'Rechnung kann nicht gebucht werden!',
+ 'Cc' => 'Cc',
'Closed' => 'Geschlossen',
'Confirm!' => 'Bestätigen Sie!',
+ 'Confirmation' => 'Auftragsbestätigung',
'Continue' => 'Weiter',
+ 'Could not spawn html2ps or GhostScript.' => 'html2ps oder GhostScript konnte nicht gestartet werden.',
+ 'Could not spawn the printer command.' => 'Die Druckanwendung konnte nicht gestartet werden.',
+ 'Could not write the html2ps config file.' => 'Die temporäre html2ps-Konfigurationsdatei konnte nicht geschrieben werden.',
+ 'Could not write the temporary HTML file.' => 'Eine temporäre HTML-Datei konnte nicht geschrieben werden.',
'Credit Limit' => 'Kreditlimit',
+ 'Credit Note' => 'Gutschrift',
'Currency' => 'Währung',
+ 'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
+ 'Customer not on file or locked!' => 'Dieser Kunde existiert nicht oder ist gesperrt.',
'Customer not on file!' => 'Kunde ist nicht in der Datenbank!',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
'Date' => 'Datum',
'Date Paid' => 'Zahlungsdatum',
'Dec' => 'Dez',
'December' => 'Dezember',
'Delete' => 'Löschen',
+ 'Delete drafts' => 'Entwürfe löschen',
'Department' => 'Abteilung',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Description' => 'Beschreibung',
+ 'Directory' => 'Verzeichnis',
+ 'Draft saved.' => 'Entwurf gespeichert.',
'Due Date' => 'Fälligkeitsdatum',
'Due Date missing!' => 'Fälligkeitsdatum fehlt!',
+ 'ELSE' => 'Zusatz',
'Edit Accounts Payables Transaction' => 'Kreditorenbuchung bearbeiten',
'Employee' => 'Bearbeiter',
+ 'Enter longdescription' => 'Langtext eingeben',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
'Exch' => 'Wechselkurs.',
'Exchangerate' => 'Wechselkurs',
'Exchangerate for payment missing!' => 'Es fehlt der Wechselkurs für die Bezahlung!',
'Exchangerate missing!' => 'Es fehlt der Wechselkurs!',
+ 'Falsches Datumsformat!' => 'Falsches Datumsformat!',
'Feb' => 'Feb',
'February' => 'Februar',
+ 'File' => 'Datei',
'From' => 'Von',
+ 'History' => 'Historie',
'ID' => 'Buchungsnummer',
'Include in Report' => 'In Bericht aufnehmen',
'Invoice' => 'Rechnung',
+ 'Invoice (one letter abbreviation)' => 'R',
'Invoice Date' => 'Rechnungsdatum',
'Invoice Date missing!' => 'Rechnungsdatum fehlt!',
'Invoice Number' => 'Rechnungsnummer',
'Jun' => 'Jun',
'June' => 'Juni',
'Korrektur' => 'Korrektur',
+ 'MAILED' => 'Gesendet',
'Mar' => 'März',
'March' => 'März',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
'May' => 'Mai',
'May ' => 'Mai',
'Memo' => 'Memo',
+ 'Message' => 'Nachricht',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
+ 'Missing amount' => 'Fehlbetrag',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
+ 'Name' => 'Name',
+ 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
+ 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
+ 'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
+ 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
+ 'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'Notes' => 'Bemerkungen',
'Nov' => 'Nov',
'November' => 'November',
'Open' => 'Offen',
'Order' => 'Auftrag',
'Order Number' => 'Auftragsnummer',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
+ 'PDF export -- options' => 'PDF-Export -- Optionen',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
'Paid' => 'bezahlt',
+ 'Part Number' => 'Artikelnummer',
+ 'Part description' => 'Artikelbeschreibung',
'Payment date missing!' => 'Tag der Zahlung fehlt!',
+ 'Payment posted!' => 'Zahlung gebucht!',
'Payments' => 'Zahlungsausgänge',
+ 'Pick List' => 'Sammelliste',
+ 'Please enter values' => 'Bitte Werte eingeben',
'Post' => 'Buchen',
+ 'Post Payment' => 'Zahlung buchen',
+ 'Proforma Invoice' => 'Proformarechnung',
'Project' => 'Projekt',
+ 'Project Number' => 'Projektnummer',
+ 'Project description' => 'Projektbeschreibung',
'Project not on file!' => 'Dieses Projekt ist nicht in der Datenbank!',
+ 'Purchase Order' => 'Lieferantenauftrag',
+ 'Quotation' => 'Angebot',
+ 'RFQ' => 'Anfrage',
'Remaining' => 'Rest',
+ 'Remove draft when posting' => 'Entwurf beim Buchen löschen',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
+ 'Salesperson' => 'Verkäufer',
+ 'Save draft' => 'Entwurf speichern',
+ 'Select a Customer' => 'Endkunde auswählen',
+ 'Select a part' => 'Artikel auswählen',
+ 'Select a project' => 'Projekt auswählen',
+ 'Select an employee' => 'Angestellten auswählen',
'Select from one of the names below' => 'Wählen Sie einen der untenstehenden Namen',
'Select from one of the projects below' => 'Wählen Sie eines der untenstehenden Projekte',
'Sep' => 'Sep',
'September' => 'September',
+ 'Skip' => 'Überspringen',
'Source' => 'Beleg',
+ 'Storno' => 'Storno',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
+ 'Subject' => 'Betreff',
'Subtotal' => 'Zwischensumme',
'Tax' => 'Steuer',
'Tax Included' => 'Steuer im Preis inbegriffen',
'Taxkey' => 'Steuerschlüssel',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'The list has been printed.' => 'Die Liste wurde ausgedruckt.',
+ 'To (email)' => 'An',
'Total' => 'Summe',
+ 'Transaction %d cancelled.' => 'Buchung %d erfolgreich storniert.',
'Transaction deleted!' => 'Buchung gelöscht!',
+ 'Transaction description' => 'Vorgangsbezeichnung',
+ 'Transaction has already been cancelled!' => 'Diese Buchung wurde bereits storniert.',
'Transaction posted!' => 'Buchung verbucht!',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
+ 'Type' => 'Typ',
+ 'Unit' => 'Einheit',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
'Update' => 'Erneuern',
'Use As Template' => 'Als Vorlage verwenden',
+ 'Value' => 'Wert',
+ 'Variable' => 'Variable',
'Vendor' => 'Lieferant',
- 'Vendor Invoice' => 'Einkaufsrechnung',
+ 'Vendor details' => 'Lieferantendetails',
'Vendor missing!' => 'Lieferant fehlt!',
+ 'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!',
'Yes' => 'Ja',
+ 'Zero amount posting!' => 'Buchung ohne Wert',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
'button' => '?',
+ 'history' => 'Historie',
+ 'invoice' => 'Rechnung',
+ 'invoice_list' => 'debitorenbuchungsliste',
+ 'mark as paid' => 'als bezahlt markieren',
+ 'no' => 'nein',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'report_generator_dispatch_to is not defined.' => 'report_generator_dispatch_to ist nicht definiert.',
+ 'report_generator_nextsub is not defined.' => 'report_generator_nextsub ist nicht definiert.',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
+ 'wrongformat' => 'Falsches Format',
+ 'yes' => 'ja',
};
$self->{subs} = {
- 'acc_menu' => 'acc_menu',
+ 'E' => 'E',
+ 'H' => 'H',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
'add' => 'add',
'add_transaction' => 'add_transaction',
- 'ap_subtotal' => 'ap_subtotal',
'ap_transaction' => 'ap_transaction',
'ap_transactions' => 'ap_transactions',
'ar_transaction' => 'ar_transaction',
+ 'build_std_url' => 'build_std_url',
+ 'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'check_name' => 'check_name',
'check_project' => 'check_project',
'continue' => 'continue',
'create_links' => 'create_links',
+ 'create_subtotal_row' => 'create_subtotal_row',
'delete' => 'delete',
- 'display' => 'display',
+ 'delete_drafts' => 'delete_drafts',
+ 'delivery_customer_selection' => 'delivery_customer_selection',
'display_form' => 'display_form',
+ 'dont_load_draft' => 'dont_load_draft',
+ 'draft_action_dispatcher' => 'draft_action_dispatcher',
'edit' => 'edit',
+ 'employee_selection_internal' => 'employee_selection_internal',
'form_footer' => 'form_footer',
'form_header' => 'form_header',
+ 'format_dates' => 'format_dates',
'gl_transaction' => 'gl_transaction',
+ 'load_draft' => 'load_draft',
+ 'load_draft_maybe' => 'load_draft_maybe',
+ 'mark_as_paid' => 'mark_as_paid',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
'name_selected' => 'name_selected',
+ 'part_selection_internal' => 'part_selection_internal',
'post' => 'post',
'post_as_new' => 'post_as_new',
+ 'post_payment' => 'post_payment',
'project_selected' => 'project_selected',
+ 'project_selection_internal' => 'project_selection_internal',
+ 'reformat_numbers' => 'reformat_numbers',
+ 'remove_draft' => 'remove_draft',
+ 'report_generator_back' => 'report_generator_back',
+ 'report_generator_dispatcher' => 'report_generator_dispatcher',
+ 'report_generator_do' => 'report_generator_do',
+ 'report_generator_export_as_csv' => 'report_generator_export_as_csv',
+ 'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
'sales_invoice' => 'sales_invoice',
+ 'save_draft' => 'save_draft',
'search' => 'search',
- 'section_menu' => 'section_menu',
+ 'select_employee' => 'select_employee',
+ 'select_employee_internal' => 'select_employee_internal',
'select_name' => 'select_name',
+ 'select_part' => 'select_part',
+ 'select_part_internal' => 'select_part_internal',
'select_project' => 'select_project',
+ 'set_longdescription' => 'set_longdescription',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
+ 'storno' => 'storno',
'update' => 'update',
'use_as_template' => 'use_as_template',
'vendor_invoice' => 'vendor_invoice',
+ 'vendor_selection' => 'vendor_selection',
'yes' => 'yes',
'kreditorenbuchung' => 'ap_transaction',
'kreditorenbuchung_erfassen' => 'add_accounts_payables_transaction',
'weiter' => 'continue',
'löschen' => 'delete',
+ 'entwürfe_löschen' => 'delete_drafts',
'kreditorenbuchung_bearbeiten' => 'edit_accounts_payables_transaction',
'buchen' => 'post',
+ 'zahlung_buchen' => 'post_payment',
+ 'entwurf_speichern' => 'save_draft',
+ 'Überspringen' => 'skip',
+ 'storno' => 'storno',
'erneuern' => 'update',
'als_vorlage_verwenden' => 'use_as_template',
'einkaufsrechnung' => 'vendor_invoice',
'ja' => 'yes',
+ 'als_bezahlt_markieren' => 'mark_as_paid',
};
1;
$self->{texts} = {
- 'AR Transaction' => 'Debitorenbuchung',
+ 'ADDED' => 'Hinzugefügt',
+ 'AR Transaction (abbreviation)' => 'D',
'AR Transactions' => 'Debitorenbuchungen',
'Account' => 'Konto',
'Accounting Menu' => 'Kontoverwaltung',
'Apr' => 'Apr',
'April' => 'April',
'Are you sure you want to delete Transaction' => 'Buchung wirklich löschen?',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
'Aug' => 'Aug',
'August' => 'August',
+ 'Bcc' => 'Bcc',
+ 'Bin List' => 'Lagerliste',
'Bis' => 'bis',
+ 'CANCELED' => 'Storniert',
+ 'CSV export -- options' => 'CSV-Export -- Optionen',
+ 'Cancel Accounts Receivables Transaction' => 'Debitorenbuchung stornieren',
'Cannot delete transaction!' => 'Buchung kann nicht gelöscht werden!',
'Cannot post payment for a closed period!' => 'Es können keine Zahlungen für abgeschlossene Bücher gebucht werden!',
+ 'Cannot post payment!' => 'Zahlung kann nicht gebucht werden!',
'Cannot post transaction for a closed period!' => 'Für einen bereits abgeschlossenen Zeitraum kann keine Buchung angelegt werden!',
'Cannot post transaction!' => 'Rechnung kann nicht gebucht werden!',
+ 'Cc' => 'Cc',
'Closed' => 'Geschlossen',
'Confirm!' => 'Bestätigen Sie!',
+ 'Confirmation' => 'Auftragsbestätigung',
'Continue' => 'Weiter',
+ 'Could not spawn html2ps or GhostScript.' => 'html2ps oder GhostScript konnte nicht gestartet werden.',
+ 'Could not spawn the printer command.' => 'Die Druckanwendung konnte nicht gestartet werden.',
+ 'Could not write the html2ps config file.' => 'Die temporäre html2ps-Konfigurationsdatei konnte nicht geschrieben werden.',
+ 'Could not write the temporary HTML file.' => 'Eine temporäre HTML-Datei konnte nicht geschrieben werden.',
'Credit Limit' => 'Kreditlimit',
+ 'Credit Note' => 'Gutschrift',
'Credit note (one letter abbreviation)' => 'G',
'Currency' => 'Währung',
'Customer' => 'Kunde',
+ 'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
'Customer missing!' => 'Kundenname fehlt!',
+ 'Customer not on file or locked!' => 'Dieser Kunde existiert nicht oder ist gesperrt.',
'Customer not on file!' => 'Kunde ist nicht in der Datenbank!',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
'Date' => 'Datum',
'Date Paid' => 'Zahlungsdatum',
'Dec' => 'Dez',
'December' => 'Dezember',
'Delete' => 'Löschen',
+ 'Delete drafts' => 'Entwürfe löschen',
'Department' => 'Abteilung',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Description' => 'Beschreibung',
+ 'Directory' => 'Verzeichnis',
+ 'Draft saved.' => 'Entwurf gespeichert.',
'Due Date' => 'Fälligkeitsdatum',
'Due Date missing!' => 'Fälligkeitsdatum fehlt!',
+ 'ELSE' => 'Zusatz',
'Edit Accounts Receivables Transaction' => 'Debitorenbuchung bearbeiten',
+ 'Enter longdescription' => 'Langtext eingeben',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
+ 'Ertrag' => 'Ertrag',
+ 'Ertrag prozentual' => 'Ertrag prozentual',
'Exch' => 'Wechselkurs.',
'Exchangerate' => 'Wechselkurs',
'Exchangerate for payment missing!' => 'Es fehlt der Wechselkurs für die Bezahlung!',
'Exchangerate missing!' => 'Es fehlt der Wechselkurs!',
+ 'Falsches Datumsformat!' => 'Falsches Datumsformat!',
'Feb' => 'Feb',
'February' => 'Februar',
+ 'File' => 'Datei',
'From' => 'Von',
+ 'History' => 'Historie',
'ID' => 'Buchungsnummer',
'Include in Report' => 'In Bericht aufnehmen',
'Incoming Payments' => 'Zahlungseingänge',
'Invoice Date' => 'Rechnungsdatum',
'Invoice Date missing!' => 'Rechnungsdatum fehlt!',
'Invoice Number' => 'Rechnungsnummer',
+ 'Invoice with Storno (abbreviation)' => 'R(S)',
'Jan' => 'Jan',
'January' => 'Januar',
'Jul' => 'Jul',
'Jun' => 'Jun',
'June' => 'Juni',
'Korrektur' => 'Korrektur',
+ 'MAILED' => 'Gesendet',
'Mar' => 'März',
'March' => 'März',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
'May' => 'Mai',
'May ' => 'Mai',
'Memo' => 'Memo',
+ 'Message' => 'Nachricht',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
+ 'Missing amount' => 'Fehlbetrag',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
+ 'Name' => 'Name',
+ 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
+ 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
+ 'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
+ 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
+ 'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'Notes' => 'Bemerkungen',
'Nov' => 'Nov',
'November' => 'November',
'Open' => 'Offen',
'Order' => 'Auftrag',
'Order Number' => 'Auftragsnummer',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
+ 'PDF export -- options' => 'PDF-Export -- Optionen',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
'Paid' => 'bezahlt',
+ 'Part Number' => 'Artikelnummer',
+ 'Part description' => 'Artikelbeschreibung',
'Payment date missing!' => 'Tag der Zahlung fehlt!',
+ 'Payment posted!' => 'Zahlung gebucht!',
+ 'Pick List' => 'Sammelliste',
+ 'Please enter values' => 'Bitte Werte eingeben',
'Post' => 'Buchen',
+ 'Post Payment' => 'Zahlung buchen',
+ 'Proforma Invoice' => 'Proformarechnung',
'Project' => 'Projekt',
+ 'Project Number' => 'Projektnummer',
+ 'Project description' => 'Projektbeschreibung',
'Project not on file!' => 'Dieses Projekt ist nicht in der Datenbank!',
+ 'Purchase Order' => 'Lieferantenauftrag',
+ 'Quotation' => 'Angebot',
+ 'RFQ' => 'Anfrage',
'Remaining' => 'Rest',
- 'Sales Invoice' => 'Rechnung',
+ 'Remove draft when posting' => 'Entwurf beim Buchen löschen',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
'Salesperson' => 'Verkäufer',
+ 'Save draft' => 'Entwurf speichern',
+ 'Select a Customer' => 'Endkunde auswählen',
+ 'Select a part' => 'Artikel auswählen',
+ 'Select a project' => 'Projekt auswählen',
+ 'Select an employee' => 'Angestellten auswählen',
'Select from one of the names below' => 'Wählen Sie einen der untenstehenden Namen',
'Select from one of the projects below' => 'Wählen Sie eines der untenstehenden Projekte',
'Sep' => 'Sep',
'September' => 'September',
'Ship via' => 'Transportmittel',
'Shipping Point' => 'Versandort',
+ 'Skip' => 'Überspringen',
'Source' => 'Beleg',
+ 'Storno' => 'Storno',
'Storno (one letter abbreviation)' => 'S',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
+ 'Subject' => 'Betreff',
'Subtotal' => 'Zwischensumme',
'Tax' => 'Steuer',
'Tax Included' => 'Steuer im Preis inbegriffen',
'Taxkey' => 'Steuerschlüssel',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'The list has been printed.' => 'Die Liste wurde ausgedruckt.',
+ 'To (email)' => 'An',
'Total' => 'Summe',
+ 'Transaction %d cancelled.' => 'Buchung %d erfolgreich storniert.',
'Transaction deleted!' => 'Buchung gelöscht!',
+ 'Transaction description' => 'Vorgangsbezeichnung',
+ 'Transaction has already been cancelled!' => 'Diese Buchung wurde bereits storniert.',
'Transaction posted!' => 'Buchung verbucht!',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
'Type' => 'Typ',
+ 'Unit' => 'Einheit',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
'Update' => 'Erneuern',
'Use As Template' => 'Als Vorlage verwenden',
+ 'Value' => 'Wert',
+ 'Variable' => 'Variable',
+ 'Vendor details' => 'Lieferantendetails',
+ 'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!',
'Yes' => 'Ja',
+ 'Zero amount posting!' => 'Buchung ohne Wert',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
'button' => '?',
+ 'history' => 'Historie',
+ 'invoice' => 'Rechnung',
+ 'invoice_list' => 'debitorenbuchungsliste',
+ 'mark as paid' => 'als bezahlt markieren',
+ 'no' => 'nein',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'report_generator_dispatch_to is not defined.' => 'report_generator_dispatch_to ist nicht definiert.',
+ 'report_generator_nextsub is not defined.' => 'report_generator_nextsub ist nicht definiert.',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
+ 'wrongformat' => 'Falsches Format',
+ 'yes' => 'ja',
};
$self->{subs} = {
+ 'E' => 'E',
+ 'H' => 'H',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
+ '_post' => '_post',
'acc_menu' => 'acc_menu',
'add' => 'add',
'add_transaction' => 'add_transaction',
'ap_transaction' => 'ap_transaction',
- 'ar_subtotal' => 'ar_subtotal',
'ar_transaction' => 'ar_transaction',
'ar_transactions' => 'ar_transactions',
+ 'build_std_url' => 'build_std_url',
+ 'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'check_name' => 'check_name',
'check_project' => 'check_project',
'continue' => 'continue',
'create_links' => 'create_links',
+ 'create_subtotal_row' => 'create_subtotal_row',
'delete' => 'delete',
+ 'delete_drafts' => 'delete_drafts',
+ 'delivery_customer_selection' => 'delivery_customer_selection',
'display' => 'display',
'display_form' => 'display_form',
+ 'dont_load_draft' => 'dont_load_draft',
+ 'draft_action_dispatcher' => 'draft_action_dispatcher',
'edit' => 'edit',
+ 'employee_selection_internal' => 'employee_selection_internal',
'form_footer' => 'form_footer',
'form_header' => 'form_header',
+ 'format_dates' => 'format_dates',
'gl_transaction' => 'gl_transaction',
+ 'load_draft' => 'load_draft',
+ 'load_draft_maybe' => 'load_draft_maybe',
+ 'mark_as_paid' => 'mark_as_paid',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
'name_selected' => 'name_selected',
+ 'part_selection_internal' => 'part_selection_internal',
'post' => 'post',
'post_as_new' => 'post_as_new',
+ 'post_payment' => 'post_payment',
'project_selected' => 'project_selected',
+ 'project_selection_internal' => 'project_selection_internal',
+ 'reformat_numbers' => 'reformat_numbers',
+ 'remove_draft' => 'remove_draft',
+ 'report_generator_back' => 'report_generator_back',
+ 'report_generator_dispatcher' => 'report_generator_dispatcher',
+ 'report_generator_do' => 'report_generator_do',
+ 'report_generator_export_as_csv' => 'report_generator_export_as_csv',
+ 'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
'sales_invoice' => 'sales_invoice',
+ 'save_draft' => 'save_draft',
'search' => 'search',
'section_menu' => 'section_menu',
+ 'select_employee' => 'select_employee',
+ 'select_employee_internal' => 'select_employee_internal',
'select_name' => 'select_name',
+ 'select_part' => 'select_part',
+ 'select_part_internal' => 'select_part_internal',
'select_project' => 'select_project',
+ 'set_longdescription' => 'set_longdescription',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
+ 'storno' => 'storno',
'update' => 'update',
'use_as_template' => 'use_as_template',
'vendor_invoice' => 'vendor_invoice',
+ 'vendor_selection' => 'vendor_selection',
'yes' => 'yes',
'debitorenbuchung' => 'ar_transaction',
'weiter' => 'continue',
'löschen' => 'delete',
+ 'entwürfe_löschen' => 'delete_drafts',
'buchen' => 'post',
+ 'zahlung_buchen' => 'post_payment',
'rechnung' => 'sales_invoice',
+ 'entwurf_speichern' => 'save_draft',
+ 'Überspringen' => 'skip',
+ 'storno' => 'storno',
'erneuern' => 'update',
'als_vorlage_verwenden' => 'use_as_template',
'ja' => 'yes',
+ 'als_bezahlt_markieren' => 'mark_as_paid',
};
1;
$self->{texts} = {
+ 'ADDED' => 'Hinzugefügt',
'Address' => 'Adresse',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
+ 'Bcc' => 'Bcc',
+ 'Bin List' => 'Lagerliste',
+ 'CANCELED' => 'Storniert',
+ 'Cc' => 'Cc',
+ 'Confirmation' => 'Auftragsbestätigung',
'Continue' => 'Weiter',
+ 'Credit Note' => 'Gutschrift',
+ 'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
+ 'Customer not on file or locked!' => 'Dieser Kunde existiert nicht oder ist gesperrt.',
'Customer not on file!' => 'Kunde ist nicht in der Datenbank!',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
+ 'Date' => 'Datum',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Description' => 'Beschreibung',
+ 'Directory' => 'Verzeichnis',
+ 'ELSE' => 'Zusatz',
+ 'Enter longdescription' => 'Langtext eingeben',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
+ 'File' => 'Datei',
+ 'History' => 'Historie',
+ 'Invoice' => 'Rechnung',
+ 'MAILED' => 'Gesendet',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
+ 'Message' => 'Nachricht',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
+ 'Name' => 'Name',
+ 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
+ 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
+ 'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
+ 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
+ 'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'Number' => 'Nummer',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
+ 'Part Number' => 'Artikelnummer',
+ 'Part description' => 'Artikelbeschreibung',
+ 'Pick List' => 'Sammelliste',
+ 'Please enter values' => 'Bitte Werte eingeben',
+ 'Proforma Invoice' => 'Proformarechnung',
+ 'Project Number' => 'Projektnummer',
+ 'Project description' => 'Projektbeschreibung',
'Project not on file!' => 'Dieses Projekt ist nicht in der Datenbank!',
+ 'Purchase Order' => 'Lieferantenauftrag',
+ 'Quotation' => 'Angebot',
+ 'RFQ' => 'Anfrage',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
+ 'Select a Customer' => 'Endkunde auswählen',
+ 'Select a part' => 'Artikel auswählen',
+ 'Select a project' => 'Projekt auswählen',
+ 'Select an employee' => 'Angestellten auswählen',
'Select from one of the names below' => 'Wählen Sie einen der untenstehenden Namen',
'Select from one of the projects below' => 'Wählen Sie eines der untenstehenden Projekte',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
+ 'Subject' => 'Betreff',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'To (email)' => 'An',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
+ 'Unit' => 'Einheit',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
+ 'Value' => 'Wert',
+ 'Variable' => 'Variable',
+ 'Vendor details' => 'Lieferantendetails',
+ 'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
+ 'invoice' => 'Rechnung',
+ 'no' => 'nein',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
+ 'yes' => 'ja',
};
$self->{subs} = {
+ 'E' => 'E',
+ 'H' => 'H',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
'add_transaction' => 'add_transaction',
'ap_transaction' => 'ap_transaction',
'ar_transaction' => 'ar_transaction',
+ 'build_std_url' => 'build_std_url',
+ 'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'check_name' => 'check_name',
'check_project' => 'check_project',
'continue' => 'continue',
+ 'delivery_customer_selection' => 'delivery_customer_selection',
+ 'employee_selection_internal' => 'employee_selection_internal',
+ 'format_dates' => 'format_dates',
'gl_transaction' => 'gl_transaction',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
'name_selected' => 'name_selected',
+ 'part_selection_internal' => 'part_selection_internal',
'project_selected' => 'project_selected',
+ 'project_selection_internal' => 'project_selection_internal',
+ 'reformat_numbers' => 'reformat_numbers',
'sales_invoice' => 'sales_invoice',
+ 'select_employee' => 'select_employee',
+ 'select_employee_internal' => 'select_employee_internal',
'select_name' => 'select_name',
+ 'select_part' => 'select_part',
+ 'select_part_internal' => 'select_part_internal',
'select_project' => 'select_project',
+ 'set_longdescription' => 'set_longdescription',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
'vendor_invoice' => 'vendor_invoice',
+ 'vendor_selection' => 'vendor_selection',
'weiter' => 'continue',
};
$self->{texts} = {
+ 'ADDED' => 'Hinzugefügt',
'Account' => 'Konto',
- 'Accounting Menu' => 'Kontoverwaltung',
+ 'Address' => 'Adresse',
'Are you sure you want to remove the marked entries from the queue?' => 'Sind Sie sicher, dass die markierten Einträge von der Warteschlange gelöscht werden sollen?',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
+ 'Bcc' => 'Bcc',
+ 'Bin List' => 'Lagerliste',
'Bis' => 'bis',
+ 'CANCELED' => 'Storniert',
'Cannot remove files!' => 'Dateien können nicht gelöscht werden!',
+ 'Cc' => 'Cc',
'Checks' => 'Schecks',
'Confirm!' => 'Bestätigen Sie!',
+ 'Confirmation' => 'Auftragsbestätigung',
'Continue' => 'Weiter',
+ 'Credit Note' => 'Gutschrift',
'Customer' => 'Kunde',
+ 'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
'Date' => 'Datum',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
+ 'Directory' => 'Verzeichnis',
+ 'ELSE' => 'Zusatz',
+ 'Enter longdescription' => 'Langtext eingeben',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
+ 'Falsches Datumsformat!' => 'Falsches Datumsformat!',
+ 'File' => 'Datei',
'From' => 'Von',
+ 'History' => 'Historie',
'Invoice' => 'Rechnung',
'Invoice Number' => 'Rechnungsnummer',
+ 'MAILED' => 'Gesendet',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
'Marked entries printed!' => 'Markierte Einträge wurden gedruckt!',
+ 'Message' => 'Nachricht',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
+ 'Name' => 'Name',
+ 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
+ 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
+ 'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
+ 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
+ 'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'Order' => 'Auftrag',
'Order Number' => 'Auftragsnummer',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
'Packing Lists' => 'Lieferschein',
+ 'Part Number' => 'Artikelnummer',
+ 'Part description' => 'Artikelbeschreibung',
+ 'Pick List' => 'Sammelliste',
+ 'Please enter values' => 'Bitte Werte eingeben',
'Print' => 'Drucken',
'Printing ... ' => 'Es wird gedruckt.',
+ 'Proforma Invoice' => 'Proformarechnung',
+ 'Project Number' => 'Projektnummer',
+ 'Project description' => 'Projektbeschreibung',
+ 'Purchase Order' => 'Lieferantenauftrag',
'Purchase Orders' => 'Lieferantenaufträge',
'Quotation' => 'Angebot',
'Quotation Number' => 'Angebotsnummer',
'Quotations' => 'Angebote',
- 'RFQs' => 'Anfragen',
+ 'RFQ' => 'Anfrage',
+ 'RFQs' => 'Preisanfragen',
'Receipts' => 'Zahlungseingänge',
'Reference' => 'Referenz',
'Remove' => 'entfernen',
'Removed spoolfiles!' => 'Druckdateien entfernt!',
'Removing marked entries from queue ...' => 'Markierte Einträge werden von der Warteschlange entfernt ...',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
'Sales Invoices' => 'Kundenrechnung',
'Sales Orders' => 'Aufträge',
+ 'Select a Customer' => 'Endkunde auswählen',
+ 'Select a part' => 'Artikel auswählen',
+ 'Select a project' => 'Projekt auswählen',
'Select all' => 'Alle auswählen',
+ 'Select an employee' => 'Angestellten auswählen',
'Spoolfile' => 'Druckdatei',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
+ 'Subject' => 'Betreff',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
'To' => 'An',
+ 'To (email)' => 'An',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
+ 'Unit' => 'Einheit',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
+ 'Value' => 'Wert',
+ 'Variable' => 'Variable',
'Vendor' => 'Lieferant',
+ 'Vendor details' => 'Lieferantendetails',
'Yes' => 'Ja',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
'button' => '?',
'done' => 'erledigt',
+ 'invoice' => 'Rechnung',
+ 'no' => 'nein',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
+ 'wrongformat' => 'Falsches Format',
+ 'yes' => 'ja',
};
$self->{subs} = {
- 'acc_menu' => 'acc_menu',
+ 'E' => 'E',
+ 'H' => 'H',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
+ 'build_std_url' => 'build_std_url',
+ 'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'continue' => 'continue',
- 'display' => 'display',
+ 'delivery_customer_selection' => 'delivery_customer_selection',
+ 'employee_selection_internal' => 'employee_selection_internal',
+ 'format_dates' => 'format_dates',
'list_spool' => 'list_spool',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
+ 'part_selection_internal' => 'part_selection_internal',
'print' => 'print',
+ 'project_selection_internal' => 'project_selection_internal',
+ 'reformat_numbers' => 'reformat_numbers',
'remove' => 'remove',
'search' => 'search',
- 'section_menu' => 'section_menu',
'select_all' => 'select_all',
+ 'select_employee' => 'select_employee',
+ 'select_employee_internal' => 'select_employee_internal',
+ 'select_part' => 'select_part',
+ 'select_part_internal' => 'select_part_internal',
+ 'set_longdescription' => 'set_longdescription',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
+ 'vendor_selection' => 'vendor_selection',
'yes' => 'yes',
'weiter' => 'continue',
'drucken' => 'print',
$self->{texts} = {
+ 'ADDED' => 'Hinzugefügt',
'Account' => 'Konto',
'Apr' => 'Apr',
'April' => 'April',
'Aug' => 'Aug',
'August' => 'August',
'Balance' => 'Bilanz',
+ 'Bcc' => 'Bcc',
+ 'Bin List' => 'Lagerliste',
+ 'CANCELED' => 'Storniert',
+ 'CSV export -- options' => 'CSV-Export -- Optionen',
+ 'Cc' => 'Cc',
'Chart of Accounts' => 'Kontenübersicht',
+ 'Confirmation' => 'Auftragsbestätigung',
+ 'Could not spawn html2ps or GhostScript.' => 'html2ps oder GhostScript konnte nicht gestartet werden.',
+ 'Could not spawn the printer command.' => 'Die Druckanwendung konnte nicht gestartet werden.',
+ 'Could not write the html2ps config file.' => 'Die temporäre html2ps-Konfigurationsdatei konnte nicht geschrieben werden.',
+ 'Could not write the temporary HTML file.' => 'Eine temporäre HTML-Datei konnte nicht geschrieben werden.',
'Credit' => 'Haben',
+ 'Credit Note' => 'Gutschrift',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
'Date' => 'Datum',
'Debit' => 'Soll',
'Dec' => 'Dez',
'December' => 'Dezember',
'Department' => 'Abteilung',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Description' => 'Beschreibung',
+ 'Directory' => 'Verzeichnis',
+ 'ELSE' => 'Zusatz',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
'Feb' => 'Feb',
'February' => 'Februar',
+ 'File' => 'Datei',
'From' => 'Von',
- 'GIFI' => 'GIFI',
'Include in Report' => 'In Bericht aufnehmen',
+ 'Invoice' => 'Rechnung',
'Jan' => 'Jan',
'January' => 'Januar',
'Jul' => 'Jul',
'Jun' => 'Jun',
'June' => 'Juni',
'List Transactions' => 'Buchungsliste',
+ 'MAILED' => 'Gesendet',
'Mar' => 'März',
'March' => 'März',
'May' => 'Mai',
'May ' => 'Mai',
+ 'Message' => 'Nachricht',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
'Nov' => 'Nov',
'November' => 'November',
'Oct' => 'Okt',
'October' => 'Oktober',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
+ 'PDF export -- options' => 'PDF-Export -- Optionen',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
+ 'Pick List' => 'Sammelliste',
+ 'Proforma Invoice' => 'Proformarechnung',
'Project Number' => 'Projektnummer',
+ 'Purchase Order' => 'Lieferantenauftrag',
+ 'Quotation' => 'Angebot',
+ 'RFQ' => 'Anfrage',
'Reference' => 'Referenz',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
'Sep' => 'Sep',
'September' => 'September',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
+ 'Subject' => 'Betreff',
'Subtotal' => 'Zwischensumme',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'The list has been printed.' => 'Die Liste wurde ausgedruckt.',
'To' => 'An',
+ 'To (email)' => 'An',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
+ 'chart_of_accounts' => 'kontenuebersicht',
+ 'invoice' => 'Rechnung',
+ 'list_of_transactions' => 'buchungsliste',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'report_generator_dispatch_to is not defined.' => 'report_generator_dispatch_to ist nicht definiert.',
+ 'report_generator_nextsub is not defined.' => 'report_generator_nextsub ist nicht definiert.',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
};
$self->{subs} = {
- 'ca_subtotal' => 'ca_subtotal',
'chart_of_accounts' => 'chart_of_accounts',
+ 'create_subtotal_row' => 'create_subtotal_row',
'list' => 'list',
'list_transactions' => 'list_transactions',
+ 'report_generator_back' => 'report_generator_back',
+ 'report_generator_dispatcher' => 'report_generator_dispatcher',
+ 'report_generator_do' => 'report_generator_do',
+ 'report_generator_export_as_csv' => 'report_generator_export_as_csv',
+ 'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
+ 'weiter' => 'continue',
'buchungsliste' => 'list_transactions',
};
--- /dev/null
+ISO-8859-15
+++ /dev/null
-$self->{texts} = {
- ' Date missing!' => ' Datum fehlt!',
- '*/' => '*/',
- 'Account' => 'Konto',
- 'Accounting Menu' => 'Kontoverwaltung',
- 'Add Credit Note' => 'Gutschrift erfassen',
- 'Add Purchase Order' => 'Lieferantenauftrag erfassen',
- 'Add Quotation' => 'Angebot erfassen',
- 'Add Request for Quotation' => 'Anfrage erfassen',
- 'Add Sales Order' => 'Auftrag erfassen',
- 'Address' => 'Adresse',
- 'Amount' => 'Betrag',
- 'Apr' => 'Apr',
- 'April' => 'April',
- 'Are you sure you want to delete Invoice Number' => 'Soll die Rechnung mit folgender Nummer wirklich gelöscht werden:',
- 'Attachment' => 'als Anhang',
- 'Aug' => 'Aug',
- 'August' => 'August',
- 'Bcc' => 'Bcc',
- 'Billing Address' => 'Rechnungsadresse',
- 'Bin' => 'Lagerplatz',
- 'Bin List' => 'Lagerliste',
- 'Business' => 'Firma',
- 'Cannot delete invoice!' => 'Rechnung kann nicht gelöscht werden!',
- 'Cannot post invoice for a closed period!' => 'Das Rechnungsdatum fällt in einen abgeschlossen Zeitraum!',
- 'Cannot post invoice!' => 'Rechnung kann nicht gebucht werden!',
- 'Cannot post payment for a closed period!' => 'Es können keine Zahlungen für abgeschlossene Bücher gebucht werden!',
- 'Cc' => 'Cc',
- 'Choose Customer' => 'Endkunde wählen:',
- 'Choose Vendor' => 'Händler wählen',
- 'City' => 'Stadt',
- 'Company Name' => 'Firmenname',
- 'Confirm!' => 'Bestätigen Sie!',
- 'Confirmation' => 'Auftragsbestätigung',
- 'Contact' => 'Kontakt',
- 'Contact Person' => 'Ansprechpartner',
- 'Continue' => 'Weiter',
- 'Copies' => 'Kopien',
- 'Country' => 'Land',
- 'Credit Limit' => 'Kreditlimit',
- 'Credit Note' => 'Gutschrift',
- 'Credit Note Date' => 'Gutschriftdatum',
- 'Credit Note Number' => 'Gutschriftnummer',
- 'Currency' => 'Währung',
- 'Customer' => 'Kunde',
- 'Customer Number' => 'Kundennummer',
- 'Customer Order Number' => 'Bestellnummer des Kunden',
- 'Customer missing!' => 'Kundenname fehlt!',
- 'Customer not on file!' => 'Kunde ist nicht in der Datenbank!',
- 'Date' => 'Datum',
- 'Dec' => 'Dez',
- 'December' => 'Dezember',
- 'Delete' => 'Löschen',
- 'Delivery Date' => 'Lieferdatum',
- 'Department' => 'Abteilung',
- 'Description' => 'Beschreibung',
- 'Discount' => 'Rabatt',
- 'Due Date' => 'Fälligkeitsdatum',
- 'E-mail' => 'eMail',
- 'E-mail address missing!' => 'E-Mail-Adresse fehlt!',
- 'E-mailed' => 'eMail gesendet.',
- 'Edit Credit Note' => 'Gutschrift bearbeiten',
- 'Enter longdescription' => 'Langtext eingeben',
- 'Exch' => 'Wechselkurs.',
- 'Exchangerate' => 'Wechselkurs',
- 'Exchangerate for payment missing!' => 'Es fehlt der Wechselkurs für die Bezahlung!',
- 'Exchangerate missing!' => 'Es fehlt der Wechselkurs!',
- 'Extended' => 'Gesamt',
- 'Fax' => 'Fax',
- 'Feb' => 'Feb',
- 'February' => 'Februar',
- 'Group' => 'Warengruppe',
- 'Group Items' => 'Waren gruppieren',
- 'In-line' => 'im Text',
- 'Incoming Payments' => 'Zahlungseingänge',
- 'Internal Notes' => 'interne Bemerkungen',
- 'Invoice' => 'Rechnung',
- 'Invoice Date missing!' => 'Rechnungsdatum fehlt!',
- 'Invoice Number missing!' => 'Rechnungsnummer fehlt!',
- 'Invoice deleted!' => 'Rechnung gelöscht!',
- 'Item not on file!' => 'Dieser Artikel ist nicht in der Datenbank!',
- 'Jan' => 'Jan',
- 'January' => 'Januar',
- 'Jul' => 'Jul',
- 'July' => 'Juli',
- 'Jun' => 'Jun',
- 'June' => 'Juni',
- 'L' => 'L',
- 'License' => 'Lizenz',
- 'Mar' => 'März',
- 'March' => 'März',
- 'May' => 'Mai',
- 'May ' => 'Mai',
- 'Memo' => 'Memo',
- 'Message' => 'Nachricht',
- 'Name' => 'Name',
- 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
- 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
- 'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
- 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
- 'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
- 'No.' => 'Position',
- 'Notes' => 'Bemerkungen',
- 'Nov' => 'Nov',
- 'November' => 'November',
- 'Number' => 'Nummer',
- 'Number missing in Row' => 'Nummer fehlt in Zeile',
- 'Oct' => 'Okt',
- 'October' => 'Oktober',
- 'OpenDocument/OASIS' => 'OpenDocument/OASIS',
- 'Order' => 'Auftrag',
- 'Order Date missing!' => 'Auftragsdatum fehlt!',
- 'Order Number' => 'Auftragsnummer',
- 'Order Number missing!' => 'Auftragsnummer fehlt!',
- 'PDF' => 'PDF',
- 'PDF (OpenDocument/OASIS)' => 'PDF (OpenDocument/OASIS)',
- 'Packing List' => 'Lieferschein',
- 'Packing List Date missing!' => 'Datum für Verpackungsliste fehlt!',
- 'Packing List Number missing!' => 'Verpackungslistennummer fehlt!',
- 'Part' => 'Ware',
- 'Part Description' => 'Artikelbeschreibung',
- 'Part Number' => 'Artikelnummer',
- 'Part description' => 'Artikelbeschreibung',
- 'Payment Terms' => 'Zahlungskonditionen',
- 'Payment date missing!' => 'Tag der Zahlung fehlt!',
- 'Phone' => 'Telefon',
- 'Pick List' => 'Sammelliste',
- 'Please enter values' => 'Bitte Werte eingeben',
- 'Post' => 'Buchen',
- 'Post as new' => 'Neu buchen',
- 'Postscript' => 'Postscript',
- 'Preview' => 'Druckvorschau',
- 'Price' => 'Preis',
- 'Pricegroup' => 'Preisgruppe',
- 'Print' => 'Drucken',
- 'Print and Post' => 'Drucken und Buchen',
- 'Printed' => 'gedruckt.',
- 'Printer' => 'Drucker',
- 'Proforma Invoice' => 'Proformarechnung',
- 'Project' => 'Projekt',
- 'Project Number' => 'Projektnummer',
- 'Project description' => 'Projektbeschreibung',
- 'Project not on file!' => 'Dieses Projekt ist nicht in der Datenbank!',
- 'Purchase Order' => 'Lieferantenauftrag',
- 'Qty' => 'Menge',
- 'Queue' => 'Warteschlange',
- 'Queued' => 'In Warteschlange eingereiht.',
- 'Quotation' => 'Angebot',
- 'Quotation Date missing!' => 'Angebotsdatum fehlt!',
- 'Quotation Number' => 'Angebotsnummer',
- 'Quotation Number missing!' => 'Angebotsnummer fehlt!',
- 'Record in' => 'Buchen auf',
- 'Remaining' => 'Rest',
- 'Reqdate' => 'Lieferdatum',
- 'Required by' => 'Lieferdatum',
- 'Sales Order' => 'Kundenauftrag',
- 'Salesperson' => 'Verkäufer',
- 'Screen' => 'Bildschirm',
- 'Select a Customer' => 'Endkunde auswählen',
- 'Select a part' => 'Artikel auswählen',
- 'Select a project' => 'Projekt auswählen',
- 'Select an employee' => 'Angestellten auswählen',
- 'Select from one of the items below' => 'Wählen Sie einen der untenstehenden Einträge',
- 'Select from one of the names below' => 'Wählen Sie einen der untenstehenden Namen',
- 'Select from one of the projects below' => 'Wählen Sie eines der untenstehenden Projekte',
- 'Select postscript or PDF!' => 'Postscript oder PDF auswählen!',
- 'Sep' => 'Sep',
- 'September' => 'September',
- 'Serial No.' => 'Seriennummer',
- 'Service' => 'Dienstleistung',
- 'Ship' => 'Lagerausgang',
- 'Ship to' => 'Lieferadresse',
- 'Ship via' => 'Transportmittel',
- 'Shipping Address' => 'Lieferadresse',
- 'Shipping Point' => 'Versandort',
- 'Show details' => 'Details anzeigen',
- 'Source' => 'Beleg',
- 'Storno Invoice' => 'Stornorechnung',
- 'Storno Packing List' => 'Stornolieferschein',
- 'Street' => 'Straße',
- 'Subject' => 'Betreff',
- 'Subtotal' => 'Zwischensumme',
- 'Tax Included' => 'Steuer im Preis inbegriffen',
- 'To' => 'An',
- 'Total' => 'Summe',
- 'Trade Discount' => 'Rabatt',
- 'Unit' => 'Einheit',
- 'Update' => 'Erneuern',
- 'Value' => 'Wert',
- 'Variable' => 'Variable',
- 'Vendor Number' => 'Lieferantennummer',
- 'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!',
- 'What type of item is this?' => 'Was ist dieser Artikel?',
- 'Yes' => 'Ja',
- 'Zipcode' => 'PLZ',
- 'button' => '?',
- 'ea' => 'St.',
- 'emailed to' => 'gemailt an',
- 'none (pricegroup)' => 'keine',
- 'posted!' => 'gebucht',
- 'sent' => 'gesendet',
- 'sent to printer' => 'an Drucker geschickt',
-};
-
-$self->{subs} = {
- 'H' => 'H',
- 'acc_menu' => 'acc_menu',
- 'add' => 'add',
- 'add_transaction' => 'add_transaction',
- 'ap_transaction' => 'ap_transaction',
- 'ar_transaction' => 'ar_transaction',
- 'calculate_qty' => 'calculate_qty',
- 'check_form' => 'check_form',
- 'check_name' => 'check_name',
- 'check_project' => 'check_project',
- 'continue' => 'continue',
- 'credit_note_links' => 'credit_note_links',
- 'customer_details' => 'customer_details',
- 'delete' => 'delete',
- 'delivery_customer_selection' => 'delivery_customer_selection',
- 'display' => 'display',
- 'display_form' => 'display_form',
- 'display_row' => 'display_row',
- 'e_mail' => 'e_mail',
- 'edit' => 'edit',
- 'employee_selection_internal' => 'employee_selection_internal',
- 'form_footer' => 'form_footer',
- 'form_header' => 'form_header',
- 'format_dates' => 'format_dates',
- 'gl_transaction' => 'gl_transaction',
- 'invoicetotal' => 'invoicetotal',
- 'item_selected' => 'item_selected',
- 'name_selected' => 'name_selected',
- 'new_item' => 'new_item',
- 'new_license' => 'new_license',
- 'order' => 'order',
- 'part_selection_internal' => 'part_selection_internal',
- 'post' => 'post',
- 'post_as_new' => 'post_as_new',
- 'prepare_credit_note' => 'prepare_credit_note',
- 'preview' => 'preview',
- 'print' => 'print',
- 'print_and_post' => 'print_and_post',
- 'print_form' => 'print_form',
- 'print_options' => 'print_options',
- 'project_selected' => 'project_selected',
- 'project_selection_internal' => 'project_selection_internal',
- 'quotation' => 'quotation',
- 'reformat_numbers' => 'reformat_numbers',
- 'relink_accounts' => 'relink_accounts',
- 'request_for_quotation' => 'request_for_quotation',
- 'restore_form' => 'restore_form',
- 'sales_invoice' => 'sales_invoice',
- 'save_form' => 'save_form',
- 'section_menu' => 'section_menu',
- 'select_employee' => 'select_employee',
- 'select_employee_internal' => 'select_employee_internal',
- 'select_item' => 'select_item',
- 'select_name' => 'select_name',
- 'select_part' => 'select_part',
- 'select_part_internal' => 'select_part_internal',
- 'select_project' => 'select_project',
- 'send_email' => 'send_email',
- 'set_duedate' => 'set_duedate',
- 'set_longdescription' => 'set_longdescription',
- 'set_pricegroup' => 'set_pricegroup',
- 'ship_to' => 'ship_to',
- 'update' => 'update',
- 'validate_items' => 'validate_items',
- 'vendor_details' => 'vendor_details',
- 'vendor_invoice' => 'vendor_invoice',
- 'vendor_selection' => 'vendor_selection',
- 'yes' => 'yes',
- 'weiter' => 'continue',
- 'löschen' => 'delete',
- 'email' => 'e_mail',
- 'auftrag' => 'order',
- 'buchen' => 'post',
- 'neu_buchen' => 'post_as_new',
- 'druckvorschau' => 'preview',
- 'drucken' => 'print',
- 'drucken_und_buchen' => 'print_and_post',
- 'lieferadresse' => 'ship_to',
- 'erneuern' => 'update',
- 'ja' => 'yes',
-};
-
-1;
$self->{texts} = {
+ 'ADDED' => 'Hinzugefügt',
'Address' => 'Adresse',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
+ 'Bcc' => 'Bcc',
+ 'Bin List' => 'Lagerliste',
+ 'CANCELED' => 'Storniert',
+ 'Cc' => 'Cc',
+ 'Confirmation' => 'Auftragsbestätigung',
+ 'Credit Note' => 'Gutschrift',
'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
+ 'Date' => 'Datum',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
+ 'Directory' => 'Verzeichnis',
+ 'ELSE' => 'Zusatz',
'Enter longdescription' => 'Langtext eingeben',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
+ 'File' => 'Datei',
+ 'History' => 'Historie',
+ 'Invoice' => 'Rechnung',
+ 'MAILED' => 'Gesendet',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
+ 'Message' => 'Nachricht',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
'Name' => 'Name',
'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
'Part Number' => 'Artikelnummer',
'Part description' => 'Artikelbeschreibung',
+ 'Pick List' => 'Sammelliste',
'Please enter values' => 'Bitte Werte eingeben',
+ 'Proforma Invoice' => 'Proformarechnung',
'Project Number' => 'Projektnummer',
'Project description' => 'Projektbeschreibung',
+ 'Purchase Order' => 'Lieferantenauftrag',
+ 'Quotation' => 'Angebot',
+ 'RFQ' => 'Anfrage',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
'Select a Customer' => 'Endkunde auswählen',
'Select a part' => 'Artikel auswählen',
'Select a project' => 'Projekt auswählen',
'Select an employee' => 'Angestellten auswählen',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
+ 'Subject' => 'Betreff',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'To (email)' => 'An',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
'Unit' => 'Einheit',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
'Value' => 'Wert',
'Variable' => 'Variable',
+ 'Vendor details' => 'Lieferantendetails',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
+ 'invoice' => 'Rechnung',
+ 'no' => 'nein',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
+ 'yes' => 'ja',
};
$self->{subs} = {
+ 'E' => 'E',
'H' => 'H',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
+ 'build_std_url' => 'build_std_url',
'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'delivery_customer_selection' => 'delivery_customer_selection',
'employee_selection_internal' => 'employee_selection_internal',
'format_dates' => 'format_dates',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
'part_selection_internal' => 'part_selection_internal',
'project_selection_internal' => 'project_selection_internal',
'reformat_numbers' => 'reformat_numbers',
- 'restore_form' => 'restore_form',
- 'save_form' => 'save_form',
'select_employee' => 'select_employee',
'select_employee_internal' => 'select_employee_internal',
'select_part' => 'select_part',
'select_part_internal' => 'select_part_internal',
'set_longdescription' => 'set_longdescription',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
'vendor_selection' => 'vendor_selection',
+ 'weiter' => 'continue',
};
1;
$self->{texts} = {
+ 'ADDED' => 'Hinzugefügt',
'AP' => 'Einkauf',
'AR' => 'Verkauf',
'Account' => 'Konto',
- 'Accounting Menu' => 'Kontoverwaltung',
'Address' => 'Adresse',
'All' => 'Alle',
'Amount' => 'Betrag',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
+ 'Bcc' => 'Bcc',
+ 'Bin List' => 'Lagerliste',
+ 'CANCELED' => 'Storniert',
'Cannot post Payment!' => 'Zahlung kann nicht gebucht werden!',
'Cannot post Receipt!' => 'Beleg kann nicht gebucht werden!',
'Cannot post payment!' => 'Zahlung kann nicht gebucht werden!',
'Cannot process payment for a closed period!' => 'Es kann keine Zahlung in einem abgeschlossenen Zeitraum verbucht werden!',
+ 'Cc' => 'Cc',
+ 'Confirmation' => 'Auftragsbestätigung',
'Continue' => 'Weiter',
+ 'Credit Note' => 'Gutschrift',
'Currency' => 'Währung',
'Customer' => 'Kunde',
+ 'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
+ 'Customer not on file or locked!' => 'Dieser Kunde existiert nicht oder ist gesperrt.',
'Customer not on file!' => 'Kunde ist nicht in der Datenbank!',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
'Date' => 'Datum',
'Date missing!' => 'Datum fehlt!',
'Department' => 'Abteilung',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Deposit' => 'Gutschrift',
'Description' => 'Beschreibung',
+ 'Directory' => 'Verzeichnis',
'Due' => 'Fällig',
+ 'ELSE' => 'Zusatz',
+ 'Enter longdescription' => 'Langtext eingeben',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
'Exchangerate' => 'Wechselkurs',
'Exchangerate missing!' => 'Es fehlt der Wechselkurs!',
+ 'Falsches Datumsformat!' => 'Falsches Datumsformat!',
+ 'File' => 'Datei',
+ 'History' => 'Historie',
'Invoice' => 'Rechnung',
'Invoices' => 'Rechnungen',
+ 'MAILED' => 'Gesendet',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
'Memo' => 'Memo',
+ 'Message' => 'Nachricht',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
+ 'Name' => 'Name',
+ 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
+ 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
+ 'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
+ 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
+ 'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'Number' => 'Nummer',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
'PDF' => 'PDF',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
+ 'Part Number' => 'Artikelnummer',
+ 'Part description' => 'Artikelbeschreibung',
'Payment' => 'Zahlungsausgang',
'Payment posted!' => 'Zahlung gebucht!',
+ 'Pick List' => 'Sammelliste',
+ 'Please enter values' => 'Bitte Werte eingeben',
'Post' => 'Buchen',
'Postscript' => 'Postscript',
'Prepayment' => 'Vorauszahlung',
'Print' => 'Drucken',
'Printer' => 'Drucker',
+ 'Proforma Invoice' => 'Proformarechnung',
+ 'Project Number' => 'Projektnummer',
+ 'Project description' => 'Projektbeschreibung',
'Project not on file!' => 'Dieses Projekt ist nicht in der Datenbank!',
+ 'Purchase Order' => 'Lieferantenauftrag',
'Queue' => 'Warteschlange',
+ 'Quotation' => 'Angebot',
+ 'RFQ' => 'Anfrage',
'Receipt' => 'Zahlungseingang',
'Receipt posted!' => 'Beleg gebucht!',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
'Screen' => 'Bildschirm',
'Select' => 'auswählen',
+ 'Select a Customer' => 'Endkunde auswählen',
+ 'Select a part' => 'Artikel auswählen',
+ 'Select a project' => 'Projekt auswählen',
+ 'Select an employee' => 'Angestellten auswählen',
'Select from one of the names below' => 'Wählen Sie einen der untenstehenden Namen',
'Select from one of the projects below' => 'Wählen Sie eines der untenstehenden Projekte',
'Source' => 'Beleg',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
+ 'Subject' => 'Betreff',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'To (email)' => 'An',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
+ 'Unit' => 'Einheit',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
'Update' => 'Erneuern',
+ 'Value' => 'Wert',
+ 'Variable' => 'Variable',
'Vendor' => 'Lieferant',
+ 'Vendor details' => 'Lieferantendetails',
+ 'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!',
+ 'Zero amount posting!' => 'Buchung ohne Wert',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
'button' => '?',
+ 'invoice' => 'Rechnung',
+ 'no' => 'nein',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
+ 'wrongformat' => 'Falsches Format',
+ 'yes' => 'ja',
};
$self->{subs} = {
- 'acc_menu' => 'acc_menu',
+ 'E' => 'E',
+ 'H' => 'H',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
'add_transaction' => 'add_transaction',
'ap_transaction' => 'ap_transaction',
'ar_transaction' => 'ar_transaction',
+ 'build_std_url' => 'build_std_url',
+ 'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'check_form' => 'check_form',
'check_name' => 'check_name',
'check_project' => 'check_project',
'continue' => 'continue',
'customer_details' => 'customer_details',
- 'display' => 'display',
+ 'delivery_customer_selection' => 'delivery_customer_selection',
+ 'employee_selection_internal' => 'employee_selection_internal',
'form_footer' => 'form_footer',
'form_header' => 'form_header',
+ 'format_dates' => 'format_dates',
'gl_transaction' => 'gl_transaction',
'list_invoices' => 'list_invoices',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
'name_selected' => 'name_selected',
+ 'part_selection_internal' => 'part_selection_internal',
'payment' => 'payment',
'post' => 'post',
'print' => 'print',
'project_selected' => 'project_selected',
+ 'project_selection_internal' => 'project_selection_internal',
+ 'reformat_numbers' => 'reformat_numbers',
'sales_invoice' => 'sales_invoice',
- 'section_menu' => 'section_menu',
+ 'select_employee' => 'select_employee',
+ 'select_employee_internal' => 'select_employee_internal',
'select_name' => 'select_name',
+ 'select_part' => 'select_part',
+ 'select_part_internal' => 'select_part_internal',
'select_project' => 'select_project',
+ 'set_longdescription' => 'set_longdescription',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
'update' => 'update',
'vendor_details' => 'vendor_details',
'vendor_invoice' => 'vendor_invoice',
+ 'vendor_selection' => 'vendor_selection',
'weiter' => 'continue',
'buchen' => 'post',
'drucken' => 'print',
$self->{texts} = {
' Number' => ' Nummer',
+ 'ADDED' => 'Hinzugefügt',
'Abteilung' => 'Abteilung',
'Account Number' => 'Kontonummer',
- 'Accounting Menu' => 'Kontoverwaltung',
- 'Add' => 'Erfassen',
'Add Customer' => 'Kunde erfassen',
'Add Vendor' => 'Lieferant erfassen',
'Address' => 'Adresse',
'All' => 'Alle',
'Ansprechpartner' => 'Ansprechpartner',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
'Bank' => 'Bank',
'Bank Code Number' => 'Bankleitzahl',
'Bcc' => 'Bcc',
'Billing Address' => 'Rechnungsadresse',
+ 'Bin List' => 'Lagerliste',
'Birthday' => 'Geburtstag',
+ 'CANCELED' => 'Storniert',
+ 'CSV export -- options' => 'CSV-Export -- Optionen',
'Cannot delete customer!' => 'Kunde kann nicht gelöscht werden!',
'Cannot delete vendor!' => 'Lieferant kann nicht gelöscht werden!',
'Cc' => 'Cc',
'City' => 'Stadt',
'Company Name' => 'Firmenname',
+ 'Confirmation' => 'Auftragsbestätigung',
'Contact' => 'Kontakt',
- 'Continue' => 'Weiter',
+ 'Could not spawn html2ps or GhostScript.' => 'html2ps oder GhostScript konnte nicht gestartet werden.',
+ 'Could not spawn the printer command.' => 'Die Druckanwendung konnte nicht gestartet werden.',
+ 'Could not write the html2ps config file.' => 'Die temporäre html2ps-Konfigurationsdatei konnte nicht geschrieben werden.',
+ 'Could not write the temporary HTML file.' => 'Eine temporäre HTML-Datei konnte nicht geschrieben werden.',
'Country' => 'Land',
'Credit Limit' => 'Kreditlimit',
+ 'Credit Note' => 'Gutschrift',
'Customer Number' => 'Kundennummer',
'Customer deleted!' => 'Kunde gelöscht!',
- 'Customer not on file!' => 'Kunde ist nicht in der Datenbank!',
+ 'Customer details' => 'Kundendetails',
'Customer saved!' => 'Kunde gespeichert!',
'Customers' => 'Kunden',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
+ 'Date' => 'Datum',
'Delete' => 'Löschen',
'Department' => 'Abteilung',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Description' => 'Beschreibung',
+ 'Directory' => 'Verzeichnis',
'Discount' => 'Rabatt',
'E-mail' => 'eMail',
+ 'ELSE' => 'Zusatz',
'Edit Customer' => 'Kunde editieren',
'Edit Vendor' => 'Lieferant editieren',
+ 'Enter longdescription' => 'Langtext eingeben',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
'Fax' => 'Fax',
+ 'File' => 'Datei',
'From' => 'Von',
- 'GIFI' => 'GIFI',
'Given Name' => 'Vorname',
'Greeting' => 'Anrede',
+ 'History' => 'Historie',
'Homepage' => 'Homepage',
'ID' => 'Buchungsnummer',
- 'Include in Report' => 'In Bericht aufnehmen',
'Invdate' => 'Rechnungsdatum',
'Invoice' => 'Rechnung',
- 'Invoices' => 'Rechnungen',
'KNr. beim Kunden' => 'KNr. beim Kunden',
'Kundennummer' => 'Kundennummer',
'Language' => 'Sprache',
'Lieferungen' => 'Lieferungen',
+ 'MAILED' => 'Gesendet',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
+ 'Message' => 'Nachricht',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
'Mobile1' => 'Mobile 1',
'Mobile2' => 'Mobile 2',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
'Name' => 'Name',
'Name missing!' => 'Name fehlt!',
+ 'New contact' => 'Neuer Ansprechpartner',
+ 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
+ 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
+ 'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
+ 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
+ 'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'Notes' => 'Bemerkungen',
'Number' => 'Nummer',
'Obsolete' => 'Ungültig',
'Order' => 'Auftrag',
- 'Orders' => 'Aufträge',
'Orphaned' => 'Nie benutzt',
- 'Password' => 'Passwort',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
+ 'PDF export -- options' => 'PDF-Export -- Optionen',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
+ 'Part Number' => 'Artikelnummer',
+ 'Part description' => 'Artikelbeschreibung',
'Payment Terms' => 'Zahlungskonditionen',
'Phone' => 'Telefon',
'Phone1' => 'Telefon 1 ',
'Phone2' => 'Telefon 2',
+ 'Pick List' => 'Sammelliste',
+ 'Please enter values' => 'Bitte Werte eingeben',
'Preisklasse' => 'Preisgruppe',
'Private E-mail' => 'Private eMail',
'Private Phone' => 'Privates Tel.',
+ 'Proforma Invoice' => 'Proformarechnung',
'Project' => 'Projekt',
+ 'Project Number' => 'Projektnummer',
+ 'Project description' => 'Projektbeschreibung',
+ 'Purchase Order' => 'Lieferantenauftrag',
'Qty' => 'Menge',
'Quotation' => 'Angebot',
- 'Quotations' => 'Angebote',
+ 'RFQ' => 'Anfrage',
+ 'Request for Quotation' => 'Anfrage',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
'SIC' => 'SIC',
- 'Salesman' => 'Vertreter',
- 'Salesman missing!' => 'Vertreter fehlt!',
+ 'Sales Order' => 'Kundenauftrag',
+ 'Salesman' => 'Verkäufer/in',
'Sat. Fax' => 'Sat. Fax',
'Sat. Phone' => 'Sat. Tel.',
'Save' => 'Speichern',
'Save and Order' => 'Speichern und Auftrag erfassen',
'Save and Quotation' => 'Speichern und Angebot',
'Save and RFQ' => 'Speichern und Lieferantenanfrage',
- 'Select from one of the names below' => 'Wählen Sie einen der untenstehenden Namen',
+ 'Select a Customer' => 'Endkunde auswählen',
+ 'Select a part' => 'Artikel auswählen',
+ 'Select a project' => 'Projekt auswählen',
+ 'Select an employee' => 'Angestellten auswählen',
+ 'Sell Price' => 'Verkaufspreis',
'Shipping Address' => 'Lieferadresse',
'Steuersatz' => 'Steuersatz',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
'Street' => 'Straße',
- 'Tax Included' => 'Steuer im Preis inbegriffen',
+ 'Subject' => 'Betreff',
'Tax Number' => 'Steuernummer',
'Tax Number / SSN' => 'Steuernummer',
- 'Taxable' => 'Steuerpflichtig',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'The list has been printed.' => 'Die Liste wurde ausgedruckt.',
+ 'This customer number is already in use.' => 'Diese Kundennummer wird bereits verwendet.',
+ 'This vendor number is already in use.' => 'Diese Lieferantennummer wird bereits verwendet.',
'Title' => 'Titel',
+ 'To (email)' => 'An',
'To (time)' => 'Bis',
- 'Type of Business' => 'Kundentyp',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
+ 'Type of Business' => 'Kunden-/Lieferantentyp',
'USt-IdNr.' => 'USt-IdNr.',
'Unit' => 'Einheit',
- 'Update' => 'Erneuern',
- 'Username' => 'Benutzername',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
+ 'Value' => 'Wert',
+ 'Variable' => 'Variable',
'Vendor Number' => 'Lieferantennummer',
'Vendor deleted!' => 'Lieferant gelöscht!',
- 'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!',
+ 'Vendor details' => 'Lieferantendetails',
'Vendor saved!' => 'Lieferant gespeichert!',
'Vendors' => 'Lieferanten',
'Zipcode' => 'PLZ',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
+ 'customer_list' => 'kundenliste',
'customernumber not unique!' => 'Die Kundennummer ist schon vergeben',
- 's' => 's',
+ 'history' => 'Historie',
+ 'invoice' => 'Rechnung',
+ 'no' => 'nein',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'report_generator_dispatch_to is not defined.' => 'report_generator_dispatch_to ist nicht definiert.',
+ 'report_generator_nextsub is not defined.' => 'report_generator_nextsub ist nicht definiert.',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
+ 'vendor_list' => 'lieferantenliste',
+ 'yes' => 'ja',
};
$self->{subs} = {
- 'acc_menu' => 'acc_menu',
+ 'E' => 'E',
+ 'H' => 'H',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
'add' => 'add',
'add_transaction' => 'add_transaction',
- 'check_salesman' => 'check_salesman',
+ 'build_std_url' => 'build_std_url',
+ 'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'continue' => 'continue',
'delete' => 'delete',
+ 'delivery_customer_selection' => 'delivery_customer_selection',
'display' => 'display',
'edit' => 'edit',
+ 'employee_selection_internal' => 'employee_selection_internal',
'form_footer' => 'form_footer',
'form_header' => 'form_header',
+ 'format_dates' => 'format_dates',
'get_contact' => 'get_contact',
'get_delivery' => 'get_delivery',
'get_shipto' => 'get_shipto',
'list_names' => 'list_names',
- 'salesman_selected' => 'salesman_selected',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
+ 'part_selection_internal' => 'part_selection_internal',
+ 'project_selection_internal' => 'project_selection_internal',
+ 'reformat_numbers' => 'reformat_numbers',
+ 'report_generator_back' => 'report_generator_back',
+ 'report_generator_dispatcher' => 'report_generator_dispatcher',
+ 'report_generator_do' => 'report_generator_do',
+ 'report_generator_export_as_csv' => 'report_generator_export_as_csv',
+ 'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
'save' => 'save',
'save_and_ap_transaction' => 'save_and_ap_transaction',
'save_and_ar_transaction' => 'save_and_ar_transaction',
'save_and_quotation' => 'save_and_quotation',
'save_and_rfq' => 'save_and_rfq',
'search' => 'search',
- 'search_delivery' => 'search_delivery',
- 'section_menu' => 'section_menu',
- 'select_salesman' => 'select_salesman',
+ 'select_employee' => 'select_employee',
+ 'select_employee_internal' => 'select_employee_internal',
+ 'select_part' => 'select_part',
+ 'select_part_internal' => 'select_part_internal',
+ 'set_longdescription' => 'set_longdescription',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
'update' => 'update',
+ 'vendor_selection' => 'vendor_selection',
'erfassen' => 'add',
'weiter' => 'continue',
'löschen' => 'delete',
'speichern_und_auftrag_erfassen' => 'save_and_order',
'speichern_und_angebot' => 'save_and_quotation',
'speichern_und_lieferantenanfrage' => 'save_and_rfq',
- 'erneuern' => 'update',
};
1;
$self->{texts} = {
+ 'ADDED' => 'Hinzugefügt',
'Abrechnungsnummer' => 'Abrechnungsnummer',
+ 'Address' => 'Adresse',
'April' => 'April',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
'August' => 'August',
+ 'Bcc' => 'Bcc',
'Beratername' => 'Beratername',
'Beraternummer' => 'Beraternummer',
+ 'Bin List' => 'Lagerliste',
'Bis Konto: ' => 'bis Konto: ',
+ 'CANCELED' => 'Storniert',
+ 'Cc' => 'Cc',
+ 'Confirmation' => 'Auftragsbestätigung',
'Continue' => 'Weiter',
+ 'Credit Note' => 'Gutschrift',
+ 'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
'DATEV Angaben' => 'DATEV-Angaben',
'DATEX - Export Assistent' => 'DATEV-Exportassistent',
+ 'DELETED' => 'Gelöscht',
'DFV-Kennzeichen' => 'DFV-Kennzeichen',
- 'Datenträgernummer' => 'Datenträgernummer',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
+ 'Date' => 'Datum',
'Datum von' => 'Datum von',
'December' => 'Dezember',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
+ 'Directory' => 'Verzeichnis',
+ 'ELSE' => 'Zusatz',
+ 'Enter longdescription' => 'Langtext eingeben',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
'Export Buchungsdaten' => 'Export Buchungsdaten',
'Export Stammdaten' => 'Export Stammdaten',
'February' => 'Februar',
+ 'File' => 'Datei',
+ 'History' => 'Historie',
'I' => 'I',
'II' => 'II',
'III' => 'III',
'IV' => 'IV',
+ 'Invoice' => 'Rechnung',
'January' => 'Januar',
'July' => 'Juli',
'June' => 'Juni',
'KNE-Export erfolgreich!' => 'KNE-Export erfolgreich!',
'Konten' => 'Konten',
'Kontonummernerweiterung (KNE)' => 'Kontonummernerweiterung (KNE)',
+ 'MAILED' => 'Gesendet',
'Mandantennummer' => 'Mandantennummer',
'March' => 'März',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
'May' => 'Mai',
+ 'Medium Number' => 'Datenträgernummer',
+ 'Message' => 'Nachricht',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
'Monat' => 'Monat',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
+ 'Name' => 'Name',
+ 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
+ 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
+ 'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
+ 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
+ 'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'November' => 'November',
'OBE-Export erfolgreich!' => 'OBE-Export erfolgreich!',
'October' => 'Oktober',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
+ 'Part Number' => 'Artikelnummer',
+ 'Part description' => 'Artikelbeschreibung',
'Password' => 'Passwort',
+ 'Pick List' => 'Sammelliste',
+ 'Please enter values' => 'Bitte Werte eingeben',
+ 'Proforma Invoice' => 'Proformarechnung',
+ 'Project Number' => 'Projektnummer',
+ 'Project description' => 'Projektbeschreibung',
+ 'Purchase Order' => 'Lieferantenauftrag',
'Quartal' => 'Quartal',
+ 'Quotation' => 'Angebot',
+ 'RFQ' => 'Anfrage',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
+ 'Select a Customer' => 'Endkunde auswählen',
+ 'Select a part' => 'Artikel auswählen',
+ 'Select a project' => 'Projekt auswählen',
+ 'Select an employee' => 'Angestellten auswählen',
'September' => 'September',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
+ 'Subject' => 'Betreff',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'To (email)' => 'An',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
+ 'Unit' => 'Einheit',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
+ 'Value' => 'Wert',
+ 'Variable' => 'Variable',
+ 'Vendor details' => 'Lieferantendetails',
'Von Konto: ' => 'von Konto: ',
'Zeitraum' => 'Zeitraum',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
'bis' => 'bis',
+ 'invoice' => 'Rechnung',
+ 'no' => 'nein',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
+ 'yes' => 'ja',
};
$self->{subs} = {
+ 'E' => 'E',
+ 'H' => 'H',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
+ 'build_std_url' => 'build_std_url',
+ 'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'continue' => 'continue',
+ 'delivery_customer_selection' => 'delivery_customer_selection',
'download' => 'download',
+ 'employee_selection_internal' => 'employee_selection_internal',
'export' => 'export',
'export2' => 'export2',
'export3' => 'export3',
'export_bewegungsdaten' => 'export_bewegungsdaten',
'export_stammdaten' => 'export_stammdaten',
+ 'format_dates' => 'format_dates',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
+ 'part_selection_internal' => 'part_selection_internal',
+ 'project_selection_internal' => 'project_selection_internal',
+ 'reformat_numbers' => 'reformat_numbers',
+ 'select_employee' => 'select_employee',
+ 'select_employee_internal' => 'select_employee_internal',
+ 'select_part' => 'select_part',
+ 'select_part_internal' => 'select_part_internal',
+ 'set_longdescription' => 'set_longdescription',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
+ 'vendor_selection' => 'vendor_selection',
'weiter' => 'continue',
};
$self->{texts} = {
' Date missing!' => ' Datum fehlt!',
'*/' => '*/',
- 'Accounting Menu' => 'Kontoverwaltung',
- 'Active?' => 'Aktiviert?',
+ 'ADDED' => 'Hinzugefügt',
'Add Purchase Order' => 'Lieferantenauftrag erfassen',
'Add Quotation' => 'Angebot erfassen',
'Add Request for Quotation' => 'Anfrage erfassen',
'Apr' => 'Apr',
'April' => 'April',
'Attachment' => 'als Anhang',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
'Aug' => 'Aug',
'August' => 'August',
- 'Auto Send?' => 'Auto. Versand?',
+ 'Automatically created invoice for fee and interest for dunning %s' => 'Automatisch erzeugte Rechnung für Gebühren und Zinsen zu Mahnung %s',
'Bcc' => 'Bcc',
'Billing Address' => 'Rechnungsadresse',
'Bin' => 'Lagerplatz',
'Bin List' => 'Lagerliste',
+ 'CANCELED' => 'Storniert',
+ 'CSV export -- options' => 'CSV-Export -- Optionen',
'Cc' => 'Cc',
'City' => 'Stadt',
'Company Name' => 'Firmenname',
'Confirmation' => 'Auftragsbestätigung',
'Contact' => 'Kontakt',
'Continue' => 'Weiter',
- 'Copies' => 'Kopien',
+ 'Could not print dunning.' => 'Die Mahnungen konnten nicht gedruckt werden.',
+ 'Could not spawn ghostscript.' => 'Die Anwendung "ghostscript" konnte nicht gestartet werden.',
+ 'Could not spawn html2ps or GhostScript.' => 'html2ps oder GhostScript konnte nicht gestartet werden.',
+ 'Could not spawn the printer command.' => 'Die Druckanwendung konnte nicht gestartet werden.',
+ 'Could not write the html2ps config file.' => 'Die temporäre html2ps-Konfigurationsdatei konnte nicht geschrieben werden.',
+ 'Could not write the temporary HTML file.' => 'Eine temporäre HTML-Datei konnte nicht geschrieben werden.',
'Country' => 'Land',
'Credit Note' => 'Gutschrift',
- 'Current / Next Level' => 'Aktuelles / Nächstes Mahnlevel',
- 'Customer' => 'Kunde',
'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
+ 'Customer not on file or locked!' => 'Dieser Kunde existiert nicht oder ist gesperrt.',
'Customer not on file!' => 'Kunde ist nicht in der Datenbank!',
'Customername' => 'Kundenname',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
+ 'Date' => 'Datum',
'Dec' => 'Dez',
'December' => 'Dezember',
'Delivery Date' => 'Lieferdatum',
'Department' => 'Abteilung',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Description' => 'Beschreibung',
+ 'Directory' => 'Verzeichnis',
'Discount' => 'Rabatt',
- 'Duedate +Days' => 'Fällikeitsdatum +Tage',
'Dunning Date' => 'Mahndatum',
- 'Dunning Date from' => 'Mahnungen von',
- 'Dunning Description' => 'Mahnstufenbeschreibung',
'Dunning Description missing in row ' => 'Mahnstufenbeschreibung fehlt in Zeile ',
'Dunning Duedate' => 'Zahlbar bis',
'Dunning Level' => 'Mahnlevel',
'Dunning Level missing in row ' => 'Mahnlevel fehlt in ',
'Dunning Process Config saved!' => 'Mahnwesenkonfiguration gespeichert!',
- 'Dunning Process started for selected invoices!' => 'Mahnprozess für selektierte Rechnungen
-gestartet',
+ 'Dunning Process started for selected invoices!' => 'Mahnprozess für selektierte Rechnungen gestartet',
'Dunning overview' => 'Mahnungsübersicht',
'E-mail' => 'eMail',
'E-mail address missing!' => 'E-Mail-Adresse fehlt!',
- 'E-mailed' => 'eMail gesendet.',
+ 'EK' => 'EK',
+ 'ELSE' => 'Zusatz',
'Edit Dunning Process Config' => 'Mahnwesenkonfiguration bearbeiten',
'Enter longdescription' => 'Langtext eingeben',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
+ 'Ertrag' => 'Ertrag',
'Extended' => 'Gesamt',
+ 'Falsches Datumsformat!' => 'Falsches Datumsformat!',
'Fax' => 'Fax',
'Feb' => 'Feb',
'February' => 'Februar',
- 'Fee' => 'Gebühr',
- 'Fristsetzung' => 'Fristsetzung',
+ 'File' => 'Datei',
'Group' => 'Warengruppe',
- 'Group Invoices' => 'Rechnungen zusammenfassen',
- 'Group Items' => 'Waren gruppieren',
+ 'History' => 'Historie',
'In-line' => 'im Text',
- 'Interest Rate' => 'Zinssatz',
- 'Inv. Duedate' => 'Rg. Fälligkeit',
+ 'Interest' => 'Zinsen',
'Invdate' => 'Rechnungsdatum',
- 'Invdate from' => 'Rechnungen von',
- 'Invno.' => 'Rg. Nr.',
'Invnumber' => 'Rechnungsnummer',
'Invoice' => 'Rechnung',
'Invoice Date missing!' => 'Rechnungsdatum fehlt!',
'Invoice Duedate' => 'Fälligkeitsdatum',
- 'Invoice Number' => 'Rechnungsnummer',
'Invoice Number missing!' => 'Rechnungsnummer fehlt!',
'Item not on file!' => 'Dieser Artikel ist nicht in der Datenbank!',
'Jan' => 'Jan',
'Jun' => 'Jun',
'June' => 'Juni',
'L' => 'L',
+ 'LP' => 'LP',
'License' => 'Lizenz',
+ 'MAILED' => 'Gesendet',
'Mar' => 'März',
'March' => 'März',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
'May' => 'Mai',
'May ' => 'Mai',
'Message' => 'Nachricht',
- 'Minimum Amount' => 'Mindestbetrag',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
'Name' => 'Name',
- 'Next Dunning Level' => 'Nächste Mahnstufe',
'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
+ 'No dunnings have been selected for printing.' => 'Es wurden keine Mahnungen zum Drucken ausgewählt.',
'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'No.' => 'Position',
- 'Notes' => 'Bemerkungen',
'Nov' => 'Nov',
'November' => 'November',
'Number' => 'Nummer',
'October' => 'Oktober',
'OpenDocument/OASIS' => 'OpenDocument/OASIS',
'Order Date missing!' => 'Auftragsdatum fehlt!',
- 'Order Number' => 'Auftragsnummer',
'Order Number missing!' => 'Auftragsnummer fehlt!',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
'PDF' => 'PDF',
'PDF (OpenDocument/OASIS)' => 'PDF (OpenDocument/OASIS)',
+ 'PDF export -- options' => 'PDF-Export -- Optionen',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
'Packing List' => 'Lieferschein',
'Packing List Date missing!' => 'Datum für Verpackungsliste fehlt!',
'Packing List Number missing!' => 'Verpackungslistennummer fehlt!',
'Part Number' => 'Artikelnummer',
'Part description' => 'Artikelbeschreibung',
'Payment Terms missing in row ' => 'Zahlungsfrist fehlt in Zeile ',
- 'Payment until' => 'Zahlungseingänge bis',
'Phone' => 'Telefon',
'Pick List' => 'Sammelliste',
'Please enter values' => 'Bitte Werte eingeben',
'Postscript' => 'Postscript',
'Price' => 'Preis',
'Pricegroup' => 'Preisgruppe',
- 'Printed' => 'gedruckt.',
+ 'Print dunnings' => 'Mahnungen drucken',
'Printer' => 'Drucker',
'Proforma Invoice' => 'Proformarechnung',
'Project' => 'Projekt',
'Purchase Order' => 'Lieferantenauftrag',
'Qty' => 'Menge',
'Queue' => 'Warteschlange',
- 'Queued' => 'In Warteschlange eingereiht.',
'Quotation' => 'Angebot',
'Quotation Date missing!' => 'Angebotsdatum fehlt!',
'Quotation Number missing!' => 'Angebotsnummer fehlt!',
+ 'RFQ' => 'Anfrage',
'Reqdate' => 'Lieferdatum',
'Required by' => 'Lieferdatum',
- 'Sales Order' => 'Kundenauftrag',
- 'Save' => 'Speichern',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
'Screen' => 'Bildschirm',
'Search Dunning' => 'Mahnung suchen',
'Select a Customer' => 'Endkunde auswählen',
'Service' => 'Dienstleistung',
'Set eMail text' => 'eMail Text eingeben',
'Ship' => 'Lagerausgang',
+ 'Ship rcvd' => 'Lagereingang',
'Ship to' => 'Lieferadresse',
'Shipping Address' => 'Lieferadresse',
'Show details' => 'Details anzeigen',
- 'Show old dunnings' => 'Alte Mahnungen anzeigen',
'Start Dunning Process' => 'Mahnprozess starten',
'Storno Invoice' => 'Stornorechnung',
'Storno Packing List' => 'Stornolieferschein',
'Street' => 'Straße',
'Subject' => 'Betreff',
'Subtotal' => 'Zwischensumme',
- 'Template' => 'Druckvorlage',
'Terms missing in row ' => '+Tage fehlen in Zeile ',
- 'The dunning process started' => 'Der Mahnprozess ist gestartet.',
- 'To' => 'An',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'The dunnings have been printed.' => 'Die Mahnung(en) wurden gedruckt.',
+ 'The list has been printed.' => 'Die Liste wurde ausgedruckt.',
+ 'To (email)' => 'An',
'Total Fees' => 'Kumulierte Gebühren',
- 'Total Interest' => 'Kumulierte Zinsen',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
'Unit' => 'Einheit',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
'Value' => 'Wert',
'Variable' => 'Variable',
'Vendor Number' => 'Lieferantennummer',
+ 'Vendor details' => 'Lieferantendetails',
+ 'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!',
'What type of item is this?' => 'Was ist dieser Artikel?',
'Zipcode' => 'PLZ',
- 'button' => '?',
- 'eMail Send?' => 'eMail-Versand?',
- 'eMail?' => 'eMail?',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
+ 'dunning_list' => 'mahnungsliste',
'emailed to' => 'gemailt an',
+ 'invoice' => 'Rechnung',
+ 'no' => 'nein',
'none (pricegroup)' => 'keine',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'report_generator_dispatch_to is not defined.' => 'report_generator_dispatch_to ist nicht definiert.',
+ 'report_generator_nextsub is not defined.' => 'report_generator_nextsub ist nicht definiert.',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
'sent' => 'gesendet',
'sent to printer' => 'an Drucker geschickt',
+ 'wrongformat' => 'Falsches Format',
+ 'yes' => 'ja',
};
$self->{subs} = {
+ 'E' => 'E',
'H' => 'H',
- 'acc_menu' => 'acc_menu',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
'add' => 'add',
'add_transaction' => 'add_transaction',
'ap_transaction' => 'ap_transaction',
'ar_transaction' => 'ar_transaction',
+ 'build_std_url' => 'build_std_url',
'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'check_form' => 'check_form',
'check_name' => 'check_name',
'check_project' => 'check_project',
'continue' => 'continue',
'customer_details' => 'customer_details',
'delivery_customer_selection' => 'delivery_customer_selection',
- 'display' => 'display',
'display_form' => 'display_form',
'display_row' => 'display_row',
- 'e_mail' => 'e_mail',
'edit_config' => 'edit_config',
+ 'edit_e_mail' => 'edit_e_mail',
'employee_selection_internal' => 'employee_selection_internal',
'format_dates' => 'format_dates',
'gl_transaction' => 'gl_transaction',
'invoicetotal' => 'invoicetotal',
'item_selected' => 'item_selected',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
'name_selected' => 'name_selected',
'new_item' => 'new_item',
'new_license' => 'new_license',
'part_selection_internal' => 'part_selection_internal',
'post_as_new' => 'post_as_new',
'print' => 'print',
+ 'print_dunning' => 'print_dunning',
'print_form' => 'print_form',
+ 'print_multiple' => 'print_multiple',
'print_options' => 'print_options',
'project_selected' => 'project_selected',
'project_selection_internal' => 'project_selection_internal',
'quotation' => 'quotation',
'reformat_numbers' => 'reformat_numbers',
'relink_accounts' => 'relink_accounts',
+ 'report_generator_back' => 'report_generator_back',
+ 'report_generator_dispatcher' => 'report_generator_dispatcher',
+ 'report_generator_do' => 'report_generator_do',
+ 'report_generator_export_as_csv' => 'report_generator_export_as_csv',
+ 'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
'request_for_quotation' => 'request_for_quotation',
- 'restore_form' => 'restore_form',
'sales_invoice' => 'sales_invoice',
'save' => 'save',
'save_dunning' => 'save_dunning',
- 'save_form' => 'save_form',
'search' => 'search',
- 'section_menu' => 'section_menu',
'select_employee' => 'select_employee',
'select_employee_internal' => 'select_employee_internal',
'select_item' => 'select_item',
'set_pricegroup' => 'set_pricegroup',
'ship_to' => 'ship_to',
'show_dunning' => 'show_dunning',
+ 'show_history' => 'show_history',
'show_invoices' => 'show_invoices',
+ 'show_vc_details' => 'show_vc_details',
'validate_items' => 'validate_items',
'vendor_details' => 'vendor_details',
'vendor_invoice' => 'vendor_invoice',
'vendor_selection' => 'vendor_selection',
'weiter' => 'continue',
+ 'drucken' => 'print',
'speichern' => 'save',
};
--- /dev/null
+$self->{texts} = {
+ 'ADDED' => 'Hinzugefügt',
+ 'Address' => 'Adresse',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
+ 'Bcc' => 'Bcc',
+ 'Bin List' => 'Lagerliste',
+ 'CANCELED' => 'Storniert',
+ 'Cc' => 'Cc',
+ 'Confirmation' => 'Auftragsbestätigung',
+ 'Credit Note' => 'Gutschrift',
+ 'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
+ 'Date' => 'Datum',
+ 'Delete drafts' => 'Entwürfe löschen',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
+ 'Directory' => 'Verzeichnis',
+ 'Draft saved.' => 'Entwurf gespeichert.',
+ 'ELSE' => 'Zusatz',
+ 'Enter longdescription' => 'Langtext eingeben',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
+ 'File' => 'Datei',
+ 'History' => 'Historie',
+ 'Invoice' => 'Rechnung',
+ 'MAILED' => 'Gesendet',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
+ 'Message' => 'Nachricht',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
+ 'Name' => 'Name',
+ 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
+ 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
+ 'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
+ 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
+ 'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
+ 'Part Number' => 'Artikelnummer',
+ 'Part description' => 'Artikelbeschreibung',
+ 'Pick List' => 'Sammelliste',
+ 'Please enter values' => 'Bitte Werte eingeben',
+ 'Proforma Invoice' => 'Proformarechnung',
+ 'Project Number' => 'Projektnummer',
+ 'Project description' => 'Projektbeschreibung',
+ 'Purchase Order' => 'Lieferantenauftrag',
+ 'Quotation' => 'Angebot',
+ 'RFQ' => 'Anfrage',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
+ 'Select a Customer' => 'Endkunde auswählen',
+ 'Select a part' => 'Artikel auswählen',
+ 'Select a project' => 'Projekt auswählen',
+ 'Select an employee' => 'Angestellten auswählen',
+ 'Skip' => 'Überspringen',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
+ 'Subject' => 'Betreff',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'To (email)' => 'An',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
+ 'Unit' => 'Einheit',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
+ 'Value' => 'Wert',
+ 'Variable' => 'Variable',
+ 'Vendor details' => 'Lieferantendetails',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
+ 'invoice' => 'Rechnung',
+ 'no' => 'nein',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
+ 'yes' => 'ja',
+};
+
+$self->{subs} = {
+ 'E' => 'E',
+ 'H' => 'H',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
+ 'build_std_url' => 'build_std_url',
+ 'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
+ 'delete_drafts' => 'delete_drafts',
+ 'delivery_customer_selection' => 'delivery_customer_selection',
+ 'dont_load_draft' => 'dont_load_draft',
+ 'draft_action_dispatcher' => 'draft_action_dispatcher',
+ 'employee_selection_internal' => 'employee_selection_internal',
+ 'format_dates' => 'format_dates',
+ 'load_draft' => 'load_draft',
+ 'load_draft_maybe' => 'load_draft_maybe',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
+ 'part_selection_internal' => 'part_selection_internal',
+ 'project_selection_internal' => 'project_selection_internal',
+ 'reformat_numbers' => 'reformat_numbers',
+ 'remove_draft' => 'remove_draft',
+ 'save_draft' => 'save_draft',
+ 'select_employee' => 'select_employee',
+ 'select_employee_internal' => 'select_employee_internal',
+ 'select_part' => 'select_part',
+ 'select_part_internal' => 'select_part_internal',
+ 'set_longdescription' => 'set_longdescription',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
+ 'vendor_selection' => 'vendor_selection',
+ 'weiter' => 'continue',
+ 'entwürfe_löschen' => 'delete_drafts',
+ 'entwurf_speichern' => 'save_draft',
+ 'Überspringen' => 'skip',
+};
+
+1;
$self->{texts} = {
- 'AP Transaction' => 'Kreditorenbuchung',
- 'AR Transaction' => 'Debitorenbuchung',
+ 'ADDED' => 'Hinzugefügt',
'Account' => 'Konto',
- 'Accounting Menu' => 'Kontoverwaltung',
'Add General Ledger Transaction' => 'Dialogbuchen',
'Address' => 'Adresse',
'All' => 'Alle',
'April' => 'April',
'Are you sure you want to delete Transaction' => 'Buchung wirklich löschen?',
'Asset' => 'Aktiva/Mittelverwendung',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
'Aug' => 'Aug',
'August' => 'August',
'Balance' => 'Bilanz',
+ 'Bcc' => 'Bcc',
'Belegnummer' => 'Buchungsnummer',
+ 'Bin List' => 'Lagerliste',
'Bis' => 'bis',
'Buchungsdatum' => 'Buchungsdatum',
- 'Buchungsjournal' => 'Buchungsjournal',
+ 'Buchungsnummer' => 'Buchungsnummer',
+ 'CANCELED' => 'Storniert',
+ 'CSV export -- options' => 'CSV-Export -- Optionen',
+ 'Cancel Accounts Receivables Transaction' => 'Debitorenbuchung stornieren',
'Cannot delete transaction!' => 'Buchung kann nicht gelöscht werden!',
'Cannot have a value in both Debit and Credit!' => 'Es kann nicht gleichzeitig Soll und Haben gebucht werden!',
'Cannot post a transaction without a value!' => 'Eine Buchung ohne Betrag kann nicht vorgenommen werden!',
'Cannot post transaction for a closed period!' => 'Für einen bereits abgeschlossenen Zeitraum kann keine Buchung angelegt werden!',
'Cannot post transaction with a debit and credit entry for the same account!' => 'Kann Soll und Haben nicht auf dasselbe Konto buchen!',
+ 'Cc' => 'Cc',
'Confirm!' => 'Bestätigen Sie!',
+ 'Confirmation' => 'Auftragsbestätigung',
'Continue' => 'Weiter',
'Contra' => 'gegen',
+ 'Could not spawn html2ps or GhostScript.' => 'html2ps oder GhostScript konnte nicht gestartet werden.',
+ 'Could not spawn the printer command.' => 'Die Druckanwendung konnte nicht gestartet werden.',
+ 'Could not write the html2ps config file.' => 'Die temporäre html2ps-Konfigurationsdatei konnte nicht geschrieben werden.',
+ 'Could not write the temporary HTML file.' => 'Eine temporäre HTML-Datei konnte nicht geschrieben werden.',
'Credit' => 'Haben',
'Credit Account' => 'Habenkonto',
+ 'Credit Note' => 'Gutschrift',
'Credit Tax' => 'Umsatzsteuer',
'Credit Tax Account' => 'Umsatzsteuerkonto',
+ 'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
+ 'Customer not on file or locked!' => 'Dieser Kunde existiert nicht oder ist gesperrt.',
'Customer not on file!' => 'Kunde ist nicht in der Datenbank!',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
'Date' => 'Datum',
'Debit' => 'Soll',
'Debit Account' => 'Sollkonto',
'December' => 'Dezember',
'Delete' => 'Löschen',
'Department' => 'Abteilung',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Description' => 'Beschreibung',
'Description missing!' => 'Beschreibung fehlt.',
+ 'Directory' => 'Verzeichnis',
+ 'ELSE' => 'Zusatz',
'Edit General Ledger Transaction' => 'Buchung im Hauptbuch bearbeiten',
+ 'Empty transaction!' => 'Buchung ist leer!',
+ 'Enter longdescription' => 'Langtext eingeben',
'Equity' => 'Passiva',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
'Expense' => 'Aufwandskonto',
+ 'Falsches Datumsformat!' => 'Falsches Datumsformat!',
'Feb' => 'Feb',
'February' => 'Februar',
+ 'File' => 'Datei',
'From' => 'Von',
- 'GIFI' => 'GIFI',
- 'GL Transaction' => 'Dialogbuchung',
- 'General Ledger' => 'Finanzbuchhaltung',
+ 'History' => 'Historie',
'ID' => 'Buchungsnummer',
'Include in Report' => 'In Bericht aufnehmen',
+ 'Invoice' => 'Rechnung',
'Jan' => 'Jan',
'January' => 'Januar',
+ 'Journal' => 'Buchungsjournal',
'Jul' => 'Jul',
'July' => 'Juli',
'Jun' => 'Jun',
'June' => 'Juni',
'Korrektur' => 'Korrektur',
'Liability' => 'Passiva/Mittelherkunft',
+ 'MAILED' => 'Gesendet',
'Mar' => 'März',
'March' => 'März',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
'May' => 'Mai',
'May ' => 'Mai',
'Memo' => 'Memo',
+ 'Message' => 'Nachricht',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
'Mitarbeiter' => 'Mitarbeiter',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
'MwSt. inkl.' => 'MwSt. inkl.',
+ 'Name' => 'Name',
+ 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
+ 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
+ 'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
+ 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
+ 'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'Notes' => 'Bemerkungen',
'Nov' => 'Nov',
'November' => 'November',
'Oct' => 'Okt',
'October' => 'Oktober',
'Out of balance transaction!' => 'Buchung ist nicht ausgeglichen!',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
+ 'PDF export -- options' => 'PDF-Export -- Optionen',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
+ 'Part Number' => 'Artikelnummer',
+ 'Part description' => 'Artikelbeschreibung',
+ 'Pick List' => 'Sammelliste',
+ 'Please enter values' => 'Bitte Werte eingeben',
'Post' => 'Buchen',
- 'Post as new' => 'Neu buchen',
+ 'Previous transdate text' => 'wurde gespeichert am',
+ 'Previous transnumber text' => 'Letzte Buchung mit der Buchungsnummer',
+ 'Proforma Invoice' => 'Proformarechnung',
+ 'Project Number' => 'Projektnummer',
+ 'Project Numbers' => 'Projektnummern',
+ 'Project description' => 'Projektbeschreibung',
'Project not on file!' => 'Dieses Projekt ist nicht in der Datenbank!',
+ 'Purchase Order' => 'Lieferantenauftrag',
+ 'Quotation' => 'Angebot',
+ 'RFQ' => 'Anfrage',
'Reference' => 'Referenz',
'Reference missing!' => 'Referenz fehlt!',
'Revenue' => 'Erlöskonto',
- 'Sales Invoice' => 'Rechnung',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
+ 'Select a Customer' => 'Endkunde auswählen',
+ 'Select a part' => 'Artikel auswählen',
+ 'Select a project' => 'Projekt auswählen',
+ 'Select an employee' => 'Angestellten auswählen',
'Select from one of the names below' => 'Wählen Sie einen der untenstehenden Namen',
'Select from one of the projects below' => 'Wählen Sie eines der untenstehenden Projekte',
'Sep' => 'Sep',
'September' => 'September',
+ 'Show details' => 'Details anzeigen',
'Source' => 'Beleg',
'Storno' => 'Storno',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
+ 'Subject' => 'Betreff',
'Subtotal' => 'Zwischensumme',
'Tax' => 'Steuer',
'Taxkey' => 'Steuerschlüssel',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'The list has been printed.' => 'Die Liste wurde ausgedruckt.',
+ 'To (email)' => 'An',
'To (time)' => 'Bis',
+ 'Transaction %d cancelled.' => 'Buchung %d erfolgreich storniert.',
'Transaction Date missing!' => 'Buchungsdatum fehlt!',
'Transaction deleted!' => 'Buchung gelöscht!',
+ 'Transaction has already been cancelled!' => 'Diese Buchung wurde bereits storniert.',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
+ 'Unbalanced Ledger' => 'Bilanzfehler',
+ 'Unit' => 'Einheit',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
'Update' => 'Erneuern',
- 'Vendor Invoice' => 'Einkaufsrechnung',
+ 'Value' => 'Wert',
+ 'Variable' => 'Variable',
+ 'Vendor details' => 'Lieferantendetails',
+ 'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!',
'Yes' => 'Ja',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
'button' => '?',
+ 'general_ledger_list' => 'buchungsjournal',
+ 'invoice' => 'Rechnung',
+ 'no' => 'nein',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'report_generator_dispatch_to is not defined.' => 'report_generator_dispatch_to ist nicht definiert.',
+ 'report_generator_nextsub is not defined.' => 'report_generator_nextsub ist nicht definiert.',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
+ 'wrongformat' => 'Falsches Format',
+ 'yes' => 'ja',
};
$self->{subs} = {
- 'acc_menu' => 'acc_menu',
+ 'E' => 'E',
+ 'H' => 'H',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
'add' => 'add',
'add_transaction' => 'add_transaction',
'ap_transaction' => 'ap_transaction',
'ar_transaction' => 'ar_transaction',
+ 'build_std_url' => 'build_std_url',
+ 'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'check_name' => 'check_name',
'check_project' => 'check_project',
'continue' => 'continue',
+ 'create_subtotal_row' => 'create_subtotal_row',
'delete' => 'delete',
- 'display' => 'display',
+ 'delivery_customer_selection' => 'delivery_customer_selection',
'display_form' => 'display_form',
'display_rows' => 'display_rows',
'edit' => 'edit',
+ 'employee_selection_internal' => 'employee_selection_internal',
'form_footer' => 'form_footer',
'form_header' => 'form_header',
+ 'format_dates' => 'format_dates',
'generate_report' => 'generate_report',
- 'gl_subtotal' => 'gl_subtotal',
'gl_transaction' => 'gl_transaction',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
'name_selected' => 'name_selected',
+ 'part_selection_internal' => 'part_selection_internal',
'post' => 'post',
'post_as_new' => 'post_as_new',
+ 'post_transaction' => 'post_transaction',
+ 'prepare_transaction' => 'prepare_transaction',
'project_selected' => 'project_selected',
+ 'project_selection_internal' => 'project_selection_internal',
+ 'reformat_numbers' => 'reformat_numbers',
+ 'report_generator_back' => 'report_generator_back',
+ 'report_generator_dispatcher' => 'report_generator_dispatcher',
+ 'report_generator_do' => 'report_generator_do',
+ 'report_generator_export_as_csv' => 'report_generator_export_as_csv',
+ 'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
'sales_invoice' => 'sales_invoice',
'search' => 'search',
- 'section_menu' => 'section_menu',
+ 'select_employee' => 'select_employee',
+ 'select_employee_internal' => 'select_employee_internal',
'select_name' => 'select_name',
+ 'select_part' => 'select_part',
+ 'select_part_internal' => 'select_part_internal',
'select_project' => 'select_project',
+ 'set_longdescription' => 'set_longdescription',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
'storno' => 'storno',
'update' => 'update',
'vendor_invoice' => 'vendor_invoice',
+ 'vendor_selection' => 'vendor_selection',
'yes' => 'yes',
'kreditorenbuchung' => 'ap_transaction',
'debitorenbuchung' => 'ar_transaction',
'löschen' => 'delete',
'dialogbuchung' => 'gl_transaction',
'buchen' => 'post',
- 'neu_buchen' => 'post_as_new',
'rechnung' => 'sales_invoice',
'storno' => 'storno',
'erneuern' => 'update',
--- /dev/null
+$self->{texts} = {
+ 'Database update error:' => 'Fehler beim Datenbankupgrade:',
+};
+
+$self->{subs} = {
+ 'do_query' => 'do_query',
+ 'do_update' => 'do_update',
+ 'mydberror' => 'mydberror',
+};
+
+1;
' Date missing!' => ' Datum fehlt!',
' Part Number missing!' => ' Artikelnummer fehlt!',
'*/' => '*/',
+ 'ADDED' => 'Hinzugefügt',
'Accounting Menu' => 'Kontoverwaltung',
'Active' => 'Aktiv',
- 'Add' => 'Erfassen',
'Add ' => 'Hinzufügen',
'Add Assembly' => 'Erzeugnis erfassen',
'Add Part' => 'Ware erfassen',
'Are you sure you want to update the prices' => 'Sind Sie sicher, dass Sie die Preise
aktualisieren wollen?',
'Assemblies' => 'Erzeugnisse',
- 'Assemblies restocked!' => 'Erzeugnisse sind im Lager!',
'Assembly Number missing!' => 'Erzeugnisnummer fehlt!',
'Attachment' => 'als Anhang',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
'Aug' => 'Aug',
'August' => 'August',
'BOM' => 'Stückliste',
'Bin List' => 'Lagerliste',
'Bought' => 'Gekauft',
'Buchungsgruppe' => 'Buchungsgruppe',
+ 'Business Volume' => 'Geschäftsvolumen',
+ 'CANCELED' => 'Storniert',
+ 'CSV export -- options' => 'CSV-Export -- Optionen',
'Cannot delete item!' => 'Artikel kann nicht gelöscht werden!',
- 'Cannot stock assemblies!' => 'Erzeugnisse können nicht ins Lager!',
'Cc' => 'Cc',
'City' => 'Stadt',
'Company Name' => 'Firmenname',
'Confirmation' => 'Auftragsbestätigung',
'Contact' => 'Kontakt',
'Continue' => 'Weiter',
- 'Copies' => 'Kopien',
+ 'Could not spawn html2ps or GhostScript.' => 'html2ps oder GhostScript konnte nicht gestartet werden.',
+ 'Could not spawn the printer command.' => 'Die Druckanwendung konnte nicht gestartet werden.',
'Could not update prices!' => 'Preise konnten nicht aktualisiert werden!',
+ 'Could not write the html2ps config file.' => 'Die temporäre html2ps-Konfigurationsdatei konnte nicht geschrieben werden.',
+ 'Could not write the temporary HTML file.' => 'Eine temporäre HTML-Datei konnte nicht geschrieben werden.',
'Country' => 'Land',
'Credit Note' => 'Gutschrift',
'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
+ 'Date' => 'Datum',
'Dec' => 'Dez',
'December' => 'Dezember',
'Delete' => 'Löschen',
'Delivery Date' => 'Lieferdatum',
'Department' => 'Abteilung',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Description must not be empty!' => 'Beschreibung darf nicht leer sein',
+ 'Directory' => 'Verzeichnis',
'Discount' => 'Rabatt',
'Drawing' => 'Zeichnung',
'E-mail' => 'eMail',
'E-mail address missing!' => 'E-Mail-Adresse fehlt!',
- 'E-mailed' => 'eMail gesendet.',
+ 'EAN' => 'EAN',
+ 'EAN-Code' => 'EAN-Code',
+ 'EK' => 'EK',
+ 'ELSE' => 'Zusatz',
'Edit ' => 'Bearbeiten',
'Edit Assembly' => 'Erzeugnis bearbeiten',
'Edit Part' => 'Ware bearbeiten',
'Edit Service' => 'Dienstleistung bearbeiten',
'Enter longdescription' => 'Langtext eingeben',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
+ 'Ertrag' => 'Ertrag',
'Expense' => 'Aufwandskonto',
'Extended' => 'Gesamt',
'Fax' => 'Fax',
'Feb' => 'Feb',
'February' => 'Februar',
+ 'File' => 'Datei',
'Formula' => 'Formel',
'From' => 'Von',
- 'Geschäftsvolumen' => 'Geschäftsvolumen',
'Group' => 'Warengruppe',
- 'Group Items' => 'Waren gruppieren',
+ 'History' => 'Historie',
'If you see this message, you most likely just setup your LX-Office and haven\'t added any entry types. If this is the case, the option is accessible for administrators in the System menu.' => 'Wenn Sie diese Meldung sehen haben Sie wahrscheinlich ein frisches LX-Office Setup und noch keine Buchungsgruppen eingerichtet. Ein Administrator kann dies im Systemmenü erledigen.',
'Image' => 'Grafik',
'In-line' => 'im Text',
'Include in Report' => 'In Bericht aufnehmen',
'Individual Items' => 'Einzelteile',
'Inventory' => 'Inventar',
- 'Inventory quantity must be zero before you can set this assembly obsolete!' => 'Bevor dieses Erzeugnis als ungültig markiert werden kann, muß das Inventar auf Null sein!',
- 'Inventory quantity must be zero before you can set this part obsolete!' => 'Bevor diese Ware als ungültig markiert werden kann, muß das Inventar Null sein!',
+ 'Inventory quantity must be zero before you can set this assembly obsolete!' => 'Bevor dieses Erzeugnis als ungültig markiert werden kann, muß das Inventar auf Null sein!',
+ 'Inventory quantity must be zero before you can set this part obsolete!' => 'Bevor diese Ware als ungültig markiert werden kann, muß das Inventar Null sein!',
'Invoice' => 'Rechnung',
'Invoice Date missing!' => 'Rechnungsdatum fehlt!',
'Invoice Number' => 'Rechnungsnummer',
'Jun' => 'Jun',
'June' => 'Juni',
'L' => 'L',
+ 'LP' => 'LP',
'Language Values' => 'Sprachübersetzungen',
'Last Cost' => 'Einkaufspreis',
'License' => 'Lizenz',
'Line Total' => 'Zeilensumme',
'List Price' => 'Listenpreis',
'Long Description' => 'Langtext',
+ 'MAILED' => 'Gesendet',
'Make' => 'Hersteller',
'Mar' => 'März',
'March' => 'März',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
'May' => 'Mai',
'May ' => 'Mai',
'Message' => 'Nachricht',
'Microfiche' => 'Mikrofilm',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
'Model' => 'Modell',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
'Name' => 'Name',
'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'No.' => 'Position',
'Not Discountable' => 'Nicht rabattierfähig',
'Notes' => 'Bemerkungen',
'On Hand' => 'Auf Lager',
'On Order' => 'Ist bestellt',
'OpenDocument/OASIS' => 'OpenDocument/OASIS',
+ 'Options' => 'Optionen',
'Order Date missing!' => 'Auftragsdatum fehlt!',
'Order Number' => 'Auftragsnummer',
'Order Number missing!' => 'Auftragsnummer fehlt!',
'Ordered' => 'Vom Kunde bestellt',
'Orphaned' => 'Nie benutzt',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
'PDF' => 'PDF',
'PDF (OpenDocument/OASIS)' => 'PDF (OpenDocument/OASIS)',
+ 'PDF export -- options' => 'PDF-Export -- Optionen',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
'Packing List' => 'Lieferschein',
'Packing List Date missing!' => 'Datum für Verpackungsliste fehlt!',
'Packing List Number missing!' => 'Verpackungslistennummer fehlt!',
'Preisklasse' => 'Preisgruppe',
'Price' => 'Preis',
'Pricegroup' => 'Preisgruppe',
- 'Printed' => 'gedruckt.',
'Printer' => 'Drucker',
'Proforma Invoice' => 'Proformarechnung',
'Project' => 'Projekt',
'Purchase Order' => 'Lieferantenauftrag',
'Qty' => 'Menge',
'Queue' => 'Warteschlange',
- 'Queued' => 'In Warteschlange eingereiht.',
'Quotation' => 'Angebot',
'Quotation Date missing!' => 'Angebotsdatum fehlt!',
'Quotation Number missing!' => 'Angebotsnummer fehlt!',
'Reqdate' => 'Lieferdatum',
'Required by' => 'Lieferdatum',
'Revenue' => 'Erlöskonto',
- 'Sales Order' => 'Kundenauftrag',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
'Save' => 'Speichern',
'Save as new' => 'als neu speichern',
'Screen' => 'Bildschirm',
'Services' => 'Dienstleistungen',
'Set Language Values' => 'Spracheinstellungen',
'Ship' => 'Lagerausgang',
+ 'Ship rcvd' => 'Lagereingang',
'Ship to' => 'Lieferadresse',
'Shipping Address' => 'Lieferadresse',
'Shopartikel' => 'Shopartikel',
- 'Short' => 'kurz',
+ 'Short' => 'Knapp',
'Show details' => 'Details anzeigen',
'Sold' => 'Verkauft',
'Stock' => 'einlagern',
- 'Stock Assembly' => 'Erzeugnis einlagern',
'Storno Invoice' => 'Stornorechnung',
'Storno Packing List' => 'Stornolieferschein',
'Street' => 'Straße',
'Subject' => 'Betreff',
'Subtotal' => 'Zwischensumme',
'TOP100' => 'Top 100',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
'The formula needs the following syntax:<br>For regular article:<br>Variablename= Variable Unit;<br>Variablename2= Variable2 Unit2;<br>...<br>###<br>Variable + ( Variable2 / Variable )<br><b>Please be beware of the spaces in the formula</b><br>' => 'Die Formeln müssen in der folgenden Syntax eingegeben werden:<br>Bei normalen Artikeln:<br>Variablenname= Variable Einheit;<br>Variablenname2= Variable2 Einheit2;<br>...<br>###<br>Variable + Variable2 * ( Variable - Variable2 )<br>Bitte achten Sie auf die Leerzeichen in der Formel<br>Es muss jeweils die Gesamte Zeile eingegeben werden',
+ 'The list has been printed.' => 'Die Liste wurde ausgedruckt.',
'To' => 'An',
+ 'To (email)' => 'An',
'To (time)' => 'Bis',
'Top 100' => 'Top 100',
'Top 100 hinzufuegen' => 'Top 100 hinzufügen',
'Top Level' => 'Hauptartikelbezeichnung',
'Total' => 'Summe',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
'Unit' => 'Einheit',
'Unit of measure' => 'Maßeinheit',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
'Update' => 'Erneuern',
'Update prices' => 'Preise aktualisieren',
'Updated' => 'Erneuert am',
'Value' => 'Wert',
'Variable' => 'Variable',
'Vendor Number' => 'Lieferantennummer',
+ 'Vendor details' => 'Lieferantendetails',
'Verrechnungseinheit' => 'Verrechnungseinheit',
'Weight' => 'Gewicht',
'What type of item is this?' => 'Was ist dieser Artikel?',
'Zipcode' => 'PLZ',
+ '[email]' => '[email]',
+ 'assembly_list' => 'erzeugnisliste',
+ 'bin_list' => 'Lagerliste',
'button' => '?',
'choice' => 'auswählen',
'choice part' => 'Artikel auswählen',
'deliverydate' => 'Lieferdatum',
'ea' => 'St.',
'emailed to' => 'gemailt an',
+ 'history' => 'Historie',
+ 'invoice' => 'Rechnung',
'list' => 'auflisten',
+ 'no' => 'nein',
'none (pricegroup)' => 'keine',
'number' => 'Nummer',
+ 'packing_list' => 'Versandliste',
+ 'part_list' => 'warenliste',
+ 'pick_list' => 'Entnahmeliste',
'prices updated!' => ' Preise aktualisiert!',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'report_generator_dispatch_to is not defined.' => 'report_generator_dispatch_to ist nicht definiert.',
+ 'report_generator_nextsub is not defined.' => 'report_generator_nextsub ist nicht definiert.',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
'sent' => 'gesendet',
'sent to printer' => 'an Drucker geschickt',
+ 'service_list' => 'dienstleistungsliste',
'soldtotal' => 'Verkaufte Anzahl',
+ 'yes' => 'ja',
};
$self->{subs} = {
+ 'E' => 'E',
'H' => 'H',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
'acc_menu' => 'acc_menu',
'add' => 'add',
'addtop100' => 'addtop100',
'assembly_row' => 'assembly_row',
+ 'build_std_url' => 'build_std_url',
'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'check_form' => 'check_form',
'choice' => 'choice',
'confirm_price_update' => 'confirm_price_update',
'display' => 'display',
'display_form' => 'display_form',
'display_row' => 'display_row',
- 'e_mail' => 'e_mail',
'edit' => 'edit',
+ 'edit_e_mail' => 'edit_e_mail',
'employee_selection_internal' => 'employee_selection_internal',
'form_footer' => 'form_footer',
'form_header' => 'form_header',
'item_selected' => 'item_selected',
'link_part' => 'link_part',
'list' => 'list',
- 'list_assemblies' => 'list_assemblies',
'makemodel_row' => 'makemodel_row',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
'new_item' => 'new_item',
'new_license' => 'new_license',
'order' => 'order',
'quotation' => 'quotation',
'reformat_numbers' => 'reformat_numbers',
'relink_accounts' => 'relink_accounts',
+ 'report_generator_back' => 'report_generator_back',
+ 'report_generator_dispatcher' => 'report_generator_dispatcher',
+ 'report_generator_do' => 'report_generator_do',
+ 'report_generator_export_as_csv' => 'report_generator_export_as_csv',
+ 'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
'request_for_quotation' => 'request_for_quotation',
- 'restock_assemblies' => 'restock_assemblies',
- 'restore_form' => 'restore_form',
'save' => 'save',
'save_as_new' => 'save_as_new',
- 'save_form' => 'save_form',
'search' => 'search',
'search_update_prices' => 'search_update_prices',
'section_menu' => 'section_menu',
'set_longdescription' => 'set_longdescription',
'set_pricegroup' => 'set_pricegroup',
'ship_to' => 'ship_to',
- 'stock_assembly' => 'stock_assembly',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
'top100' => 'top100',
'update' => 'update',
'update_prices' => 'update_prices',
--- /dev/null
+$self->{texts} = {
+ 'At least one Perl module that Lx-Office ERP requires for running is not installed on your system.' => 'Mindestes ein Perl-Modul, das Lx-Office ERP zur Ausführung benötigt, ist auf Ihrem System nicht installiert.',
+ 'Bcc' => 'Bcc',
+ 'Cc' => 'Cc',
+ 'Date' => 'Datum',
+ 'Directory' => 'Verzeichnis',
+ 'File' => 'Datei',
+ 'Here\'s an example command line:' => 'Hier ist eine Kommandozeile, die als Beispiel dient:',
+ 'Message' => 'Nachricht',
+ 'Module home page' => 'Modul-Webseite',
+ 'Module name' => 'Modulname',
+ 'One or more Perl modules missing' => 'Ein oder mehr Perl-Module fehlen',
+ 'Please install the below listed modules or ask your system administrator to.' => 'Bitte installieren Sie die unten aufgeführten Module, oder bitten Sie Ihren Administrator darum.',
+ 'Subject' => 'Betreff',
+ 'The preferred one is to install packages provided by your operating system distribution (e.g. Debian or RPM packages).' => 'Die bevorzugte Art, ein Perl-Modul zu installieren, ist durch Installation eines von Ihrem Betriebssystem zur Verfügung gestellten Paketes (z.B. Debian-Pakete oder RPM).',
+ 'The second way is to use Perl\'s CPAN module and let it download and install the module for you.' => 'Die zweite Variante besteht darin, Perls CPAN-Modul zu benutzen und es das Modul für Sie installieren zu lassen.',
+ 'The third way is to download the module from the above mentioned URL and to install the module manually following the installations instructions contained in the source archive.' => 'Die dritte Variante besteht darin, das Paket von der oben genannten URL herunterzuladen und es manuell zu installieren. Beachten Sie dabei die im Paket enthaltenen Installationsanweisungen.',
+ 'There are usually three ways to install Perl modules.' => 'Es gibt normalerweise drei Arten, ein Perlmodul zu installieren.',
+ 'To (email)' => 'An',
+ 'You cannot continue before all required modules are installed.' => 'Sie können nicht fortfahren, bevor alle benötigten Pakete installiert sind.',
+ '[email]' => '[email]',
+};
+
+$self->{subs} = {
+ 'verify_installation' => 'verify_installation',
+};
+
+1;
$self->{texts} = {
' Date missing!' => ' Datum fehlt!',
'*/' => '*/',
+ 'ADDED' => 'Hinzugefügt',
'Add Purchase Order' => 'Lieferantenauftrag erfassen',
'Add Quotation' => 'Angebot erfassen',
'Add Request for Quotation' => 'Anfrage erfassen',
'Apr' => 'Apr',
'April' => 'April',
'Attachment' => 'als Anhang',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
'Aug' => 'Aug',
'August' => 'August',
'Bcc' => 'Bcc',
'Billing Address' => 'Rechnungsadresse',
'Bin' => 'Lagerplatz',
'Bin List' => 'Lagerliste',
+ 'CANCELED' => 'Storniert',
'Cc' => 'Cc',
'City' => 'Stadt',
'Company Name' => 'Firmenname',
'Confirmation' => 'Auftragsbestätigung',
'Contact' => 'Kontakt',
'Continue' => 'Weiter',
- 'Copies' => 'Kopien',
'Country' => 'Land',
'Credit Note' => 'Gutschrift',
'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
+ 'Date' => 'Datum',
'Dec' => 'Dez',
'December' => 'Dezember',
'Delivery Date' => 'Lieferdatum',
'Department' => 'Abteilung',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
+ 'Directory' => 'Verzeichnis',
'Discount' => 'Rabatt',
'E-mail' => 'eMail',
'E-mail address missing!' => 'E-Mail-Adresse fehlt!',
- 'E-mailed' => 'eMail gesendet.',
+ 'EK' => 'EK',
+ 'ELSE' => 'Zusatz',
'Enter longdescription' => 'Langtext eingeben',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
+ 'Ertrag' => 'Ertrag',
'Extended' => 'Gesamt',
'Fax' => 'Fax',
'Feb' => 'Feb',
'February' => 'Februar',
+ 'File' => 'Datei',
'Group' => 'Warengruppe',
- 'Group Items' => 'Waren gruppieren',
+ 'History' => 'Historie',
'In-line' => 'im Text',
'Invoice' => 'Rechnung',
'Invoice Date missing!' => 'Rechnungsdatum fehlt!',
'Jun' => 'Jun',
'June' => 'Juni',
'L' => 'L',
+ 'LP' => 'LP',
'License' => 'Lizenz',
+ 'MAILED' => 'Gesendet',
'Mar' => 'März',
'March' => 'März',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
'May' => 'Mai',
'May ' => 'Mai',
'Message' => 'Nachricht',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
'Name' => 'Name',
'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'No.' => 'Position',
'Nov' => 'Nov',
'November' => 'November',
'OpenDocument/OASIS' => 'OpenDocument/OASIS',
'Order Date missing!' => 'Auftragsdatum fehlt!',
'Order Number missing!' => 'Auftragsnummer fehlt!',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
'PDF' => 'PDF',
'PDF (OpenDocument/OASIS)' => 'PDF (OpenDocument/OASIS)',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
'Packing List' => 'Lieferschein',
'Packing List Date missing!' => 'Datum für Verpackungsliste fehlt!',
'Packing List Number missing!' => 'Verpackungslistennummer fehlt!',
'Postscript' => 'Postscript',
'Price' => 'Preis',
'Pricegroup' => 'Preisgruppe',
- 'Printed' => 'gedruckt.',
'Printer' => 'Drucker',
'Proforma Invoice' => 'Proformarechnung',
'Project' => 'Projekt',
'Purchase Order' => 'Lieferantenauftrag',
'Qty' => 'Menge',
'Queue' => 'Warteschlange',
- 'Queued' => 'In Warteschlange eingereiht.',
'Quotation' => 'Angebot',
'Quotation Date missing!' => 'Angebotsdatum fehlt!',
'Quotation Number missing!' => 'Angebotsnummer fehlt!',
+ 'RFQ' => 'Anfrage',
'Reqdate' => 'Lieferdatum',
'Required by' => 'Lieferdatum',
- 'Sales Order' => 'Kundenauftrag',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
'Screen' => 'Bildschirm',
'Select a Customer' => 'Endkunde auswählen',
'Select a part' => 'Artikel auswählen',
'Serial No.' => 'Seriennummer',
'Service' => 'Dienstleistung',
'Ship' => 'Lagerausgang',
+ 'Ship rcvd' => 'Lagereingang',
'Ship to' => 'Lieferadresse',
'Shipping Address' => 'Lieferadresse',
'Show details' => 'Details anzeigen',
'Street' => 'Straße',
'Subject' => 'Betreff',
'Subtotal' => 'Zwischensumme',
- 'To' => 'An',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'To (email)' => 'An',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
'Unit' => 'Einheit',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
'Value' => 'Wert',
'Variable' => 'Variable',
'Vendor Number' => 'Lieferantennummer',
+ 'Vendor details' => 'Lieferantendetails',
'What type of item is this?' => 'Was ist dieser Artikel?',
'Zipcode' => 'PLZ',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
'emailed to' => 'gemailt an',
+ 'invoice' => 'Rechnung',
+ 'no' => 'nein',
'none (pricegroup)' => 'keine',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
'sent' => 'gesendet',
'sent to printer' => 'an Drucker geschickt',
+ 'yes' => 'ja',
};
$self->{subs} = {
+ 'E' => 'E',
'H' => 'H',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
+ 'build_std_url' => 'build_std_url',
'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'check_form' => 'check_form',
'customer_details' => 'customer_details',
'delivery_customer_selection' => 'delivery_customer_selection',
'display_form' => 'display_form',
'display_row' => 'display_row',
- 'e_mail' => 'e_mail',
+ 'edit_e_mail' => 'edit_e_mail',
'employee_selection_internal' => 'employee_selection_internal',
'format_dates' => 'format_dates',
'invoicetotal' => 'invoicetotal',
'item_selected' => 'item_selected',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
'new_item' => 'new_item',
'new_license' => 'new_license',
'order' => 'order',
'reformat_numbers' => 'reformat_numbers',
'relink_accounts' => 'relink_accounts',
'request_for_quotation' => 'request_for_quotation',
- 'restore_form' => 'restore_form',
- 'save_form' => 'save_form',
'select_employee' => 'select_employee',
'select_employee_internal' => 'select_employee_internal',
'select_item' => 'select_item',
'set_longdescription' => 'set_longdescription',
'set_pricegroup' => 'set_pricegroup',
'ship_to' => 'ship_to',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
'validate_items' => 'validate_items',
'vendor_details' => 'vendor_details',
'vendor_selection' => 'vendor_selection',
$self->{texts} = {
' Date missing!' => ' Datum fehlt!',
- ' Payment posted!' => 'Zahlung gebucht!',
'*/' => '*/',
+ 'ADDED' => 'Hinzugefügt',
'Account' => 'Konto',
- 'Accounting Menu' => 'Kontoverwaltung',
'Add Purchase Order' => 'Lieferantenauftrag erfassen',
'Add Quotation' => 'Angebot erfassen',
'Add Request for Quotation' => 'Anfrage erfassen',
'April' => 'April',
'Are you sure you want to delete Invoice Number' => 'Soll die Rechnung mit folgender Nummer wirklich gelöscht werden:',
'Attachment' => 'als Anhang',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
'Aug' => 'Aug',
'August' => 'August',
'Bcc' => 'Bcc',
'Billing Address' => 'Rechnungsadresse',
'Bin' => 'Lagerplatz',
'Bin List' => 'Lagerliste',
+ 'CANCELED' => 'Storniert',
'Cannot delete invoice!' => 'Rechnung kann nicht gelöscht werden!',
'Cannot post invoice for a closed period!' => 'Das Rechnungsdatum fällt in einen abgeschlossen Zeitraum!',
'Cannot post invoice!' => 'Rechnung kann nicht gebucht werden!',
'Contact' => 'Kontakt',
'Contact Person' => 'Ansprechpartner',
'Continue' => 'Weiter',
- 'Copies' => 'Kopien',
'Country' => 'Land',
'Credit Limit' => 'Kreditlimit',
'Credit Note' => 'Gutschrift',
'Currency' => 'Währung',
'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
+ 'Customer not on file or locked!' => 'Dieser Kunde existiert nicht oder ist gesperrt.',
'Customer not on file!' => 'Kunde ist nicht in der Datenbank!',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
'Date' => 'Datum',
'Dec' => 'Dez',
'December' => 'Dezember',
'Delete' => 'Löschen',
+ 'Delete drafts' => 'Entwürfe löschen',
'Delivery Date' => 'Lieferdatum',
'Department' => 'Abteilung',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Description' => 'Beschreibung',
+ 'Directory' => 'Verzeichnis',
'Discount' => 'Rabatt',
+ 'Draft saved.' => 'Entwurf gespeichert.',
'Due Date' => 'Fälligkeitsdatum',
'E-mail' => 'eMail',
'E-mail address missing!' => 'E-Mail-Adresse fehlt!',
- 'E-mailed' => 'eMail gesendet.',
+ 'EK' => 'EK',
+ 'ELSE' => 'Zusatz',
'Edit Vendor Invoice' => 'Einkaufsrechnung bearbeiten',
+ 'Employee' => 'Bearbeiter',
'Enter longdescription' => 'Langtext eingeben',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
+ 'Ertrag' => 'Ertrag',
'Exch' => 'Wechselkurs.',
'Exchangerate' => 'Wechselkurs',
'Exchangerate for payment missing!' => 'Es fehlt der Wechselkurs für die Bezahlung!',
'Exchangerate missing!' => 'Es fehlt der Wechselkurs!',
'Extended' => 'Gesamt',
+ 'Falsches Datumsformat!' => 'Falsches Datumsformat!',
'Fax' => 'Fax',
'Feb' => 'Feb',
'February' => 'Februar',
+ 'File' => 'Datei',
'Group' => 'Warengruppe',
- 'Group Items' => 'Waren gruppieren',
+ 'History' => 'Historie',
'In-line' => 'im Text',
'Internal Notes' => 'interne Bemerkungen',
'Invoice' => 'Rechnung',
'Invoice Number' => 'Rechnungsnummer',
'Invoice Number missing!' => 'Rechnungsnummer fehlt!',
'Invoice deleted!' => 'Rechnung gelöscht!',
+ 'Invoice has already been storno\'d!' => 'Diese Rechnung wurde bereits storniert.',
'Item not on file!' => 'Dieser Artikel ist nicht in der Datenbank!',
'Jan' => 'Jan',
'January' => 'Januar',
'Jun' => 'Jun',
'June' => 'Juni',
'L' => 'L',
+ 'LP' => 'LP',
'License' => 'Lizenz',
+ 'MAILED' => 'Gesendet',
'Mar' => 'März',
'March' => 'März',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
'May' => 'Mai',
'May ' => 'Mai',
'Memo' => 'Memo',
'Message' => 'Nachricht',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
+ 'Missing amount' => 'Fehlbetrag',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
'Name' => 'Name',
'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'No.' => 'Position',
'Notes' => 'Bemerkungen',
'Nov' => 'Nov',
'Oct' => 'Okt',
'October' => 'Oktober',
'OpenDocument/OASIS' => 'OpenDocument/OASIS',
+ 'Order Date' => 'Auftragsdatum',
'Order Date missing!' => 'Auftragsdatum fehlt!',
'Order Number' => 'Auftragsnummer',
'Order Number missing!' => 'Auftragsnummer fehlt!',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
'PDF' => 'PDF',
'PDF (OpenDocument/OASIS)' => 'PDF (OpenDocument/OASIS)',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
'Packing List' => 'Lieferschein',
'Packing List Date missing!' => 'Datum für Verpackungsliste fehlt!',
'Packing List Number missing!' => 'Verpackungslistennummer fehlt!',
'Part Number' => 'Artikelnummer',
'Part description' => 'Artikelbeschreibung',
'Payment date missing!' => 'Tag der Zahlung fehlt!',
+ 'Payment posted!' => 'Zahlung gebucht!',
'Payments' => 'Zahlungsausgänge',
'Phone' => 'Telefon',
'Pick List' => 'Sammelliste',
'Postscript' => 'Postscript',
'Price' => 'Preis',
'Pricegroup' => 'Preisgruppe',
- 'Printed' => 'gedruckt.',
'Printer' => 'Drucker',
'Proforma Invoice' => 'Proformarechnung',
'Project' => 'Projekt',
'Purchase Order' => 'Lieferantenauftrag',
'Qty' => 'Menge',
'Queue' => 'Warteschlange',
- 'Queued' => 'In Warteschlange eingereiht.',
'Quotation' => 'Angebot',
+ 'Quotation Date' => 'Angebotsdatum',
'Quotation Date missing!' => 'Angebotsdatum fehlt!',
'Quotation Number missing!' => 'Angebotsnummer fehlt!',
+ 'RFQ' => 'Anfrage',
+ 'Rechnungsnummer' => 'Rechnungsnummer',
'Record in' => 'Buchen auf',
'Remaining' => 'Rest',
'Reqdate' => 'Lieferdatum',
'Required by' => 'Lieferdatum',
- 'Sales Order' => 'Kundenauftrag',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
+ 'Save draft' => 'Entwurf speichern',
'Screen' => 'Bildschirm',
'Select a Customer' => 'Endkunde auswählen',
'Select a part' => 'Artikel auswählen',
'Serial No.' => 'Seriennummer',
'Service' => 'Dienstleistung',
'Ship' => 'Lagerausgang',
+ 'Ship rcvd' => 'Lagereingang',
'Ship to' => 'Lieferadresse',
'Shipping Address' => 'Lieferadresse',
'Show details' => 'Details anzeigen',
+ 'Skip' => 'Überspringen',
'Source' => 'Beleg',
'Steuersatz' => 'Steuersatz',
'Storno' => 'Storno',
'Subject' => 'Betreff',
'Subtotal' => 'Zwischensumme',
'Tax Included' => 'Steuer im Preis inbegriffen',
- 'To' => 'An',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'To (email)' => 'An',
'Total' => 'Summe',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
'Unit' => 'Einheit',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
'Update' => 'Erneuern',
'Use As Template' => 'Als Vorlage verwenden',
'Value' => 'Wert',
'Variable' => 'Variable',
'Vendor' => 'Lieferant',
'Vendor Number' => 'Lieferantennummer',
+ 'Vendor details' => 'Lieferantendetails',
'Vendor missing!' => 'Lieferant fehlt!',
+ 'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!',
'What type of item is this?' => 'Was ist dieser Artikel?',
'Yes' => 'Ja',
'Zipcode' => 'PLZ',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
'button' => '?',
'ea' => 'St.',
'emailed to' => 'gemailt an',
+ 'history' => 'Historie',
+ 'invoice' => 'Rechnung',
+ 'mark as paid' => 'als bezahlt markieren',
+ 'no' => 'nein',
'none (pricegroup)' => 'keine',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
'posted!' => 'gebucht',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
'sent' => 'gesendet',
'sent to printer' => 'an Drucker geschickt',
+ 'wrongformat' => 'Falsches Format',
+ 'yes' => 'ja',
};
$self->{subs} = {
+ 'E' => 'E',
'H' => 'H',
- 'acc_menu' => 'acc_menu',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
'add' => 'add',
'add_transaction' => 'add_transaction',
'ap_transaction' => 'ap_transaction',
'ar_transaction' => 'ar_transaction',
+ 'build_std_url' => 'build_std_url',
'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'check_form' => 'check_form',
'check_name' => 'check_name',
'check_project' => 'check_project',
'continue' => 'continue',
'customer_details' => 'customer_details',
'delete' => 'delete',
+ 'delete_drafts' => 'delete_drafts',
'delivery_customer_selection' => 'delivery_customer_selection',
- 'display' => 'display',
'display_form' => 'display_form',
'display_row' => 'display_row',
- 'e_mail' => 'e_mail',
+ 'dont_load_draft' => 'dont_load_draft',
+ 'draft_action_dispatcher' => 'draft_action_dispatcher',
'edit' => 'edit',
+ 'edit_e_mail' => 'edit_e_mail',
'employee_selection_internal' => 'employee_selection_internal',
'form_footer' => 'form_footer',
'form_header' => 'form_header',
'invoice_links' => 'invoice_links',
'invoicetotal' => 'invoicetotal',
'item_selected' => 'item_selected',
+ 'load_draft' => 'load_draft',
+ 'load_draft_maybe' => 'load_draft_maybe',
+ 'mark_as_paid' => 'mark_as_paid',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
'name_selected' => 'name_selected',
'new_item' => 'new_item',
'new_license' => 'new_license',
'quotation' => 'quotation',
'reformat_numbers' => 'reformat_numbers',
'relink_accounts' => 'relink_accounts',
+ 'remove_draft' => 'remove_draft',
'request_for_quotation' => 'request_for_quotation',
- 'restore_form' => 'restore_form',
'sales_invoice' => 'sales_invoice',
- 'save_form' => 'save_form',
- 'section_menu' => 'section_menu',
+ 'save_draft' => 'save_draft',
'select_employee' => 'select_employee',
'select_employee_internal' => 'select_employee_internal',
'select_item' => 'select_item',
'set_longdescription' => 'set_longdescription',
'set_pricegroup' => 'set_pricegroup',
'ship_to' => 'ship_to',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
'storno' => 'storno',
'update' => 'update',
'use_as_template' => 'use_as_template',
'yes' => 'yes',
'weiter' => 'continue',
'löschen' => 'delete',
+ 'entwürfe_löschen' => 'delete_drafts',
'buchen' => 'post',
'zahlung_buchen' => 'post_payment',
+ 'entwurf_speichern' => 'save_draft',
+ 'Überspringen' => 'skip',
'storno' => 'storno',
'erneuern' => 'update',
'als_vorlage_verwenden' => 'use_as_template',
'ja' => 'yes',
+ 'als_bezahlt_markieren' => 'mark_as_paid',
};
1;
$self->{texts} = {
' Date missing!' => ' Datum fehlt!',
- ' Payment posted!' => 'Zahlung gebucht!',
'*/' => '*/',
+ 'ADDED' => 'Hinzugefügt',
'Account' => 'Konto',
- 'Accounting Menu' => 'Kontoverwaltung',
'Add Credit Note' => 'Gutschrift erfassen',
'Add Purchase Order' => 'Lieferantenauftrag erfassen',
'Add Quotation' => 'Angebot erfassen',
'April' => 'April',
'Are you sure you want to delete Invoice Number' => 'Soll die Rechnung mit folgender Nummer wirklich gelöscht werden:',
'Attachment' => 'als Anhang',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
'Aug' => 'Aug',
'August' => 'August',
'Bcc' => 'Bcc',
'Billing Address' => 'Rechnungsadresse',
'Bin' => 'Lagerplatz',
'Bin List' => 'Lagerliste',
- 'Business' => 'Firma',
+ 'CANCELED' => 'Storniert',
'Cannot delete invoice!' => 'Rechnung kann nicht gelöscht werden!',
'Cannot post invoice for a closed period!' => 'Das Rechnungsdatum fällt in einen abgeschlossen Zeitraum!',
'Cannot post invoice!' => 'Rechnung kann nicht gebucht werden!',
'Contact' => 'Kontakt',
'Contact Person' => 'Ansprechpartner',
'Continue' => 'Weiter',
- 'Copies' => 'Kopien',
'Country' => 'Land',
'Credit Limit' => 'Kreditlimit',
'Credit Limit exceeded!!!' => 'Kreditlimit überschritten!',
'Customer' => 'Kunde',
'Customer Number' => 'Kundennummer',
'Customer Order Number' => 'Bestellnummer des Kunden',
+ 'Customer details' => 'Kundendetails',
'Customer missing!' => 'Kundenname fehlt!',
+ 'Customer not on file or locked!' => 'Dieser Kunde existiert nicht oder ist gesperrt.',
'Customer not on file!' => 'Kunde ist nicht in der Datenbank!',
+ 'Customer type' => 'Kundentyp',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
'Date' => 'Datum',
'Dec' => 'Dez',
'December' => 'Dezember',
'Delete' => 'Löschen',
+ 'Delete drafts' => 'Entwürfe löschen',
'Delivery Date' => 'Lieferdatum',
'Department' => 'Abteilung',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Description' => 'Beschreibung',
+ 'Directory' => 'Verzeichnis',
'Discount' => 'Rabatt',
+ 'Draft saved.' => 'Entwurf gespeichert.',
'Due Date' => 'Fälligkeitsdatum',
'Dunning Amount' => 'gemahnter Betrag',
'E-mail' => 'eMail',
'E-mail address missing!' => 'E-Mail-Adresse fehlt!',
- 'E-mailed' => 'eMail gesendet.',
+ 'EK' => 'EK',
+ 'ELSE' => 'Zusatz',
'Edit Credit Note' => 'Gutschrift bearbeiten',
'Edit Sales Invoice' => 'Rechnung bearbeiten',
'Edit Storno Credit Note' => 'Storno Gutschrift bearbeiten',
'Edit Storno Invoice' => 'Stornorechnung bearbeiten',
+ 'Employee' => 'Bearbeiter',
'Enter longdescription' => 'Langtext eingeben',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
+ 'Ertrag' => 'Ertrag',
+ 'Ertrag prozentual' => 'Ertrag prozentual',
'Exch' => 'Wechselkurs.',
'Exchangerate' => 'Wechselkurs',
'Exchangerate for payment missing!' => 'Es fehlt der Wechselkurs für die Bezahlung!',
'Exchangerate missing!' => 'Es fehlt der Wechselkurs!',
'Extended' => 'Gesamt',
+ 'Falsches Datumsformat!' => 'Falsches Datumsformat!',
'Fax' => 'Fax',
'Feb' => 'Feb',
'February' => 'Februar',
+ 'File' => 'Datei',
'Group' => 'Warengruppe',
- 'Group Items' => 'Waren gruppieren',
+ 'History' => 'Historie',
'In-line' => 'im Text',
'Incoming Payments' => 'Zahlungseingänge',
'Internal Notes' => 'interne Bemerkungen',
'Invoice Number' => 'Rechnungsnummer',
'Invoice Number missing!' => 'Rechnungsnummer fehlt!',
'Invoice deleted!' => 'Rechnung gelöscht!',
+ 'Invoice has already been storno\'d!' => 'Diese Rechnung wurde bereits storniert.',
'Item not on file!' => 'Dieser Artikel ist nicht in der Datenbank!',
'Jan' => 'Jan',
'January' => 'Januar',
'Jun' => 'Jun',
'June' => 'Juni',
'L' => 'L',
+ 'LP' => 'LP',
'License' => 'Lizenz',
+ 'MAILED' => 'Gesendet',
'Mar' => 'März',
'March' => 'März',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
'Max. Dunning Level' => 'höchste Mahnstufe',
'May' => 'Mai',
'May ' => 'Mai',
'Memo' => 'Memo',
'Message' => 'Nachricht',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
+ 'Missing amount' => 'Fehlbetrag',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
'Name' => 'Name',
'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'No.' => 'Position',
'Notes' => 'Bemerkungen',
'Nov' => 'Nov',
'October' => 'Oktober',
'OpenDocument/OASIS' => 'OpenDocument/OASIS',
'Order' => 'Auftrag',
+ 'Order Date' => 'Auftragsdatum',
'Order Date missing!' => 'Auftragsdatum fehlt!',
'Order Number' => 'Auftragsnummer',
'Order Number missing!' => 'Auftragsnummer fehlt!',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
'PDF' => 'PDF',
'PDF (OpenDocument/OASIS)' => 'PDF (OpenDocument/OASIS)',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
'Packing List' => 'Lieferschein',
'Packing List Date missing!' => 'Datum für Verpackungsliste fehlt!',
'Packing List Number missing!' => 'Verpackungslistennummer fehlt!',
'Part description' => 'Artikelbeschreibung',
'Payment Terms' => 'Zahlungskonditionen',
'Payment date missing!' => 'Tag der Zahlung fehlt!',
+ 'Payment posted!' => 'Zahlung gebucht!',
'Payments' => 'Zahlungsausgänge',
'Phone' => 'Telefon',
'Pick List' => 'Sammelliste',
'Pricegroup' => 'Preisgruppe',
'Print' => 'Drucken',
'Print and Post' => 'Drucken und Buchen',
- 'Printed' => 'gedruckt.',
'Printer' => 'Drucker',
'Proforma Invoice' => 'Proformarechnung',
'Project' => 'Projekt',
'Purchase Order' => 'Lieferantenauftrag',
'Qty' => 'Menge',
'Queue' => 'Warteschlange',
- 'Queued' => 'In Warteschlange eingereiht.',
'Quotation' => 'Angebot',
+ 'Quotation Date' => 'Angebotsdatum',
'Quotation Date missing!' => 'Angebotsdatum fehlt!',
'Quotation Number' => 'Angebotsnummer',
'Quotation Number missing!' => 'Angebotsnummer fehlt!',
+ 'RFQ' => 'Anfrage',
'Record in' => 'Buchen auf',
'Remaining' => 'Rest',
'Reqdate' => 'Lieferdatum',
'Required by' => 'Lieferdatum',
- 'Sales Order' => 'Kundenauftrag',
- 'Salesperson' => 'Verkäufer',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
+ 'Salesman' => 'Verkäufer/in',
+ 'Save draft' => 'Entwurf speichern',
'Screen' => 'Bildschirm',
'Select a Customer' => 'Endkunde auswählen',
'Select a part' => 'Artikel auswählen',
'Serial No.' => 'Seriennummer',
'Service' => 'Dienstleistung',
'Ship' => 'Lagerausgang',
+ 'Ship rcvd' => 'Lagereingang',
'Ship to' => 'Lieferadresse',
'Ship via' => 'Transportmittel',
'Shipping Address' => 'Lieferadresse',
'Shipping Point' => 'Versandort',
'Show details' => 'Details anzeigen',
+ 'Skip' => 'Überspringen',
'Source' => 'Beleg',
'Steuersatz' => 'Steuersatz',
'Storno' => 'Storno',
'Subject' => 'Betreff',
'Subtotal' => 'Zwischensumme',
'Tax Included' => 'Steuer im Preis inbegriffen',
- 'To' => 'An',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'To (email)' => 'An',
'Total' => 'Summe',
'Trade Discount' => 'Rabatt',
+ 'Transaction description' => 'Vorgangsbezeichnung',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
'Unit' => 'Einheit',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
'Update' => 'Erneuern',
'Use As Template' => 'Als Vorlage verwenden',
'Value' => 'Wert',
'Variable' => 'Variable',
'Vendor Number' => 'Lieferantennummer',
+ 'Vendor details' => 'Lieferantendetails',
+ 'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!',
'What type of item is this?' => 'Was ist dieser Artikel?',
'Yes' => 'Ja',
'Zipcode' => 'PLZ',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
'button' => '?',
'ea' => 'St.',
'emailed to' => 'gemailt an',
+ 'history' => 'Historie',
+ 'invoice' => 'Rechnung',
+ 'mark as paid' => 'als bezahlt markieren',
+ 'no' => 'nein',
'none (pricegroup)' => 'keine',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
'posted!' => 'gebucht',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
'sent' => 'gesendet',
'sent to printer' => 'an Drucker geschickt',
+ 'wrongformat' => 'Falsches Format',
+ 'yes' => 'ja',
};
$self->{subs} = {
+ 'E' => 'E',
'H' => 'H',
- 'acc_menu' => 'acc_menu',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
'add' => 'add',
'add_transaction' => 'add_transaction',
'ap_transaction' => 'ap_transaction',
'ar_transaction' => 'ar_transaction',
+ 'build_std_url' => 'build_std_url',
'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'check_form' => 'check_form',
'check_name' => 'check_name',
'check_project' => 'check_project',
'credit_note' => 'credit_note',
'customer_details' => 'customer_details',
'delete' => 'delete',
+ 'delete_drafts' => 'delete_drafts',
'delivery_customer_selection' => 'delivery_customer_selection',
- 'display' => 'display',
'display_form' => 'display_form',
'display_row' => 'display_row',
+ 'dont_load_draft' => 'dont_load_draft',
+ 'draft_action_dispatcher' => 'draft_action_dispatcher',
'e_mail' => 'e_mail',
'edit' => 'edit',
+ 'edit_e_mail' => 'edit_e_mail',
'employee_selection_internal' => 'employee_selection_internal',
'form_footer' => 'form_footer',
'form_header' => 'form_header',
'invoice_links' => 'invoice_links',
'invoicetotal' => 'invoicetotal',
'item_selected' => 'item_selected',
+ 'load_draft' => 'load_draft',
+ 'load_draft_maybe' => 'load_draft_maybe',
+ 'mark_as_paid' => 'mark_as_paid',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
'name_selected' => 'name_selected',
'new_item' => 'new_item',
'new_license' => 'new_license',
'quotation' => 'quotation',
'reformat_numbers' => 'reformat_numbers',
'relink_accounts' => 'relink_accounts',
+ 'remove_draft' => 'remove_draft',
'request_for_quotation' => 'request_for_quotation',
- 'restore_form' => 'restore_form',
'sales_invoice' => 'sales_invoice',
- 'save_form' => 'save_form',
- 'section_menu' => 'section_menu',
+ 'save_draft' => 'save_draft',
'select_employee' => 'select_employee',
'select_employee_internal' => 'select_employee_internal',
'select_item' => 'select_item',
'set_longdescription' => 'set_longdescription',
'set_pricegroup' => 'set_pricegroup',
'ship_to' => 'ship_to',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
'storno' => 'storno',
'update' => 'update',
'use_as_template' => 'use_as_template',
'weiter' => 'continue',
'gutschrift' => 'credit_note',
'löschen' => 'delete',
+ 'entwürfe_löschen' => 'delete_drafts',
'email' => 'e_mail',
'auftrag' => 'order',
'buchen' => 'post',
'druckvorschau' => 'preview',
'drucken' => 'print',
'drucken_und_buchen' => 'print_and_post',
+ 'entwurf_speichern' => 'save_draft',
'lieferadresse' => 'ship_to',
+ 'Überspringen' => 'skip',
'storno' => 'storno',
'erneuern' => 'update',
'als_vorlage_verwenden' => 'use_as_template',
'ja' => 'yes',
+ 'als_bezahlt_markieren' => 'mark_as_paid',
};
1;
$self->{texts} = {
'Logout' => 'Abmeldung',
+ 'drucken' => 'drucken',
};
$self->{subs} = {
$self->{texts} = {
+ 'ADDED' => 'Hinzugefügt',
'Add' => 'Erfassen',
'Add License' => 'Lizenz erfassen',
+ 'Address' => 'Adresse',
'All' => 'Alle',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
+ 'Bcc' => 'Bcc',
+ 'Bin List' => 'Lagerliste',
+ 'CANCELED' => 'Storniert',
+ 'Cc' => 'Cc',
'City' => 'Stadt',
'Comment' => 'Kommentar',
'Company Name' => 'Firmenname',
+ 'Confirmation' => 'Auftragsbestätigung',
'Continue' => 'Weiter',
+ 'Credit Note' => 'Gutschrift',
'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
'Customer missing!' => 'Kundenname fehlt!',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
+ 'Date' => 'Datum',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Description' => 'Beschreibung',
+ 'Directory' => 'Verzeichnis',
+ 'ELSE' => 'Zusatz',
+ 'Enter longdescription' => 'Langtext eingeben',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
'Expired licenses' => 'Abgelaufene Lizenzen',
'Expiring in x month(s)' => 'Die in x Monat(en) ablaufen',
+ 'File' => 'Datei',
+ 'History' => 'Historie',
'Include in Report' => 'In Bericht aufnehmen',
+ 'Invoice' => 'Rechnung',
'Invoice Number' => 'Rechnungsnummer',
'License key' => 'Lizenzschlüssel',
'Licenses' => 'Lizenzen',
+ 'MAILED' => 'Gesendet',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
+ 'Message' => 'Nachricht',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
+ 'Name' => 'Name',
+ 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
+ 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
+ 'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
'No licenses were found that match the search criteria.' => 'Es wurden keine Lizenzen gefunden, auf die die Suchkriterien zutreffen.',
+ 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
+ 'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'Own Product' => 'eigenes Produkt',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
'Part Number' => 'Artikelnummer',
+ 'Part description' => 'Artikelbeschreibung',
+ 'Pick List' => 'Sammelliste',
'Please enter a license key.' => 'Bitte geben Sie einen Lizenzschlüssel an.',
'Please enter a number of licenses.' => 'Bitte geben Sie die Anzahl Lizenzschlüssel an.',
+ 'Please enter values' => 'Bitte Werte eingeben',
+ 'Proforma Invoice' => 'Proformarechnung',
+ 'Project Number' => 'Projektnummer',
+ 'Project description' => 'Projektbeschreibung',
+ 'Purchase Order' => 'Lieferantenauftrag',
'Quantity' => 'Menge',
+ 'Quotation' => 'Angebot',
+ 'RFQ' => 'Anfrage',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
'Save' => 'Speichern',
+ 'Select a Customer' => 'Endkunde auswählen',
+ 'Select a part' => 'Artikel auswählen',
+ 'Select a project' => 'Projekt auswählen',
+ 'Select an employee' => 'Angestellten auswählen',
'Select from one of the items below' => 'Wählen Sie einen der untenstehenden Einträge',
'Select from one of the names below' => 'Wählen Sie einen der untenstehenden Namen',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
'Street' => 'Straße',
+ 'Subject' => 'Betreff',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
'The licensing module has been deactivated in lx-erp.conf.' => 'Das Lizenzverwaltungsmodul wurde in lx-erp.conf deaktiviert.',
+ 'To (email)' => 'An',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
+ 'Unit' => 'Einheit',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
'Update' => 'Erneuern',
'Valid until' => 'gültig bis',
+ 'Value' => 'Wert',
+ 'Variable' => 'Variable',
+ 'Vendor details' => 'Lieferantendetails',
'View License' => 'Lizenz ansehen',
'Zipcode' => 'PLZ',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
+ 'invoice' => 'Rechnung',
+ 'no' => 'nein',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
+ 'yes' => 'ja',
};
$self->{subs} = {
+ 'E' => 'E',
+ 'H' => 'H',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
'add' => 'add',
+ 'build_std_url' => 'build_std_url',
+ 'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'continue' => 'continue',
+ 'delivery_customer_selection' => 'delivery_customer_selection',
'details' => 'details',
'do_add' => 'do_add',
'do_search' => 'do_search',
+ 'employee_selection_internal' => 'employee_selection_internal',
'form_footer' => 'form_footer',
'form_header' => 'form_header',
+ 'format_dates' => 'format_dates',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
+ 'part_selection_internal' => 'part_selection_internal',
'print_customer_selection' => 'print_customer_selection',
'print_license_form' => 'print_license_form',
'print_part_selection' => 'print_part_selection',
+ 'project_selection_internal' => 'project_selection_internal',
'quot' => 'quot',
+ 'reformat_numbers' => 'reformat_numbers',
'save' => 'save',
'search' => 'search',
+ 'select_employee' => 'select_employee',
+ 'select_employee_internal' => 'select_employee_internal',
+ 'select_part' => 'select_part',
+ 'select_part_internal' => 'select_part_internal',
+ 'set_longdescription' => 'set_longdescription',
'set_std_hidden' => 'set_std_hidden',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
'update' => 'update',
+ 'vendor_selection' => 'vendor_selection',
'erfassen' => 'add',
'weiter' => 'continue',
'speichern' => 'save',
}
opendir DIR, "$bindir" or die "$!";
-@progfiles = grep { /\.pl/; !/(_|^\.)/ } readdir DIR;
+@progfiles = grep { /\.pl$/ && !/(_|^\.)/ } readdir DIR;
seekdir DIR, 0;
@customfiles = grep /_/, readdir DIR;
closedir DIR;
if (/require\s+\W.*\.pl/) {
my $newfile = $&;
$newfile =~ s/require\s+\W//;
- $newfile =~ s/\$form->{path}\///;
+ $newfile =~ s|bin/mozilla||;
# &scanfile("$bindir/$newfile", 0, $scanned_files);
$cached{$file}{scan}{"$bindir/$newfile"} = 1;
} elsif (/use\s+SL::(.*?);/) {
}
# is this a template call?
- if (/parse_html_template\s*\(\s*[\"\']([\w\/]+)/) {
+ if (/parse_html_template2?\s*\(\s*[\"\']([\w\/]+)/) {
my $newfile = "$basedir/templates/webpages/$1_master.html";
if (-f $newfile) {
# &scanhtmlfile($newfile);
$self->{texts} = {
+ 'ADDED' => 'Hinzugefügt',
'About' => 'über',
+ 'Address' => 'Adresse',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
+ 'Bcc' => 'Bcc',
+ 'Bin List' => 'Lagerliste',
+ 'CANCELED' => 'Storniert',
+ 'Cc' => 'Cc',
+ 'Confirmation' => 'Auftragsbestätigung',
+ 'Credit Note' => 'Gutschrift',
+ 'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
'Database Host' => 'Datenbankcomputer',
'Dataset' => 'Datenbank',
'Dataset upgrade' => 'Datenbankaktualisierung',
+ 'Date' => 'Datum',
'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
+ 'Directory' => 'Verzeichnis',
+ 'ELSE' => 'Zusatz',
+ 'Enter longdescription' => 'Langtext eingeben',
'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
+ 'File' => 'Datei',
+ 'History' => 'Historie',
'Incorrect username or password!' => 'Ungültiger Benutzername oder falsches Passwort!',
+ 'Invoice' => 'Rechnung',
'Licensed to' => 'Lizensiert für',
'Login' => 'Anmeldung',
'Login Name' => 'Benutzername',
+ 'MAILED' => 'Gesendet',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
+ 'Message' => 'Nachricht',
'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
+ 'Name' => 'Name',
+ 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
+ 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
+ 'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
+ 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
+ 'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
+ 'Part Number' => 'Artikelnummer',
+ 'Part description' => 'Artikelbeschreibung',
'Password' => 'Passwort',
+ 'Pick List' => 'Sammelliste',
+ 'Please enter values' => 'Bitte Werte eingeben',
+ 'Proforma Invoice' => 'Proformarechnung',
+ 'Project Number' => 'Projektnummer',
+ 'Project description' => 'Projektbeschreibung',
+ 'Purchase Order' => 'Lieferantenauftrag',
+ 'Quotation' => 'Angebot',
+ 'RFQ' => 'Anfrage',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
+ 'Select a Customer' => 'Endkunde auswählen',
+ 'Select a part' => 'Artikel auswählen',
+ 'Select a project' => 'Projekt auswählen',
+ 'Select an employee' => 'Angestellten auswählen',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
+ 'Subject' => 'Betreff',
'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'To (email)' => 'An',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
+ 'Unit' => 'Einheit',
'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
'User' => 'Benutzer',
+ 'Value' => 'Wert',
+ 'Variable' => 'Variable',
+ 'Vendor details' => 'Lieferantendetails',
'Version' => 'Version',
'You are logged out!' => 'Auf Wiedersehen!',
'You did not enter a name!' => 'Sie haben keinen Namen eingegeben!',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
+ 'invoice' => 'Rechnung',
'localhost' => 'lokaler Rechner',
+ 'no' => 'nein',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
+ 'yes' => 'ja',
};
$self->{subs} = {
+ 'E' => 'E',
+ 'H' => 'H',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
+ 'build_std_url' => 'build_std_url',
+ 'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'company_logo' => 'company_logo',
+ 'delivery_customer_selection' => 'delivery_customer_selection',
+ 'employee_selection_internal' => 'employee_selection_internal',
+ 'format_dates' => 'format_dates',
'login' => 'login',
'login_screen' => 'login_screen',
'logout' => 'logout',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
+ 'part_selection_internal' => 'part_selection_internal',
+ 'project_selection_internal' => 'project_selection_internal',
+ 'reformat_numbers' => 'reformat_numbers',
+ 'select_employee' => 'select_employee',
+ 'select_employee_internal' => 'select_employee_internal',
+ 'select_part' => 'select_part',
+ 'select_part_internal' => 'select_part_internal',
+ 'set_longdescription' => 'set_longdescription',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
+ 'vendor_selection' => 'vendor_selection',
'weiter' => 'continue',
'anmeldung' => 'login',
};
'Add AP Transaction' => 'Kreditorenbuchung',
'Add AR Transaction' => 'Debitorenbuchung',
'Add Account' => 'Konto erfassen',
+ 'Add Accounting Group' => 'Buchungsgruppe erfassen',
'Add Assembly' => 'Erzeugnis erfassen',
- 'Add Business' => 'Kundentyp erfassen',
+ 'Add Business' => 'Kunden-/Lieferantentyp erfassen',
'Add Credit Note' => 'Gutschrift erfassen',
'Add Customer' => 'Kunde erfassen',
'Add Department' => 'Abteilung erfassen',
'Add Vendor Invoice' => 'Einkaufsrechnung erfassen',
'Assemblies' => 'Erzeugnisse',
'Audit Control' => 'Bücherkontrolle',
- 'BG anzeigen' => 'BG anzeigen',
- 'BG hinzufügen' => 'BG hinzufügen',
'BWA' => 'BWA',
'Balance Sheet' => 'Bilanz',
'Batch Printing' => 'Druck',
'Edit Dunning' => 'Mahnungen konfigurieren',
'General Ledger' => 'Finanzbuchhaltung',
'Groups' => 'Warengruppen',
- 'Import CSV' => 'Import CSV',
+ 'HTML Templates' => 'HTML-Vorlagen',
+ 'History Search Engine' => 'Historien Suchmaschine',
+ 'Import CSV' => 'CSV-Import',
'Income Statement' => 'GuV',
'Invoices' => 'Rechnungen',
'Journal' => 'Buchungsjournal',
+ 'LaTeX Templates' => 'LaTeX-Vorlagen',
'Languages' => 'Sprachen',
'Lead' => 'Kundenquelle',
'Licenses' => 'Lizenzen',
+ 'List Accounting Groups' => 'Buchungsgruppen anzeigen',
'List Accounts' => 'Konten anzeigen',
- 'List Businesses' => 'Kundentypen anzeigen',
+ 'List Businesses' => 'Kunden-/Lieferantentypen anzeigen',
'List Departments' => 'Abteilungen anzeigen',
'List Groups' => 'Warengruppen anzeigen',
'List Languages' => 'Sprachen anzeigen',
'List Payment Terms' => 'Zahlungskonditionen anzeigen',
'List Pricegroups' => 'Preisgruppen anzeigen',
'List Printer' => 'Drucker anzeigen',
+ 'List Tax' => 'Bearbeiten',
'Logout' => 'Abmeldung',
'Master Data' => 'Stammdaten',
'Packing Lists' => 'Lieferschein',
'Projecttransactions' => 'Projektbuchungen',
'Purchase Orders' => 'Lieferantenaufträge',
'Quotations' => 'Angebote',
- 'RFQs' => 'Anfragen',
+ 'RFQs' => 'Preisanfragen',
'Receipt' => 'Zahlungseingang',
'Receipts' => 'Zahlungseingänge',
'Reconciliation' => 'Kontenabgleich',
'Shipto' => 'Lieferanschriften',
'Stylesheet' => 'Stilvorlage',
'System' => 'System',
+ 'Taxes' => 'Steuern',
+ 'Templates' => 'Vorlagen',
'Trial Balance' => 'Saldenbilanz',
- 'Type of Business' => 'Kundentyp',
+ 'Type of Business' => 'Kunden-/Lieferantentyp',
'UStVa' => 'UStVa',
'UStVa Einstellungen' => 'UStVa Einstellungen',
'Units' => 'Einheiten',
'Add AP Transaction' => 'Kreditorenbuchung',
'Add AR Transaction' => 'Debitorenbuchung',
'Add Account' => 'Konto erfassen',
+ 'Add Accounting Group' => 'Buchungsgruppe erfassen',
'Add Assembly' => 'Erzeugnis erfassen',
- 'Add Business' => 'Kundentyp erfassen',
+ 'Add Business' => 'Kunden-/Lieferantentyp erfassen',
'Add Credit Note' => 'Gutschrift erfassen',
'Add Customer' => 'Kunde erfassen',
'Add Department' => 'Abteilung erfassen',
'Add Vendor Invoice' => 'Einkaufsrechnung erfassen',
'Assemblies' => 'Erzeugnisse',
'Audit Control' => 'Bücherkontrolle',
- 'BG anzeigen' => 'BG anzeigen',
- 'BG hinzufügen' => 'BG hinzufügen',
'BWA' => 'BWA',
'Balance Sheet' => 'Bilanz',
'Batch Printing' => 'Druck',
'Edit Dunning' => 'Mahnungen konfigurieren',
'General Ledger' => 'Finanzbuchhaltung',
'Groups' => 'Warengruppen',
- 'Import CSV' => 'Import CSV',
+ 'HTML Templates' => 'HTML-Vorlagen',
+ 'History Search Engine' => 'Historien Suchmaschine',
+ 'Import CSV' => 'CSV-Import',
'Income Statement' => 'GuV',
'Invoices' => 'Rechnungen',
'Journal' => 'Buchungsjournal',
+ 'LaTeX Templates' => 'LaTeX-Vorlagen',
'Languages' => 'Sprachen',
'Lead' => 'Kundenquelle',
'Licenses' => 'Lizenzen',
+ 'List Accounting Groups' => 'Buchungsgruppen anzeigen',
'List Accounts' => 'Konten anzeigen',
- 'List Businesses' => 'Kundentypen anzeigen',
+ 'List Businesses' => 'Kunden-/Lieferantentypen anzeigen',
'List Departments' => 'Abteilungen anzeigen',
'List Groups' => 'Warengruppen anzeigen',
'List Languages' => 'Sprachen anzeigen',
'List Payment Terms' => 'Zahlungskonditionen anzeigen',
'List Pricegroups' => 'Preisgruppen anzeigen',
'List Printer' => 'Drucker anzeigen',
+ 'List Tax' => 'Bearbeiten',
'Logout' => 'Abmeldung',
'Master Data' => 'Stammdaten',
'Packing Lists' => 'Lieferschein',
'Projecttransactions' => 'Projektbuchungen',
'Purchase Orders' => 'Lieferantenaufträge',
'Quotations' => 'Angebote',
- 'RFQs' => 'Anfragen',
+ 'RFQs' => 'Preisanfragen',
'Receipt' => 'Zahlungseingang',
'Receipts' => 'Zahlungseingänge',
'Reconciliation' => 'Kontenabgleich',
'Shipto' => 'Lieferanschriften',
'Stylesheet' => 'Stilvorlage',
'System' => 'System',
+ 'Taxes' => 'Steuern',
+ 'Templates' => 'Vorlagen',
'Trial Balance' => 'Saldenbilanz',
- 'Type of Business' => 'Kundentyp',
+ 'Type of Business' => 'Kunden-/Lieferantentyp',
'UStVa' => 'UStVa',
'UStVa Einstellungen' => 'UStVa Einstellungen',
'Units' => 'Einheiten',
$self->{texts} = {
- 'Logout' => 'Abmeldung',
};
$self->{subs} = {
'acc_menu' => 'acc_menu',
'clock_line' => 'clock_line',
'display' => 'display',
- 'my_length' => 'my_length',
'print_menu' => 'print_menu',
};
' Date missing!' => ' Datum fehlt!',
' missing!' => ' fehlt!',
'*/' => '*/',
- 'Accounting Menu' => 'Kontoverwaltung',
- 'Add' => 'Erfassen',
+ 'ADDED' => 'Hinzugefügt',
'Add Exchangerate' => 'Wechselkurs erfassen',
'Add Purchase Order' => 'Lieferantenauftrag erfassen',
'Add Quotation' => 'Angebot erfassen',
'Are you sure you want to delete Order Number' => 'Soll der Auftrag mit folgender Nummer wirklich gelöscht werden:',
'Are you sure you want to delete Quotation Number' => 'Sind Sie sicher, dass Angebotnummer gelöscht werden soll?',
'Attachment' => 'als Anhang',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
'Aug' => 'Aug',
'August' => 'August',
'Bcc' => 'Bcc',
'Bin' => 'Lagerplatz',
'Bin List' => 'Lagerliste',
'Bis' => 'bis',
- 'Business' => 'Firma',
- 'C' => 'G',
+ 'CANCELED' => 'Storniert',
+ 'CSV export -- options' => 'CSV-Export -- Optionen',
'Cannot delete order!' => 'Auftrag kann nicht gelöscht werden!',
'Cannot delete quotation!' => 'Angebot kann nicht gelöscht werden!',
'Cannot save order!' => 'Auftrag kann nicht gespeichert werden!',
'Contact' => 'Kontakt',
'Contact Person' => 'Ansprechpartner',
'Continue' => 'Weiter',
- 'Copies' => 'Kopien',
- 'Could not save!' => 'Konnte nicht speichern!',
- 'Could not transfer Inventory!' => 'Konnte Waren nicht umlagern!',
+ 'Could not spawn html2ps or GhostScript.' => 'html2ps oder GhostScript konnte nicht gestartet werden.',
+ 'Could not spawn the printer command.' => 'Die Druckanwendung konnte nicht gestartet werden.',
+ 'Could not write the html2ps config file.' => 'Die temporäre html2ps-Konfigurationsdatei konnte nicht geschrieben werden.',
+ 'Could not write the temporary HTML file.' => 'Eine temporäre HTML-Datei konnte nicht geschrieben werden.',
'Country' => 'Land',
'Credit Limit' => 'Kreditlimit',
'Credit Limit exceeded!!!' => 'Kreditlimit überschritten!',
'Customer' => 'Kunde',
'Customer Number' => 'Kundennummer',
'Customer Order Number' => 'Bestellnummer des Kunden',
+ 'Customer details' => 'Kundendetails',
'Customer missing!' => 'Kundenname fehlt!',
+ 'Customer not on file or locked!' => 'Dieser Kunde existiert nicht oder ist gesperrt.',
'Customer not on file!' => 'Kunde ist nicht in der Datenbank!',
+ 'Customer type' => 'Kundentyp',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
'Date' => 'Datum',
- 'Date Received' => 'Empfangsdatum',
- 'Date received missing!' => 'Empfangsdatum fehlt!',
'Dec' => 'Dez',
'December' => 'Dezember',
'Delete' => 'Löschen',
+ 'Delivered' => 'Geliefert',
'Delivery Date' => 'Lieferdatum',
'Department' => 'Abteilung',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Description' => 'Beschreibung',
+ 'Directory' => 'Verzeichnis',
'Discount' => 'Rabatt',
- 'Done' => 'Fertig',
'Dunning Amount' => 'gemahnter Betrag',
'E-mail' => 'eMail',
'E-mail address missing!' => 'E-Mail-Adresse fehlt!',
- 'E-mailed' => 'eMail gesendet.',
+ 'EK' => 'EK',
+ 'ELSE' => 'Zusatz',
'Edit Purchase Order' => 'Lieferantenaufrag bearbeiten',
'Edit Quotation' => 'Angebot bearbeiten',
'Edit Request for Quotation' => 'Anfrage bearbeiten',
'Edit the sales_quotation' => 'Bearbeiten des Angebots',
'Employee' => 'Bearbeiter',
'Enter longdescription' => 'Langtext eingeben',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
+ 'Ertrag' => 'Ertrag',
+ 'Ertrag prozentual' => 'Ertrag prozentual',
'Exchangerate' => 'Wechselkurs',
'Exchangerate missing!' => 'Es fehlt der Wechselkurs!',
'Extended' => 'Gesamt',
+ 'Falsches Datumsformat!' => 'Falsches Datumsformat!',
'Fax' => 'Fax',
'Feb' => 'Feb',
'February' => 'Februar',
+ 'File' => 'Datei',
'From' => 'Von',
'Group' => 'Warengruppe',
- 'Group Items' => 'Waren gruppieren',
+ 'History' => 'Historie',
'ID' => 'Buchungsnummer',
'In-line' => 'im Text',
'Include in Report' => 'In Bericht aufnehmen',
'Internal Notes' => 'interne Bemerkungen',
- 'Inventory saved!' => 'Inventar gespeichert.',
- 'Inventory transferred!' => 'Inventar umgelagert.',
'Invoice' => 'Rechnung',
'Invoice Date missing!' => 'Rechnungsdatum fehlt!',
'Invoice Number missing!' => 'Rechnungsnummer fehlt!',
'Jun' => 'Jun',
'June' => 'Juni',
'L' => 'L',
+ 'LP' => 'LP',
'License' => 'Lizenz',
+ 'MAILED' => 'Gesendet',
'Mar' => 'März',
'March' => 'März',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
'Max. Dunning Level' => 'höchste Mahnstufe',
'May' => 'Mai',
'May ' => 'Mai',
'Message' => 'Nachricht',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
'Name' => 'Name',
+ 'No' => 'Nein',
'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'No.' => 'Position',
+ 'Not delivered' => 'Nicht geliefert',
'Notes' => 'Bemerkungen',
- 'Nothing entered!' => 'Es wurde nichts eingegeben.',
- 'Nothing to transfer!' => 'Es gibt nichts zum Umlagern!',
'Nov' => 'Nov',
'November' => 'November',
'Number' => 'Nummer',
'Number missing in Row' => 'Nummer fehlt in Zeile',
- 'O' => 'O',
'Oct' => 'Okt',
'October' => 'Oktober',
'Open' => 'Offen',
'Order Number' => 'Auftragsnummer',
'Order Number missing!' => 'Auftragsnummer fehlt!',
'Order deleted!' => 'Auftrag gelöscht!',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
'PDF' => 'PDF',
'PDF (OpenDocument/OASIS)' => 'PDF (OpenDocument/OASIS)',
+ 'PDF export -- options' => 'PDF-Export -- Optionen',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
'Packing List' => 'Lieferschein',
'Packing List Date missing!' => 'Datum für Verpackungsliste fehlt!',
'Packing List Number missing!' => 'Verpackungslistennummer fehlt!',
'Price' => 'Preis',
'Pricegroup' => 'Preisgruppe',
'Print' => 'Drucken',
- 'Printed' => 'gedruckt.',
'Printer' => 'Drucker',
'Proforma Invoice' => 'Proformarechnung',
'Project' => 'Projekt',
'Purchase Orders' => 'Lieferantenaufträge',
'Qty' => 'Menge',
'Queue' => 'Warteschlange',
- 'Queued' => 'In Warteschlange eingereiht.',
'Quotation' => 'Angebot',
'Quotation Date' => 'Angebotsdatum',
'Quotation Date missing!' => 'Angebotsdatum fehlt!',
'Quotations' => 'Angebote',
'RFQ' => 'Anfrage',
'RFQ Number' => 'Anfragenummer',
- 'Recd' => 'erhalten',
- 'Receive Merchandise' => 'Waren einlagern',
'Remaining' => 'Rest',
'Reqdate' => 'Lieferdatum',
'Request for Quotation' => 'Anfrage',
'Request for Quotations' => 'Anfragen',
'Required by' => 'Lieferdatum',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
'Sales Order' => 'Kundenauftrag',
'Sales Orders' => 'Aufträge',
+ 'Salesman' => 'Verkäufer/in',
'Salesperson' => 'Verkäufer',
'Save' => 'Speichern',
'Save and Close' => 'Speichern und schließen',
'Serial No.' => 'Seriennummer',
'Service' => 'Dienstleistung',
'Ship' => 'Lagerausgang',
- 'Ship Merchandise' => 'Waren versenden',
+ 'Ship rcvd' => 'Lagereingang',
'Ship to' => 'Lieferadresse',
'Ship via' => 'Transportmittel',
'Shipping Address' => 'Lieferadresse',
- 'Shipping Date' => 'Lieferdatum',
- 'Shipping Date missing!' => 'Lieferdatum fehlt.',
'Shipping Point' => 'Versandort',
'Show details' => 'Details anzeigen',
'Steuersatz' => 'Steuersatz',
'Subtotal' => 'Zwischensumme',
'Tax' => 'Steuer',
'Tax Included' => 'Steuer im Preis inbegriffen',
- 'To' => 'An',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'The list has been printed.' => 'Die Liste wurde ausgedruckt.',
+ 'To (email)' => 'An',
'Total' => 'Summe',
'Trade Discount' => 'Rabatt',
- 'Transfer' => 'Umlagerung',
- 'Transfer Inventory' => 'Ware umlagern',
- 'Transfer to' => 'umlagern nach',
+ 'Transaction description' => 'Vorgangsbezeichnung',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
'Unit' => 'Einheit',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
'Update' => 'Erneuern',
'Valid until' => 'gültig bis',
'Value' => 'Wert',
'Variable' => 'Variable',
'Vendor' => 'Lieferant',
'Vendor Number' => 'Lieferantennummer',
+ 'Vendor details' => 'Lieferantendetails',
'Vendor missing!' => 'Lieferant fehlt!',
+ 'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!',
- 'Warehouse' => 'Lager',
+ 'Vendor type' => 'Lieferantentyp',
'What type of item is this?' => 'Was ist dieser Artikel?',
'Workflow purchase_order' => 'Workflow Lieferantenauftrag',
'Workflow request_quotation' => 'Workflow Preisanfrage',
'Workflow sales_quotation' => 'Workflow Angebot',
'Yes' => 'Ja',
'Zipcode' => 'PLZ',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
'button' => '?',
'ea' => 'St.',
'emailed to' => 'gemailt an',
+ 'history' => 'Historie',
+ 'invoice' => 'Rechnung',
+ 'no' => 'nein',
'none (pricegroup)' => 'keine',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'purchase_order_list' => 'lieferantenauftragsliste',
+ 'quotation_list' => 'angebotsliste',
+ 'report_generator_dispatch_to is not defined.' => 'report_generator_dispatch_to ist nicht definiert.',
+ 'report_generator_nextsub is not defined.' => 'report_generator_nextsub ist nicht definiert.',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'rfq_list' => 'anfragenliste',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_order_list' => 'auftragsliste',
+ 'sales_quotation' => 'Verkaufsangebot',
'saved!' => 'gespeichert',
'sent' => 'gesendet',
'sent to printer' => 'an Drucker geschickt',
+ 'wrongformat' => 'Falsches Format',
+ 'yes' => 'ja',
};
$self->{subs} = {
+ 'E' => 'E',
'H' => 'H',
- 'acc_menu' => 'acc_menu',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
'add' => 'add',
'add_transaction' => 'add_transaction',
'ap_transaction' => 'ap_transaction',
'ar_transaction' => 'ar_transaction',
'backorder_exchangerate' => 'backorder_exchangerate',
+ 'build_std_url' => 'build_std_url',
'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
+ 'check_delivered_flag' => 'check_delivered_flag',
+ 'check_for_direct_delivery' => 'check_for_direct_delivery',
+ 'check_for_direct_delivery_no' => 'check_for_direct_delivery_no',
+ 'check_for_direct_delivery_yes' => 'check_for_direct_delivery_yes',
'check_form' => 'check_form',
'check_name' => 'check_name',
'check_project' => 'check_project',
'continue' => 'continue',
'create_backorder' => 'create_backorder',
+ 'create_subtotal_row' => 'create_subtotal_row',
'customer_details' => 'customer_details',
'delete' => 'delete',
+ 'delete_order_quotation' => 'delete_order_quotation',
'delivery_customer_selection' => 'delivery_customer_selection',
- 'display' => 'display',
'display_form' => 'display_form',
'display_row' => 'display_row',
- 'display_ship_receive' => 'display_ship_receive',
- 'done' => 'done',
'e_mail' => 'e_mail',
'edit' => 'edit',
+ 'edit_e_mail' => 'edit_e_mail',
'employee_selection_internal' => 'employee_selection_internal',
'form_footer' => 'form_footer',
'form_header' => 'form_header',
'invoice' => 'invoice',
'invoicetotal' => 'invoicetotal',
'item_selected' => 'item_selected',
- 'list_transfer' => 'list_transfer',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
'name_selected' => 'name_selected',
'new_item' => 'new_item',
'new_license' => 'new_license',
+ 'no' => 'no',
'order' => 'order',
'order_links' => 'order_links',
'orders' => 'orders',
'quotation' => 'quotation',
'reformat_numbers' => 'reformat_numbers',
'relink_accounts' => 'relink_accounts',
+ 'report_generator_back' => 'report_generator_back',
+ 'report_generator_dispatcher' => 'report_generator_dispatcher',
+ 'report_generator_do' => 'report_generator_do',
+ 'report_generator_export_as_csv' => 'report_generator_export_as_csv',
+ 'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
'request_for_quotation' => 'request_for_quotation',
- 'restore_form' => 'restore_form',
'sales_invoice' => 'sales_invoice',
'sales_order' => 'sales_order',
'save' => 'save',
'save_and_close' => 'save_and_close',
'save_as_new' => 'save_as_new',
'save_exchangerate' => 'save_exchangerate',
- 'save_form' => 'save_form',
'search' => 'search',
- 'search_transfer' => 'search_transfer',
- 'section_menu' => 'section_menu',
'select_employee' => 'select_employee',
'select_employee_internal' => 'select_employee_internal',
'select_item' => 'select_item',
'set_headings' => 'set_headings',
'set_longdescription' => 'set_longdescription',
'set_pricegroup' => 'set_pricegroup',
- 'ship_receive' => 'ship_receive',
'ship_to' => 'ship_to',
- 'subtotal' => 'subtotal',
- 'transfer' => 'transfer',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
'update' => 'update',
'validate_items' => 'validate_items',
'vendor_details' => 'vendor_details',
'vendor_invoice' => 'vendor_invoice',
'vendor_selection' => 'vendor_selection',
'yes' => 'yes',
- 'erfassen' => 'add',
'weiter' => 'continue',
'löschen' => 'delete',
- 'fertig' => 'done',
'email' => 'e_mail',
'rechnung' => 'invoice',
+ 'nein' => 'no',
'auftrag' => 'order',
'drucken' => 'print',
'lieferantenauftrag' => 'purchase_order',
'speichern_und_schließen' => 'save_and_close',
'als_neu_speichern' => 'save_as_new',
'lieferadresse' => 'ship_to',
- 'umlagerung' => 'transfer',
'erneuern' => 'update',
'ja' => 'yes',
};
$self->{texts} = {
- 'Accounting Menu' => 'Kontoverwaltung',
+ 'ADDED' => 'Hinzugefügt',
+ 'Active' => 'Aktiv',
'Add' => 'Erfassen',
'Add Group' => 'Warengruppe erfassen',
'Add Pricegroup' => 'Preisgruppe erfassen',
'Add Project' => 'Projekt erfassen',
+ 'Address' => 'Adresse',
'All' => 'Alle',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
+ 'Bcc' => 'Bcc',
+ 'Bin List' => 'Lagerliste',
+ 'Both' => 'Sowohl als auch',
+ 'CANCELED' => 'Storniert',
+ 'Cc' => 'Cc',
+ 'Confirmation' => 'Auftragsbestätigung',
'Continue' => 'Weiter',
+ 'Credit Note' => 'Gutschrift',
+ 'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
+ 'Date' => 'Datum',
'Delete' => 'Löschen',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Description' => 'Beschreibung',
+ 'Directory' => 'Verzeichnis',
+ 'ELSE' => 'Zusatz',
'Edit Group' => 'Warengruppe editieren',
'Edit Pricegroup' => 'Preisgruppe bearbeiten',
'Edit Project' => 'Projekt bearbeiten',
+ 'Enter longdescription' => 'Langtext eingeben',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
+ 'File' => 'Datei',
'Group' => 'Warengruppe',
'Group deleted!' => 'Warengruppe gelöscht!',
'Group missing!' => 'Warengruppe fehlt!',
'Group saved!' => 'Warengruppe gespeichert!',
'Groups' => 'Warengruppen',
+ 'History' => 'Historie',
+ 'Inactive' => 'Inaktiv',
+ 'Invoice' => 'Rechnung',
+ 'MAILED' => 'Gesendet',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
+ 'Message' => 'Nachricht',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
+ 'Name' => 'Name',
+ 'No' => 'Nein',
+ 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
+ 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
+ 'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
+ 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
+ 'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'Number' => 'Nummer',
'Orphaned' => 'Nie benutzt',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
+ 'Part Number' => 'Artikelnummer',
+ 'Part description' => 'Artikelbeschreibung',
+ 'Pick List' => 'Sammelliste',
+ 'Please enter values' => 'Bitte Werte eingeben',
'Preisgruppe' => 'Preisgruppe',
'Pricegroup' => 'Preisgruppe',
'Pricegroup deleted!' => 'Preisgruppe gelöscht!',
'Pricegroup missing!' => 'Preisgruppe fehlt!',
'Pricegroup saved!' => 'Preisgruppe gespeichert!',
+ 'Proforma Invoice' => 'Proformarechnung',
'Project' => 'Projekt',
+ 'Project Number' => 'Projektnummer',
'Project Number missing!' => 'Projektnummer fehlt!',
'Project deleted!' => 'Projekt gelöscht!',
+ 'Project description' => 'Projektbeschreibung',
'Project saved!' => 'Projekt gespeichert!',
'Projects' => 'Projekte',
+ 'Purchase Order' => 'Lieferantenauftrag',
+ 'Quotation' => 'Angebot',
+ 'RFQ' => 'Anfrage',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
'Save' => 'Speichern',
+ 'Select a Customer' => 'Endkunde auswählen',
+ 'Select a part' => 'Artikel auswählen',
+ 'Select a project' => 'Projekt auswählen',
+ 'Select an employee' => 'Angestellten auswählen',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
+ 'Subject' => 'Betreff',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'To (email)' => 'An',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
+ 'Unit' => 'Einheit',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
+ 'Value' => 'Wert',
+ 'Variable' => 'Variable',
+ 'Vendor details' => 'Lieferantendetails',
+ 'Yes' => 'Ja',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
+ 'history' => 'Historie',
+ 'invoice' => 'Rechnung',
+ 'no' => 'nein',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
+ 'yes' => 'ja',
};
$self->{subs} = {
- 'acc_menu' => 'acc_menu',
+ 'E' => 'E',
+ 'H' => 'H',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
'add' => 'add',
+ 'build_std_url' => 'build_std_url',
+ 'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'continue' => 'continue',
'delete' => 'delete',
- 'display' => 'display',
+ 'delivery_customer_selection' => 'delivery_customer_selection',
'edit' => 'edit',
+ 'employee_selection_internal' => 'employee_selection_internal',
'form_partsgroup_footer' => 'form_partsgroup_footer',
'form_partsgroup_header' => 'form_partsgroup_header',
'form_pricegroup_footer' => 'form_pricegroup_footer',
'form_pricegroup_header' => 'form_pricegroup_header',
'form_project_footer' => 'form_project_footer',
'form_project_header' => 'form_project_header',
+ 'format_dates' => 'format_dates',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
+ 'part_selection_internal' => 'part_selection_internal',
'partsgroup_report' => 'partsgroup_report',
'pricegroup_report' => 'pricegroup_report',
'project_report' => 'project_report',
+ 'project_selection_internal' => 'project_selection_internal',
+ 'reformat_numbers' => 'reformat_numbers',
'save' => 'save',
'search' => 'search',
- 'section_menu' => 'section_menu',
+ 'select_employee' => 'select_employee',
+ 'select_employee_internal' => 'select_employee_internal',
+ 'select_part' => 'select_part',
+ 'select_part_internal' => 'select_part_internal',
+ 'set_longdescription' => 'set_longdescription',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
+ 'vendor_selection' => 'vendor_selection',
'erfassen' => 'add',
'weiter' => 'continue',
'löschen' => 'delete',
$self->{texts} = {
+ 'ADDED' => 'Hinzugefügt',
'Account' => 'Konto',
- 'Accounting Menu' => 'Kontoverwaltung',
+ 'Address' => 'Adresse',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
'Balance' => 'Bilanz',
+ 'Bcc' => 'Bcc',
+ 'Bin List' => 'Lagerliste',
+ 'CANCELED' => 'Storniert',
+ 'Cc' => 'Cc',
'Cleared Balance' => 'abgeschlossen',
+ 'Confirmation' => 'Auftragsbestätigung',
'Continue' => 'Weiter',
+ 'Credit Note' => 'Gutschrift',
+ 'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
'Date' => 'Datum',
'Decrease' => 'Verringern',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Deposit' => 'Gutschrift',
'Description' => 'Beschreibung',
'Difference' => 'Differenz',
+ 'Directory' => 'Verzeichnis',
'Done' => 'Fertig',
+ 'ELSE' => 'Zusatz',
+ 'Enter longdescription' => 'Langtext eingeben',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
'Exchangerate Difference' => 'Wechselkursunterschied',
+ 'Falsches Datumsformat!' => 'Falsches Datumsformat!',
+ 'File' => 'Datei',
'From' => 'Von',
+ 'History' => 'Historie',
'Increase' => 'Erhöhen',
+ 'Invoice' => 'Rechnung',
+ 'MAILED' => 'Gesendet',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
+ 'Message' => 'Nachricht',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
+ 'Name' => 'Name',
+ 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
+ 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
+ 'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
+ 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
+ 'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'Out of balance!' => 'Summen stimmen nicht berein!',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
+ 'Part Number' => 'Artikelnummer',
+ 'Part description' => 'Artikelbeschreibung',
'Payment' => 'Zahlungsausgang',
+ 'Pick List' => 'Sammelliste',
+ 'Please enter values' => 'Bitte Werte eingeben',
+ 'Proforma Invoice' => 'Proformarechnung',
+ 'Project Number' => 'Projektnummer',
+ 'Project description' => 'Projektbeschreibung',
+ 'Purchase Order' => 'Lieferantenauftrag',
+ 'Quotation' => 'Angebot',
+ 'RFQ' => 'Anfrage',
'Reconciliation' => 'Kontenabgleich',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
+ 'Select a Customer' => 'Endkunde auswählen',
+ 'Select a part' => 'Artikel auswählen',
+ 'Select a project' => 'Projekt auswählen',
'Select all' => 'Alle auswählen',
+ 'Select an employee' => 'Angestellten auswählen',
'Source' => 'Beleg',
'Statement Balance' => 'Sammelrechnungsbilanz',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
+ 'Subject' => 'Betreff',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'To (email)' => 'An',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
+ 'Unit' => 'Einheit',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
'Until' => 'Bis',
'Update' => 'Erneuern',
+ 'Value' => 'Wert',
+ 'Variable' => 'Variable',
+ 'Vendor details' => 'Lieferantendetails',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
+ 'invoice' => 'Rechnung',
+ 'no' => 'nein',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
+ 'yes' => 'ja',
};
$self->{subs} = {
- 'acc_menu' => 'acc_menu',
+ 'E' => 'E',
+ 'H' => 'H',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
+ 'build_std_url' => 'build_std_url',
+ 'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'continue' => 'continue',
- 'display' => 'display',
+ 'delivery_customer_selection' => 'delivery_customer_selection',
'display_form' => 'display_form',
'done' => 'done',
+ 'employee_selection_internal' => 'employee_selection_internal',
+ 'format_dates' => 'format_dates',
'get_payments' => 'get_payments',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
+ 'part_selection_internal' => 'part_selection_internal',
+ 'project_selection_internal' => 'project_selection_internal',
'reconciliation' => 'reconciliation',
- 'section_menu' => 'section_menu',
+ 'reformat_numbers' => 'reformat_numbers',
'select_all' => 'select_all',
+ 'select_employee' => 'select_employee',
+ 'select_employee_internal' => 'select_employee_internal',
+ 'select_part' => 'select_part',
+ 'select_part_internal' => 'select_part_internal',
+ 'set_longdescription' => 'set_longdescription',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
'update' => 'update',
+ 'vendor_selection' => 'vendor_selection',
'weiter' => 'continue',
'fertig' => 'done',
'alle_auswählen' => 'select_all',
--- /dev/null
+$self->{texts} = {
+ 'ADDED' => 'Hinzugefügt',
+ 'Bcc' => 'Bcc',
+ 'Bin List' => 'Lagerliste',
+ 'CANCELED' => 'Storniert',
+ 'CSV export -- options' => 'CSV-Export -- Optionen',
+ 'Cc' => 'Cc',
+ 'Confirmation' => 'Auftragsbestätigung',
+ 'Could not spawn html2ps or GhostScript.' => 'html2ps oder GhostScript konnte nicht gestartet werden.',
+ 'Could not spawn the printer command.' => 'Die Druckanwendung konnte nicht gestartet werden.',
+ 'Could not write the html2ps config file.' => 'Die temporäre html2ps-Konfigurationsdatei konnte nicht geschrieben werden.',
+ 'Could not write the temporary HTML file.' => 'Eine temporäre HTML-Datei konnte nicht geschrieben werden.',
+ 'Credit Note' => 'Gutschrift',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
+ 'Date' => 'Datum',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
+ 'Directory' => 'Verzeichnis',
+ 'ELSE' => 'Zusatz',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
+ 'File' => 'Datei',
+ 'Invoice' => 'Rechnung',
+ 'MAILED' => 'Gesendet',
+ 'Message' => 'Nachricht',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
+ 'PDF export -- options' => 'PDF-Export -- Optionen',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
+ 'Pick List' => 'Sammelliste',
+ 'Proforma Invoice' => 'Proformarechnung',
+ 'Purchase Order' => 'Lieferantenauftrag',
+ 'Quotation' => 'Angebot',
+ 'RFQ' => 'Anfrage',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
+ 'Subject' => 'Betreff',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'The list has been printed.' => 'Die Liste wurde ausgedruckt.',
+ 'To (email)' => 'An',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
+ '[email]' => '[email]',
+ 'bin_list' => 'Lagerliste',
+ 'invoice' => 'Rechnung',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'report_generator_dispatch_to is not defined.' => 'report_generator_dispatch_to ist nicht definiert.',
+ 'report_generator_nextsub is not defined.' => 'report_generator_nextsub ist nicht definiert.',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
+};
+
+$self->{subs} = {
+ 'report_generator_back' => 'report_generator_back',
+ 'report_generator_dispatcher' => 'report_generator_dispatcher',
+ 'report_generator_do' => 'report_generator_do',
+ 'report_generator_export_as_csv' => 'report_generator_export_as_csv',
+ 'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
+ 'weiter' => 'continue',
+};
+
+1;
$self->{texts} = {
+ 'ADDED' => 'Hinzugefügt',
'AP Aging' => 'Offene Verbindlichkeiten',
'AR Aging' => 'Offene Forderungen',
'Account' => 'Konto',
'Account Number' => 'Kontonummer',
- 'Accounting Menu' => 'Kontoverwaltung',
'Accrual' => 'Bilanzierung',
'Address' => 'Adresse',
'All Accounts' => 'Alle Konten',
'Apr' => 'Apr',
'April' => 'April',
'Attachment' => 'als Anhang',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
'Aug' => 'Aug',
'August' => 'August',
'Balance' => 'Bilanz',
'Balance Sheet' => 'Bilanz',
'Bcc' => 'Bcc',
+ 'Bin List' => 'Lagerliste',
'Bis' => 'bis',
+ 'CANCELED' => 'Storniert',
+ 'CSV export -- options' => 'CSV-Export -- Optionen',
'Cc' => 'Cc',
'Compare to' => 'Gegenüberstellen zu',
+ 'Confirmation' => 'Auftragsbestätigung',
'Continue' => 'Weiter',
'Copies' => 'Kopien',
+ 'Could not spawn html2ps or GhostScript.' => 'html2ps oder GhostScript konnte nicht gestartet werden.',
+ 'Could not spawn the printer command.' => 'Die Druckanwendung konnte nicht gestartet werden.',
+ 'Could not write the html2ps config file.' => 'Die temporäre html2ps-Konfigurationsdatei konnte nicht geschrieben werden.',
+ 'Could not write the temporary HTML file.' => 'Eine temporäre HTML-Datei konnte nicht geschrieben werden.',
'Credit' => 'Haben',
+ 'Credit Note' => 'Gutschrift',
'Current' => 'Betrag',
'Current Earnings' => 'Gewinn',
'Customer' => 'Kunde',
+ 'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
+ 'Customer not on file or locked!' => 'Dieser Kunde existiert nicht oder ist gesperrt.',
'Customer not on file!' => 'Kunde ist nicht in der Datenbank!',
'Customized Report' => 'Vorgewählte Zeiträume',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
+ 'Dataset upgrade' => 'Datenbankaktualisierung',
'Date' => 'Datum',
'Debit' => 'Soll',
'Dec' => 'Dez',
'December' => 'Dezember',
'Decimalplaces' => 'Dezimalstellen',
'Department' => 'Abteilung',
+ 'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Description' => 'Beschreibung',
+ 'Directory' => 'Verzeichnis',
'Due' => 'Fällig',
'E-mail' => 'eMail',
'E-mail Statement to' => 'Fälligkeitsabrechnung als eMail an',
+ 'ELSE' => 'Zusatz',
'EUR' => 'E/Ü-Rechnung',
+ 'Enter longdescription' => 'Langtext eingeben',
+ 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
+ 'Falsches Datumsformat!' => 'Falsches Datumsformat!',
'Feb' => 'Feb',
'February' => 'Februar',
+ 'File' => 'Datei',
'Free report period' => 'Freier Zeitraum',
'From' => 'Von',
- 'GIFI' => 'GIFI',
'HTML' => 'HTML',
'Heading' => 'Überschrift',
+ 'History' => 'Historie',
'ID' => 'Buchungsnummer',
'In-line' => 'im Text',
'Include Exchangerate Difference' => 'Wechselkursunterschied einbeziehen',
'July' => 'Juli',
'Jun' => 'Jun',
'June' => 'Juni',
+ 'MAILED' => 'Gesendet',
'Mar' => 'März',
'March' => 'März',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
'May' => 'Mai',
'May ' => 'Mai',
'Memo' => 'Memo',
'Message' => 'Nachricht',
'Method' => 'Verfahren',
+ 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
+ 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
'Monthly' => 'monatlich',
- 'N/A' => 'N.Z.',
+ 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
+ 'Name' => 'Name',
+ 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
+ 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
+ 'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
+ 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
+ 'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'Non-taxable Purchases' => 'Nicht zu versteuernde Einkäufe',
'Non-taxable Sales' => 'Nicht zu versteuernde Verkäufe',
'Nothing selected!' => 'Es wurde nichts ausgewählt!',
'Number' => 'Nummer',
'Oct' => 'Okt',
'October' => 'Oktober',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
'PDF' => 'PDF',
+ 'PDF export -- options' => 'PDF-Export -- Optionen',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
+ 'Part Number' => 'Artikelnummer',
+ 'Part description' => 'Artikelbeschreibung',
'Payments' => 'Zahlungsausgänge',
+ 'Pick List' => 'Sammelliste',
+ 'Please enter values' => 'Bitte Werte eingeben',
'Postscript' => 'Postscript',
- 'Print' => 'Drucken',
'Printer' => 'Drucker',
+ 'Proforma Invoice' => 'Proformarechnung',
'Project' => 'Projekt',
'Project Number' => 'Projektnummer',
'Project Transactions' => 'Projektbuchungen',
+ 'Project description' => 'Projektbeschreibung',
'Project not on file!' => 'Dieses Projekt ist nicht in der Datenbank!',
+ 'Purchase Order' => 'Lieferantenauftrag',
'Quarter' => 'Quartal',
'Quarterly' => 'quartalsweise',
+ 'Quotation' => 'Angebot',
+ 'RFQ' => 'Anfrage',
'Receipts' => 'Zahlungseingänge',
'Reference' => 'Referenz',
'Report for' => 'Bericht für',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
'Screen' => 'Bildschirm',
- 'Select all' => 'Alle auswählen',
+ 'Select a Customer' => 'Endkunde auswählen',
+ 'Select a part' => 'Artikel auswählen',
+ 'Select a project' => 'Projekt auswählen',
+ 'Select an employee' => 'Angestellten auswählen',
'Select from one of the names below' => 'Wählen Sie einen der untenstehenden Namen',
'Select from one of the projects below' => 'Wählen Sie eines der untenstehenden Projekte',
'Select postscript or PDF!' => 'Postscript oder PDF auswählen!',
'Statement' => 'Sammelrechnung',
'Statement sent to' => 'Sammelrechnung verschickt an',
'Statements sent to printer!' => 'Sammelrechnungen an Drucker geschickt!',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
'Subject' => 'Betreff',
'Subtotal' => 'Zwischensumme',
'Tax' => 'Steuer',
'Tax collected' => 'vereinnahmte Steuer',
'Tax paid' => 'Vorsteuer',
+ 'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'The list has been printed.' => 'Die Liste wurde ausgedruckt.',
+ 'To (email)' => 'An',
'Total' => 'Summe',
'Trial Balance' => 'Saldenbilanz',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
+ 'Unit' => 'Einheit',
+ 'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
+ 'Value' => 'Wert',
+ 'Variable' => 'Variable',
'Vendor' => 'Lieferant',
+ 'Vendor details' => 'Lieferantendetails',
+ 'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!',
'YYYY' => 'JJJJ',
'Year' => 'Jahr',
'Yearly' => 'jährlich',
'Zeitraum' => 'Zeitraum',
+ '[email]' => '[email]',
+ 'ap_aging_list' => 'liste_offene_verbindlichkeiten',
+ 'ar_aging_list' => 'liste_offene_forderungen',
'as at' => 'zum Stand',
+ 'bin_list' => 'Lagerliste',
'bis' => 'bis',
'button' => '?',
'config' => 'Konfiguration',
'debug' => 'Debug',
'for Period' => 'für den Zeitraum',
+ 'invoice' => 'Rechnung',
+ 'list_of_payments' => 'zahlungsausgaenge',
+ 'list_of_receipts' => 'zahlungseingaenge',
+ 'list_of_transactions' => 'buchungsliste',
+ 'no' => 'nein',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'report_generator_dispatch_to is not defined.' => 'report_generator_dispatch_to ist nicht definiert.',
+ 'report_generator_nextsub is not defined.' => 'report_generator_nextsub ist nicht definiert.',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
'ustva' => 'UStVA',
'winston_export' => 'Winston-Export',
+ 'wrongformat' => 'Falsches Format',
+ 'yes' => 'ja',
};
$self->{subs} = {
- 'acc_menu' => 'acc_menu',
+ 'E' => 'E',
+ 'H' => 'H',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
'add_transaction' => 'add_transaction',
'aging' => 'aging',
'ap_transaction' => 'ap_transaction',
'ar_transaction' => 'ar_transaction',
+ 'build_std_url' => 'build_std_url',
+ 'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'check_name' => 'check_name',
'check_project' => 'check_project',
'config' => 'config',
'continue' => 'continue',
+ 'create_aging_subtotal_row' => 'create_aging_subtotal_row',
+ 'create_list_accounts_subtotal_row' => 'create_list_accounts_subtotal_row',
'debug' => 'debug',
- 'display' => 'display',
+ 'delivery_customer_selection' => 'delivery_customer_selection',
'e_mail' => 'e_mail',
+ 'employee_selection_internal' => 'employee_selection_internal',
+ 'format_dates' => 'format_dates',
'generate_ap_aging' => 'generate_ap_aging',
'generate_ar_aging' => 'generate_ar_aging',
'generate_balance_sheet' => 'generate_balance_sheet',
'gl_transaction' => 'gl_transaction',
'list_accounts' => 'list_accounts',
'list_payments' => 'list_payments',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
'name_selected' => 'name_selected',
+ 'part_selection_internal' => 'part_selection_internal',
'print' => 'print',
'print_form' => 'print_form',
'print_options' => 'print_options',
'project_selected' => 'project_selected',
+ 'project_selection_internal' => 'project_selection_internal',
+ 'reformat_numbers' => 'reformat_numbers',
'report' => 'report',
+ 'report_generator_back' => 'report_generator_back',
+ 'report_generator_dispatcher' => 'report_generator_dispatcher',
+ 'report_generator_do' => 'report_generator_do',
+ 'report_generator_export_as_csv' => 'report_generator_export_as_csv',
+ 'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
'sales_invoice' => 'sales_invoice',
- 'section_menu' => 'section_menu',
'select_all' => 'select_all',
+ 'select_employee' => 'select_employee',
+ 'select_employee_internal' => 'select_employee_internal',
'select_name' => 'select_name',
+ 'select_part' => 'select_part',
+ 'select_part_internal' => 'select_part_internal',
'select_project' => 'select_project',
'send_email' => 'send_email',
+ 'set_longdescription' => 'set_longdescription',
+ 'show_history' => 'show_history',
+ 'show_vc_details' => 'show_vc_details',
'statement_details' => 'statement_details',
'tax_subtotal' => 'tax_subtotal',
'vendor_invoice' => 'vendor_invoice',
+ 'vendor_selection' => 'vendor_selection',
'winston_export' => 'winston_export',
'weiter' => 'continue',
'email' => 'e_mail',
'2. Quarter' => '2. Quartal',
'3. Quarter' => '3. Quartal',
'4. Quarter' => '4. Quartal',
- 'Account' => 'Konto',
- 'Account Nummer' => 'Kontonummer',
+ 'ADDED' => 'Hinzugefügt',
'Address' => 'Adresse',
'Amended Advance Turnover Tax Return' => 'Berichtigte Anmeldung',
'Amended Advance Turnover Tax Return (Nr. 10)' => 'Ist dies eine berichtigte Anmeldung? (Nr. 10/Zeile 15 Steuererklärung)',
'Application Error. Wrong Format' => 'Fehler in der Anwendung. Falsches Format: ',
'Apr' => 'Apr',
'April' => 'April',
- 'Assume Tax Consultant Data in Tax Computation?' => 'Beraterdaten in UStVA übernehmen?',
+ 'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
'Aug' => 'Aug',
'August' => 'August',
- 'Bank' => 'Bank',
- 'Bank Code' => 'BLZ: ',
- 'Bank Code (long)' => 'Bankleitzahl (BLZ)',
- 'Bank Connection' => 'Bankverbindung',
- 'Bank Connection Tax Office' => 'Bankverbindung des Finanzamts',
+ 'Bcc' => 'Bcc',
+ 'Bin List' => 'Lagerliste',
+ 'CANCELED' => 'Storniert',
+ 'Cc' => 'Cc',
'Check Details' => 'Bitte Angaben überprüfen',
'Choose Outputformat' => 'Ausgabeformat auswählen...',
'Choose a Tax Number' => 'Bitte eine Steuernummer angeben',
- 'Clearing Tax Received (No 71)' => 'Verrechnung des Erstattungsbetrages erwünscht (Zeile 71)',
- 'Company' => 'Firma',
- 'Contact' => 'Kontakt',
+ 'Confirmation' => 'Auftragsbestätigung',
'Continue' => 'Weiter',
+ 'Credit Note' => 'Gutschrift',
+ 'Customer Number' => 'Kundennummer',
+ 'Customer details' => 'Kundendetails',
+ 'Customer not on file or locked!' => 'Dieser Kunde existiert nicht oder ist gesperrt.',
'Customer not on file!' => 'Kunde ist nicht in der Datenbank!',
+ 'DELETED' => 'Gelöscht',
+ 'DUNNING STARTED' => 'Mahnprozess gestartet',
'Dataset upgrade' => 'Datenbankaktualisierung',
+ 'Date' => 'Datum',
'Dec' => 'Dez',
'December' => 'Dezember',
'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Description' => 'Beschreibung',
+ 'Directory' => 'Verzeichnis',
+ 'ELSE' => 'Zusatz',
'ELSTER Export (Taxbird)' => 'ELSTER-Export nach Taxbird',
'ELSTER Export (Winston)' => 'ELSTER Export nach Winston',
'ELSTER Export nach Winston' => 'ELSTER Export nach Winston',
- 'ELSTER Tax Number' => 'ELSTER-Steuernummer: ',
+ 'Enter longdescription' => 'Langtext eingeben',
'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
- 'Extension Of Time' => 'Dauerfristverlängerung',
- 'Fax' => 'Fax',
'Feb' => 'Feb',
'February' => 'Februar',
- 'Help' => 'Hilfe',
- 'Hint-Missing-Preferences' => 'Bitte fehlende USTVA Einstellungen ergänzen (Menüpunkt: Programm)',
- 'Hints' => 'Hinweise',
- 'Internet' => 'Internet',
+ 'File' => 'Datei',
+ 'History' => 'Historie',
+ 'Invoice' => 'Rechnung',
'Jan' => 'Jan',
'January' => 'Januar',
'Jul' => 'Jul',
'July' => 'Juli',
'Jun' => 'Jun',
'June' => 'Juni',
- 'Local Tax Office Preferences' => 'Angaben zum Finanzamt',
+ 'MAILED' => 'Gesendet',
'Mar' => 'März',
'March' => 'März',
+ 'Mark as paid?' => 'Als bezahlt markieren?',
+ 'Marked as paid' => 'Als bezahlt markiert',
'May' => 'Mai',
'May ' => 'Mai',
- 'Method' => 'Verfahren',
+ 'Message' => 'Nachricht',
'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
'Missing Method!' => 'Fehlender Voranmeldungszeitraum',
- 'Missing Preferences: Outputroutine disabled' => 'Die Ausgabefunktionen sind wegen unzureichender Voreinstellungen deaktiviert!',
'Missing Tax Authoritys Preferences' => 'Fehlende Angaben zum Finanzamt!',
'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
'Name' => 'Name',
'No Company Address given' => 'Keine Firmenadresse hinterlegt!',
'No Company Name given' => 'Kein Firmenname hinterlegt!',
+ 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
+ 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
+ 'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.',
+ 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
+ 'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
+ 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'Nov' => 'Nov',
'November' => 'November',
'Number' => 'Nummer',
'Oct' => 'Okt',
'October' => 'Oktober',
- 'Openings' => 'Öffnungszeiten',
- 'Outputformat' => 'Ausgabeformat',
+ 'PAYMENT POSTED' => 'Rechung gebucht',
+ 'POSTED' => 'Gebucht',
+ 'POSTED AS NEW' => 'Als neu gebucht',
+ 'PRINTED' => 'Gedruckt',
+ 'Packing List' => 'Lieferschein',
+ 'Part Number' => 'Artikelnummer',
+ 'Part description' => 'Artikelbeschreibung',
+ 'Pick List' => 'Sammelliste',
+ 'Please enter values' => 'Bitte Werte eingeben',
'Preview' => 'Druckvorschau',
+ 'Proforma Invoice' => 'Proformarechnung',
+ 'Project Number' => 'Projektnummer',
+ 'Project description' => 'Projektbeschreibung',
'Project not on file!' => 'Dieses Projekt ist nicht in der Datenbank!',
+ 'Purchase Order' => 'Lieferantenauftrag',
+ 'Quotation' => 'Angebot',
+ 'RFQ' => 'Anfrage',
+ 'SAVED' => 'Gespeichert',
+ 'SAVED FOR DUNNING' => 'Gespeichert',
+ 'SCREENED' => 'Angezeigt',
+ 'Select a Customer' => 'Endkunde auswählen',
+ 'Select a part' => 'Artikel auswählen',
'Select a period' => 'Bitte Zeitraum auswählen',
+ 'Select a project' => 'Projekt auswählen',
+ 'Select an employee' => 'Angestellten auswählen',
'Select from one of the names below' => 'Wählen Sie einen der untenstehenden Namen',
'Select from one of the projects below' => 'Wählen Sie eines der untenstehenden Projekte',
'Sep' => 'Sep',
'September' => 'September',
- 'Show' => 'Zeigen',
- 'Street' => 'Straße',
- 'Tax Consultant' => 'Steuerberater/-in',
- 'Tax Number' => 'Steuernummer',
- 'Tax Office' => 'Finanzamt',
+ 'Storno Invoice' => 'Stornorechnung',
+ 'Storno Packing List' => 'Stornolieferschein',
+ 'Subject' => 'Betreff',
'Tax Office Preferences' => 'Finanzamt - Einstellungen',
- 'Tax Period' => 'Voranmeldungszeitraum',
- 'Taxation' => 'Versteuerungs Verfahren',
- 'Tel' => 'Tel',
- 'Telephone' => 'Telefon',
'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
+ 'To (email)' => 'An',
+ 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
'USTVA-Hint: Method' => 'Wenn Sie Ist-Versteuert sind, wählen Sie die Einnahmen-/Überschuß-Rechnung aus. Sind Sie Soll-Versteuert und bilanzverpflichtet, dann wählen Sie Bilanz aus.',
'USTVA-Hint: Tax Authoritys' => 'Bitte das Bundesland UND die Stadt bzw. den Einzugsbereich Ihres zuständigen Finanzamts auswählen.',
'UStVA' => 'UStVA',
'UStVA (PDF-Dokument)' => 'UStVa als PDF-Dokument',
+ 'Unit' => 'Einheit',
'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
- 'User Config' => 'Benutzereinstellungen',
+ 'Value' => 'Wert',
+ 'Variable' => 'Variable',
+ 'Vendor details' => 'Lieferantendetails',
+ 'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!',
- 'With Extension Of Time' => 'mit Dauerfristverlängerung',
'Wrong Period' => 'Falscher Zeitraum',
'Year' => 'Jahr',
'Yearly' => 'jährlich',
'Yearly taxreport not yet implemented' => 'Jährlicher Steuerreport für dieses Ausgabeformat noch nicht implementiert',
- 'Zip, City' => 'PLZ, Ort',
+ '[email]' => '[email]',
'accrual' => 'Bilanzierung (Soll-Versteuerung)',
- 'back' => 'zurück',
+ 'bin_list' => 'Lagerliste',
'cash' => 'E/Ü-Rechnung (Ist-Versteuerung)',
- 'continue' => 'weiter',
- 'debug' => 'Debug',
'for Period' => 'für den Zeitraum',
- 'month' => 'monatliche Abgabe',
- 'quarter' => 'vierteljährliche (quartalsweise) Abgabe',
- 'save' => 'speichern',
+ 'invoice' => 'Rechnung',
+ 'month' => 'Monatliche Abgabe',
+ 'no' => 'nein',
+ 'packing_list' => 'Versandliste',
+ 'pick_list' => 'Entnahmeliste',
+ 'proforma' => 'Proforma',
+ 'purchase_order' => 'Auftrag',
+ 'quarter' => 'Vierteljährliche (quartalsweise) Abgabe',
+ 'request_quotation' => 'Angebotsanforderung',
+ 'sales_order' => 'Kundenauftrag',
+ 'sales_quotation' => 'Verkaufsangebot',
'saved' => 'gespeichert',
'to (date)' => 'bis',
+ 'yes' => 'ja',
};
$self->{subs} = {
+ 'E' => 'E',
+ 'H' => 'H',
+ 'NTI' => 'NTI',
+ 'Q' => 'Q',
'add_transaction' => 'add_transaction',
'ap_transaction' => 'ap_transaction',
'ar_transaction' => 'ar_transaction',
'back' => 'back',
+ 'build_std_url' => 'build_std_url',
+ 'calculate_qty' => 'calculate_qty',
+ 'call_sub' => 'call_sub',
'check_name' => 'check_name',
'check_project' => 'check_project',
- 'config' => 'config',
+ 'config_step1' => 'config_step1',
+ 'config_step2' => 'config_step2',
'continue' => 'continue',
'create_steuernummer' => 'create_steuernummer',
'debug' => 'debug',
- 'edit' => 'edit',
- 'edit_form' => 'edit_form',
+ 'delivery_customer_selection' => 'delivery_customer_selection',
'elster_hash' => 'elster_hash',
+ 'employee_selection_internal' => 'employee_selection_internal',
+ 'format_dates' => 'format_dates',
'generate_ustva' => 'generate_ustva',
- 'get_config' => 'get_config',
'gl_transaction' => 'gl_transaction',
'help' => 'help',
+ 'mark_as_paid_common' => 'mark_as_paid_common',
'name_selected' => 'name_selected',
+ 'part_selection_internal' => 'part_selection_internal',
'project_selected' => 'project_selected',
+ 'project_selection_internal' => 'project_selection_internal',
+ 'reformat_numbers' => 'reformat_numbers',
'report' => 'report',
'sales_invoice' => 'sales_invoice',
'save' => 'save',
+ 'select_employee' => 'select_employee',
+ 'select_employee_internal' => 'select_employee_internal',
'select_name' => 'select_name',
+ 'select_part' => 'select_part',
+ 'select_part_internal' => 'select_part_internal',
'select_project' => 'select_project',
+ 'set_longdescription' => 'set_longdescription',
'show' => 'show',
- 'show_fa_daten' => 'show_fa_daten',
+ 'show_history' => 'show_history',
'show_options' => 'show_options',
+ 'show_vc_details' => 'show_vc_details',
'ustva_vorauswahl' => 'ustva_vorauswahl',
'vendor_invoice' => 'vendor_invoice',
+ 'vendor_selection' => 'vendor_selection',
'weiter' => 'continue',
- 'hilfe' => 'help',
+ 'speichern' => 'save',
'zeigen' => 'show',
'zurück' => 'back',
- 'weiter' => 'continue',
- 'debug' => 'debug',
- 'speichern' => 'save',
};
1;
#
#######################################################################
+BEGIN {
+ unshift @INC, "modules/YAML"; # Use our own version of YAML.
+ push @INC, "modules"; # Only use our own versions of modules if there's no system version.
+}
+
# setup defaults, DO NOT CHANGE
$userspath = "users";
$templates = "templates";
$lxdebug = LXDebug->new();
eval { require "lx-erp.conf"; };
+eval { require "lx-erp-local.conf"; } if -f "lx-erp-local.conf";
if ($ENV{CONTENT_LENGTH}) {
read(STDIN, $_, $ENV{CONTENT_LENGTH});
$pos = rindex $0, '/';
$script = substr($0, $pos + 1);
+$form->{login} =~ s|.*/||;
+
if (-e "$userspath/nologin" && $script ne 'admin.pl') {
print "content-type: text/plain
exit;
}
-if ($form{path}) {
- $form{path} =~ s/%2f/\//gi;
- $form{path} =~ s/\.\.\///g;
-
- if ($form{path} !~ /^bin\//) {
- print "content-type: text/plain
-
-Invalid path!\n";
- die;
- }
-
- $ARGV[0] = "$_&script=$script";
- require "$form{path}/$script";
-} else {
-
- if (!$form{terminal}) {
- if ($ENV{HTTP_USER_AGENT}) {
-
- # web browser
- if ($ENV{HTTP_USER_AGENT} =~ /(mozilla|links|opera|w3m)/i) {
- $form{terminal} = "mozilla";
- }
+require "bin/mozilla/installationcheck.pl";
+verify_installation();
- } else {
- if ($ENV{TERM} =~ /xterm/) {
- $form{terminal} = "xterm";
- }
- if ($ENV{TERM} =~ /(console|linux|vt.*)/i) {
- $form{terminal} = "console";
- }
- }
- }
-
- if ($form{terminal}) {
-
- $ARGV[0] = "path=bin/$form{terminal}&script=$script";
- map { $ARGV[0] .= "&${_}=$form{$_}" } keys %form;
-
- require "bin/$form{terminal}/$script";
-
- } else {
-
- print qq|
- Unknown terminal
- |;
- }
-
-}
+$ARGV[0] = "$_&script=$script";
+require "bin/mozilla/$script";
# end of main
use Cwd;
-use vars qw($userspath $spool $memberfile $templates $sendmail $language $sid $latex $eur $webdav $lizenzen $jscalendar);
+use vars qw($userspath $spool $memberfile $templates $sendmail $language $sid $latex $eur $webdav $lizenzen $pg_dump_exe $pg_restore_exe $watch_form_variables);
# path to user configuration files
$userspath = "users";
$webdav = 0;
$lizenzen = 1;
-# Jscalendar an/aus
-$jscalendar = 1;
-
-
## Support fuer OpenDocument-Vorlagen
# Diese Option legt fest, ob OpenDocument-Vorlagen generell verfuegbar sind.
$opendocument_templates = 1;
$xvfb_bin = "/usr/bin/Xvfb";
# Das charset, in dem die Daten in der Datenbank abgelegt sind.
+# $dbcharset = 'UTF-8'; # Für UNICODE UTF-8
$dbcharset = "ISO-8859-15";
+# Pfad zu 'html2ps' zum Export von Listenansichten als PDF
+$html2ps_bin = "/usr/bin/html2ps";
+$ghostscript_bin = "/usr/bin/gs";
+
+
+
+# Datenbankbackups werden mit dem externen Programm "pg_dump" erledigt.
+# Wenn es nicht im aktuellen Pfad vorhanden ist, so muss hier der vollständige
+# Pfad eingetragen werden. Wenn die Variable auf "DISABLED" gesetzt wird,
+# so wird der Menüpunkt zum Backup von Datenbanken im Administrationsfrontend
+# nicht angeboten.
+# Das gleiche gilt analog für das Wiederherstellen mittels "pg_restore".
+$pg_dump_exe = "pg_dump";
+$pg_restore_exe = "pg_restore";
+
# Globale Debug-Ausgaben (de-)aktivieren? Moegliche Werte sind
-# LXDebug::NONE, LXDebug::INFO, LXDebug::DEBUG1, LXDebug::DEBUG2, LXDebug::QUERY
+# LXDebug::NONE - keine Debugausgaben
+# LXDebug::INFO
+# LXDebug::DEBUG1
+# LXDebug::DEBUG2
+# LXDebug::QUERY - SQL Queries
+# LXDebug::TRACE - Tracing von Funktionsaufrufen
+# LXDebug::BACKTRACE_ON_ERROR - Vollständiger Aufrufpfad, wenn $form->error() aufgerufen wird
+# LXDebug::ALL - alle Debugausgaben
+#
+# LXDebug::DEVEL - wie INFO | QUERY | TRACE | BACKTRACE_ON_ERROR
+#
+# Beipiel:
+# $LXDebug::global_level = LXDebug::TRACE | LXDebug::QUERY;
$LXDebug::global_level = LXDebug::NONE;
-$LXDebug::global_trace_subs = 0;
+
+# Überwachung der Inhalte von $form aktiviert oder nicht? Wenn ja,
+# dann können einzelne Variablen mit
+# $form->{"Watchdog::<variablenname>"} = 1;
+# überwacht werden. Bedeutet aber auch einen Geschwindigkeitsverlust,
+# weshalb sie normalerweise deaktiviert ist.
+$LXDebug::watch_form = 0;
1;
-use vars qw($userspath $spool $memberfile $templates $sendmail $language $sid $latex $eur $webdav $lizenzen $jscalendar);
+use Cwd;
+use vars qw($userspath $spool $memberfile $templates $sendmail $language $sid $latex $eur $webdav $lizenzen $pg_dump_exe $pg_restore_exe $watch_form_variables);
# path to user configuration files
$userspath = "users";
$ENV{"ORACLE_HOME"} = "/usr/local/oracle";
# if you have latex installed set to 1
-$latex = 1;
+$latex_templates = 1;
# if the server can't find gzip, latex, dvips or pdflatex, add the path
$ENV{PATH} .= ":/usr/local/bin";
# Aktivierung der verschiedenen Spezialmodule
$webdav = 0;
-$lizenzen = 0;
-$vertreter = 0;
+$lizenzen = 1;
-# Jscalendar an/aus
-$jscalendar = 1;
+## Support fuer OpenDocument-Vorlagen
+# Diese Option legt fest, ob OpenDocument-Vorlagen generell verfuegbar sind.
+$opendocument_templates = 1;
+
+# Die folgenden zwei Variablen legen Pfade zu Programmen fest, die benoetigt
+# werden, um OpenDocument-Vorlagen in PDFs umzuwandeln.
+
+# Pfad zu OpenOffice.org writer
+$openofficeorg_writer_bin = "/usr/bin/oowriter";
+
+# Soll OpenOffice dauerhaft gestartet bleiben? Die Konvertierung nachfolgender
+# Dokumente geht dann schneller. Allerdings wird auf dem System ein
+# installiertes Python mit den Python-UNO-Bindings benoetigt, die Bestandteil
+# von OpenOffice sind.
+$openofficeorg_daemon = 1;
+$openofficeorg_daemon_port = 2002;
+
+# Pfad zum "X virtual frame buffer", unter dem OpenOffice gestartet wird.
+# Zusaetzlich muessen die Programme "xauth" und "mcookie" gefunden werden
+# koennen, was eine Aenderung an PATH bedeuten kann.
+$ENV{"PATH"} = $ENV{"PATH"} . ":/usr/X11R6/bin:/usr/X11/bin";
+$xvfb_bin = "/usr/bin/Xvfb";
+
+# Das charset, in dem die Daten in der Datenbank abgelegt sind.
+# $dbcharset = 'UTF-8'; # Für UNICODE UTF-8
+$dbcharset = "ISO-8859-15";
+
+
+# Pfad zu 'html2ps' zum Export von Listenansichten als PDF
+$html2ps_bin = "/usr/bin/html2ps";
+$ghostscript_bin = "/usr/bin/gs";
+
+
+
+# Datenbankbackups werden mit dem externen Programm "pg_dump" erledigt.
+# Wenn es nicht im aktuellen Pfad vorhanden ist, so muss hier der vollständige
+# Pfad eingetragen werden. Wenn die Variable auf "DISABLED" gesetzt wird,
+# so wird der Menüpunkt zum Backup von Datenbanken im Administrationsfrontend
+# nicht angeboten.
+# Das gleiche gilt analog für das Wiederherstellen mittels "pg_restore".
+$pg_dump_exe = "pg_dump";
+$pg_restore_exe = "pg_restore";
+
+# Globale Debug-Ausgaben (de-)aktivieren? Moegliche Werte sind
+# LXDebug::NONE - keine Debugausgaben
+# LXDebug::INFO
+# LXDebug::DEBUG1
+# LXDebug::DEBUG2
+# LXDebug::QUERY - SQL Queries
+# LXDebug::TRACE - Tracing von Funktionsaufrufen
+# LXDebug::BACKTRACE_ON_ERROR - Vollständiger Aufrufpfad, wenn $form->error() aufgerufen wird
+# LXDebug::ALL - alle Debugausgaben
+#
+# LXDebug::DEVEL - wie INFO | QUERY | TRACE | BACKTRACE_ON_ERROR
+#
+# Beipiel:
+# $LXDebug::global_level = LXDebug::TRACE | LXDebug::QUERY;
+$LXDebug::global_level = LXDebug::NONE;
+
+# Überwachung der Inhalte von $form aktiviert oder nicht? Wenn ja,
+# dann können einzelne Variablen mit
+# $form->{"Watchdog::<variablenname>"} = 1;
+# überwacht werden. Bedeutet aber auch einen Geschwindigkeitsverlust,
+# weshalb sie normalerweise deaktiviert ist.
+$LXDebug::watch_form = 0;
1;
+++ /dev/null
-#!/bin/sh
-
-# Erstellt die benotigten Symlinks
-
-ln -vsf login.pl admin.pl
-for i in ap ar bp ca cp ct cn dn gl ic ir is menu oe pe rc rp datev licenses fa ustva menunew common menuv3; do
- ln -vsf am.pl $i.pl
-done
-
action=search
type=request_quotation
-# Mehrlagerfähigkeit noch nicht implementiert
-# [Shipping]
-#
-# [Shipping--Stock Assembly]
-# module=ic.pl
-# action=stock_assembly
-#
-# [Shipping--Ship]
-# module=oe.pl
-# action=search
-# type=ship_order
-#
-# [Shipping--Receive]
-# module=oe.pl
-# action=search
-# type=receive_order
-#
-# [Shipping--Transfer]
-# module=oe.pl
-# action=search_transfer
-
-
[General Ledger]
[System]
[System--UStVa Einstellungen]
module=ustva.pl
-action=edit
+action=config_step1
[System--Edit Dunning]
module=dn.pl
target=acc_menu
submenu=1
-[System--Buchungsgruppen--BG hinzufügen]
+[System--Buchungsgruppen--Add Accounting Group]
module=am.pl
action=add_buchungsgruppe
-[System--Buchungsgruppen--BG anzeigen]
+[System--Buchungsgruppen--List Accounting Groups]
module=am.pl
action=list_buchungsgruppe
+[System--Taxes]
+module=menu.pl
+action=acc_menu
+target=acc_menu
+submenu=1
+
+[System--Taxes--List Tax]
+module=am.pl
+action=list_tax
+
[System--Groups]
module=menu.pl
action=acc_menu
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
[System--Import CSV--Parts]
module=lxo-import/partsB.php
-#[System--SIC]
-#module=menu.pl
-#action=acc_menu
-#target=acc_menu
-#submenu=1
-#
-#[System--SIC--Add SIC]
-#module=am.pl
-#action=add_sic
-#
-#[System--SIC--List SIC]
-#module=am.pl
-#action=list_sic
-
-[System--Stylesheet]
-module=am.pl
-action=display_stylesheet
+
+[System--Templates]
+module=menu.pl
+action=acc_menu
+target=acc_menu
+submenu=1
+
+[System--Templates--HTML Templates]
+module=amtemplates.pl
+action=display_template_form
+type=templates
+format=html
+
+[System--Templates--LaTeX Templates]
+module=amtemplates.pl
+action=display_template_form
+type=templates
+format=tex
+
+[System--Templates--Stylesheet]
+module=amtemplates.pl
+action=display_template_form
+type=stylesheet
[System--Audit Control]
module=am.pl
action=audit_control
-------------------------------------------
+[System--History Search Engine]
+module=am.pl
+action=show_history_search
+
#################################
# WEISS NOCH NICHT WAS DAMIT IST #
#################################
-#[AR--Add Transaction]
-#module=ar.pl
-#action=add
-
#[AR--Reports--Tax collected]
#module=rp.pl
#action=report
#action=report
#report=nontaxable_sales
-#[AP--Add Transaction]
-#module=menu.pl
-#action=acc_menu
-#target=acc_menu
-#submenu=1
-#module=ap.pl
-#action=add
-
#[AP--Reports--Tax paid]
#module=rp.pl
#action=report
--- /dev/null
+am.pl
\ No newline at end of file
--- /dev/null
+am.pl
\ No newline at end of file
--- /dev/null
+am.pl
\ No newline at end of file
--- /dev/null
+Order Allow,Deny
+Deny from all
--- /dev/null
+package CGI::Ajax;
+use strict;
+use Data::Dumper;
+use base qw(Class::Accessor);
+use overload '""' => 'show_javascript'; # for building web pages, so
+ # you can just say: print $pjx
+BEGIN {
+ use vars qw ($VERSION @ISA @METHODS);
+ @METHODS = qw(url_list coderef_list DEBUG JSDEBUG html
+ js_encode_function cgi_header_extra);
+
+ CGI::Ajax->mk_accessors( @METHODS );
+
+ $VERSION = .697;
+}
+
+########################################### main pod documentation begin ##
+
+=head1 NAME
+
+CGI::Ajax - a perl-specific system for writing Asynchronous web
+applications
+
+=head1 SYNOPSIS
+
+ use strict;
+ use CGI; # or any other CGI:: form handler/decoder
+ use CGI::Ajax;
+
+ my $cgi = new CGI;
+ my $pjx = new CGI::Ajax( 'exported_func' => \&perl_func );
+
+ print $pjx->build_html( $cgi, \&Show_HTML);
+
+ sub perl_func {
+ my $input = shift;
+ # do something with $input
+ my $output = $input . " was the input!";
+ return( $output );
+ }
+
+ sub Show_HTML {
+ my $html = <<EOHTML;
+ <HTML>
+ <BODY>
+ Enter something:
+ <input type="text" name="val1" id="val1"
+ onkeyup="exported_func( ['val1'], ['resultdiv'] );">
+ <br>
+ <div id="resultdiv"></div>
+ </BODY>
+ </HTML>
+ EOHTML
+ return $html;
+ }
+
+I<There are several fully-functional examples in the 'scripts/'
+directory of the distribution.>
+
+=head1 DESCRIPTION
+
+CGI::Ajax is an object-oriented module that provides a unique
+mechanism for using perl code asynchronously from javascript-
+enhanced HTML pages. CGI::Ajax unburdens the user from having to
+write extensive javascript, except for associating an exported
+method with a document-defined event (such as onClick, onKeyUp,
+etc). CGI::Ajax also mixes well with HTML containing more complex
+javascript.
+
+CGI::Ajax supports methods that return single results or multiple
+results to the web page, and supports returning values to multiple
+DIV elements on the HTML page.
+
+Using CGI::Ajax, the URL for the HTTP GET/POST request is
+automatically generated based on HTML layout and events, and the
+page is then dynamically updated with the output from the perl
+function. Additionally, CGI::Ajax supports mapping URL's to a
+CGI::Ajax function name, so you can separate your code processing
+over multiple scripts.
+
+Other than using the Class::Accessor module to generate CGI::Ajax'
+accessor methods, CGI::Ajax is completely self-contained - it
+does not require you to install a larger package or a full Content
+Management System, etc.
+
+We have added I<support> for other CGI handler/decoder modules,
+like L<CGI::Simple> or L<CGI::Minimal>, but we can't test these
+since we run mod_perl2 only here. CGI::Ajax checks to see if a
+header() method is available to the CGI object, and then uses it.
+If method() isn't available, it creates it's own minimal header.
+
+A primary goal of CGI::Ajax is to keep the module streamlined and
+maximally flexible. We are trying to keep the generated javascript
+code to a minimum, but still provide users with a variety of
+methods for deploying CGI::Ajax. And VERY little user javascript.
+
+=head1 EXAMPLES
+
+The CGI::Ajax module allows a Perl subroutine to be called
+asynchronously, when triggered from a javascript event on the
+HTML page. To do this, the subroutine must be I<registered>,
+usually done during:
+
+ my $pjx = new CGI::Ajax( 'JSFUNC' => \&PERLFUNC );
+
+This maps a perl subroutine (PERLFUNC) to an automatically
+generated Javascript function (JSFUNC). Next you setup a trigger this
+function when an event occurs (e.g. "onClick"):
+
+ onClick="JSFUNC(['source1','source2'], ['dest1','dest2']);"
+
+where 'source1', 'dest1', 'source2', 'dest2' are the DIV ids of
+HTML elements in your page...
+
+ <input type=text id=source1>
+ <input type=text id=source2>
+ <div id=dest1></div>
+ <div id=dest2></div>
+
+L<CGI::Ajax> sends the values from source1 and source2 to your
+Perl subroutine and returns the results to dest1 and dest2.
+
+=head2 4 Usage Methods
+
+=over 4
+
+=item 1 Standard CGI::Ajax example
+
+Start by defining a perl subroutine that you want available from
+javascript. In this case we'll define a subrouting that determines
+whether or not an input is odd, even, or not a number (NaN):
+
+ use strict;
+ use CGI::Ajax;
+ use CGI;
+
+
+ sub evenodd_func {
+ my $input = shift;
+
+ # see if input is defined
+ if ( not defined $input ) {
+ return("input not defined or NaN");
+ }
+
+ # see if value is a number (*thanks Randall!*)
+ if ( $input !~ /\A\d+\z/ ) {
+ return("input is NaN");
+ }
+
+ # got a number, so mod by 2
+ $input % 2 == 0 ? return("EVEN") : return("ODD");
+ }
+
+Alternatively, we could have used coderefs to associate an
+exported name...
+
+ my $evenodd_func = sub {
+ # exactly the same as in the above subroutine
+ };
+
+Next we define a function to generate the web page - this can
+be done many different ways, and can also be defined as an
+anonymous sub. The only requirement is that the sub send back
+the html of the page. You can do this via a string containing the
+html, or from a coderef that returns the html, or from a function
+(as shown here)...
+
+ sub Show_HTML {
+ my $html = <<EOT;
+ <HTML>
+ <HEAD><title>CGI::Ajax Example</title>
+ </HEAD>
+ <BODY>
+ Enter a number:
+ <input type="text" name="somename" id="val1" size="6"
+ OnKeyUp="evenodd( ['val1'], ['resultdiv'] );">
+ <br>
+ <hr>
+ <div id="resultdiv">
+ </div>
+ </BODY>
+ </HTML>
+EOT
+ return $html;
+ }
+
+The exported Perl subrouting is triggered using the C<OnKeyUp>
+event handler of the input HTML element. The subroutine takes one
+value from the form, the input element B<'val1'>, and returns the
+the result to an HTML div element with an id of B<'resultdiv'>.
+Sending in the input id in an array format is required to support
+multiple inputs, and similarly, to output multiple the results,
+you can use an array for the output divs, but this isn't mandatory -
+as will be explained in the B<Advanced> usage.
+
+Now create a CGI object and a CGI::Ajax object, associating a reference
+to our subroutine with the name we want available to javascript.
+
+ my $cgi = new CGI();
+ my $pjx = new CGI::Ajax( 'evenodd' => \&evenodd_func );
+
+And if we used a coderef, it would look like this...
+
+ my $pjx = new CGI::Ajax( 'evenodd' => $evenodd_func );
+
+Now we're ready to print the output page; we send in the cgi
+object and the HTML-generating function.
+
+ print $pjx->build_html($cgi,\&Show_HTML);
+
+CGI::Ajax has support for passing in extra HTML header information
+to the CGI object. This can be accomplished by adding a third
+argument to the build_html() call. The argument needs to be a
+hashref containing Key=>value pairs that CGI objects understand:
+
+ print $pjx->build_html($cgi,\&Show_HTML,
+ {-charset=>'UTF-8, -expires=>'-1d'});
+
+See L<CGI> for more header() method options.
+
+That's it for the CGI::Ajax standard method. Let's look at
+something more advanced.
+
+=item 2 Advanced CGI::Ajax example
+
+Let's say we wanted to have a perl subroutine process multiple
+values from the HTML page, and similarly return multiple values
+back to distinct divs on the page. This is easy to do, and
+requires no changes to the perl code - you just create it as you
+would any perl subroutine that works with multiple input values
+and returns multiple values. The significant change happens in
+the event handler javascript in the HTML...
+
+ onClick="exported_func(['input1','input2'],['result1','result2']);"
+
+Here we associate our javascript function ("exported_func") with
+two HTML element ids ('input1','input2'), and also send in two
+HTML element ids to place the results in ('result1','result2').
+
+=item 3 Sending Perl Subroutine Output to a Javascript function
+
+Occassionally, you might want to have a custom javascript function
+process the returned information from your Perl subroutine.
+This is possible, and the only requierment is that you change
+your event handler code...
+
+ onClick="exported_func(['input1'],[js_process_func]);"
+
+In this scenario, C<js_process_func> is a javascript function you
+write to take the returned value from your Perl subroutine and
+process the results. I<Note that a javascript function is not
+quoted -- if it were, then CGI::Ajax would look for a HTML element
+with that id.> Beware that with this usage, B<you are responsible
+for distributing the results to the appropriate place on the
+HTML page>. If the exported Perl subroutine returns, e.g. 2
+values, then C<js_process_func> would need to process the input
+by working through an array, or using the javascript Function
+C<arguments> object.
+
+ function js_process_func() {
+ var input1 = arguments[0]
+ var input2 = arguments[1];
+ // do something and return results, or set HTML divs using
+ // innerHTML
+ document.getElementById('outputdiv').innerHTML = input1;
+ }
+
+=item 4 URL/Outside Script CGI::Ajax example
+
+There are times when you may want a different script to
+return content to your page. This could be because you have
+an existing script already written to perform a particular
+task, or you want to distribute a part of your application to another
+script. This can be accomplished in L<CGI::Ajax> by using a URL in
+place of a locally-defined Perl subroutine. In this usage,
+you alter you creation of the L<CGI::Ajax> object to link an
+exported javascript function name to a local URL instead of
+a coderef or a subroutine.
+
+ my $url = 'scripts/other_script.pl';
+ my $pjx = new CGI::Ajax( 'external' => $url );
+
+This will work as before in terms of how it is called from you
+event handler:
+
+ onClick="external(['input1','input2'],['resultdiv']);"
+
+The other_script.pl will get the values via a CGI object and
+accessing the 'args' key. The values of the B<'args'> key will
+be an array of everything that was sent into the script.
+
+ my @input = $cgi->params('args');
+ $input[0]; # contains first argument
+ $input[1]; # contains second argument, etc...
+
+This is good, but what if you need to send in arguments to the
+other script which are directly from the calling Perl script,
+i.e. you want a calling Perl script's variable to be sent, not
+the value from an HTML element on the page? This is possible
+using the following syntax:
+
+ onClick="exported_func(['args__$input1','args__$input2'],
+ ['resultdiv']);"
+
+Similary, if the external script required a constant as input
+(e.g. C<script.pl?args=42>, you would use this syntax:
+
+ onClick="exported_func(['args__42'],['resultdiv']);"
+
+In both of the above examples, the result from the external
+script would get placed into the I<resultdiv> element on our
+(the calling script's) page.
+
+If you are sending more than one argument from an external perl
+script back to a javascript function, you will need to split the
+string (AJAX applications communicate in strings only) on something.
+Internally, we use '__pjx__', and this string is checked for. If
+found, L<CGI::Ajax> will automatically split it. However, if you
+don't want to use '__pjx__', you can do it yourself:
+
+For example, from your Perl script, you would...
+
+ return("A|B"); # join with "|"
+
+and then in the javascript function you would have something like...
+
+ process_func() {
+ var arr = arguments[0].split("|");
+ // arr[0] eq 'A'
+ // arr[1] eq 'B'
+ }
+
+In order to rename parameters, in case the outside script needs
+specifically-named parameters and not CGI::Ajax' I<'args'> default
+parameter name, change your event handler associated with an HTML
+event like this
+
+ onClick="exported_func(['myname__$input1','myparam__$input2'],
+ ['resultdiv']);"
+
+The URL generated would look like this...
+
+C<script.pl?myname=input1&myparam=input2>
+
+You would then retrieve the input in the outside script with this...
+
+ my $p1 = $cgi->params('myname');
+ my $p1 = $cgi->params('myparam');
+
+Finally, what if we need to get a value from our HTML page and we
+want to send that value to an outside script but the outside script
+requires a named parameter different from I<'args'>? You can
+accomplish this with L<CGI::Ajax> using the getVal() javascript
+method (which returns an array, thus the C<getVal()[0]> notation):
+
+ onClick="exported_func(['myparam__' + getVal('div_id')[0]],
+ ['resultdiv']);"
+
+This will get the value of our HTML element with and
+I<id> of I<div_id>, and submit it to the url attached to
+I<myparam__>. So if our exported handler referred to a URI
+called I<script/scr.pl>, and the element on our HTML page called
+I<div_id> contained the number '42', then the URL would look
+like this C<script/scr.pl?myparam=42>. The result from this
+outside URL would get placed back into our HTML page in the
+element I<resultdiv>. See the example script that comes with
+the distribution called I<pjx_url.pl> and its associated outside
+script I<convert_degrees.pl> for a working example.
+
+B<N.B.> These examples show the use of outside scripts which
+are other perl scripts - I<but you are not limited to Perl>!
+The outside script could just as easily have been PHP or any other
+CGI script, as long as the return from the other script is just
+the result, and not addition HTML code (like FORM elements, etc).
+
+=back
+
+=head2 GET versus POST
+
+Note that all the examples so far have used the following syntax:
+
+ onClick="exported_func(['input1'],['result1']);"
+
+There is an optional third argument to a L<CGI::Ajax> exported
+function that allows change the submit method. The above event could
+also have been coded like this...
+
+ onClick="exported_func(['input1'],['result1'], 'GET');"
+
+By default, L<CGI::Ajax> sends a I<'GET'> request. If you need it,
+for example your URL is getting way too long, you can easily switch
+to a I<'POST'> request with this syntax...
+
+ onClick="exported_func(['input1'],['result1'], 'POST');"
+
+I<('POST' and 'post' are supported)>
+
+=head2 Page Caching
+
+We have implemented a method to prevent page cacheing from undermining
+the AJAX methods in a page. If you send in an input argument to a
+L<CGI::Ajax>-exported function called 'NO_CACHE', the a special
+parameter will get attached to the end or your url with a random
+number in it. This will prevent a browser from caching your request.
+
+ onClick="exported_func(['input1','NO_CACHE'],['result1']);"
+
+The extra param is called pjxrand, and won't interfere with the order
+of processing for the rest of your parameters.
+
+=head1 METHODS
+
+=cut
+
+################################### main pod documentation end ##
+
+######################################################
+## METHODS - public ##
+######################################################
+
+=over 4
+
+=item build_html()
+
+ Purpose: Associates a cgi obj ($cgi) with pjx object, inserts
+ javascript into <HEAD></HEAD> element and constructs
+ the page, or part of the page. AJAX applications
+ are designed to update only the section of the
+ page that needs it - the whole page doesn't have
+ to be redrawn. L<CGI::Ajax> applications use the
+ build_html() method to take care of this: if the CGI
+ parameter C<fname> exists, then the return from the
+ L<CGI::Ajax>-exported function is sent to the page.
+ Otherwise, the entire page is sent, since without
+ an C<fname> param, this has to be the first time
+ the page is being built.
+
+ Arguments: The CGI object, and either a coderef, or a string
+ containing html. Optionally, you can send in a third
+ parameter containing information that will get passed
+ directly to the CGI object header() call.
+ Returns: html or updated html (including the header)
+ Called By: originating cgi script
+
+=cut
+sub build_html {
+ my ( $self, $cgi, $html_source, $cgi_header_extra ) = @_;
+
+ if ( ref( $cgi ) =~ /CGI.*/ ) {
+ if ( $self->DEBUG() ) {
+ print STDERR "CGI::Ajax->build_html: CGI* object was received\n";
+ }
+ $self->cgi( $cgi ); # associate the cgi obj with the CGI::Ajax object
+ }
+
+ if ( defined $cgi_header_extra ) {
+ if ( $self->DEBUG() ) {
+ print STDERR "CGI::Ajax->build_html: got extra cgi header info\n";
+ if ( ref($cgi_header_extra) eq "HASH" ) {
+ foreach my $k ( keys %$cgi_header_extra ) {
+ print STDERR "\t$k => ", $cgi_header_extra->{$k}, "\n";
+ }
+ } else {
+ print STDERR "\t$cgi_header_extra\n";
+ }
+ }
+ $self->cgi_header_extra( $cgi_header_extra );
+ }
+
+ #check if "fname" was defined in the CGI object
+ if ( defined $self->cgi()->param("fname") ) {
+ # it was, so just return the html from the handled request
+ return ( $self->handle_request() );
+ }
+ else {
+ # start with the minimum, a http header line and any extra cgi
+ # header params sent in
+ my $html = "";
+ if ( $self->cgi()->can('header') ) {
+ #$html .= $self->cgi()->header();
+ $html .= $self->cgi()->header( $self->cgi_header_extra() );
+ }
+ else {
+ # don't have an object with a "header()" method, so just create
+ # a mimimal one
+ $html .= "Content-Type: text/html;";
+ $html .= $self->cgi_header_extra();
+ $html .= "\n\n";
+ }
+
+ # check if the user sent in a coderef for generating the html,
+ # or the actual html
+ if ( ref($html_source) eq "CODE" ) {
+ if ( $self->DEBUG() ) {
+ print STDERR "CGI::Ajax->build_html: html_source is a CODEREF\n";
+ }
+ eval { $html .= &$html_source };
+ if ($@) {
+ # there was a problem evaluating the html-generating function
+ # that was sent in, so generate an error page
+ if ( $self->cgi()->can('header') ) {
+ $html = $self->cgi()->header( $self->cgi_header_extra() );
+ }
+ else {
+ # don't have an object with a "header()" method, so just create
+ # a mimimal one
+ $html = "Content-Type: text/html;";
+ $html .= $self->cgi_header_extra();
+ $html .= "\n\n";
+ }
+ $html .= qq!<html><head><title></title></head><body><h2>Problems</h2> with
+ the html-generating function sent to CGI::Ajax
+ object</body></html>!;
+ return $html;
+ }
+ $self->html($html); # no problems, so set html
+ }
+ else {
+ # user must have sent in raw html, so add it
+ if ( $self->DEBUG() ) {
+ print STDERR "CGI::Ajax->build_html: html_source is HTML\n";
+ }
+ $self->html( $html . $html_source );
+ }
+
+ # now modify the html to insert the javascript
+ $self->insert_js_in_head();
+ }
+ return $self->html();
+}
+
+=item show_javascript()
+
+ Purpose: builds the text of all the javascript that needs to be
+ inserted into the calling scripts html <head> section
+ Arguments:
+ Returns: javascript text
+ Called By: originating web script
+ Note: This method is also overridden so when you just print
+ a CGI::Ajax object it will output all the javascript needed
+ for the web page.
+
+=cut
+
+sub show_javascript {
+ my ($self) = @_;
+ my $rv = $self->show_common_js(); # show the common js
+
+ # build the js for each perl function you want exported to js
+ foreach my $func ( keys %{ $self->coderef_list() }, keys %{ $self->url_list() } ) {
+ $rv .= $self->make_function($func);
+ }
+ # wrap up the return in a CDATA structure for XML compatibility
+ # (thanks Thos Davis)
+ $rv = "\n" . '//<![CDATA[' . "\n" . $rv . "\n" . '//]]>' . "\n";
+ $rv = '<script type="text/javascript">' . $rv . '</script>';
+ return $rv;
+}
+
+## new
+sub new {
+ my ($class) = shift;
+ my $self = bless ({}, ref ($class) || $class);
+# $self->SUPER::new();
+ $self->JSDEBUG(0); # turn javascript debugging off (if on,
+ # extra info will be added to the web page output
+ # if set to 1, then the core js will get
+ # compressed, but the user-defined functions will
+ # not be compressed. If set to 2 (or anything
+ # greater than 1 or 0), then none of the
+ # javascript will get compressed.
+ #
+ $self->DEBUG(0); # turn debugging off (if on, check web logs)
+
+ #accessorized attributes
+ $self->coderef_list({});
+ $self->url_list({});
+ #$self->html("");
+ #$self->cgi();
+ #$self->cgi_header_extra(""); # set cgi_header_extra to an empty string
+
+ # setup a default endcoding; if you need support for international
+ # charsets, use 'escape' instead of encodeURIComponent. Due to the
+ # number of browser problems users report about scripts with a default of
+ # encodeURIComponent, we are setting the default to 'escape'
+ $self->js_encode_function('escape');
+
+ if ( @_ < 2 ) {
+ die "incorrect usage: must have fn=>code pairs in new\n";
+ }
+
+ while ( @_ ) {
+ my($function_name,$code) = splice( @_, 0, 2 );
+ if ( ref( $code ) eq "CODE" ) {
+ if ( $self->DEBUG() ) {
+ print STDERR "name = $function_name, code = $code\n";
+ }
+ # add the name/code to hash
+ $self->coderef_list()->{ $function_name } = $code;
+ } elsif ( ref($code) ) {
+ die "Unsuported code block/url\n";
+ } else {
+ if ( $self->DEBUG() ) {
+ print STDERR "Setting function $function_name to url $code\n";
+ }
+ # if it's a url, it is added here
+ $self->url_list()->{ $function_name } = $code;
+ }
+ }
+ return ($self);
+}
+
+######################################################
+## METHODS - private ##
+######################################################
+
+# sub cgiobj(), cgi()
+#
+# Purpose: accessor method to associate a CGI object with our
+# CGI::Ajax object
+# Arguments: a CGI object
+# Returns: CGI::Ajax objects cgi object
+# Called By: originating cgi script, or build_html()
+#
+sub cgiobj {
+ my $self = shift;
+ # see if any values were sent in...
+ if ( @_ ) {
+ my $cgi = shift;
+ # add support for other CGI::* modules This requires that your web server
+ # be configured properly. I can't test anything but a mod_perl2
+ # setup, so this prevents me from testing CGI::Lite,CGI::Simple, etc.
+ if ( ref($cgi) =~ /CGI.*/ ) {
+ if ( $self->DEBUG() ) {
+ print STDERR "cgiobj() received a CGI-like object ($cgi)\n";
+ }
+ $self->{'cgi'} = $cgi;
+ } else {
+ die "CGI::Ajax -- Can't set internal CGI object to a non-CGI object ($cgi)\n";
+ }
+ }
+ # return the object
+ return( $self->{'cgi'} );
+}
+
+sub cgi {
+ my $self = shift;
+ if ( @_ ) {
+ return( $self->cgiobj( @_ ) );
+ } else {
+ return( $self->cgiobj() );
+ }
+}
+
+## # sub cgi_header_extra
+## #
+## # Purpose: accessor method to associate CGI header information
+## # with the CGI::Ajax object
+## # Arguments: a hashref with key=>value pairs that get handed off to
+## # the CGI object's header() method
+## # Returns: hashref of extra cgi header params
+## # Called By: originating cgi script, or build_html()
+##
+## sub cgi_header_extra {
+## my $self = shift;
+## if ( @_ ) {
+## $self->{'cgi_header_extra'} = shift;
+## }
+## return( $self->{'cgi_header_extra'} );
+## }
+
+# sub create_js_setRequestHeader
+#
+# Purpose: create text of the header for the javascript side,
+# xmlhttprequest call
+# Arguments: none
+# Returns: text of header to pass to xmlhttpreq call so it will
+# match whatever was setup for the main web-page
+# Called By: originating cgi script, or build_html()
+#
+
+sub create_js_setRequestHeader {
+ my $self = shift;
+ my $cgi_header_extra = $self->cgi_header_extra();
+ my $js_header_string = q{r.setRequestHeader("};
+ #$js_header_string .= $self->cgi()->header( $cgi_header_extra );
+ $js_header_string .= $self->cgi()->header();
+ $js_header_string .= q{");};
+ #if ( ref $cgi_header_extra eq "HASH" ) {
+ # foreach my $k ( keys(%$cgi_header_extra) ) {
+ # $js_header_string .= $self->cgi()->header($cgi_headers)
+ # }
+ #} else {
+ #print STDERR $self->cgi()->header($cgi_headers) ;
+
+ if ( $self->DEBUG() ) {
+ print STDERR "js_header_string is (", $js_header_string, ")\n";
+ }
+
+ return($js_header_string);
+}
+
+# sub show_common_js()
+#
+# Purpose: create text of the javascript needed to interface with
+# the perl functions
+# Arguments: none
+# Returns: text of common javascript subroutine, 'do_http_request'
+# Called By: originating cgi script, or build_html()
+#
+
+sub show_common_js {
+ my $self = shift;
+ my $encodefn = $self->js_encode_function();
+ my $decodefn = $encodefn;
+ $decodefn =~ s/^(en)/de/;
+ $decodefn =~ s/^(esc)/unesc/;
+ #my $request_header_str = $self->create_js_setRequestHeader();
+ my $request_header_str = "";
+ my $rv = <<EOT;
+var ajax = [];
+function pjx(args,fname,method) {
+ this.target=args[1];
+ this.args=args[0];
+ method=(method)?method:'GET';
+ if(method=='post'){method='POST';}
+ this.method = method;
+ this.r=ghr();
+ this.url = this.getURL(fname);
+}
+
+function formDump(){
+ var all = [];
+ var fL = document.forms.length;
+ for(var f = 0;f<fL;f++){
+ var els = document.forms[f].elements;
+ for(var e in els){
+ var tmp = (els[e].id != undefined)? els[e].id : els[e].name;
+ if(typeof tmp != 'string'){continue;}
+ if(tmp){ all[all.length]=tmp}
+ }
+ }
+ return all;
+}
+function getVal(id) {
+ if (id.constructor == Function ) { return id(); }
+ if (typeof(id)!= 'string') { return id; }
+ var element = document.getElementById(id) || document.forms[0].elements[id];
+ if(!element){
+ alert('ERROR: Cant find HTML element with id or name: ' +
+ id+'. Check that an element with name or id='+id+' exists');
+ return 0;
+ }
+ if(element.type == 'select-one') {
+ if(element.selectedIndex == -1) return;
+ var item = element[element.selectedIndex];
+ return item.value || item.text
+ }
+ if (element.type == 'select-multiple') {
+ var ans = [];
+ var k =0;
+ for (var i=0;i<element.length;i++) {
+ if (element[i].selected || element[i].checked ) {
+ ans[k++]= element[i].value || element[i].text;
+ }
+ }
+ return ans;
+ }
+
+ if(element.type == 'radio' || element.type == 'checkbox'){
+ var ans =[];
+ var elms = document.getElementsByTagName('input');
+ var endk = elms.length;
+ var i =0;
+ for(var k=0;k<endk;k++){
+ if(elms[k].type== element.type && elms[k].checked && elms[k].id==id){
+ ans[i++]=elms[k].value;
+ }
+ }
+ return ans;
+ }
+ if( element.value == undefined ){
+ return element.innerHTML;
+ }else{
+ return element.value;
+ }
+}
+function fnsplit(arg) {
+ var url="";
+ if(arg=='NO_CACHE'){return '&pjxrand='+Math.random()}
+ if((typeof(arg)).toLowerCase() == 'object'){
+ for(var k in arg){
+ url += '&' + k + '=' + arg[k];
+ }
+ }else if (arg.indexOf('__') != -1) {
+ arga = arg.split(/__/);
+ url += '&' + arga[0] +'='+ $encodefn(arga[1]);
+ } else {
+ var res = getVal(arg) || '';
+ if(res.constructor != Array){ res = [res] }
+ for(var i=0;i<res.length;i++) {
+ url += '&args=' + $encodefn(res[i]) + '&' + arg + '=' + $encodefn(res[i]);
+ }
+ }
+ return url;
+}
+
+pjx.prototype = {
+ send2perl : function(){
+ var r = this.r;
+ var dt = this.target;
+ this.pjxInitialized(dt);
+ var url=this.url;
+ var postdata;
+ if(this.method=="POST"){
+ var idx=url.indexOf('?');
+ postdata = url.substr(idx+1);
+ url = url.substr(0,idx);
+ }
+ r.open(this.method,url,true);
+ $request_header_str;
+ if(this.method=="POST"){
+ r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ r.send(postdata);
+ }
+ if(this.method=="GET"){
+ r.send(null);
+ }
+ r.onreadystatechange = handleReturn;
+ },
+ pjxInitialized : function(){},
+ pjxCompleted : function(){},
+ readyState4 : function(){
+ var rsp = $decodefn(this.r.responseText); /* the response from perl */
+ var splitval = '__pjx__'; /* to split text */
+ /* fix IE problems with undef values in an Array getting squashed*/
+ rsp = rsp.replace(splitval+splitval+'g',splitval+" "+splitval);
+ var data = rsp.split(splitval);
+ dt = this.target;
+ if (dt.constructor != Array) { dt=[dt]; }
+ if (data.constructor != Array) { data=[data]; }
+ if (typeof(dt[0])!='function') {
+ for ( var i=0; i<dt.length; i++ ) {
+ var div = document.getElementById(dt[i]);
+ if (div.type =='text' || div.type=='textarea' || div.type=='hidden' ) {
+ div.value=data[i];
+ } else{
+ div.innerHTML = data[i];
+ }
+ }
+ } else if (typeof(dt[0])=='function') {
+ dt[0].apply(this,data);
+ }
+ this.pjxCompleted(dt);
+ },
+
+ getURL : function(fname) {
+ var args = this.args;
+ var url= 'fname=' + fname;
+ for (var i=0;i<args.length;i++) {
+ url=url + args[i];
+ }
+ return url;
+ }
+};
+
+handleReturn = function() {
+ for( var k=0; k<ajax.length; k++ ) {
+ if (ajax[k].r==null) { ajax.splice(k--,1); continue; }
+ if ( ajax[k].r.readyState== 4) {
+ ajax[k].readyState4();
+ ajax.splice(k--,1);
+ continue;
+ }
+ }
+};
+
+var ghr=getghr();
+function getghr(){
+ if(typeof XMLHttpRequest != "undefined")
+ {
+ return function(){return new XMLHttpRequest();}
+ }
+ var msv= ["Msxml2.XMLHTTP.7.0", "Msxml2.XMLHTTP.6.0",
+ "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0",
+ "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];
+ for(var j=0;j<=msv.length;j++){
+ try
+ {
+ A = new ActiveXObject(msv[j]);
+ if(A){
+ return function(){return new ActiveXObject(msv[j]);}
+ }
+ }
+ catch(e) { }
+ }
+ return false;
+}
+
+
+function jsdebug(){
+ var tmp = document.getElementById('pjxdebugrequest').innerHTML = "<br><pre>";
+ for( var i=0; i < ajax.length; i++ ) {
+ tmp += '<a href= '+ ajax[i].url +' target=_blank>' +
+ decodeURI(ajax[i].url) + ' </a><br>';
+ }
+ document.getElementById('pjxdebugrequest').innerHTML = tmp + "</pre>";
+}
+
+EOT
+
+ if ( $self->JSDEBUG() <= 1 ) {
+ $rv = $self->compress_js($rv);
+ }
+
+ return($rv);
+}
+
+# sub compress_js()
+#
+# Purpose: searches the javascript for newlines and spaces and
+# removes them (if a newline) or shrinks them to a single (if
+# space).
+# Arguments: javascript to compress
+# Returns: compressed js string
+# Called By: show_common_js(),
+#
+
+sub compress_js {
+ my($self,$js) = @_;
+ return if not defined $js;
+ return if $js eq "";
+ $js =~ s/\n//g; # drop newlines
+ $js =~ s/\s+/ /g; # replace 1+ spaces with just one space
+ return $js;
+}
+
+
+# sub insert_js_in_head()
+#
+# Purpose: searches the html value in the CGI::Ajax object and inserts
+# the ajax javascript code in the <script></script> section,
+# or if no such section exists, then it creates it. If
+# JSDEBUG is set, then an extra div will be added and the
+# url wil be desplayed as a link
+# Arguments: none
+# Returns: none
+# Called By: build_html()
+#
+
+sub insert_js_in_head{
+ my $self = shift;
+ my $mhtml = $self->html();
+ my $newhtml;
+ my @shtml;
+ my $js = $self->show_javascript();
+
+ if ( $self->JSDEBUG() ) {
+ my $showurl=qq!<br/><div id='pjxdebugrequest'></div><br/>!;
+ # find the terminal </body> so we can insert just before it
+ my @splith = $mhtml =~ /(.*)(<\s*\/\s*body[^>]*>?)(.*)/is;
+ $mhtml = $splith[0].$showurl.$splith[1].$splith[2];
+ }
+
+ # see if we can match on <head>
+ @shtml= $mhtml =~ /(.*)(<\s*head[^>]*>?)(.*)/is;
+ if ( @shtml ) {
+ # yes, there's already a <head></head>, so let's insert inside it,
+ # at the beginning
+ $newhtml = $shtml[0].$shtml[1].$js.$shtml[2];
+ } elsif( @shtml= $mhtml =~ /(.*)(<\s*html[^>]*>?)(.*)/is){
+ # there's no <head>, so look for the <html> tag, and insert out
+ # javascript inside that tag
+ $newhtml = $shtml[0].$shtml[1].$js.$shtml[2];
+ } else {
+ $newhtml .= "<html><head>";
+ $newhtml .= $js;
+ $newhtml .= "</head><body>";
+ $newhtml .= "No head/html tags, nowhere to insert. Returning javascript anyway<br>";
+ $newhtml .= "</body></html>";
+ }
+ $self->html($newhtml);
+ return;
+}
+
+# sub handle_request()
+#
+# Purpose: makes sure a fname function name was set in the CGI
+# object, and then tries to eval the function with
+# parameters sent in on args
+# Arguments: none
+# Returns: the result of the perl subroutine, as text; if multiple
+# arguments are sent back from the defined, exported perl
+# method, then join then with a connector (__pjx__).
+# Called By: build_html()
+#
+
+sub handle_request {
+ my ($self) = shift;
+
+ my $result; # $result takes the output of the function, if it's an
+ # array split on __pjx__
+ my @other = (); # array for catching extra parameters
+
+ # we need to access "fname" in the form from the web page, so make
+ # sure there is a CGI object defined
+ return undef unless defined $self->cgi();
+
+ my $rv = "";
+ if ( $self->cgi()->can('header') ) {
+ $rv = $self->cgi()->header( $self->cgi_header_extra() );
+ } else {
+ # don't have an object with a "header()" method, so just create
+ # a mimimal one
+ $rv = "Content-Type: text/html;";
+ # TODO:
+ $rv .= $self->cgi_header_extra();
+ $rv .= "\n\n";
+ }
+
+ # get the name of the function
+ my $func_name = $self->cgi()->param("fname");
+
+ # check if the function name was created
+ if ( defined $self->coderef_list()->{$func_name} ) {
+ my $code = $self->coderef_list()->{$func_name};
+
+ # eval the code from the coderef, and append the output to $rv
+ if ( ref($code) eq "CODE" ) {
+ eval { ($result, @other) = $code->( $self->cgi()->param("args") ) };
+
+ if ($@) {
+ # see if the eval caused and error and report it
+ # Should we be more severe and die?
+ if ( $self->DEBUG() ) {
+ print STDERR "Problem with code: $@\n";
+ }
+ }
+
+ if( @other ) {
+ $rv .= join( "__pjx__", ($result, @other) );
+ if ( $self->DEBUG() ) {
+ print STDERR "rv = $rv\n";
+ }
+ } else {
+ if ( defined $result ) {
+ $rv .= $result;
+ }
+ }
+
+ } # end if ref = CODE
+ } else {
+ # # problems with the URL, return a CGI rrror
+ print STDERR "POSSIBLE SECURITY INCIDENT! Browser from ", $self->cgi()->remote_addr();
+ print STDERR "\trequested URL: ", $self->cgi()->url();
+ print STDERR "\tfname request: ", $self->cgi()->param('fname');
+ print STDERR " -- returning Bad Request status 400\n";
+ if ( $self->cgi()->can('header') ) {
+ return($self->cgi()->header( -status=>'400' ));
+ } else {
+ # don't have an object with a "header()" method, so just create
+ # a mimimal one with 400 error
+ $rv = "Status: 400\nContent-Type: text/html;\n\n";
+ }
+ }
+ return $rv;
+}
+
+
+# sub make_function()
+#
+# Purpose: creates the javascript wrapper for the underlying perl
+# subroutine
+# Arguments: CGI object from web form, and the name of the perl
+# function to export to javascript, or a url if the
+# function name refers to another cgi script
+# Returns: text of the javascript-wrapped perl subroutine
+# Called By: show_javascript; called once for each registered perl
+# subroutine
+#
+
+sub make_function {
+ my ($self, $func_name ) = @_;
+ return("") if not defined $func_name;
+ return("") if $func_name eq "";
+ my $rv = "";
+ my $script = $0 || $ENV{SCRIPT_FILENAME};
+ $script =~ s/.*[\/|\\](.+)$/$1/;
+ my $outside_url = $self->url_list()->{ $func_name };
+ my $url = defined $outside_url ? $outside_url : $script;
+ if ($url =~ /\?/) { $url.='&'; } else {$url.='?'}
+ $url = "'$url'";
+ my $jsdebug = "";
+ if ( $self->JSDEBUG()) {
+ $jsdebug = "jsdebug()";
+ }
+
+ #create the javascript text
+ $rv .= <<EOT;
+function $func_name() {
+ var args = $func_name.arguments;
+ for( var i=0; i<args[0].length;i++ ) {
+ args[0][i] = fnsplit(args[0][i]);
+ }
+ var l = ajax.length;
+ ajax[l]= new pjx(args,"$func_name",args[2]);
+ ajax[l].url = $url + ajax[l].url;
+ ajax[l].send2perl();
+ $jsdebug;
+}
+EOT
+
+ if ( not $self->JSDEBUG() ) {
+ $rv = $self->compress_js($rv);
+ }
+ return $rv;
+}
+
+=item register()
+
+ Purpose: adds a function name and a code ref to the global coderef
+ hash, after the original object was created
+ Arguments: function name, code reference
+ Returns: none
+ Called By: originating web script
+
+=cut
+
+sub register {
+ my ( $self, $fn, $coderef ) = @_;
+ # coderef_list() is a Class::Accessor function
+ # url_list() is a Class::Accessor function
+ if ( ref( $coderef ) eq "CODE" ) {
+ $self->coderef_list()->{$fn} = $coderef;
+ } elsif ( ref($coderef) ) {
+ die "Unsupported code/url type - error\n";
+ } else {
+ $self->url_list()->{$fn} = $coderef;
+ }
+}
+
+=item JSDEBUG()
+
+ Purpose: Show the AJAX URL that is being generated, and stop
+ compression of the generated javascript, both of which can aid
+ during debugging. If set to 1, then the core js will get
+ compressed, but the user-defined functions will not be
+ compressed. If set to 2 (or anything greater than 1 or 0),
+ then none of the javascript will get compressed.
+
+ Arguments: JSDEBUG(0); # turn javascript debugging off
+ JSDEBUG(1); # turn javascript debugging on, some javascript compression
+ JSDEBUG(2); # turn javascript debugging on, no javascript compresstion
+ Returns: prints a link to the url that is being generated automatically by
+ the Ajax object. this is VERY useful for seeing what
+ CGI::Ajax is doing. Following the link, will show a page
+ with the output that the page is generating.
+
+ Called By: $pjx->JSDEBUG(1) # where $pjx is a CGI::Ajax object;
+
+=item DEBUG()
+
+ Purpose: Show debugging information in web server logs
+ Arguments: DEBUG(0); # turn debugging off (default)
+ DEBUG(1); # turn debugging on
+ Returns: prints debugging information to the web server logs using
+ STDERR
+ Called By: $pjx->DEBUG(1) # where $pjx is a CGI::Ajax object;
+
+=back
+
+=head1 BUGS
+
+Follow any bugs at our homepage....
+
+ http://www.perljax.us
+
+=head1 SUPPORT
+
+Check out the news/discussion/bugs lists at our homepage:
+
+ http://www.perljax.us
+
+=head1 AUTHORS
+
+ Brian C. Thomas Brent Pedersen
+ CPAN ID: BCT
+ bct.x42@gmail.com bpederse@gmail.com
+
+=head1 A NOTE ABOUT THE MODULE NAME
+
+This module was initiated using the name "Perljax", but then
+registered with CPAN under the WWW group "CGI::", and so became
+"CGI::Perljax". Upon further deliberation, we decided to change it's
+name to L<CGI::Ajax>.
+
+=head1 COPYRIGHT
+
+This program is free software; you can redistribute
+it and/or modify it under the same terms as Perl itself.
+
+The full text of the license can be found in the
+LICENSE file included with this module.
+
+=head1 SEE ALSO
+
+L<Data::Javascript>
+L<CGI>
+L<Class::Accessor>
+
+=cut
+
+1;
+__END__
--- /dev/null
+Terms of Perl itself
+
+a) the GNU General Public License as published by the Free
+ Software Foundation; either version 1, or (at your option) any
+ later version, or
+b) the "Artistic License"
+
+---------------------------------------------------------------------------
+
+The General Public License (GPL)
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
+Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute
+verbatim copies of this license document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share
+and change it. By contrast, the GNU General Public License is intended to
+guarantee your freedom to share and change free software--to make sure the
+software is free for all its users. This General Public License applies to most of
+the Free Software Foundation's software and to any other program whose
+authors commit to using it. (Some other Free Software Foundation software is
+covered by the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our
+General Public Licenses are designed to make sure that you have the freedom
+to distribute copies of free software (and charge for this service if you wish), that
+you receive source code or can get it if you want it, that you can change the
+software or use pieces of it in new free programs; and that you know you can do
+these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny
+you these rights or to ask you to surrender the rights. These restrictions
+translate to certain responsibilities for you if you distribute copies of the
+software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for a
+fee, you must give the recipients all the rights that you have. You must make
+sure that they, too, receive or can get the source code. And you must show
+them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2) offer
+you this license which gives you legal permission to copy, distribute and/or
+modify the software.
+
+Also, for each author's protection and ours, we want to make certain that
+everyone understands that there is no warranty for this free software. If the
+software is modified by someone else and passed on, we want its recipients to
+know that what they have is not the original, so that any problems introduced by
+others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents. We wish
+to avoid the danger that redistributors of a free program will individually obtain
+patent licenses, in effect making the program proprietary. To prevent this, we
+have made it clear that any patent must be licensed for everyone's free use or
+not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification
+follow.
+
+GNU GENERAL PUBLIC LICENSE
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
+MODIFICATION
+
+0. This License applies to any program or other work which contains a notice
+placed by the copyright holder saying it may be distributed under the terms of
+this General Public License. The "Program", below, refers to any such program
+or work, and a "work based on the Program" means either the Program or any
+derivative work under copyright law: that is to say, a work containing the
+Program or a portion of it, either verbatim or with modifications and/or translated
+into another language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not covered by
+this License; they are outside its scope. The act of running the Program is not
+restricted, and the output from the Program is covered only if its contents
+constitute a work based on the Program (independent of having been made by
+running the Program). Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as
+you receive it, in any medium, provided that you conspicuously and appropriately
+publish on each copy an appropriate copyright notice and disclaimer of warranty;
+keep intact all the notices that refer to this License and to the absence of any
+warranty; and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may at
+your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus
+forming a work based on the Program, and copy and distribute such
+modifications or work under the terms of Section 1 above, provided that you also
+meet all of these conditions:
+
+a) You must cause the modified files to carry prominent notices stating that you
+changed the files and the date of any change.
+
+b) You must cause any work that you distribute or publish, that in whole or in
+part contains or is derived from the Program or any part thereof, to be licensed
+as a whole at no charge to all third parties under the terms of this License.
+
+c) If the modified program normally reads commands interactively when run, you
+must cause it, when started running for such interactive use in the most ordinary
+way, to print or display an announcement including an appropriate copyright
+notice and a notice that there is no warranty (or else, saying that you provide a
+warranty) and that users may redistribute the program under these conditions,
+and telling the user how to view a copy of this License. (Exception: if the
+Program itself is interactive but does not normally print such an announcement,
+your work based on the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If identifiable
+sections of that work are not derived from the Program, and can be reasonably
+considered independent and separate works in themselves, then this License,
+and its terms, do not apply to those sections when you distribute them as
+separate works. But when you distribute the same sections as part of a whole
+which is a work based on the Program, the distribution of the whole must be on
+the terms of this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your rights to
+work written entirely by you; rather, the intent is to exercise the right to control
+the distribution of derivative or collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program with the
+Program (or with a work based on the Program) on a volume of a storage or
+distribution medium does not bring the other work under the scope of this
+License.
+
+3. You may copy and distribute the Program (or a work based on it, under
+Section 2) in object code or executable form under the terms of Sections 1 and 2
+above provided that you also do one of the following:
+
+a) Accompany it with the complete corresponding machine-readable source
+code, which must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange; or,
+
+b) Accompany it with a written offer, valid for at least three years, to give any
+third party, for a charge no more than your cost of physically performing source
+distribution, a complete machine-readable copy of the corresponding source
+code, to be distributed under the terms of Sections 1 and 2 above on a medium
+customarily used for software interchange; or,
+
+c) Accompany it with the information you received as to the offer to distribute
+corresponding source code. (This alternative is allowed only for noncommercial
+distribution and only if you received the program in object code or executable
+form with such an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for making
+modifications to it. For an executable work, complete source code means all the
+source code for all modules it contains, plus any associated interface definition
+files, plus the scripts used to control compilation and installation of the
+executable. However, as a special exception, the source code distributed need
+not include anything that is normally distributed (in either source or binary form)
+with the major components (compiler, kernel, and so on) of the operating system
+on which the executable runs, unless that component itself accompanies the
+executable.
+
+If distribution of executable or object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the source
+code from the same place counts as distribution of the source code, even though
+third parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as
+expressly provided under this License. Any attempt otherwise to copy, modify,
+sublicense or distribute the Program is void, and will automatically terminate
+your rights under this License. However, parties who have received copies, or
+rights, from you under this License will not have their licenses terminated so long
+as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it.
+However, nothing else grants you permission to modify or distribute the Program
+or its derivative works. These actions are prohibited by law if you do not accept
+this License. Therefore, by modifying or distributing the Program (or any work
+based on the Program), you indicate your acceptance of this License to do so,
+and all its terms and conditions for copying, distributing or modifying the
+Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program),
+the recipient automatically receives a license from the original licensor to copy,
+distribute or modify the Program subject to these terms and conditions. You
+may not impose any further restrictions on the recipients' exercise of the rights
+granted herein. You are not responsible for enforcing compliance by third parties
+to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent infringement
+or for any other reason (not limited to patent issues), conditions are imposed on
+you (whether by court order, agreement or otherwise) that contradict the
+conditions of this License, they do not excuse you from the conditions of this
+License. If you cannot distribute so as to satisfy simultaneously your obligations
+under this License and any other pertinent obligations, then as a consequence
+you may not distribute the Program at all. For example, if a patent license would
+not permit royalty-free redistribution of the Program by all those who receive
+copies directly or indirectly through you, then the only way you could satisfy
+both it and this License would be to refrain entirely from distribution of the
+Program.
+
+If any portion of this section is held invalid or unenforceable under any particular
+circumstance, the balance of the section is intended to apply and the section as
+a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or other
+property right claims or to contest validity of any such claims; this section has
+the sole purpose of protecting the integrity of the free software distribution
+system, which is implemented by public license practices. Many people have
+made generous contributions to the wide range of software distributed through
+that system in reliance on consistent application of that system; it is up to the
+author/donor to decide if he or she is willing to distribute software through any
+other system and a licensee cannot impose that choice.
+
+This section is intended to make thoroughly clear what is believed to be a
+consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain countries
+either by patents or by copyrighted interfaces, the original copyright holder who
+places the Program under this License may add an explicit geographical
+distribution limitation excluding those countries, so that distribution is permitted
+only in or among countries not thus excluded. In such case, this License
+incorporates the limitation as if written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the
+General Public License from time to time. Such new versions will be similar in
+spirit to the present version, but may differ in detail to address new problems or
+concerns.
+
+Each version is given a distinguishing version number. If the Program specifies a
+version number of this License which applies to it and "any later version", you
+have the option of following the terms and conditions either of that version or of
+any later version published by the Free Software Foundation. If the Program does
+not specify a version number of this License, you may choose any version ever
+published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs
+whose distribution conditions are different, write to the author to ask for
+permission. For software which is copyrighted by the Free Software Foundation,
+write to the Free Software Foundation; we sometimes make exceptions for this.
+Our decision will be guided by the two goals of preserving the free status of all
+derivatives of our free software and of promoting the sharing and reuse of
+software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS
+NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
+COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
+"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
+IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
+ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
+YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
+CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED
+TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY
+WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS
+PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
+ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
+(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
+OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+
+---------------------------------------------------------------------------
+
+The Artistic License
+
+Preamble
+
+The intent of this document is to state the conditions under which a Package
+may be copied, such that the Copyright Holder maintains some semblance of
+artistic control over the development of the package, while giving the users of the
+package the right to use and distribute the Package in a more-or-less customary
+fashion, plus the right to make reasonable modifications.
+
+Definitions:
+
+- "Package" refers to the collection of files distributed by the Copyright
+ Holder, and derivatives of that collection of files created through textual
+ modification.
+- "Standard Version" refers to such a Package if it has not been modified,
+ or has been modified in accordance with the wishes of the Copyright
+ Holder.
+- "Copyright Holder" is whoever is named in the copyright or copyrights for
+ the package.
+- "You" is you, if you're thinking about copying or distributing this Package.
+- "Reasonable copying fee" is whatever you can justify on the basis of
+ media cost, duplication charges, time of people involved, and so on. (You
+ will not be required to justify it to the Copyright Holder, but only to the
+ computing community at large as a market that must bear the fee.)
+- "Freely Available" means that no fee is charged for the item itself, though
+ there may be fees involved in handling the item. It also means that
+ recipients of the item may redistribute it under the same conditions they
+ received it.
+
+1. You may make and give away verbatim copies of the source form of the
+Standard Version of this Package without restriction, provided that you duplicate
+all of the original copyright notices and associated disclaimers.
+
+2. You may apply bug fixes, portability fixes and other modifications derived from
+the Public Domain or from the Copyright Holder. A Package modified in such a
+way shall still be considered the Standard Version.
+
+3. You may otherwise modify your copy of this Package in any way, provided
+that you insert a prominent notice in each changed file stating how and when
+you changed that file, and provided that you do at least ONE of the following:
+
+ a) place your modifications in the Public Domain or otherwise
+ make them Freely Available, such as by posting said modifications
+ to Usenet or an equivalent medium, or placing the modifications on
+ a major archive site such as ftp.uu.net, or by allowing the
+ Copyright Holder to include your modifications in the Standard
+ Version of the Package.
+
+ b) use the modified Package only within your corporation or
+ organization.
+
+ c) rename any non-standard executables so the names do not
+ conflict with standard executables, which must also be provided,
+ and provide a separate manual page for each non-standard
+ executable that clearly documents how it differs from the Standard
+ Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+4. You may distribute the programs of this Package in object code or executable
+form, provided that you do at least ONE of the following:
+
+ a) distribute a Standard Version of the executables and library
+ files, together with instructions (in the manual page or equivalent)
+ on where to get the Standard Version.
+
+ b) accompany the distribution with the machine-readable source of
+ the Package with your modifications.
+
+ c) accompany any non-standard executables with their
+ corresponding Standard Version executables, giving the
+ non-standard executables non-standard names, and clearly
+ documenting the differences in manual pages (or equivalent),
+ together with instructions on where to get the Standard Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+5. You may charge a reasonable copying fee for any distribution of this Package.
+You may charge any fee you choose for support of this Package. You may not
+charge a fee for this Package itself. However, you may distribute this Package in
+aggregate with other (possibly commercial) programs as part of a larger
+(possibly commercial) software distribution provided that you do not advertise
+this Package as a product of your own.
+
+6. The scripts and library files supplied as input to or produced as output from
+the programs of this Package do not automatically fall under the copyright of this
+Package, but belong to whomever generated them, and may be sold
+commercially, and may be aggregated with this Package.
+
+7. C or perl subroutines supplied by you and linked into this Package shall not
+be considered part of this Package.
+
+8. Aggregation of this Package with a commercial distribution is always permitted
+provided that the use of this Package is embedded; that is, when no overt attempt
+is made to make this Package's interfaces visible to the end user of the
+commercial distribution. Such use shall not be construed as a distribution of
+this Package.
+
+9. The name of the Copyright Holder may not be used to endorse or promote
+products derived from this software without specific prior written permission.
+
+10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.
+
+The End
+
+
--- /dev/null
+pod2text CGI::Perljax.pm > README
+
+CGI::Perljax
+
+Perljax - a perl-specific system for writing AJAX- or
+DHTML-based web applications.
+
+
+Perljax provides a unique mechanism for using perl code
+asynchronously from javascript using AJAX to access user-written
+perl functions/methods. Perljax unburdens the user from having to
+write any javascript, except for having to associate an exported
+method with a document-defined event (such as onClick, onKeyUp,
+etc). Only in the more advanced implementations of a exported perl
+method would a user need to write custom javascript. Perljax supports
+methods that return single results, or multiple results to the web
+page. No other projects that we know of are like Perljax for the
+following reasons: 1. Perljax is targeted specifically for perl
+development. 2. Perljax shields the user from having to write any
+javascript at all (unless they want to). 3. The URL for the HTTP GET
+request is automatically generated based on HTML layout and events,
+and the page is then dynamically updated. 4. Perljax is not part
+of a Content Management System, or some other larger project.
+
+
+INSTALL
+
+perl Makefile.PL
+make
+make test
+make install
+
+*If you are on a windows box you should use 'nmake' rather than 'make'.
+
+Installation will place Perljax into the system perl @INC path, but it
+is important that you make sure mod_perl uses this path (which is
+mod_perl's default behavior, and also assuming you use mod_perl, and
+not just run perl as a CGI).
+
+Example scripts are provided in the source script directory, and can
+also be seen on the project's website, http://www.perljax.us.
--- /dev/null
+NAME
+ YAML - YAML Ain't Markup Language (tm)
+
+SYNOPSIS
+ use YAML;
+
+ # Load a YAML stream of 3 YAML documents into Perl data structures.
+ my ($hashref, $arrayref, $string) = Load(<<'...');
+ ---
+ name: ingy
+ age: old
+ weight: heavy
+ # I should comment that I also like pink, but don't tell anybody.
+ favorite colors:
+ - red
+ - green
+ - blue
+ ---
+ - Clark Evans
+ - Oren Ben-Kiki
+ - Ingy döt Net
+ --- >
+ You probably think YAML stands for "Yet Another Markup Language". It
+ ain't! YAML is really a data serialization language. But if you want
+ to think of it as a markup, that's OK with me. A lot of people try
+ to use XML as a serialization format.
+
+ "YAML" is catchy and fun to say. Try it. "YAML, YAML, YAML!!!"
+ ...
+
+ # Dump the Perl data structures back into YAML.
+ print Dump($string, $arrayref, $hashref);
+
+ # YAML::Dump is used the same way you'd use Data::Dumper::Dumper
+ use Data::Dumper;
+ print Dumper($string, $arrayref, $hashref);
+
+DESCRIPTION
+ The YAML.pm module implements a YAML Loader and Dumper based on the YAML
+ 1.0 specification. <http://www.yaml.org/spec/>
+
+ YAML is a generic data serialization language that is optimized for
+ human readability. It can be used to express the data structures of most
+ modern programming languages. (Including Perl!!!)
+
+ For information on the YAML syntax, please refer to the YAML
+ specification.
+
+WHY YAML IS COOL
+ YAML is readable for people.
+ It makes clear sense out of complex data structures. You should find
+ that YAML is an exceptional data dumping tool. Structure is shown
+ through indentation, YAML supports recursive data, and hash keys are
+ sorted by default. In addition, YAML supports several styles of
+ scalar formatting for different types of data.
+
+ YAML is editable.
+ YAML was designed from the ground up to be an excellent syntax for
+ configuration files. Almost all programs need configuration files,
+ so why invent a new syntax for each one? And why subject users to
+ the complexities of XML or native Perl code?
+
+ YAML is multilingual.
+ Yes, YAML supports Unicode. But I'm actually referring to
+ programming languages. YAML was designed to meet the serialization
+ needs of Perl, Python, Ruby, Tcl, PHP, Javascript and Java. It was
+ also designed to be interoperable between those languages. That
+ means YAML serializations produced by Perl can be processed by
+ Python.
+
+ YAML is taint safe.
+ Using modules like Data::Dumper for serialization is fine as long as
+ you can be sure that nobody can tamper with your data files or
+ transmissions. That's because you need to use Perl's "eval()"
+ built-in to deserialize the data. Somebody could add a snippet of
+ Perl to erase your files.
+
+ YAML's parser does not need to eval anything.
+
+ YAML is full featured.
+ YAML can accurately serialize all of the common Perl data structures
+ and deserialize them again without losing data relationships.
+ Although it is not 100% perfect (no serializer is or can be
+ perfect), it fares as well as the popular current modules:
+ Data::Dumper, Storable, XML::Dumper and Data::Denter.
+
+ YAML.pm also has the ability to handle code (subroutine) references
+ and typeglobs. (Still experimental) These features are not found in
+ Perl's other serialization modules.
+
+ YAML is extensible.
+ The YAML language has been designed to be flexible enough to solve
+ it's own problems. The markup itself has 3 basic construct which
+ resemble Perl's hash, array and scalar. By default, these map to
+ their Perl equivalents. But each YAML node also supports a tagging
+ mechanism (type system) which can cause that node to be interpreted
+ in a completely different manner. That's how YAML can support object
+ serialization and oddball structures like Perl's typeglob.
+
+YAML IMPLEMENTATIONS IN PERL
+ This module, YAML.pm, is really just the interface module for YAML
+ modules written in Perl. The basic interface for YAML consists of two
+ functions: "Dump" and "Load". The real work is done by the modules
+ YAML::Dumper and YAML::Loader.
+
+ Different YAML module distributions can be created by subclassing
+ YAML.pm and YAML::Loader and YAML::Dumper. For example, YAML-Simple
+ consists of YAML::Simple YAML::Dumper::Simple and YAML::Loader::Simple.
+
+ Why would there be more than one implementation of YAML? Well, despite
+ YAML's offering of being a simple data format, YAML is actually very
+ deep and complex. Implementing the entirety of the YAML specification is
+ a daunting task.
+
+ For this reason I am currently working on 3 different YAML
+ implementations.
+
+ YAML
+ The main YAML distribution will keeping evolving to support the
+ entire YAML specification in pure Perl. This may not be the fastest
+ or most stable module though. Currently, YAML.pm has lots of known
+ bugs. It is mostly a great tool for dumping Perl data structures to
+ a readable form.
+
+ YAML::Lite
+ The point of YAML::Lite is to strip YAML down to the 90% that people
+ use most and offer that in a small, fast, stable, pure Perl form.
+ YAML::Lite will simply die when it is asked to do something it
+ can't.
+
+ YAML::Syck
+ "libsyck" is the C based YAML processing library used by the Ruby
+ programming language (and also Python, PHP and Pugs). YAML::Syck is
+ the Perl binding to "libsyck". It should be very fast, but may have
+ problems of its own. It will also require C compilation.
+
+ NOTE: Audrey Tang has actually completed this module and it works
+ great and is 10 times faster than YAML.pm.
+
+ In the future, there will likely be even more YAML modules. Remember,
+ people other than Ingy are allowed to write YAML modules!
+
+FUNCTIONAL USAGE
+ YAML is completely OO under the hood. Still it exports a few useful top
+ level functions so that it is dead simple to use. These functions just
+ do the OO stuff for you. If you want direct access to the OO API see the
+ documentation for YAML::Dumper and YAML::Loader.
+
+ Exported Functions
+ The following functions are exported by YAML.pm by default. The reason
+ they are exported is so that YAML works much like Data::Dumper. If you
+ don't want functions to be imported, just use YAML with an empty import
+ list:
+
+ use YAML ();
+
+ Dump(list-of-Perl-data-structures)
+ Turn Perl data into YAML. This function works very much like
+ Data::Dumper::Dumper(). It takes a list of Perl data strucures and
+ dumps them into a serialized form. It returns a string containing
+ the YAML stream. The structures can be references or plain scalars.
+
+ Load(string-containing-a-YAML-stream)
+ Turn YAML into Perl data. This is the opposite of Dump. Just like
+ Storable's thaw() function or the eval() function in relation to
+ Data::Dumper. It parses a string containing a valid YAML stream into
+ a list of Perl data structures.
+
+ Exportable Functions
+ These functions are not exported by default but you can request them in
+ an import list like this:
+
+ use YAML qw'freeze thaw Bless';
+
+ freeze() and thaw()
+ Aliases to Dump() and Load() for Storable fans. This will also allow
+ YAML.pm to be plugged directly into modules like POE.pm, that use
+ the freeze/thaw API for internal serialization.
+
+ DumpFile(filepath, list)
+ Writes the YAML stream to a file instead of just returning a string.
+
+ LoadFile(filepath)
+ Reads the YAML stream from a file instead of a string.
+
+ Bless(perl-node, [yaml-node | class-name])
+ Associate a normal Perl node, with a yaml node. A yaml node is an
+ object tied to the YAML::Node class. The second argument is either a
+ yaml node that you've already created or a class (package) name that
+ supports a yaml_dump() function. A yaml_dump() function should take
+ a perl node and return a yaml node. If no second argument is
+ provided, Bless will create a yaml node. This node is not returned,
+ but can be retrieved with the Blessed() function.
+
+ Here's an example of how to use Bless. Say you have a hash
+ containing three keys, but you only want to dump two of them.
+ Furthermore the keys must be dumped in a certain order. Here's how
+ you do that:
+
+ use YAML qw(Dump Bless);
+ $hash = {apple => 'good', banana => 'bad', cauliflower => 'ugly'};
+ print Dump $hash;
+ Bless($hash)->keys(['banana', 'apple']);
+ print Dump $hash;
+
+ produces:
+
+ ---
+ apple: good
+ banana: bad
+ cauliflower: ugly
+ ---
+ banana: bad
+ apple: good
+
+ Bless returns the tied part of a yaml-node, so that you can call the
+ YAML::Node methods. This is the same thing that YAML::Node::ynode()
+ returns. So another way to do the above example is:
+
+ use YAML qw(Dump Bless);
+ use YAML::Node;
+ $hash = {apple => 'good', banana => 'bad', cauliflower => 'ugly'};
+ print Dump $hash;
+ Bless($hash);
+ $ynode = ynode(Blessed($hash));
+ $ynode->keys(['banana', 'apple']);
+ print Dump $hash;
+
+ Note that Blessing a Perl data structure does not change it anyway.
+ The extra information is stored separately and looked up by the
+ Blessed node's memory address.
+
+ Blessed(perl-node)
+ Returns the yaml node that a particular perl node is associated with
+ (see above). Returns undef if the node is not (YAML) Blessed.
+
+GLOBAL OPTIONS
+ YAML options are set using a group of global variables in the YAML
+ namespace. This is similar to how Data::Dumper works.
+
+ For example, to change the indentation width, do something like:
+
+ local $YAML::Indent = 3;
+
+ The current options are:
+
+ DumperClass
+ You can override which module/class YAML uses for Dumping data.
+
+ LoaderClass
+ You can override which module/class YAML uses for Loading data.
+
+ Indent
+ This is the number of space characters to use for each indentation
+ level when doing a Dump(). The default is 2.
+
+ By the way, YAML can use any number of characters for indentation at
+ any level. So if you are editing YAML by hand feel free to do it
+ anyway that looks pleasing to you; just be consistent for a given
+ level.
+
+ SortKeys
+ Default is 1. (true)
+
+ Tells YAML.pm whether or not to sort hash keys when storing a
+ document.
+
+ YAML::Node objects can have their own sort order, which is usually
+ what you want. To override the YAML::Node order and sort the keys
+ anyway, set SortKeys to 2.
+
+ Stringify
+ Default is 0. (false)
+
+ Objects with string overloading should honor the overloading and
+ dump the stringification of themselves, rather than the actual
+ object's guts.
+
+ UseHeader
+ Default is 1. (true)
+
+ This tells YAML.pm whether to use a separator string for a Dump
+ operation. This only applies to the first document in a stream.
+ Subsequent documents must have a YAML header by definition.
+
+ UseVersion
+ Default is 0. (false)
+
+ Tells YAML.pm whether to include the YAML version on the
+ separator/header.
+
+ --- %YAML:1.0
+
+ AnchorPrefix
+ Default is ''.
+
+ Anchor names are normally numeric. YAML.pm simply starts with '1'
+ and increases by one for each new anchor. This option allows you to
+ specify a string to be prepended to each anchor number.
+
+ UseCode
+ Setting the UseCode option is a shortcut to set both the DumpCode
+ and LoadCode options at once. Setting UseCode to '1' tells YAML.pm
+ to dump Perl code references as Perl (using B::Deparse) and to load
+ them back into memory using eval(). The reason this has to be an
+ option is that using eval() to parse untrusted code is, well,
+ untrustworthy.
+
+ DumpCode
+ Determines if and how YAML.pm should serialize Perl code references.
+ By default YAML.pm will dump code references as dummy placeholders
+ (much like Data::Dumper). If DumpCode is set to '1' or 'deparse',
+ code references will be dumped as actual Perl code.
+
+ DumpCode can also be set to a subroutine reference so that you can
+ write your own serializing routine. YAML.pm passes you the code ref.
+ You pass back the serialization (as a string) and a format
+ indicator. The format indicator is a simple string like: 'deparse'
+ or 'bytecode'.
+
+ LoadCode
+ LoadCode is the opposite of DumpCode. It tells YAML if and how to
+ deserialize code references. When set to '1' or 'deparse' it will
+ use "eval()". Since this is potentially risky, only use this option
+ if you know where your YAML has been.
+
+ LoadCode can also be set to a subroutine reference so that you can
+ write your own deserializing routine. YAML.pm passes the
+ serialization (as a string) and a format indicator. You pass back
+ the code reference.
+
+ UseBlock
+ YAML.pm uses heuristics to guess which scalar style is best for a
+ given node. Sometimes you'll want all multiline scalars to use the
+ 'block' style. If so, set this option to 1.
+
+ NOTE: YAML's block style is akin to Perl's here-document.
+
+ UseFold
+ If you want to force YAML to use the 'folded' style for all
+ multiline scalars, then set $UseFold to 1.
+
+ NOTE: YAML's folded style is akin to the way HTML folds text, except
+ smarter.
+
+ UseAliases
+ YAML has an alias mechanism such that any given structure in memory
+ gets serialized once. Any other references to that structure are
+ serialized only as alias markers. This is how YAML can serialize
+ duplicate and recursive structures.
+
+ Sometimes, when you KNOW that your data is nonrecursive in nature,
+ you may want to serialize such that every node is expressed in full.
+ (ie as a copy of the original). Setting $YAML::UseAliases to 0 will
+ allow you to do this. This also may result in faster processing
+ because the lookup overhead is by bypassed.
+
+ THIS OPTION CAN BE DANGEROUS. *If* your data is recursive, this
+ option *will* cause Dump() to run in an endless loop, chewing up
+ your computers memory. You have been warned.
+
+ CompressSeries
+ Default is 1.
+
+ Compresses the formatting of arrays of hashes:
+
+ -
+ foo: bar
+ -
+ bar: foo
+
+ becomes:
+
+ - foo: bar
+ - bar: foo
+
+ Since this output is usually more desirable, this option is turned
+ on by default.
+
+YAML TERMINOLOGY
+ YAML is a full featured data serialization language, and thus has its
+ own terminology.
+
+ It is important to remember that although YAML is heavily influenced by
+ Perl and Python, it is a language in its own right, not merely just a
+ representation of Perl structures.
+
+ YAML has three constructs that are conspicuously similar to Perl's hash,
+ array, and scalar. They are called mapping, sequence, and string
+ respectively. By default, they do what you would expect. But each
+ instance may have an explicit or implicit tag (type) that makes it
+ behave differently. In this manner, YAML can be extended to represent
+ Perl's Glob or Python's tuple, or Ruby's Bigint.
+
+ stream
+ A YAML stream is the full sequence of unicode characters that a YAML
+ parser would read or a YAML emitter would write. A stream may
+ contain one or more YAML documents separated by YAML headers.
+
+ ---
+ a: mapping
+ foo: bar
+ ---
+ - a
+ - sequence
+
+ document
+ A YAML document is an independent data structure representation
+ within a stream. It is a top level node. Each document in a YAML
+ stream must begin with a YAML header line. Actually the header is
+ optional on the first document.
+
+ ---
+ This: top level mapping
+ is:
+ - a
+ - YAML
+ - document
+
+ header
+ A YAML header is a line that begins a YAML document. It consists of
+ three dashes, possibly followed by more info. Another purpose of the
+ header line is that it serves as a place to put top level tag and
+ anchor information.
+
+ --- !recursive-sequence &001
+ - * 001
+ - * 001
+
+ node
+ A YAML node is the representation of a particular data stucture.
+ Nodes may contain other nodes. (In Perl terms, nodes are like
+ scalars. Strings, arrayrefs and hashrefs. But this refers to the
+ serialized format, not the in-memory structure.)
+
+ tag This is similar to a type. It indicates how a particular YAML node
+ serialization should be transferred into or out of memory. For
+ instance a Foo::Bar object would use the tag 'perl/Foo::Bar':
+
+ - !perl/Foo::Bar
+ foo: 42
+ bar: stool
+
+ collection
+ A collection is the generic term for a YAML data grouping. YAML has
+ two types of collections: mappings and sequences. (Similar to hashes
+ and arrays)
+
+ mapping
+ A mapping is a YAML collection defined by unordered key/value pairs
+ with unique keys. By default YAML mappings are loaded into Perl
+ hashes.
+
+ a mapping:
+ foo: bar
+ two: times two is 4
+
+ sequence
+ A sequence is a YAML collection defined by an ordered list of
+ elements. By default YAML sequences are loaded into Perl arrays.
+
+ a sequence:
+ - one bourbon
+ - one scotch
+ - one beer
+
+ scalar
+ A scalar is a YAML node that is a single value. By default YAML
+ scalars are loaded into Perl scalars.
+
+ a scalar key: a scalar value
+
+ YAML has many styles for representing scalars. This is important
+ because varying data will have varying formatting requirements to
+ retain the optimum human readability.
+
+ plain scalar
+ A plain sclar is unquoted. All plain scalars are automatic
+ candidates for "implicit tagging". This means that their tag may be
+ determined automatically by examination. The typical uses for this
+ are plain alpha strings, integers, real numbers, dates, times and
+ currency.
+
+ - a plain string
+ - -42
+ - 3.1415
+ - 12:34
+ - 123 this is an error
+
+ single quoted scalar
+ This is similar to Perl's use of single quotes. It means no escaping
+ except for single quotes which are escaped by using two adjacent
+ single quotes.
+
+ - 'When I say ''\n'' I mean "backslash en"'
+
+ double quoted scalar
+ This is similar to Perl's use of double quotes. Character escaping
+ can be used.
+
+ - "This scalar\nhas two lines, and a bell -->\a"
+
+ folded scalar
+ This is a multiline scalar which begins on the next line. It is
+ indicated by a single right angle bracket. It is unescaped like the
+ single quoted scalar. Line folding is also performed.
+
+ - >
+ This is a multiline scalar which begins on
+ the next line. It is indicated by a single
+ carat. It is unescaped like the single
+ quoted scalar. Line folding is also
+ performed.
+
+ block scalar
+ This final multiline form is akin to Perl's here-document except
+ that (as in all YAML data) scope is indicated by indentation.
+ Therefore, no ending marker is required. The data is verbatim. No
+ line folding.
+
+ - |
+ QTY DESC PRICE TOTAL
+ --- ---- ----- -----
+ 1 Foo Fighters $19.95 $19.95
+ 2 Bar Belles $29.95 $59.90
+
+ parser
+ A YAML processor has four stages: parse, load, dump, emit.
+
+ A parser parses a YAML stream. YAML.pm's Load() function contains a
+ parser.
+
+ loader
+ The other half of the Load() function is a loader. This takes the
+ information from the parser and loads it into a Perl data structure.
+
+ dumper
+ The Dump() function consists of a dumper and an emitter. The dumper
+ walks through each Perl data structure and gives info to the
+ emitter.
+
+ emitter
+ The emitter takes info from the dumper and turns it into a YAML
+ stream.
+
+ NOTE: In YAML.pm the parser/loader and the dumper/emitter code are
+ currently very closely tied together. In the future they may be
+ broken into separate stages.
+
+ For more information please refer to the immensely helpful YAML
+ specification available at <http://www.yaml.org/spec/>.
+
+ysh - The YAML Shell
+ The YAML distribution ships with a script called 'ysh', the YAML shell.
+ ysh provides a simple, interactive way to play with YAML. If you type in
+ Perl code, it displays the result in YAML. If you type in YAML it turns
+ it into Perl code.
+
+ To run ysh, (assuming you installed it along with YAML.pm) simply type:
+
+ ysh [options]
+
+ Please read the "ysh" documentation for the full details. There are lots
+ of options.
+
+BUGS & DEFICIENCIES
+ If you find a bug in YAML, please try to recreate it in the YAML Shell
+ with logging turned on ('ysh -L'). When you have successfully reproduced
+ the bug, please mail the LOG file to the author (ingy@cpan.org).
+
+ WARNING: This is still *ALPHA* code. Well, most of this code has been
+ around for years...
+
+ BIGGER WARNING: YAML.pm has been slow in the making, but I am committed
+ to having top notch YAML tools in the Perl world. The YAML team is close
+ to finalizing the YAML 1.1 spec. This version of YAML.pm is based off of
+ a very old pre 1.0 spec. In actuality there isn't a ton of difference,
+ and this YAML.pm is still fairly useful. Things will get much better in
+ the future.
+
+RESOURCES
+ <http://lists.sourceforge.net/lists/listinfo/yaml-core> is the mailing
+ list. This is where the language is discussed and designed.
+
+ <http://www.yaml.org> is the official YAML website.
+
+ <http://www.yaml.org/spec/> is the YAML 1.0 specification.
+
+ <http://yaml.kwiki.org> is the official YAML wiki.
+
+SEE ALSO
+ See YAML::Syck. Fast!
+
+AUTHOR
+ Ingy döt Net <ingy@cpan.org>
+
+ is resonsible for YAML.pm.
+
+ The YAML serialization language is the result of years of collaboration
+ between Oren Ben-Kiki, Clark Evans and Ingy döt Net. Several others
+ have added help along the way.
+
+COPYRIGHT
+ Copyright (c) 2005, 2006. Ingy döt Net. All rights reserved. Copyright
+ (c) 2001, 2002, 2005. Brian Ingerson. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify it
+ under the same terms as Perl itself.
+
+ See <http://www.perl.com/perl/misc/Artistic.html>
+
--- /dev/null
+package YAML;
+use strict; use warnings;
+use YAML::Base;
+use base 'YAML::Base';
+use YAML::Node; # XXX This is a temp fix for Module::Build
+use 5.006001;
+our $VERSION = '0.62';
+our @EXPORT = qw'Dump Load';
+our @EXPORT_OK = qw'freeze thaw DumpFile LoadFile Bless Blessed';
+
+# XXX This VALUE nonsense needs to go.
+use constant VALUE => "\x07YAML\x07VALUE\x07";
+
+# YAML Object Properties
+field dumper_class => 'YAML::Dumper';
+field loader_class => 'YAML::Loader';
+field dumper_object =>
+ -init => '$self->init_action_object("dumper")';
+field loader_object =>
+ -init => '$self->init_action_object("loader")';
+
+sub Dump {
+ my $yaml = YAML->new;
+ $yaml->dumper_class($YAML::DumperClass)
+ if $YAML::DumperClass;
+ return $yaml->dumper_object->dump(@_);
+}
+
+sub Load {
+ my $yaml = YAML->new;
+ $yaml->loader_class($YAML::LoaderClass)
+ if $YAML::LoaderClass;
+ return $yaml->loader_object->load(@_);
+}
+
+{
+ no warnings 'once';
+ # freeze/thaw is the API for Storable string serialization. Some
+ # modules make use of serializing packages on if they use freeze/thaw.
+ *freeze = \ &Dump;
+ *thaw = \ &Load;
+}
+
+sub DumpFile {
+ my $OUT;
+ my $filename = shift;
+ if (ref $filename eq 'GLOB') {
+ $OUT = $filename;
+ }
+ else {
+ my $mode = '>';
+ if ($filename =~ /^\s*(>{1,2})\s*(.*)$/) {
+ ($mode, $filename) = ($1, $2);
+ }
+ open $OUT, $mode, $filename
+ or YAML::Base->die('YAML_DUMP_ERR_FILE_OUTPUT', $filename, $!);
+ }
+ local $/ = "\n"; # reset special to "sane"
+ print $OUT Dump(@_);
+}
+
+sub LoadFile {
+ my $IN;
+ my $filename = shift;
+ if (ref $filename eq 'GLOB') {
+ $IN = $filename;
+ }
+ else {
+ open $IN, $filename
+ or YAML::Base->die('YAML_LOAD_ERR_FILE_INPUT', $filename, $!);
+ }
+ return Load(do { local $/; <$IN> });
+}
+
+sub init_action_object {
+ my $self = shift;
+ my $object_class = (shift) . '_class';
+ my $module_name = $self->$object_class;
+ eval "require $module_name";
+ $self->die("Error in require $module_name - $@")
+ if $@ and "$@" !~ /Can't locate/;
+ my $object = $self->$object_class->new;
+ $object->set_global_options;
+ return $object;
+}
+
+my $global = {};
+sub Bless {
+ require YAML::Dumper::Base;
+ YAML::Dumper::Base::bless($global, @_)
+}
+sub Blessed {
+ require YAML::Dumper::Base;
+ YAML::Dumper::Base::blessed($global, @_)
+}
+sub global_object { $global }
+
+1;
+
+__END__
+
+=head1 NAME
+
+YAML - YAML Ain't Markup Language (tm)
+
+=head1 SYNOPSIS
+
+ use YAML;
+
+ # Load a YAML stream of 3 YAML documents into Perl data structures.
+ my ($hashref, $arrayref, $string) = Load(<<'...');
+ ---
+ name: ingy
+ age: old
+ weight: heavy
+ # I should comment that I also like pink, but don't tell anybody.
+ favorite colors:
+ - red
+ - green
+ - blue
+ ---
+ - Clark Evans
+ - Oren Ben-Kiki
+ - Ingy döt Net
+ --- >
+ You probably think YAML stands for "Yet Another Markup Language". It
+ ain't! YAML is really a data serialization language. But if you want
+ to think of it as a markup, that's OK with me. A lot of people try
+ to use XML as a serialization format.
+
+ "YAML" is catchy and fun to say. Try it. "YAML, YAML, YAML!!!"
+ ...
+
+ # Dump the Perl data structures back into YAML.
+ print Dump($string, $arrayref, $hashref);
+
+ # YAML::Dump is used the same way you'd use Data::Dumper::Dumper
+ use Data::Dumper;
+ print Dumper($string, $arrayref, $hashref);
+
+=head1 DESCRIPTION
+
+The YAML.pm module implements a YAML Loader and Dumper based on the YAML
+1.0 specification. L<http://www.yaml.org/spec/>
+
+YAML is a generic data serialization language that is optimized for
+human readability. It can be used to express the data structures of most
+modern programming languages. (Including Perl!!!)
+
+For information on the YAML syntax, please refer to the YAML
+specification.
+
+=head1 WHY YAML IS COOL
+
+=over 4
+
+=item YAML is readable for people.
+
+It makes clear sense out of complex data structures. You should find
+that YAML is an exceptional data dumping tool. Structure is shown
+through indentation, YAML supports recursive data, and hash keys are
+sorted by default. In addition, YAML supports several styles of scalar
+formatting for different types of data.
+
+=item YAML is editable.
+
+YAML was designed from the ground up to be an excellent syntax for
+configuration files. Almost all programs need configuration files, so
+why invent a new syntax for each one? And why subject users to the
+complexities of XML or native Perl code?
+
+=item YAML is multilingual.
+
+Yes, YAML supports Unicode. But I'm actually referring to programming
+languages. YAML was designed to meet the serialization needs of Perl,
+Python, Ruby, Tcl, PHP, Javascript and Java. It was also designed to be
+interoperable between those languages. That means YAML serializations
+produced by Perl can be processed by Python.
+
+=item YAML is taint safe.
+
+Using modules like Data::Dumper for serialization is fine as long as you
+can be sure that nobody can tamper with your data files or
+transmissions. That's because you need to use Perl's C<eval()> built-in
+to deserialize the data. Somebody could add a snippet of Perl to erase
+your files.
+
+YAML's parser does not need to eval anything.
+
+=item YAML is full featured.
+
+YAML can accurately serialize all of the common Perl data structures and
+deserialize them again without losing data relationships. Although it is
+not 100% perfect (no serializer is or can be perfect), it fares as well
+as the popular current modules: Data::Dumper, Storable, XML::Dumper and
+Data::Denter.
+
+YAML.pm also has the ability to handle code (subroutine) references and
+typeglobs. (Still experimental) These features are not found in Perl's
+other serialization modules.
+
+=item YAML is extensible.
+
+The YAML language has been designed to be flexible enough to solve it's
+own problems. The markup itself has 3 basic construct which resemble
+Perl's hash, array and scalar. By default, these map to their Perl
+equivalents. But each YAML node also supports a tagging mechanism (type
+system) which can cause that node to be interpreted in a completely
+different manner. That's how YAML can support object serialization and
+oddball structures like Perl's typeglob.
+
+=back
+
+=head1 YAML IMPLEMENTATIONS IN PERL
+
+This module, YAML.pm, is really just the interface module for YAML
+modules written in Perl. The basic interface for YAML consists of two
+functions: C<Dump> and C<Load>. The real work is done by the modules
+YAML::Dumper and YAML::Loader.
+
+Different YAML module distributions can be created by subclassing
+YAML.pm and YAML::Loader and YAML::Dumper. For example, YAML-Simple
+consists of YAML::Simple YAML::Dumper::Simple and YAML::Loader::Simple.
+
+Why would there be more than one implementation of YAML? Well, despite
+YAML's offering of being a simple data format, YAML is actually very
+deep and complex. Implementing the entirety of the YAML specification is
+a daunting task.
+
+For this reason I am currently working on 3 different YAML implementations.
+
+=over
+
+=item YAML
+
+The main YAML distribution will keeping evolving to support the entire
+YAML specification in pure Perl. This may not be the fastest or most
+stable module though. Currently, YAML.pm has lots of known bugs. It is
+mostly a great tool for dumping Perl data structures to a readable form.
+
+=item YAML::Lite
+
+The point of YAML::Lite is to strip YAML down to the 90% that people
+use most and offer that in a small, fast, stable, pure Perl form.
+YAML::Lite will simply die when it is asked to do something it can't.
+
+=item YAML::Syck
+
+C<libsyck> is the C based YAML processing library used by the Ruby
+programming language (and also Python, PHP and Pugs). YAML::Syck is the
+Perl binding to C<libsyck>. It should be very fast, but may have
+problems of its own. It will also require C compilation.
+
+NOTE: Audrey Tang has actually completed this module and it works great
+ and is 10 times faster than YAML.pm.
+
+=back
+
+In the future, there will likely be even more YAML modules. Remember,
+people other than Ingy are allowed to write YAML modules!
+
+=head1 FUNCTIONAL USAGE
+
+YAML is completely OO under the hood. Still it exports a few useful top
+level functions so that it is dead simple to use. These functions just
+do the OO stuff for you. If you want direct access to the OO API see the
+documentation for YAML::Dumper and YAML::Loader.
+
+=head2 Exported Functions
+
+The following functions are exported by YAML.pm by default. The reason
+they are exported is so that YAML works much like Data::Dumper. If you
+don't want functions to be imported, just use YAML with an empty
+import list:
+
+ use YAML ();
+
+=over 4
+
+=item Dump(list-of-Perl-data-structures)
+
+Turn Perl data into YAML. This function works very much like
+Data::Dumper::Dumper(). It takes a list of Perl data strucures and
+dumps them into a serialized form. It returns a string containing the
+YAML stream. The structures can be references or plain scalars.
+
+=item Load(string-containing-a-YAML-stream)
+
+Turn YAML into Perl data. This is the opposite of Dump. Just like
+Storable's thaw() function or the eval() function in relation to
+Data::Dumper. It parses a string containing a valid YAML stream into a
+list of Perl data structures.
+
+=back
+
+=head2 Exportable Functions
+
+These functions are not exported by default but you can request them in
+an import list like this:
+
+ use YAML qw'freeze thaw Bless';
+
+=over 4
+
+=item freeze() and thaw()
+
+Aliases to Dump() and Load() for Storable fans. This will also allow
+YAML.pm to be plugged directly into modules like POE.pm, that use the
+freeze/thaw API for internal serialization.
+
+=item DumpFile(filepath, list)
+
+Writes the YAML stream to a file instead of just returning a string.
+
+=item LoadFile(filepath)
+
+Reads the YAML stream from a file instead of a string.
+
+=item Bless(perl-node, [yaml-node | class-name])
+
+Associate a normal Perl node, with a yaml node. A yaml node is an object
+tied to the YAML::Node class. The second argument is either a yaml node
+that you've already created or a class (package) name that supports a
+yaml_dump() function. A yaml_dump() function should take a perl node and
+return a yaml node. If no second argument is provided, Bless will create
+a yaml node. This node is not returned, but can be retrieved with the
+Blessed() function.
+
+Here's an example of how to use Bless. Say you have a hash containing
+three keys, but you only want to dump two of them. Furthermore the keys
+must be dumped in a certain order. Here's how you do that:
+
+ use YAML qw(Dump Bless);
+ $hash = {apple => 'good', banana => 'bad', cauliflower => 'ugly'};
+ print Dump $hash;
+ Bless($hash)->keys(['banana', 'apple']);
+ print Dump $hash;
+
+produces:
+
+ ---
+ apple: good
+ banana: bad
+ cauliflower: ugly
+ ---
+ banana: bad
+ apple: good
+
+Bless returns the tied part of a yaml-node, so that you can call the
+YAML::Node methods. This is the same thing that YAML::Node::ynode()
+returns. So another way to do the above example is:
+
+ use YAML qw(Dump Bless);
+ use YAML::Node;
+ $hash = {apple => 'good', banana => 'bad', cauliflower => 'ugly'};
+ print Dump $hash;
+ Bless($hash);
+ $ynode = ynode(Blessed($hash));
+ $ynode->keys(['banana', 'apple']);
+ print Dump $hash;
+
+Note that Blessing a Perl data structure does not change it anyway. The
+extra information is stored separately and looked up by the Blessed
+node's memory address.
+
+=item Blessed(perl-node)
+
+Returns the yaml node that a particular perl node is associated with
+(see above). Returns undef if the node is not (YAML) Blessed.
+
+=back
+
+=head1 GLOBAL OPTIONS
+
+YAML options are set using a group of global variables in the YAML
+namespace. This is similar to how Data::Dumper works.
+
+For example, to change the indentation width, do something like:
+
+ local $YAML::Indent = 3;
+
+The current options are:
+
+=over 4
+
+=item DumperClass
+
+You can override which module/class YAML uses for Dumping data.
+
+=item LoaderClass
+
+You can override which module/class YAML uses for Loading data.
+
+=item Indent
+
+This is the number of space characters to use for each indentation level
+when doing a Dump(). The default is 2.
+
+By the way, YAML can use any number of characters for indentation at any
+level. So if you are editing YAML by hand feel free to do it anyway that
+looks pleasing to you; just be consistent for a given level.
+
+=item SortKeys
+
+Default is 1. (true)
+
+Tells YAML.pm whether or not to sort hash keys when storing a document.
+
+YAML::Node objects can have their own sort order, which is usually what
+you want. To override the YAML::Node order and sort the keys anyway, set
+SortKeys to 2.
+
+=item Stringify
+
+Default is 0. (false)
+
+Objects with string overloading should honor the overloading and dump the
+stringification of themselves, rather than the actual object's guts.
+
+=item UseHeader
+
+Default is 1. (true)
+
+This tells YAML.pm whether to use a separator string for a Dump
+operation. This only applies to the first document in a stream.
+Subsequent documents must have a YAML header by definition.
+
+=item UseVersion
+
+Default is 0. (false)
+
+Tells YAML.pm whether to include the YAML version on the
+separator/header.
+
+ --- %YAML:1.0
+
+=item AnchorPrefix
+
+Default is ''.
+
+Anchor names are normally numeric. YAML.pm simply starts with '1' and
+increases by one for each new anchor. This option allows you to specify a
+string to be prepended to each anchor number.
+
+=item UseCode
+
+Setting the UseCode option is a shortcut to set both the DumpCode and
+LoadCode options at once. Setting UseCode to '1' tells YAML.pm to dump
+Perl code references as Perl (using B::Deparse) and to load them back
+into memory using eval(). The reason this has to be an option is that
+using eval() to parse untrusted code is, well, untrustworthy.
+
+=item DumpCode
+
+Determines if and how YAML.pm should serialize Perl code references. By
+default YAML.pm will dump code references as dummy placeholders (much
+like Data::Dumper). If DumpCode is set to '1' or 'deparse', code
+references will be dumped as actual Perl code.
+
+DumpCode can also be set to a subroutine reference so that you can
+write your own serializing routine. YAML.pm passes you the code ref. You
+pass back the serialization (as a string) and a format indicator. The
+format indicator is a simple string like: 'deparse' or 'bytecode'.
+
+=item LoadCode
+
+LoadCode is the opposite of DumpCode. It tells YAML if and how to
+deserialize code references. When set to '1' or 'deparse' it will use
+C<eval()>. Since this is potentially risky, only use this option if you
+know where your YAML has been.
+
+LoadCode can also be set to a subroutine reference so that you can write
+your own deserializing routine. YAML.pm passes the serialization (as a
+string) and a format indicator. You pass back the code reference.
+
+=item UseBlock
+
+YAML.pm uses heuristics to guess which scalar style is best for a given
+node. Sometimes you'll want all multiline scalars to use the 'block'
+style. If so, set this option to 1.
+
+NOTE: YAML's block style is akin to Perl's here-document.
+
+=item UseFold
+
+If you want to force YAML to use the 'folded' style for all multiline
+scalars, then set $UseFold to 1.
+
+NOTE: YAML's folded style is akin to the way HTML folds text,
+ except smarter.
+
+=item UseAliases
+
+YAML has an alias mechanism such that any given structure in memory gets
+serialized once. Any other references to that structure are serialized
+only as alias markers. This is how YAML can serialize duplicate and
+recursive structures.
+
+Sometimes, when you KNOW that your data is nonrecursive in nature, you
+may want to serialize such that every node is expressed in full. (ie as
+a copy of the original). Setting $YAML::UseAliases to 0 will allow you
+to do this. This also may result in faster processing because the lookup
+overhead is by bypassed.
+
+THIS OPTION CAN BE DANGEROUS. *If* your data is recursive, this option
+*will* cause Dump() to run in an endless loop, chewing up your computers
+memory. You have been warned.
+
+=item CompressSeries
+
+Default is 1.
+
+Compresses the formatting of arrays of hashes:
+
+ -
+ foo: bar
+ -
+ bar: foo
+
+becomes:
+
+ - foo: bar
+ - bar: foo
+
+Since this output is usually more desirable, this option is turned on by
+default.
+
+=back
+
+=head1 YAML TERMINOLOGY
+
+YAML is a full featured data serialization language, and thus has its
+own terminology.
+
+It is important to remember that although YAML is heavily influenced by
+Perl and Python, it is a language in its own right, not merely just a
+representation of Perl structures.
+
+YAML has three constructs that are conspicuously similar to Perl's hash,
+array, and scalar. They are called mapping, sequence, and string
+respectively. By default, they do what you would expect. But each
+instance may have an explicit or implicit tag (type) that makes it
+behave differently. In this manner, YAML can be extended to represent
+Perl's Glob or Python's tuple, or Ruby's Bigint.
+
+=over 4
+
+=item stream
+
+A YAML stream is the full sequence of unicode characters that a YAML
+parser would read or a YAML emitter would write. A stream may contain
+one or more YAML documents separated by YAML headers.
+
+ ---
+ a: mapping
+ foo: bar
+ ---
+ - a
+ - sequence
+
+=item document
+
+A YAML document is an independent data structure representation within a
+stream. It is a top level node. Each document in a YAML stream must
+begin with a YAML header line. Actually the header is optional on the
+first document.
+
+ ---
+ This: top level mapping
+ is:
+ - a
+ - YAML
+ - document
+
+=item header
+
+A YAML header is a line that begins a YAML document. It consists of
+three dashes, possibly followed by more info. Another purpose of the
+header line is that it serves as a place to put top level tag and anchor
+information.
+
+ --- !recursive-sequence &001
+ - * 001
+ - * 001
+
+=item node
+
+A YAML node is the representation of a particular data stucture. Nodes
+may contain other nodes. (In Perl terms, nodes are like scalars.
+Strings, arrayrefs and hashrefs. But this refers to the serialized
+format, not the in-memory structure.)
+
+=item tag
+
+This is similar to a type. It indicates how a particular YAML node
+serialization should be transferred into or out of memory. For instance
+a Foo::Bar object would use the tag 'perl/Foo::Bar':
+
+ - !perl/Foo::Bar
+ foo: 42
+ bar: stool
+
+=item collection
+
+A collection is the generic term for a YAML data grouping. YAML has two
+types of collections: mappings and sequences. (Similar to hashes and arrays)
+
+=item mapping
+
+A mapping is a YAML collection defined by unordered key/value pairs with
+unique keys. By default YAML mappings are loaded into Perl hashes.
+
+ a mapping:
+ foo: bar
+ two: times two is 4
+
+=item sequence
+
+A sequence is a YAML collection defined by an ordered list of elements. By
+default YAML sequences are loaded into Perl arrays.
+
+ a sequence:
+ - one bourbon
+ - one scotch
+ - one beer
+
+=item scalar
+
+A scalar is a YAML node that is a single value. By default YAML scalars
+are loaded into Perl scalars.
+
+ a scalar key: a scalar value
+
+YAML has many styles for representing scalars. This is important because
+varying data will have varying formatting requirements to retain the
+optimum human readability.
+
+=item plain scalar
+
+A plain sclar is unquoted. All plain scalars are automatic candidates
+for "implicit tagging". This means that their tag may be determined
+automatically by examination. The typical uses for this are plain alpha
+strings, integers, real numbers, dates, times and currency.
+
+ - a plain string
+ - -42
+ - 3.1415
+ - 12:34
+ - 123 this is an error
+
+=item single quoted scalar
+
+This is similar to Perl's use of single quotes. It means no escaping
+except for single quotes which are escaped by using two adjacent
+single quotes.
+
+ - 'When I say ''\n'' I mean "backslash en"'
+
+=item double quoted scalar
+
+This is similar to Perl's use of double quotes. Character escaping can
+be used.
+
+ - "This scalar\nhas two lines, and a bell -->\a"
+
+=item folded scalar
+
+This is a multiline scalar which begins on the next line. It is
+indicated by a single right angle bracket. It is unescaped like the
+single quoted scalar. Line folding is also performed.
+
+ - >
+ This is a multiline scalar which begins on
+ the next line. It is indicated by a single
+ carat. It is unescaped like the single
+ quoted scalar. Line folding is also
+ performed.
+
+=item block scalar
+
+This final multiline form is akin to Perl's here-document except that
+(as in all YAML data) scope is indicated by indentation. Therefore, no
+ending marker is required. The data is verbatim. No line folding.
+
+ - |
+ QTY DESC PRICE TOTAL
+ --- ---- ----- -----
+ 1 Foo Fighters $19.95 $19.95
+ 2 Bar Belles $29.95 $59.90
+
+=item parser
+
+A YAML processor has four stages: parse, load, dump, emit.
+
+A parser parses a YAML stream. YAML.pm's Load() function contains a
+parser.
+
+=item loader
+
+The other half of the Load() function is a loader. This takes the
+information from the parser and loads it into a Perl data structure.
+
+=item dumper
+
+The Dump() function consists of a dumper and an emitter. The dumper
+walks through each Perl data structure and gives info to the emitter.
+
+=item emitter
+
+The emitter takes info from the dumper and turns it into a YAML stream.
+
+NOTE:
+In YAML.pm the parser/loader and the dumper/emitter code are currently
+very closely tied together. In the future they may be broken into
+separate stages.
+
+=back
+
+For more information please refer to the immensely helpful YAML
+specification available at L<http://www.yaml.org/spec/>.
+
+=head1 ysh - The YAML Shell
+
+The YAML distribution ships with a script called 'ysh', the YAML shell.
+ysh provides a simple, interactive way to play with YAML. If you type in
+Perl code, it displays the result in YAML. If you type in YAML it turns
+it into Perl code.
+
+To run ysh, (assuming you installed it along with YAML.pm) simply type:
+
+ ysh [options]
+
+Please read the C<ysh> documentation for the full details. There are
+lots of options.
+
+=head1 BUGS & DEFICIENCIES
+
+If you find a bug in YAML, please try to recreate it in the YAML Shell
+with logging turned on ('ysh -L'). When you have successfully reproduced
+the bug, please mail the LOG file to the author (ingy@cpan.org).
+
+WARNING: This is still *ALPHA* code. Well, most of this code has been
+around for years...
+
+BIGGER WARNING: YAML.pm has been slow in the making, but I am committed
+to having top notch YAML tools in the Perl world. The YAML team is close
+to finalizing the YAML 1.1 spec. This version of YAML.pm is based off of
+a very old pre 1.0 spec. In actuality there isn't a ton of difference,
+and this YAML.pm is still fairly useful. Things will get much better in
+the future.
+
+=head1 RESOURCES
+
+L<http://lists.sourceforge.net/lists/listinfo/yaml-core> is the mailing
+list. This is where the language is discussed and designed.
+
+L<http://www.yaml.org> is the official YAML website.
+
+L<http://www.yaml.org/spec/> is the YAML 1.0 specification.
+
+L<http://yaml.kwiki.org> is the official YAML wiki.
+
+=head1 SEE ALSO
+
+See YAML::Syck. Fast!
+
+=head1 AUTHOR
+
+Ingy döt Net <ingy@cpan.org>
+
+is resonsible for YAML.pm.
+
+The YAML serialization language is the result of years of collaboration
+between Oren Ben-Kiki, Clark Evans and Ingy döt Net. Several others
+have added help along the way.
+
+=head1 COPYRIGHT
+
+Copyright (c) 2005, 2006. Ingy döt Net. All rights reserved.
+Copyright (c) 2001, 2002, 2005. Brian Ingerson. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+See L<http://www.perl.com/perl/misc/Artistic.html>
+
+=cut
--- /dev/null
+package YAML::Base;
+use strict; use warnings;
+use base 'Exporter';
+
+our @EXPORT = qw(field XXX);
+
+sub new {
+ my $class = shift;
+ $class = ref($class) || $class;
+ my $self = bless {}, $class;
+ while (@_) {
+ my $method = shift;
+ $self->$method(shift);
+ }
+ return $self;
+}
+
+# Use lexical subs to reduce pollution of private methods by base class.
+my ($_new_error, $_info, $_scalar_info, $parse_arguments, $default_as_code);
+
+sub XXX {
+ require Data::Dumper;
+ CORE::die(Data::Dumper::Dumper(@_));
+}
+
+my %code = (
+ sub_start =>
+ "sub {\n",
+ set_default =>
+ " \$_[0]->{%s} = %s\n unless exists \$_[0]->{%s};\n",
+ init =>
+ " return \$_[0]->{%s} = do { my \$self = \$_[0]; %s }\n" .
+ " unless \$#_ > 0 or defined \$_[0]->{%s};\n",
+ return_if_get =>
+ " return \$_[0]->{%s} unless \$#_ > 0;\n",
+ set =>
+ " \$_[0]->{%s} = \$_[1];\n",
+ sub_end =>
+ " return \$_[0]->{%s};\n}\n",
+);
+
+sub field {
+ my $package = caller;
+ my ($args, @values) = &$parse_arguments(
+ [ qw(-package -init) ],
+ @_,
+ );
+ my ($field, $default) = @values;
+ $package = $args->{-package} if defined $args->{-package};
+ return if defined &{"${package}::$field"};
+ my $default_string =
+ ( ref($default) eq 'ARRAY' and not @$default )
+ ? '[]'
+ : (ref($default) eq 'HASH' and not keys %$default )
+ ? '{}'
+ : &$default_as_code($default);
+
+ my $code = $code{sub_start};
+ if ($args->{-init}) {
+ my $fragment = $code{init};
+ $code .= sprintf $fragment, $field, $args->{-init}, ($field) x 4;
+ }
+ $code .= sprintf $code{set_default}, $field, $default_string, $field
+ if defined $default;
+ $code .= sprintf $code{return_if_get}, $field;
+ $code .= sprintf $code{set}, $field;
+ $code .= sprintf $code{sub_end}, $field;
+
+ my $sub = eval $code;
+ die $@ if $@;
+ no strict 'refs';
+ *{"${package}::$field"} = $sub;
+ return $code if defined wantarray;
+}
+
+sub die {
+ my $self = shift;
+ my $error = $self->$_new_error(@_);
+ $error->type('Error');
+ Carp::croak($error->format_message);
+}
+
+sub warn {
+ my $self = shift;
+ return unless $^W;
+ my $error = $self->$_new_error(@_);
+ $error->type('Warning');
+ Carp::cluck($error->format_message);
+}
+
+# This code needs to be refactored to be simpler and more precise, and no,
+# Scalar::Util doesn't DWIM.
+#
+# Can't handle:
+# * blessed regexp
+sub node_info {
+ my $self = shift;
+ my $stringify = $_[1] || 0;
+ my ($class, $type, $id) =
+ ref($_[0])
+ ? $stringify
+ ? &$_info("$_[0]")
+ : do {
+ require overload;
+ my @info = &$_info(overload::StrVal($_[0]));
+ if (ref($_[0]) eq 'Regexp') {
+ @info[0, 1] = (undef, 'REGEXP');
+ }
+ @info;
+ }
+ : &$_scalar_info($_[0]);
+ ($class, $type, $id) = &$_scalar_info("$_[0]")
+ unless $id;
+ return wantarray ? ($class, $type, $id) : $id;
+}
+
+#-------------------------------------------------------------------------------
+$_info = sub {
+ return (($_[0]) =~ qr{^(?:(.*)\=)?([^=]*)\(([^\(]*)\)$}o);
+};
+
+$_scalar_info = sub {
+ my $id = 'undef';
+ if (defined $_[0]) {
+ \$_[0] =~ /\((\w+)\)$/o or CORE::die();
+ $id = "$1-S";
+ }
+ return (undef, undef, $id);
+};
+
+$_new_error = sub {
+ require Carp;
+ my $self = shift;
+ require YAML::Error;
+
+ my $code = shift || 'unknown error';
+ my $error = YAML::Error->new(code => $code);
+ $error->line($self->line) if $self->can('line');
+ $error->document($self->document) if $self->can('document');
+ $error->arguments([@_]);
+ return $error;
+};
+
+$parse_arguments = sub {
+ my $paired_arguments = shift || [];
+ my ($args, @values) = ({}, ());
+ my %pairs = map { ($_, 1) } @$paired_arguments;
+ while (@_) {
+ my $elem = shift;
+ if (defined $elem and defined $pairs{$elem} and @_) {
+ $args->{$elem} = shift;
+ }
+ else {
+ push @values, $elem;
+ }
+ }
+ return wantarray ? ($args, @values) : $args;
+};
+
+$default_as_code = sub {
+ no warnings 'once';
+ require Data::Dumper;
+ local $Data::Dumper::Sortkeys = 1;
+ my $code = Data::Dumper::Dumper(shift);
+ $code =~ s/^\$VAR1 = //;
+ $code =~ s/;$//;
+ return $code;
+};
+
+1;
+
+__END__
+
+=head1 NAME
+
+YAML::Base - Base class for YAML classes
+
+=head1 SYNOPSIS
+
+ package YAML::Something;
+ use YAML::Base -base;
+
+=head1 DESCRIPTION
+
+YAML::Base is the parent of all YAML classes.
+
+=head1 AUTHOR
+
+Ingy döt Net <ingy@cpan.org>
+
+=head1 COPYRIGHT
+
+Copyright (c) 2006. Ingy döt Net. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+See L<http://www.perl.com/perl/misc/Artistic.html>
+
+=cut
--- /dev/null
+package YAML::Dumper;
+use strict; use warnings;
+use YAML::Base;
+use base 'YAML::Dumper::Base';
+
+use YAML::Node;
+use YAML::Types;
+
+# Context constants
+use constant KEY => 3;
+use constant BLESSED => 4;
+use constant FROMARRAY => 5;
+use constant VALUE => "\x07YAML\x07VALUE\x07";
+
+# Common YAML character sets
+my $ESCAPE_CHAR = '[\\x00-\\x08\\x0b-\\x0d\\x0e-\\x1f]';
+my $LIT_CHAR = '|';
+
+#==============================================================================
+# OO version of Dump. YAML->new->dump($foo);
+sub dump {
+ my $self = shift;
+ $self->stream('');
+ $self->document(0);
+ for my $document (@_) {
+ $self->{document}++;
+ $self->transferred({});
+ $self->id_refcnt({});
+ $self->id_anchor({});
+ $self->anchor(1);
+ $self->level(0);
+ $self->offset->[0] = 0 - $self->indent_width;
+ $self->_prewalk($document);
+ $self->_emit_header($document);
+ $self->_emit_node($document);
+ }
+ return $self->stream;
+}
+
+# Every YAML document in the stream must begin with a YAML header, unless
+# there is only a single document and the user requests "no header".
+sub _emit_header {
+ my $self = shift;
+ my ($node) = @_;
+ if (not $self->use_header and
+ $self->document == 1
+ ) {
+ $self->die('YAML_DUMP_ERR_NO_HEADER')
+ unless ref($node) =~ /^(HASH|ARRAY)$/;
+ $self->die('YAML_DUMP_ERR_NO_HEADER')
+ if ref($node) eq 'HASH' and keys(%$node) == 0;
+ $self->die('YAML_DUMP_ERR_NO_HEADER')
+ if ref($node) eq 'ARRAY' and @$node == 0;
+ # XXX Also croak if aliased, blessed, or ynode
+ $self->headless(1);
+ return;
+ }
+ $self->{stream} .= '---';
+# XXX Consider switching to 1.1 style
+ if ($self->use_version) {
+# $self->{stream} .= " #YAML:1.0";
+ }
+}
+
+# Walk the tree to be dumped and keep track of its reference counts.
+# This function is where the Dumper does all its work. All type
+# transfers happen here.
+sub _prewalk {
+ my $self = shift;
+ my $stringify = $self->stringify;
+ my ($class, $type, $node_id) = $self->node_info(\$_[0], $stringify);
+
+ # Handle typeglobs
+ if ($type eq 'GLOB') {
+ $self->transferred->{$node_id} =
+ YAML::Type::glob->yaml_dump($_[0]);
+ $self->_prewalk($self->transferred->{$node_id});
+ return;
+ }
+
+ # Handle regexps
+ if (ref($_[0]) eq 'Regexp') {
+ $self->transferred->{$node_id} =
+ YAML::Type::regexp->yaml_dump($_[0], $class, $self);
+ return;
+ }
+
+ # Handle Purity for scalars.
+ # XXX can't find a use case yet. Might be YAGNI.
+ if (not ref $_[0]) {
+ $self->{id_refcnt}{$node_id}++ if $self->purity;
+ return;
+ }
+
+ # Make a copy of original
+ my $value = $_[0];
+ ($class, $type, $node_id) = $self->node_info($value, $stringify);
+
+ # Must be a stringified object.
+ return if (ref($value) and not $type);
+
+ # Look for things already transferred.
+ if ($self->transferred->{$node_id}) {
+ (undef, undef, $node_id) = (ref $self->transferred->{$node_id})
+ ? $self->node_info($self->transferred->{$node_id}, $stringify)
+ : $self->node_info(\ $self->transferred->{$node_id}, $stringify);
+ $self->{id_refcnt}{$node_id}++;
+ return;
+ }
+
+ # Handle code refs
+ if ($type eq 'CODE') {
+ $self->transferred->{$node_id} = 'placeholder';
+ YAML::Type::code->yaml_dump(
+ $self->dump_code,
+ $_[0],
+ $self->transferred->{$node_id}
+ );
+ ($class, $type, $node_id) =
+ $self->node_info(\ $self->transferred->{$node_id}, $stringify);
+ $self->{id_refcnt}{$node_id}++;
+ return;
+ }
+
+ # Handle blessed things
+ if (defined $class) {
+ if ($value->can('yaml_dump')) {
+ $value = $value->yaml_dump;
+ }
+ elsif ($type eq 'SCALAR') {
+ $self->transferred->{$node_id} = 'placeholder';
+ YAML::Type::blessed->yaml_dump
+ ($_[0], $self->transferred->{$node_id});
+ ($class, $type, $node_id) =
+ $self->node_info(\ $self->transferred->{$node_id}, $stringify);
+ $self->{id_refcnt}{$node_id}++;
+ return;
+ }
+ else {
+ $value = YAML::Type::blessed->yaml_dump($value);
+ }
+ $self->transferred->{$node_id} = $value;
+ (undef, $type, $node_id) = $self->node_info($value, $stringify);
+ }
+
+ # Handle YAML Blessed things
+ if (defined YAML->global_object()->{blessed_map}{$node_id}) {
+ $value = YAML->global_object()->{blessed_map}{$node_id};
+ $self->transferred->{$node_id} = $value;
+ ($class, $type, $node_id) = $self->node_info($value, $stringify);
+ $self->_prewalk($value);
+ return;
+ }
+
+ # Handle hard refs
+ if ($type eq 'REF' or $type eq 'SCALAR') {
+ $value = YAML::Type::ref->yaml_dump($value);
+ $self->transferred->{$node_id} = $value;
+ (undef, $type, $node_id) = $self->node_info($value, $stringify);
+ }
+
+ # Handle ref-to-glob's
+ elsif ($type eq 'GLOB') {
+ my $ref_ynode = $self->transferred->{$node_id} =
+ YAML::Type::ref->yaml_dump($value);
+
+ my $glob_ynode = $ref_ynode->{&VALUE} =
+ YAML::Type::glob->yaml_dump($$value);
+
+ (undef, undef, $node_id) = $self->node_info($glob_ynode, $stringify);
+ $self->transferred->{$node_id} = $glob_ynode;
+ $self->_prewalk($glob_ynode);
+ return;
+ }
+
+ # Increment ref count for node
+ return if ++($self->{id_refcnt}{$node_id}) > 1;
+
+ # Keep on walking
+ if ($type eq 'HASH') {
+ $self->_prewalk($value->{$_})
+ for keys %{$value};
+ return;
+ }
+ elsif ($type eq 'ARRAY') {
+ $self->_prewalk($_)
+ for @{$value};
+ return;
+ }
+
+ # Unknown type. Need to know about it.
+ $self->warn(<<"...");
+YAML::Dumper can't handle dumping this type of data.
+Please report this to the author.
+
+id: $node_id
+type: $type
+class: $class
+value: $value
+
+...
+
+ return;
+}
+
+# Every data element and sub data element is a node.
+# Everything emitted goes through this function.
+sub _emit_node {
+ my $self = shift;
+ my ($type, $node_id);
+ my $ref = ref($_[0]);
+ if ($ref and $ref ne 'Regexp') {
+ (undef, $type, $node_id) = $self->node_info($_[0], $self->stringify);
+ }
+ else {
+ $type = $ref || 'SCALAR';
+ (undef, undef, $node_id) = $self->node_info(\$_[0], $self->stringify);
+ }
+
+ my ($ynode, $tag) = ('') x 2;
+ my ($value, $context) = (@_, 0);
+
+ if (defined $self->transferred->{$node_id}) {
+ $value = $self->transferred->{$node_id};
+ $ynode = ynode($value);
+ if (ref $value) {
+ $tag = defined $ynode ? $ynode->tag->short : '';
+ (undef, $type, $node_id) =
+ $self->node_info($value, $self->stringify);
+ }
+ else {
+ $ynode = ynode($self->transferred->{$node_id});
+ $tag = defined $ynode ? $ynode->tag->short : '';
+ $type = 'SCALAR';
+ (undef, undef, $node_id) =
+ $self->node_info(
+ \ $self->transferred->{$node_id},
+ $self->stringify
+ );
+ }
+ }
+ elsif ($ynode = ynode($value)) {
+ $tag = $ynode->tag->short;
+ }
+
+ if ($self->use_aliases) {
+ $self->{id_refcnt}{$node_id} ||= 0;
+ if ($self->{id_refcnt}{$node_id} > 1) {
+ if (defined $self->{id_anchor}{$node_id}) {
+ $self->{stream} .= ' *' . $self->{id_anchor}{$node_id} . "\n";
+ return;
+ }
+ my $anchor = $self->anchor_prefix . $self->{anchor}++;
+ $self->{stream} .= ' &' . $anchor;
+ $self->{id_anchor}{$node_id} = $anchor;
+ }
+ }
+
+ return $self->_emit_str("$value") # Stringified object
+ if ref($value) and not $type;
+ return $self->_emit_scalar($value, $tag)
+ if $type eq 'SCALAR' and $tag;
+ return $self->_emit_str($value)
+ if $type eq 'SCALAR';
+ return $self->_emit_mapping($value, $tag, $node_id, $context)
+ if $type eq 'HASH';
+ return $self->_emit_sequence($value, $tag)
+ if $type eq 'ARRAY';
+ $self->warn('YAML_DUMP_WARN_BAD_NODE_TYPE', $type);
+ return $self->_emit_str("$value");
+}
+
+# A YAML mapping is akin to a Perl hash.
+sub _emit_mapping {
+ my $self = shift;
+ my ($value, $tag, $node_id, $context) = @_;
+ $self->{stream} .= " !$tag" if $tag;
+
+ # Sometimes 'keys' fails. Like on a bad tie implementation.
+ my $empty_hash = not(eval {keys %$value});
+ $self->warn('YAML_EMIT_WARN_KEYS', $@) if $@;
+ return ($self->{stream} .= " {}\n") if $empty_hash;
+
+ # If CompressSeries is on (default) and legal is this context, then
+ # use it and make the indent level be 2 for this node.
+ if ($context == FROMARRAY and
+ $self->compress_series and
+ not (defined $self->{id_anchor}{$node_id} or $tag or $empty_hash)
+ ) {
+ $self->{stream} .= ' ';
+ $self->offset->[$self->level+1] = $self->offset->[$self->level] + 2;
+ }
+ else {
+ $context = 0;
+ $self->{stream} .= "\n"
+ unless $self->headless && not($self->headless(0));
+ $self->offset->[$self->level+1] =
+ $self->offset->[$self->level] + $self->indent_width;
+ }
+
+ $self->{level}++;
+ my @keys;
+ if ($self->sort_keys == 1) {
+ if (ynode($value)) {
+ @keys = keys %$value;
+ }
+ else {
+ @keys = sort keys %$value;
+ }
+ }
+ elsif ($self->sort_keys == 2) {
+ @keys = sort keys %$value;
+ }
+ # XXX This is hackish but sometimes handy. Not sure whether to leave it in.
+ elsif (ref($self->sort_keys) eq 'ARRAY') {
+ my $i = 1;
+ my %order = map { ($_, $i++) } @{$self->sort_keys};
+ @keys = sort {
+ (defined $order{$a} and defined $order{$b})
+ ? ($order{$a} <=> $order{$b})
+ : ($a cmp $b);
+ } keys %$value;
+ }
+ else {
+ @keys = keys %$value;
+ }
+ # Force the YAML::VALUE ('=') key to sort last.
+ if (exists $value->{&VALUE}) {
+ for (my $i = 0; $i < @keys; $i++) {
+ if ($keys[$i] eq &VALUE) {
+ splice(@keys, $i, 1);
+ push @keys, &VALUE;
+ last;
+ }
+ }
+ }
+
+ for my $key (@keys) {
+ $self->_emit_key($key, $context);
+ $context = 0;
+ $self->{stream} .= ':';
+ $self->_emit_node($value->{$key});
+ }
+ $self->{level}--;
+}
+
+# A YAML series is akin to a Perl array.
+sub _emit_sequence {
+ my $self = shift;
+ my ($value, $tag) = @_;
+ $self->{stream} .= " !$tag" if $tag;
+
+ return ($self->{stream} .= " []\n") if @$value == 0;
+
+ $self->{stream} .= "\n"
+ unless $self->headless && not($self->headless(0));
+
+ # XXX Really crufty feature. Better implemented by ynodes.
+ if ($self->inline_series and
+ @$value <= $self->inline_series and
+ not (scalar grep {ref or /\n/} @$value)
+ ) {
+ $self->{stream} =~ s/\n\Z/ /;
+ $self->{stream} .= '[';
+ for (my $i = 0; $i < @$value; $i++) {
+ $self->_emit_str($value->[$i], KEY);
+ last if $i == $#{$value};
+ $self->{stream} .= ', ';
+ }
+ $self->{stream} .= "]\n";
+ return;
+ }
+
+ $self->offset->[$self->level + 1] =
+ $self->offset->[$self->level] + $self->indent_width;
+ $self->{level}++;
+ for my $val (@$value) {
+ $self->{stream} .= ' ' x $self->offset->[$self->level];
+ $self->{stream} .= '-';
+ $self->_emit_node($val, FROMARRAY);
+ }
+ $self->{level}--;
+}
+
+# Emit a mapping key
+sub _emit_key {
+ my $self = shift;
+ my ($value, $context) = @_;
+ $self->{stream} .= ' ' x $self->offset->[$self->level]
+ unless $context == FROMARRAY;
+ $self->_emit_str($value, KEY);
+}
+
+# Emit a blessed SCALAR
+sub _emit_scalar {
+ my $self = shift;
+ my ($value, $tag) = @_;
+ $self->{stream} .= " !$tag";
+ $self->_emit_str($value, BLESSED);
+}
+
+sub _emit {
+ my $self = shift;
+ $self->{stream} .= join '', @_;
+}
+
+# Emit a string value. YAML has many scalar styles. This routine attempts to
+# guess the best style for the text.
+sub _emit_str {
+ my $self = shift;
+ my $type = $_[1] || 0;
+
+ # Use heuristics to find the best scalar emission style.
+ $self->offset->[$self->level + 1] =
+ $self->offset->[$self->level] + $self->indent_width;
+ $self->{level}++;
+
+ my $sf = $type == KEY ? '' : ' ';
+ my $sb = $type == KEY ? '? ' : ' ';
+ my $ef = $type == KEY ? '' : "\n";
+ my $eb = "\n";
+
+ while (1) {
+ $self->_emit($sf),
+ $self->_emit_plain($_[0]),
+ $self->_emit($ef), last
+ if not defined $_[0];
+ $self->_emit($sf, '=', $ef), last
+ if $_[0] eq VALUE;
+ $self->_emit($sf),
+ $self->_emit_double($_[0]),
+ $self->_emit($ef), last
+ if $_[0] =~ /$ESCAPE_CHAR/;
+ if ($_[0] =~ /\n/) {
+ $self->_emit($sb),
+ $self->_emit_block($LIT_CHAR, $_[0]),
+ $self->_emit($eb), last
+ if $self->use_block;
+ Carp::cluck "[YAML] \$UseFold is no longer supported"
+ if $self->use_fold;
+ $self->_emit($sf),
+ $self->_emit_double($_[0]),
+ $self->_emit($ef), last
+ if length $_[0] <= 30;
+ $self->_emit($sf),
+ $self->_emit_double($_[0]),
+ $self->_emit($ef), last
+ if $_[0] !~ /\n\s*\S/;
+ $self->_emit($sb),
+ $self->_emit_block($LIT_CHAR, $_[0]),
+ $self->_emit($eb), last;
+ }
+ $self->_emit($sf),
+ $self->_emit_plain($_[0]),
+ $self->_emit($ef), last
+ if $self->is_valid_plain($_[0]);
+ $self->_emit($sf),
+ $self->_emit_double($_[0]),
+ $self->_emit($ef), last
+ if $_[0] =~ /'/;
+ $self->_emit($sf),
+ $self->_emit_single($_[0]),
+ $self->_emit($ef);
+ last;
+ }
+
+ $self->{level}--;
+
+ return;
+}
+
+# Check whether or not a scalar should be emitted as an plain scalar.
+sub is_valid_plain {
+ my $self = shift;
+ return 0 unless length $_[0];
+ # refer to YAML::Loader::parse_inline_simple()
+ return 0 if $_[0] =~ /^[\s\{\[\~\`\'\"\!\@\#\>\|\%\&\?\*\^]/;
+ return 0 if $_[0] =~ /[\{\[\]\},]/;
+ return 0 if $_[0] =~ /[:\-\?]\s/;
+ return 0 if $_[0] =~ /\s#/;
+ return 0 if $_[0] =~ /\:(\s|$)/;
+ return 0 if $_[0] =~ /[\s\|\>]$/;
+ return 1;
+}
+
+sub _emit_block {
+ my $self = shift;
+ my ($indicator, $value) = @_;
+ $self->{stream} .= $indicator;
+ $value =~ /(\n*)\Z/;
+ my $chomp = length $1 ? (length $1 > 1) ? '+' : '' : '-';
+ $value = '~' if not defined $value;
+ $self->{stream} .= $chomp;
+ $self->{stream} .= $self->indent_width if $value =~ /^\s/;
+ $self->{stream} .= $self->indent($value);
+}
+
+# Plain means that the scalar is unquoted.
+sub _emit_plain {
+ my $self = shift;
+ $self->{stream} .= defined $_[0] ? $_[0] : '~';
+}
+
+# Double quoting is for single lined escaped strings.
+sub _emit_double {
+ my $self = shift;
+ (my $escaped = $self->escape($_[0])) =~ s/"/\\"/g;
+ $self->{stream} .= qq{"$escaped"};
+}
+
+# Single quoting is for single lined unescaped strings.
+sub _emit_single {
+ my $self = shift;
+ my $item = shift;
+ $item =~ s{'}{''}g;
+ $self->{stream} .= "'$item'";
+}
+
+#==============================================================================
+# Utility subroutines.
+#==============================================================================
+
+# Indent a scalar to the current indentation level.
+sub indent {
+ my $self = shift;
+ my ($text) = @_;
+ return $text unless length $text;
+ $text =~ s/\n\Z//;
+ my $indent = ' ' x $self->offset->[$self->level];
+ $text =~ s/^/$indent/gm;
+ $text = "\n$text";
+ return $text;
+}
+
+# Escapes for unprintable characters
+my @escapes = qw(\z \x01 \x02 \x03 \x04 \x05 \x06 \a
+ \x08 \t \n \v \f \r \x0e \x0f
+ \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17
+ \x18 \x19 \x1a \e \x1c \x1d \x1e \x1f
+ );
+
+# Escape the unprintable characters
+sub escape {
+ my $self = shift;
+ my ($text) = @_;
+ $text =~ s/\\/\\\\/g;
+ $text =~ s/([\x00-\x1f])/$escapes[ord($1)]/ge;
+ return $text;
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+YAML::Dumper - YAML class for dumping Perl objects to YAML
+
+=head1 SYNOPSIS
+
+ use YAML::Dumper;
+ my $dumper = YAML::Dumper->new;
+ $dumper->indent_width(4);
+ print $dumper->dump({foo => 'bar'});
+
+=head1 DESCRIPTION
+
+YAML::Dumper is the module that YAML.pm used to serialize Perl objects to
+YAML. It is fully object oriented and usable on its own.
+
+=head1 AUTHOR
+
+Ingy döt Net <ingy@cpan.org>
+
+=head1 COPYRIGHT
+
+Copyright (c) 2006. Ingy döt Net. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+See L<http://www.perl.com/perl/misc/Artistic.html>
+
+=cut
--- /dev/null
+package YAML::Dumper::Base;
+use strict; use warnings;
+use YAML::Base; use base 'YAML::Base';
+use YAML::Node;
+
+# YAML Dumping options
+field spec_version => '1.0';
+field indent_width => 2;
+field use_header => 1;
+field use_version => 0;
+field sort_keys => 1;
+field anchor_prefix => '';
+field dump_code => 0;
+field use_block => 0;
+field use_fold => 0;
+field compress_series => 1;
+field inline_series => 0;
+field use_aliases => 1;
+field purity => 0;
+field stringify => 0;
+
+# Properties
+field stream => '';
+field document => 0;
+field transferred => {};
+field id_refcnt => {};
+field id_anchor => {};
+field anchor => 1;
+field level => 0;
+field offset => [];
+field headless => 0;
+field blessed_map => {};
+
+# Global Options are an idea taken from Data::Dumper. Really they are just
+# sugar on top of real OO properties. They make the simple Dump/Load API
+# easy to configure.
+sub set_global_options {
+ my $self = shift;
+ $self->spec_version($YAML::SpecVersion)
+ if defined $YAML::SpecVersion;
+ $self->indent_width($YAML::Indent)
+ if defined $YAML::Indent;
+ $self->use_header($YAML::UseHeader)
+ if defined $YAML::UseHeader;
+ $self->use_version($YAML::UseVersion)
+ if defined $YAML::UseVersion;
+ $self->sort_keys($YAML::SortKeys)
+ if defined $YAML::SortKeys;
+ $self->anchor_prefix($YAML::AnchorPrefix)
+ if defined $YAML::AnchorPrefix;
+ $self->dump_code($YAML::DumpCode || $YAML::UseCode)
+ if defined $YAML::DumpCode or defined $YAML::UseCode;
+ $self->use_block($YAML::UseBlock)
+ if defined $YAML::UseBlock;
+ $self->use_fold($YAML::UseFold)
+ if defined $YAML::UseFold;
+ $self->compress_series($YAML::CompressSeries)
+ if defined $YAML::CompressSeries;
+ $self->inline_series($YAML::InlineSeries)
+ if defined $YAML::InlineSeries;
+ $self->use_aliases($YAML::UseAliases)
+ if defined $YAML::UseAliases;
+ $self->purity($YAML::Purity)
+ if defined $YAML::Purity;
+ $self->stringify($YAML::Stringify)
+ if defined $YAML::Stringify;
+}
+
+sub dump {
+ my $self = shift;
+ $self->die('dump() not implemented in this class.');
+}
+
+sub blessed {
+ my $self = shift;
+ my ($ref) = @_;
+ $ref = \$_[0] unless ref $ref;
+ my (undef, undef, $node_id) = YAML::Base->node_info($ref);
+ $self->{blessed_map}->{$node_id};
+}
+
+sub bless {
+ my $self = shift;
+ my ($ref, $blessing) = @_;
+ my $ynode;
+ $ref = \$_[0] unless ref $ref;
+ my (undef, undef, $node_id) = YAML::Base->node_info($ref);
+ if (not defined $blessing) {
+ $ynode = YAML::Node->new($ref);
+ }
+ elsif (ref $blessing) {
+ $self->die() unless ynode($blessing);
+ $ynode = $blessing;
+ }
+ else {
+ no strict 'refs';
+ my $transfer = $blessing . "::yaml_dump";
+ $self->die() unless defined &{$transfer};
+ $ynode = &{$transfer}($ref);
+ $self->die() unless ynode($ynode);
+ }
+ $self->{blessed_map}->{$node_id} = $ynode;
+ my $object = ynode($ynode) or $self->die();
+ return $object;
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+YAML::Dumper::Base - Base class for YAML Dumper classes
+
+=head1 SYNOPSIS
+
+ package YAML::Dumper::Something;
+ use YAML::Dumper::Base -base;
+
+=head1 DESCRIPTION
+
+YAML::Dumper::Base is a base class for creating YAML dumper classes.
+
+=head1 AUTHOR
+
+Ingy döt Net <ingy@cpan.org>
+
+=head1 COPYRIGHT
+
+Copyright (c) 2006. Ingy döt Net. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+See L<http://www.perl.com/perl/misc/Artistic.html>
+
+=cut
--- /dev/null
+package YAML::Error;
+use strict; use warnings;
+use YAML::Base; use base 'YAML::Base';
+
+field 'code';
+field 'type' => 'Error';
+field 'line';
+field 'document';
+field 'arguments' => [];
+
+my ($error_messages, %line_adjust);
+
+sub format_message {
+ my $self = shift;
+ my $output = 'YAML ' . $self->type . ': ';
+ my $code = $self->code;
+ if ($error_messages->{$code}) {
+ $code = sprintf($error_messages->{$code}, @{$self->arguments});
+ }
+ $output .= $code . "\n";
+
+ $output .= ' Code: ' . $self->code . "\n"
+ if defined $self->code;
+ $output .= ' Line: ' . $self->line . "\n"
+ if defined $self->line;
+ $output .= ' Document: ' . $self->document . "\n"
+ if defined $self->document;
+ return $output;
+}
+
+sub error_messages {
+ $error_messages;
+}
+
+%$error_messages = map {s/^\s+//;$_} split "\n", <<'...';
+YAML_PARSE_ERR_BAD_CHARS
+ Invalid characters in stream. This parser only supports printable ASCII
+YAML_PARSE_ERR_NO_FINAL_NEWLINE
+ Stream does not end with newline character
+YAML_PARSE_ERR_BAD_MAJOR_VERSION
+ Can't parse a %s document with a 1.0 parser
+YAML_PARSE_WARN_BAD_MINOR_VERSION
+ Parsing a %s document with a 1.0 parser
+YAML_PARSE_WARN_MULTIPLE_DIRECTIVES
+ '%s directive used more than once'
+YAML_PARSE_ERR_TEXT_AFTER_INDICATOR
+ No text allowed after indicator
+YAML_PARSE_ERR_NO_ANCHOR
+ No anchor for alias '*%s'
+YAML_PARSE_ERR_NO_SEPARATOR
+ Expected separator '---'
+YAML_PARSE_ERR_SINGLE_LINE
+ Couldn't parse single line value
+YAML_PARSE_ERR_BAD_ANCHOR
+ Invalid anchor
+YAML_DUMP_ERR_INVALID_INDENT
+ Invalid Indent width specified: '%s'
+YAML_LOAD_USAGE
+ usage: YAML::Load($yaml_stream_scalar)
+YAML_PARSE_ERR_BAD_NODE
+ Can't parse node
+YAML_PARSE_ERR_BAD_EXPLICIT
+ Unsupported explicit transfer: '%s'
+YAML_DUMP_USAGE_DUMPCODE
+ Invalid value for DumpCode: '%s'
+YAML_LOAD_ERR_FILE_INPUT
+ Couldn't open %s for input:\n%s
+YAML_DUMP_ERR_FILE_CONCATENATE
+ Can't concatenate to YAML file %s
+YAML_DUMP_ERR_FILE_OUTPUT
+ Couldn't open %s for output:\n%s
+YAML_DUMP_ERR_NO_HEADER
+ With UseHeader=0, the node must be a plain hash or array
+YAML_DUMP_WARN_BAD_NODE_TYPE
+ Can't perform serialization for node type: '%s'
+YAML_EMIT_WARN_KEYS
+ Encountered a problem with 'keys':\n%s
+YAML_DUMP_WARN_DEPARSE_FAILED
+ Deparse failed for CODE reference
+YAML_DUMP_WARN_CODE_DUMMY
+ Emitting dummy subroutine for CODE reference
+YAML_PARSE_ERR_MANY_EXPLICIT
+ More than one explicit transfer
+YAML_PARSE_ERR_MANY_IMPLICIT
+ More than one implicit request
+YAML_PARSE_ERR_MANY_ANCHOR
+ More than one anchor
+YAML_PARSE_ERR_ANCHOR_ALIAS
+ Can't define both an anchor and an alias
+YAML_PARSE_ERR_BAD_ALIAS
+ Invalid alias
+YAML_PARSE_ERR_MANY_ALIAS
+ More than one alias
+YAML_LOAD_ERR_NO_CONVERT
+ Can't convert implicit '%s' node to explicit '%s' node
+YAML_LOAD_ERR_NO_DEFAULT_VALUE
+ No default value for '%s' explicit transfer
+YAML_LOAD_ERR_NON_EMPTY_STRING
+ Only the empty string can be converted to a '%s'
+YAML_LOAD_ERR_BAD_MAP_TO_SEQ
+ Can't transfer map as sequence. Non numeric key '%s' encountered.
+YAML_DUMP_ERR_BAD_GLOB
+ '%s' is an invalid value for Perl glob
+YAML_DUMP_ERR_BAD_REGEXP
+ '%s' is an invalid value for Perl Regexp
+YAML_LOAD_ERR_BAD_MAP_ELEMENT
+ Invalid element in map
+YAML_LOAD_WARN_DUPLICATE_KEY
+ Duplicate map key found. Ignoring.
+YAML_LOAD_ERR_BAD_SEQ_ELEMENT
+ Invalid element in sequence
+YAML_PARSE_ERR_INLINE_MAP
+ Can't parse inline map
+YAML_PARSE_ERR_INLINE_SEQUENCE
+ Can't parse inline sequence
+YAML_PARSE_ERR_BAD_DOUBLE
+ Can't parse double quoted string
+YAML_PARSE_ERR_BAD_SINGLE
+ Can't parse single quoted string
+YAML_PARSE_ERR_BAD_INLINE_IMPLICIT
+ Can't parse inline implicit value '%s'
+YAML_PARSE_ERR_BAD_IMPLICIT
+ Unrecognized implicit value '%s'
+YAML_PARSE_ERR_INDENTATION
+ Error. Invalid indentation level
+YAML_PARSE_ERR_INCONSISTENT_INDENTATION
+ Inconsistent indentation level
+YAML_LOAD_WARN_UNRESOLVED_ALIAS
+ Can't resolve alias *%s
+YAML_LOAD_WARN_NO_REGEXP_IN_REGEXP
+ No 'REGEXP' element for Perl regexp
+YAML_LOAD_WARN_BAD_REGEXP_ELEM
+ Unknown element '%s' in Perl regexp
+YAML_LOAD_WARN_GLOB_NAME
+ No 'NAME' element for Perl glob
+YAML_LOAD_WARN_PARSE_CODE
+ Couldn't parse Perl code scalar: %s
+YAML_LOAD_WARN_CODE_DEPARSE
+ Won't parse Perl code unless $YAML::LoadCode is set
+YAML_EMIT_ERR_BAD_LEVEL
+ Internal Error: Bad level detected
+YAML_PARSE_WARN_AMBIGUOUS_TAB
+ Amibiguous tab converted to spaces
+YAML_LOAD_WARN_BAD_GLOB_ELEM
+ Unknown element '%s' in Perl glob
+YAML_PARSE_ERR_ZERO_INDENT
+ Can't use zero as an indentation width
+YAML_LOAD_WARN_GLOB_IO
+ Can't load an IO filehandle. Yet!!!
+...
+
+%line_adjust = map {($_, 1)}
+ qw(YAML_PARSE_ERR_BAD_MAJOR_VERSION
+ YAML_PARSE_WARN_BAD_MINOR_VERSION
+ YAML_PARSE_ERR_TEXT_AFTER_INDICATOR
+ YAML_PARSE_ERR_NO_ANCHOR
+ YAML_PARSE_ERR_MANY_EXPLICIT
+ YAML_PARSE_ERR_MANY_IMPLICIT
+ YAML_PARSE_ERR_MANY_ANCHOR
+ YAML_PARSE_ERR_ANCHOR_ALIAS
+ YAML_PARSE_ERR_BAD_ALIAS
+ YAML_PARSE_ERR_MANY_ALIAS
+ YAML_LOAD_ERR_NO_CONVERT
+ YAML_LOAD_ERR_NO_DEFAULT_VALUE
+ YAML_LOAD_ERR_NON_EMPTY_STRING
+ YAML_LOAD_ERR_BAD_MAP_TO_SEQ
+ YAML_LOAD_ERR_BAD_STR_TO_INT
+ YAML_LOAD_ERR_BAD_STR_TO_DATE
+ YAML_LOAD_ERR_BAD_STR_TO_TIME
+ YAML_LOAD_WARN_DUPLICATE_KEY
+ YAML_PARSE_ERR_INLINE_MAP
+ YAML_PARSE_ERR_INLINE_SEQUENCE
+ YAML_PARSE_ERR_BAD_DOUBLE
+ YAML_PARSE_ERR_BAD_SINGLE
+ YAML_PARSE_ERR_BAD_INLINE_IMPLICIT
+ YAML_PARSE_ERR_BAD_IMPLICIT
+ YAML_LOAD_WARN_NO_REGEXP_IN_REGEXP
+ YAML_LOAD_WARN_BAD_REGEXP_ELEM
+ YAML_LOAD_WARN_REGEXP_CREATE
+ YAML_LOAD_WARN_GLOB_NAME
+ YAML_LOAD_WARN_PARSE_CODE
+ YAML_LOAD_WARN_CODE_DEPARSE
+ YAML_LOAD_WARN_BAD_GLOB_ELEM
+ YAML_PARSE_ERR_ZERO_INDENT
+ );
+
+package YAML::Warning;
+use base 'YAML::Error';
+
+1;
+
+__END__
+
+=head1 NAME
+
+YAML::Error - Error formatting class for YAML modules
+
+=head1 SYNOPSIS
+
+ $self->die('YAML_PARSE_ERR_NO_ANCHOR', $alias);
+ $self->warn('YAML_LOAD_WARN_DUPLICATE_KEY');
+
+=head1 DESCRIPTION
+
+This module provides a C<die> and a C<warn> facility.
+
+=head1 AUTHOR
+
+Ingy döt Net <ingy@cpan.org>
+
+=head1 COPYRIGHT
+
+Copyright (c) 2006. Ingy döt Net. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+See L<http://www.perl.com/perl/misc/Artistic.html>
+
+=cut
--- /dev/null
+package YAML::Loader;
+use strict; use warnings;
+use YAML::Base;
+use base 'YAML::Loader::Base';
+use YAML::Types;
+
+# Context constants
+use constant LEAF => 1;
+use constant COLLECTION => 2;
+use constant VALUE => "\x07YAML\x07VALUE\x07";
+use constant COMMENT => "\x07YAML\x07COMMENT\x07";
+
+# Common YAML character sets
+my $ESCAPE_CHAR = '[\\x00-\\x08\\x0b-\\x0d\\x0e-\\x1f]';
+my $FOLD_CHAR = '>';
+my $LIT_CHAR = '|';
+my $LIT_CHAR_RX = "\\$LIT_CHAR";
+
+sub load {
+ my $self = shift;
+ $self->stream($_[0] || '');
+ return $self->_parse();
+}
+
+# Top level function for parsing. Parse each document in order and
+# handle processing for YAML headers.
+sub _parse {
+ my $self = shift;
+ my (%directives, $preface);
+ $self->{stream} =~ s|\015\012|\012|g;
+ $self->{stream} =~ s|\015|\012|g;
+ $self->line(0);
+ $self->die('YAML_PARSE_ERR_BAD_CHARS')
+ if $self->stream =~ /$ESCAPE_CHAR/;
+ $self->die('YAML_PARSE_ERR_NO_FINAL_NEWLINE')
+ if length($self->stream) and
+ $self->{stream} !~ s/(.)\n\Z/$1/s;
+ $self->lines([split /\x0a/, $self->stream, -1]);
+ $self->line(1);
+ # Throw away any comments or blanks before the header (or start of
+ # content for headerless streams)
+ $self->_parse_throwaway_comments();
+ $self->document(0);
+ $self->documents([]);
+ # Add an "assumed" header if there is no header and the stream is
+ # not empty (after initial throwaways).
+ if (not $self->eos) {
+ if ($self->lines->[0] !~ /^---(\s|$)/) {
+ unshift @{$self->lines}, '---';
+ $self->{line}--;
+ }
+ }
+
+ # Main Loop. Parse out all the top level nodes and return them.
+ while (not $self->eos) {
+ $self->anchor2node({});
+ $self->{document}++;
+ $self->done(0);
+ $self->level(0);
+ $self->offset->[0] = -1;
+
+ if ($self->lines->[0] =~ /^---\s*(.*)$/) {
+ my @words = split /\s+/, $1;
+ %directives = ();
+ while (@words && $words[0] =~ /^#(\w+):(\S.*)$/) {
+ my ($key, $value) = ($1, $2);
+ shift(@words);
+ if (defined $directives{$key}) {
+ $self->warn('YAML_PARSE_WARN_MULTIPLE_DIRECTIVES',
+ $key, $self->document);
+ next;
+ }
+ $directives{$key} = $value;
+ }
+ $self->preface(join ' ', @words);
+ }
+ else {
+ $self->die('YAML_PARSE_ERR_NO_SEPARATOR');
+ }
+
+ if (not $self->done) {
+ $self->_parse_next_line(COLLECTION);
+ }
+ if ($self->done) {
+ $self->{indent} = -1;
+ $self->content('');
+ }
+
+ $directives{YAML} ||= '1.0';
+ $directives{TAB} ||= 'NONE';
+ ($self->{major_version}, $self->{minor_version}) =
+ split /\./, $directives{YAML}, 2;
+ $self->die('YAML_PARSE_ERR_BAD_MAJOR_VERSION', $directives{YAML})
+ if $self->major_version ne '1';
+ $self->warn('YAML_PARSE_WARN_BAD_MINOR_VERSION', $directives{YAML})
+ if $self->minor_version ne '0';
+ $self->die('Unrecognized TAB policy')
+ unless $directives{TAB} =~ /^(NONE|\d+)(:HARD)?$/;
+
+ push @{$self->documents}, $self->_parse_node();
+ }
+ return wantarray ? @{$self->documents} : $self->documents->[-1];
+}
+
+# This function is the dispatcher for parsing each node. Every node
+# recurses back through here. (Inlines are an exception as they have
+# their own sub-parser.)
+sub _parse_node {
+ my $self = shift;
+ my $preface = $self->preface;
+ $self->preface('');
+ my ($node, $type, $indicator, $escape, $chomp) = ('') x 5;
+ my ($anchor, $alias, $explicit, $implicit, $class) = ('') x 5;
+ ($anchor, $alias, $explicit, $implicit, $preface) =
+ $self->_parse_qualifiers($preface);
+ if ($anchor) {
+ $self->anchor2node->{$anchor} = CORE::bless [], 'YAML-anchor2node';
+ }
+ $self->inline('');
+ while (length $preface) {
+ my $line = $self->line - 1;
+ if ($preface =~ s/^($FOLD_CHAR|$LIT_CHAR_RX)(-|\+)?\d*\s*//) {
+ $indicator = $1;
+ $chomp = $2 if defined($2);
+ }
+ else {
+ $self->die('YAML_PARSE_ERR_TEXT_AFTER_INDICATOR') if $indicator;
+ $self->inline($preface);
+ $preface = '';
+ }
+ }
+ if ($alias) {
+ $self->die('YAML_PARSE_ERR_NO_ANCHOR', $alias)
+ unless defined $self->anchor2node->{$alias};
+ if (ref($self->anchor2node->{$alias}) ne 'YAML-anchor2node') {
+ $node = $self->anchor2node->{$alias};
+ }
+ else {
+ $node = do {my $sv = "*$alias"};
+ push @{$self->anchor2node->{$alias}}, [\$node, $self->line];
+ }
+ }
+ elsif (length $self->inline) {
+ $node = $self->_parse_inline(1, $implicit, $explicit);
+ if (length $self->inline) {
+ $self->die('YAML_PARSE_ERR_SINGLE_LINE');
+ }
+ }
+ elsif ($indicator eq $LIT_CHAR) {
+ $self->{level}++;
+ $node = $self->_parse_block($chomp);
+ $node = $self->_parse_implicit($node) if $implicit;
+ $self->{level}--;
+ }
+ elsif ($indicator eq $FOLD_CHAR) {
+ $self->{level}++;
+ $node = $self->_parse_unfold($chomp);
+ $node = $self->_parse_implicit($node) if $implicit;
+ $self->{level}--;
+ }
+ else {
+ $self->{level}++;
+ $self->offset->[$self->level] ||= 0;
+ if ($self->indent == $self->offset->[$self->level]) {
+ if ($self->content =~ /^-( |$)/) {
+ $node = $self->_parse_seq($anchor);
+ }
+ elsif ($self->content =~ /(^\?|\:( |$))/) {
+ $node = $self->_parse_mapping($anchor);
+ }
+ elsif ($preface =~ /^\s*$/) {
+ $node = $self->_parse_implicit('');
+ }
+ else {
+ $self->die('YAML_PARSE_ERR_BAD_NODE');
+ }
+ }
+ else {
+ $node = undef;
+ }
+ $self->{level}--;
+ }
+ $#{$self->offset} = $self->level;
+
+ if ($explicit) {
+ if ($class) {
+ if (not ref $node) {
+ my $copy = $node;
+ undef $node;
+ $node = \$copy;
+ }
+ CORE::bless $node, $class;
+ }
+ else {
+ $node = $self->_parse_explicit($node, $explicit);
+ }
+ }
+ if ($anchor) {
+ if (ref($self->anchor2node->{$anchor}) eq 'YAML-anchor2node') {
+ # XXX Can't remember what this code actually does
+ for my $ref (@{$self->anchor2node->{$anchor}}) {
+ ${$ref->[0]} = $node;
+ $self->warn('YAML_LOAD_WARN_UNRESOLVED_ALIAS',
+ $anchor, $ref->[1]);
+ }
+ }
+ $self->anchor2node->{$anchor} = $node;
+ }
+ return $node;
+}
+
+# Preprocess the qualifiers that may be attached to any node.
+sub _parse_qualifiers {
+ my $self = shift;
+ my ($preface) = @_;
+ my ($anchor, $alias, $explicit, $implicit, $token) = ('') x 5;
+ $self->inline('');
+ while ($preface =~ /^[&*!]/) {
+ my $line = $self->line - 1;
+ if ($preface =~ s/^\!(\S+)\s*//) {
+ $self->die('YAML_PARSE_ERR_MANY_EXPLICIT') if $explicit;
+ $explicit = $1;
+ }
+ elsif ($preface =~ s/^\!\s*//) {
+ $self->die('YAML_PARSE_ERR_MANY_IMPLICIT') if $implicit;
+ $implicit = 1;
+ }
+ elsif ($preface =~ s/^\&([^ ,:]+)\s*//) {
+ $token = $1;
+ $self->die('YAML_PARSE_ERR_BAD_ANCHOR')
+ unless $token =~ /^[a-zA-Z0-9]+$/;
+ $self->die('YAML_PARSE_ERR_MANY_ANCHOR') if $anchor;
+ $self->die('YAML_PARSE_ERR_ANCHOR_ALIAS') if $alias;
+ $anchor = $token;
+ }
+ elsif ($preface =~ s/^\*([^ ,:]+)\s*//) {
+ $token = $1;
+ $self->die('YAML_PARSE_ERR_BAD_ALIAS')
+ unless $token =~ /^[a-zA-Z0-9]+$/;
+ $self->die('YAML_PARSE_ERR_MANY_ALIAS') if $alias;
+ $self->die('YAML_PARSE_ERR_ANCHOR_ALIAS') if $anchor;
+ $alias = $token;
+ }
+ }
+ return ($anchor, $alias, $explicit, $implicit, $preface);
+}
+
+# Morph a node to it's explicit type
+sub _parse_explicit {
+ my $self = shift;
+ my ($node, $explicit) = @_;
+ my ($type, $class);
+ if ($explicit =~ /^\!perl\/(hash|array|scalar)\:(\w(\w|\:\:)*)?$/) {
+ ($type, $class) = (($1 || ''), ($2 || ''));
+ if (ref $node) {
+ return CORE::bless $node, $class;
+ }
+ else {
+ return CORE::bless \$node, $class;
+ }
+ }
+ if ($explicit =~
+ /^\!?perl\/(undef|glob|regexp|code|ref)\:(\w(\w|\:\:)*)?$/) {
+ ($type, $class) = (($1 || ''), ($2 || ''));
+ my $type_class = "YAML::Type::$type";
+ no strict 'refs';
+ if ($type_class->can('yaml_load')) {
+ return $type_class->yaml_load($node, $class, $self);
+ }
+ else {
+ $self->die('YAML_LOAD_ERR_NO_CONVERT', 'XXX', $explicit);
+ }
+ }
+ # This !perl/@Foo and !perl/$Foo are deprecated but still parsed
+ elsif ($YAML::TagClass->{$explicit} ||
+ $explicit =~ m{^perl/(\@|\$)?([a-zA-Z](\w|::)+)$}
+ ) {
+ $class = $YAML::TagClass->{$explicit} || $2;
+ if ($class->can('yaml_load')) {
+ require YAML::Node;
+ return $class->yaml_load(YAML::Node->new($node, $explicit));
+ }
+ else {
+ if (ref $node) {
+ return CORE::bless $node, $class;
+ }
+ else {
+ return CORE::bless \$node, $class;
+ }
+ }
+ }
+ elsif (ref $node) {
+ require YAML::Node;
+ return YAML::Node->new($node, $explicit);
+ }
+ else {
+ # XXX This is likely wrong. Failing test:
+ # --- !unknown 'scalar value'
+ return $node;
+ }
+}
+
+# Parse a YAML mapping into a Perl hash
+sub _parse_mapping {
+ my $self = shift;
+ my ($anchor) = @_;
+ my $mapping = {};
+ $self->anchor2node->{$anchor} = $mapping;
+ my $key;
+ while (not $self->done and $self->indent == $self->offset->[$self->level]) {
+ # If structured key:
+ if ($self->{content} =~ s/^\?\s*//) {
+ $self->preface($self->content);
+ $self->_parse_next_line(COLLECTION);
+ $key = $self->_parse_node();
+ $key = "$key";
+ }
+ # If "default" key (equals sign)
+ elsif ($self->{content} =~ s/^\=\s*//) {
+ $key = VALUE;
+ }
+ # If "comment" key (slash slash)
+ elsif ($self->{content} =~ s/^\=\s*//) {
+ $key = COMMENT;
+ }
+ # Regular scalar key:
+ else {
+ $self->inline($self->content);
+ $key = $self->_parse_inline();
+ $key = "$key";
+ $self->content($self->inline);
+ $self->inline('');
+ }
+
+ unless ($self->{content} =~ s/^:\s*//) {
+ $self->die('YAML_LOAD_ERR_BAD_MAP_ELEMENT');
+ }
+ $self->preface($self->content);
+ my $line = $self->line;
+ $self->_parse_next_line(COLLECTION);
+ my $value = $self->_parse_node();
+ if (exists $mapping->{$key}) {
+ $self->warn('YAML_LOAD_WARN_DUPLICATE_KEY');
+ }
+ else {
+ $mapping->{$key} = $value;
+ }
+ }
+ return $mapping;
+}
+
+# Parse a YAML sequence into a Perl array
+sub _parse_seq {
+ my $self = shift;
+ my ($anchor) = @_;
+ my $seq = [];
+ $self->anchor2node->{$anchor} = $seq;
+ while (not $self->done and $self->indent == $self->offset->[$self->level]) {
+ if ($self->content =~ /^-(?: (.*))?$/) {
+ $self->preface(defined($1) ? $1 : '');
+ }
+ else {
+ $self->die('YAML_LOAD_ERR_BAD_SEQ_ELEMENT');
+ }
+ if ($self->preface =~ /^(\s*)(\w.*\:(?: |$).*)$/) {
+ $self->indent($self->offset->[$self->level] + 2 + length($1));
+ $self->content($2);
+ $self->level($self->level + 1);
+ $self->offset->[$self->level] = $self->indent;
+ $self->preface('');
+ push @$seq, $self->_parse_mapping('');
+ $self->{level}--;
+ $#{$self->offset} = $self->level;
+ }
+ else {
+ $self->_parse_next_line(COLLECTION);
+ push @$seq, $self->_parse_node();
+ }
+ }
+ return $seq;
+}
+
+# Parse an inline value. Since YAML supports inline collections, this is
+# the top level of a sub parsing.
+sub _parse_inline {
+ my $self = shift;
+ my ($top, $top_implicit, $top_explicit) = (@_, '', '', '');
+ $self->{inline} =~ s/^\s*(.*)\s*$/$1/; # OUCH - mugwump
+ my ($node, $anchor, $alias, $explicit, $implicit) = ('') x 5;
+ ($anchor, $alias, $explicit, $implicit, $self->{inline}) =
+ $self->_parse_qualifiers($self->inline);
+ if ($anchor) {
+ $self->anchor2node->{$anchor} = CORE::bless [], 'YAML-anchor2node';
+ }
+ $implicit ||= $top_implicit;
+ $explicit ||= $top_explicit;
+ ($top_implicit, $top_explicit) = ('', '');
+ if ($alias) {
+ $self->die('YAML_PARSE_ERR_NO_ANCHOR', $alias)
+ unless defined $self->anchor2node->{$alias};
+ if (ref($self->anchor2node->{$alias}) ne 'YAML-anchor2node') {
+ $node = $self->anchor2node->{$alias};
+ }
+ else {
+ $node = do {my $sv = "*$alias"};
+ push @{$self->anchor2node->{$alias}}, [\$node, $self->line];
+ }
+ }
+ elsif ($self->inline =~ /^\{/) {
+ $node = $self->_parse_inline_mapping($anchor);
+ }
+ elsif ($self->inline =~ /^\[/) {
+ $node = $self->_parse_inline_seq($anchor);
+ }
+ elsif ($self->inline =~ /^"/) {
+ $node = $self->_parse_inline_double_quoted();
+ $node = $self->_unescape($node);
+ $node = $self->_parse_implicit($node) if $implicit;
+ }
+ elsif ($self->inline =~ /^'/) {
+ $node = $self->_parse_inline_single_quoted();
+ $node = $self->_parse_implicit($node) if $implicit;
+ }
+ else {
+ if ($top) {
+ $node = $self->inline;
+ $self->inline('');
+ }
+ else {
+ $node = $self->_parse_inline_simple();
+ }
+ $node = $self->_parse_implicit($node) unless $explicit;
+ }
+ if ($explicit) {
+ $node = $self->_parse_explicit($node, $explicit);
+ }
+ if ($anchor) {
+ if (ref($self->anchor2node->{$anchor}) eq 'YAML-anchor2node') {
+ for my $ref (@{$self->anchor2node->{$anchor}}) {
+ ${$ref->[0]} = $node;
+ $self->warn('YAML_LOAD_WARN_UNRESOLVED_ALIAS',
+ $anchor, $ref->[1]);
+ }
+ }
+ $self->anchor2node->{$anchor} = $node;
+ }
+ return $node;
+}
+
+# Parse the inline YAML mapping into a Perl hash
+sub _parse_inline_mapping {
+ my $self = shift;
+ my ($anchor) = @_;
+ my $node = {};
+ $self->anchor2node->{$anchor} = $node;
+
+ $self->die('YAML_PARSE_ERR_INLINE_MAP')
+ unless $self->{inline} =~ s/^\{\s*//;
+ while (not $self->{inline} =~ s/^\s*\}//) {
+ my $key = $self->_parse_inline();
+ $self->die('YAML_PARSE_ERR_INLINE_MAP')
+ unless $self->{inline} =~ s/^\: \s*//;
+ my $value = $self->_parse_inline();
+ if (exists $node->{$key}) {
+ $self->warn('YAML_LOAD_WARN_DUPLICATE_KEY');
+ }
+ else {
+ $node->{$key} = $value;
+ }
+ next if $self->inline =~ /^\s*\}/;
+ $self->die('YAML_PARSE_ERR_INLINE_MAP')
+ unless $self->{inline} =~ s/^\,\s*//;
+ }
+ return $node;
+}
+
+# Parse the inline YAML sequence into a Perl array
+sub _parse_inline_seq {
+ my $self = shift;
+ my ($anchor) = @_;
+ my $node = [];
+ $self->anchor2node->{$anchor} = $node;
+
+ $self->die('YAML_PARSE_ERR_INLINE_SEQUENCE')
+ unless $self->{inline} =~ s/^\[\s*//;
+ while (not $self->{inline} =~ s/^\s*\]//) {
+ my $value = $self->_parse_inline();
+ push @$node, $value;
+ next if $self->inline =~ /^\s*\]/;
+ $self->die('YAML_PARSE_ERR_INLINE_SEQUENCE')
+ unless $self->{inline} =~ s/^\,\s*//;
+ }
+ return $node;
+}
+
+# Parse the inline double quoted string.
+sub _parse_inline_double_quoted {
+ my $self = shift;
+ my $node;
+ if ($self->inline =~ /^"((?:\\"|[^"])*)"\s*(.*)$/) {
+ $node = $1;
+ $self->inline($2);
+ $node =~ s/\\"/"/g;
+ }
+ else {
+ $self->die('YAML_PARSE_ERR_BAD_DOUBLE');
+ }
+ return $node;
+}
+
+
+# Parse the inline single quoted string.
+sub _parse_inline_single_quoted {
+ my $self = shift;
+ my $node;
+ if ($self->inline =~ /^'((?:''|[^'])*)'\s*(.*)$/) {
+ $node = $1;
+ $self->inline($2);
+ $node =~ s/''/'/g;
+ }
+ else {
+ $self->die('YAML_PARSE_ERR_BAD_SINGLE');
+ }
+ return $node;
+}
+
+# Parse the inline unquoted string and do implicit typing.
+sub _parse_inline_simple {
+ my $self = shift;
+ my $value;
+ if ($self->inline =~ /^(|[^!@#%^&*].*?)(?=[\[\]\{\},]|, |: |- |:\s*$|$)/) {
+ $value = $1;
+ substr($self->{inline}, 0, length($1)) = '';
+ }
+ else {
+ $self->die('YAML_PARSE_ERR_BAD_INLINE_IMPLICIT', $value);
+ }
+ return $value;
+}
+
+sub _parse_implicit {
+ my $self = shift;
+ my ($value) = @_;
+ $value =~ s/\s*$//;
+ return $value if $value eq '';
+ return undef if $value =~ /^~$/;
+ return $value
+ unless $value =~ /^[\@\`\^]/ or
+ $value =~ /^[\-\?]\s/;
+ $self->die('YAML_PARSE_ERR_BAD_IMPLICIT', $value);
+}
+
+# Unfold a YAML multiline scalar into a single string.
+sub _parse_unfold {
+ my $self = shift;
+ my ($chomp) = @_;
+ my $node = '';
+ my $space = 0;
+ while (not $self->done and $self->indent == $self->offset->[$self->level]) {
+ $node .= $self->content. "\n";
+ $self->_parse_next_line(LEAF);
+ }
+ $node =~ s/^(\S.*)\n(?=\S)/$1 /gm;
+ $node =~ s/^(\S.*)\n(\n+\S)/$1$2/gm;
+ $node =~ s/\n*\Z// unless $chomp eq '+';
+ $node .= "\n" unless $chomp;
+ return $node;
+}
+
+# Parse a YAML block style scalar. This is like a Perl here-document.
+sub _parse_block {
+ my $self = shift;
+ my ($chomp) = @_;
+ my $node = '';
+ while (not $self->done and $self->indent == $self->offset->[$self->level]) {
+ $node .= $self->content . "\n";
+ $self->_parse_next_line(LEAF);
+ }
+ return $node if '+' eq $chomp;
+ $node =~ s/\n*\Z/\n/;
+ $node =~ s/\n\Z// if $chomp eq '-';
+ return $node;
+}
+
+# Handle Perl style '#' comments. Comments must be at the same indentation
+# level as the collection line following them.
+sub _parse_throwaway_comments {
+ my $self = shift;
+ while (@{$self->lines} and
+ $self->lines->[0] =~ m{^\s*(\#|$)}
+ ) {
+ shift @{$self->lines};
+ $self->{line}++;
+ }
+ $self->eos($self->{done} = not @{$self->lines});
+}
+
+# This is the routine that controls what line is being parsed. It gets called
+# once for each line in the YAML stream.
+#
+# This routine must:
+# 1) Skip past the current line
+# 2) Determine the indentation offset for a new level
+# 3) Find the next _content_ line
+# A) Skip over any throwaways (Comments/blanks)
+# B) Set $self->indent, $self->content, $self->line
+# 4) Expand tabs appropriately
+sub _parse_next_line {
+ my $self = shift;
+ my ($type) = @_;
+ my $level = $self->level;
+ my $offset = $self->offset->[$level];
+ $self->die('YAML_EMIT_ERR_BAD_LEVEL') unless defined $offset;
+ shift @{$self->lines};
+ $self->eos($self->{done} = not @{$self->lines});
+ return if $self->eos;
+ $self->{line}++;
+
+ # Determine the offset for a new leaf node
+ if ($self->preface =~
+ qr/(?:^|\s)(?:$FOLD_CHAR|$LIT_CHAR_RX)(?:-|\+)?(\d*)\s*$/
+ ) {
+ $self->die('YAML_PARSE_ERR_ZERO_INDENT')
+ if length($1) and $1 == 0;
+ $type = LEAF;
+ if (length($1)) {
+ $self->offset->[$level + 1] = $offset + $1;
+ }
+ else {
+ # First get rid of any comments.
+ while (@{$self->lines} && ($self->lines->[0] =~ /^\s*#/)) {
+ $self->lines->[0] =~ /^( *)/ or die;
+ last unless length($1) <= $offset;
+ shift @{$self->lines};
+ $self->{line}++;
+ }
+ $self->eos($self->{done} = not @{$self->lines});
+ return if $self->eos;
+ if ($self->lines->[0] =~ /^( *)\S/ and length($1) > $offset) {
+ $self->offset->[$level+1] = length($1);
+ }
+ else {
+ $self->offset->[$level+1] = $offset + 1;
+ }
+ }
+ $offset = $self->offset->[++$level];
+ }
+ # Determine the offset for a new collection level
+ elsif ($type == COLLECTION and
+ $self->preface =~ /^(\s*(\!\S*|\&\S+))*\s*$/) {
+ $self->_parse_throwaway_comments();
+ if ($self->eos) {
+ $self->offset->[$level+1] = $offset + 1;
+ return;
+ }
+ else {
+ $self->lines->[0] =~ /^( *)\S/ or die;
+ if (length($1) > $offset) {
+ $self->offset->[$level+1] = length($1);
+ }
+ else {
+ $self->offset->[$level+1] = $offset + 1;
+ }
+ }
+ $offset = $self->offset->[++$level];
+ }
+
+ if ($type == LEAF) {
+ while (@{$self->lines} and
+ $self->lines->[0] =~ m{^( *)(\#)} and
+ length($1) < $offset
+ ) {
+ shift @{$self->lines};
+ $self->{line}++;
+ }
+ $self->eos($self->{done} = not @{$self->lines});
+ }
+ else {
+ $self->_parse_throwaway_comments();
+ }
+ return if $self->eos;
+
+ if ($self->lines->[0] =~ /^---(\s|$)/) {
+ $self->done(1);
+ return;
+ }
+ if ($type == LEAF and
+ $self->lines->[0] =~ /^ {$offset}(.*)$/
+ ) {
+ $self->indent($offset);
+ $self->content($1);
+ }
+ elsif ($self->lines->[0] =~ /^\s*$/) {
+ $self->indent($offset);
+ $self->content('');
+ }
+ else {
+ $self->lines->[0] =~ /^( *)(\S.*)$/;
+ while ($self->offset->[$level] > length($1)) {
+ $level--;
+ }
+ $self->die('YAML_PARSE_ERR_INCONSISTENT_INDENTATION')
+ if $self->offset->[$level] != length($1);
+ $self->indent(length($1));
+ $self->content($2);
+ }
+ $self->die('YAML_PARSE_ERR_INDENTATION')
+ if $self->indent - $offset > 1;
+}
+
+#==============================================================================
+# Utility subroutines.
+#==============================================================================
+
+# Printable characters for escapes
+my %unescapes =
+ (
+ z => "\x00", a => "\x07", t => "\x09",
+ n => "\x0a", v => "\x0b", f => "\x0c",
+ r => "\x0d", e => "\x1b", '\\' => '\\',
+ );
+
+# Transform all the backslash style escape characters to their literal meaning
+sub _unescape {
+ my $self = shift;
+ my ($node) = @_;
+ $node =~ s/\\([never\\fartz]|x([0-9a-fA-F]{2}))/
+ (length($1)>1)?pack("H2",$2):$unescapes{$1}/gex;
+ return $node;
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+YAML::Loader - YAML class for loading Perl objects to YAML
+
+=head1 SYNOPSIS
+
+ use YAML::Loader;
+ my $loader = YAML::Loader->new;
+ my $hash = $loader->load(<<'...');
+ foo: bar
+ ...
+
+=head1 DESCRIPTION
+
+YAML::Loader is the module that YAML.pm used to deserialize YAML to Perl
+objects. It is fully object oriented and usable on its own.
+
+=head1 AUTHOR
+
+Ingy döt Net <ingy@cpan.org>
+
+=head1 COPYRIGHT
+
+Copyright (c) 2006. Ingy döt Net. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+See L<http://www.perl.com/perl/misc/Artistic.html>
+
+=cut
--- /dev/null
+package YAML::Loader::Base;
+use strict; use warnings;
+use YAML::Base; use base 'YAML::Base';
+
+field load_code => 0;
+
+field stream => '';
+field document => 0;
+field line => 0;
+field documents => [];
+field lines => [];
+field eos => 0;
+field done => 0;
+field anchor2node => {};
+field level => 0;
+field offset => [];
+field preface => '';
+field content => '';
+field indent => 0;
+field major_version => 0;
+field minor_version => 0;
+field inline => '';
+
+sub set_global_options {
+ my $self = shift;
+ $self->load_code($YAML::LoadCode || $YAML::UseCode)
+ if defined $YAML::LoadCode or defined $YAML::UseCode;
+}
+
+sub load {
+ die 'load() not implemented in this class.';
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+YAML::Loader::Base - Base class for YAML Loader classes
+
+=head1 SYNOPSIS
+
+ package YAML::Loader::Something;
+ use YAML::Loader::Base -base;
+
+=head1 DESCRIPTION
+
+YAML::Loader::Base is a base class for creating YAML loader classes.
+
+=head1 AUTHOR
+
+Ingy döt Net <ingy@cpan.org>
+
+=head1 COPYRIGHT
+
+Copyright (c) 2006. Ingy döt Net. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+See L<http://www.perl.com/perl/misc/Artistic.html>
+
+=cut
--- /dev/null
+package YAML::Marshall;
+use strict; use warnings;
+use YAML::Node();
+
+sub import {
+ my $class = shift;
+ no strict 'refs';
+ my $package = caller;
+ unless (grep { $_ eq $class} @{$package . '::ISA'}) {
+ push @{$package . '::ISA'}, $class;
+ }
+
+ my $tag = shift;
+ if ($tag) {
+ no warnings 'once';
+ $YAML::TagClass->{$tag} = $package;
+ ${$package . "::YamlTag"} = $tag;
+ }
+}
+
+sub yaml_dump {
+ my $self = shift;
+ no strict 'refs';
+ my $tag = ${ref($self) . "::YamlTag"} || 'perl/' . ref($self);
+ $self->yaml_node($self, $tag);
+}
+
+sub yaml_load {
+ my ($class, $node) = @_;
+ if (my $ynode = $class->yaml_ynode($node)) {
+ $node = $ynode->{NODE};
+ }
+ bless $node, $class;
+}
+
+sub yaml_node {
+ shift;
+ YAML::Node->new(@_);
+}
+
+sub yaml_ynode {
+ shift;
+ YAML::Node::ynode(@_);
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+YAML::Marshall - YAML marshalling class you can mixin to your classes
+
+=head1 SYNOPSIS
+
+ package Bar;
+ use Foo -base;
+ use YAML::Marshall -mixin;
+
+=head1 DESCRIPTION
+
+For classes that want to handle their own YAML serialization.
+
+=head1 AUTHOR
+
+Ingy döt Net <ingy@cpan.org>
+
+=head1 COPYRIGHT
+
+Copyright (c) 2006. Ingy döt Net. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+See L<http://www.perl.com/perl/misc/Artistic.html>
+
+=cut
--- /dev/null
+package YAML::Node;
+use strict; use warnings;
+use YAML::Base; use base 'YAML::Base';
+use YAML::Tag;
+
+our @EXPORT = qw(ynode);
+
+sub ynode {
+ my $self;
+ if (ref($_[0]) eq 'HASH') {
+ $self = tied(%{$_[0]});
+ }
+ elsif (ref($_[0]) eq 'ARRAY') {
+ $self = tied(@{$_[0]});
+ }
+ else {
+ $self = tied($_[0]);
+ }
+ return (ref($self) =~ /^yaml_/) ? $self : undef;
+}
+
+sub new {
+ my ($class, $node, $tag) = @_;
+ my $self;
+ $self->{NODE} = $node;
+ my (undef, $type) = $class->node_info($node);
+ $self->{KIND} = (not defined $type) ? 'scalar' :
+ ($type eq 'ARRAY') ? 'sequence' :
+ ($type eq 'HASH') ? 'mapping' :
+ $class->die("Can't create YAML::Node from '$type'");
+ tag($self, ($tag || ''));
+ if ($self->{KIND} eq 'scalar') {
+ yaml_scalar->new($self, $_[1]);
+ return \ $_[1];
+ }
+ my $package = "yaml_" . $self->{KIND};
+ $package->new($self)
+}
+
+sub node { $_->{NODE} }
+sub kind { $_->{KIND} }
+sub tag {
+ my ($self, $value) = @_;
+ if (defined $value) {
+ $self->{TAG} = YAML::Tag->new($value);
+ return $self;
+ }
+ else {
+ return $self->{TAG};
+ }
+}
+sub keys {
+ my ($self, $value) = @_;
+ if (defined $value) {
+ $self->{KEYS} = $value;
+ return $self;
+ }
+ else {
+ return $self->{KEYS};
+ }
+}
+
+#==============================================================================
+package yaml_scalar;
+@yaml_scalar::ISA = qw(YAML::Node);
+
+sub new {
+ my ($class, $self) = @_;
+ tie $_[2], $class, $self;
+}
+
+sub TIESCALAR {
+ my ($class, $self) = @_;
+ bless $self, $class;
+ $self
+}
+
+sub FETCH {
+ my ($self) = @_;
+ $self->{NODE}
+}
+
+sub STORE {
+ my ($self, $value) = @_;
+ $self->{NODE} = $value
+}
+
+#==============================================================================
+package yaml_sequence;
+@yaml_sequence::ISA = qw(YAML::Node);
+
+sub new {
+ my ($class, $self) = @_;
+ my $new;
+ tie @$new, $class, $self;
+ $new
+}
+
+sub TIEARRAY {
+ my ($class, $self) = @_;
+ bless $self, $class
+}
+
+sub FETCHSIZE {
+ my ($self) = @_;
+ scalar @{$self->{NODE}};
+}
+
+sub FETCH {
+ my ($self, $index) = @_;
+ $self->{NODE}[$index]
+}
+
+sub STORE {
+ my ($self, $index, $value) = @_;
+ $self->{NODE}[$index] = $value
+}
+
+sub undone {
+ die "Not implemented yet"; # XXX
+}
+
+*STORESIZE = *POP = *PUSH = *SHIFT = *UNSHIFT = *SPLICE = *DELETE = *EXISTS =
+*STORESIZE = *POP = *PUSH = *SHIFT = *UNSHIFT = *SPLICE = *DELETE = *EXISTS =
+*undone; # XXX Must implement before release
+
+#==============================================================================
+package yaml_mapping;
+@yaml_mapping::ISA = qw(YAML::Node);
+
+sub new {
+ my ($class, $self) = @_;
+ @{$self->{KEYS}} = sort keys %{$self->{NODE}};
+ my $new;
+ tie %$new, $class, $self;
+ $new
+}
+
+sub TIEHASH {
+ my ($class, $self) = @_;
+ bless $self, $class
+}
+
+sub FETCH {
+ my ($self, $key) = @_;
+ if (exists $self->{NODE}{$key}) {
+ return (grep {$_ eq $key} @{$self->{KEYS}})
+ ? $self->{NODE}{$key} : undef;
+ }
+ return $self->{HASH}{$key};
+}
+
+sub STORE {
+ my ($self, $key, $value) = @_;
+ if (exists $self->{NODE}{$key}) {
+ $self->{NODE}{$key} = $value;
+ }
+ elsif (exists $self->{HASH}{$key}) {
+ $self->{HASH}{$key} = $value;
+ }
+ else {
+ if (not grep {$_ eq $key} @{$self->{KEYS}}) {
+ push(@{$self->{KEYS}}, $key);
+ }
+ $self->{HASH}{$key} = $value;
+ }
+ $value
+}
+
+sub DELETE {
+ my ($self, $key) = @_;
+ my $return;
+ if (exists $self->{NODE}{$key}) {
+ $return = $self->{NODE}{$key};
+ }
+ elsif (exists $self->{HASH}{$key}) {
+ $return = delete $self->{NODE}{$key};
+ }
+ for (my $i = 0; $i < @{$self->{KEYS}}; $i++) {
+ if ($self->{KEYS}[$i] eq $key) {
+ splice(@{$self->{KEYS}}, $i, 1);
+ }
+ }
+ return $return;
+}
+
+sub CLEAR {
+ my ($self) = @_;
+ @{$self->{KEYS}} = ();
+ %{$self->{HASH}} = ();
+}
+
+sub FIRSTKEY {
+ my ($self) = @_;
+ $self->{ITER} = 0;
+ $self->{KEYS}[0]
+}
+
+sub NEXTKEY {
+ my ($self) = @_;
+ $self->{KEYS}[++$self->{ITER}]
+}
+
+sub EXISTS {
+ my ($self, $key) = @_;
+ exists $self->{NODE}{$key}
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+YAML::Node - A generic data node that encapsulates YAML information
+
+=head1 SYNOPSIS
+
+ use YAML;
+ use YAML::Node;
+
+ my $ynode = YAML::Node->new({}, 'ingerson.com/fruit');
+ %$ynode = qw(orange orange apple red grape green);
+ print Dump $ynode;
+
+yields:
+
+ --- !ingerson.com/fruit
+ orange: orange
+ apple: red
+ grape: green
+
+=head1 DESCRIPTION
+
+A generic node in YAML is similar to a plain hash, array, or scalar node
+in Perl except that it must also keep track of its type. The type is a
+URI called the YAML type tag.
+
+YAML::Node is a class for generating and manipulating these containers.
+A YAML node (or ynode) is a tied hash, array or scalar. In most ways it
+behaves just like the plain thing. But you can assign and retrieve and
+YAML type tag URI to it. For the hash flavor, you can also assign the
+order that the keys will be retrieved in. By default a ynode will offer
+its keys in the same order that they were assigned.
+
+YAML::Node has a class method call new() that will return a ynode. You
+pass it a regular node and an optional type tag. After that you can
+use it like a normal Perl node, but when you YAML::Dump it, the magical
+properties will be honored.
+
+This is how you can control the sort order of hash keys during a YAML
+serialization. By default, YAML sorts keys alphabetically. But notice
+in the above example that the keys were Dumped in the same order they
+were assigned.
+
+YAML::Node exports a function called ynode(). This function returns the tied object so that you can call special methods on it like ->keys().
+
+keys() works like this:
+
+ use YAML;
+ use YAML::Node;
+
+ %$node = qw(orange orange apple red grape green);
+ $ynode = YAML::Node->new($node);
+ ynode($ynode)->keys(['grape', 'apple']);
+ print Dump $ynode;
+
+produces:
+
+ ---
+ grape: green
+ apple: red
+
+It tells the ynode which keys and what order to use.
+
+ynodes will play a very important role in how programs use YAML. They
+are the foundation of how a Perl class can marshall the Loading and
+Dumping of its objects.
+
+The upcoming versions of YAML.pm will have much more information on this.
+
+=head1 AUTHOR
+
+Ingy döt Net <ingy@cpan.org>
+
+=head1 COPYRIGHT
+
+Copyright (c) 2006. Ingy döt Net. All rights reserved.
+Copyright (c) 2002. Brian Ingerson. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+See L<http://www.perl.com/perl/misc/Artistic.html>
+
+=cut
--- /dev/null
+package YAML::Tag;
+use strict; use warnings;
+
+use overload '""' => sub { ${$_[0]} };
+
+sub new {
+ my ($class, $self) = @_;
+ bless \$self, $class
+}
+
+sub short {
+ ${$_[0]}
+}
+
+sub canonical {
+ ${$_[0]}
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+YAML::Tag - Tag URI object class for YAML
+
+=head1 SYNOPSIS
+
+ use YAML::Tag;
+
+=head1 DESCRIPTION
+
+Used by YAML::Node.
+
+=head1 AUTHOR
+
+Ingy döt Net <ingy@cpan.org>
+
+=head1 COPYRIGHT
+
+Copyright (c) 2006. Ingy döt Net. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+See L<http://www.perl.com/perl/misc/Artistic.html>
+
+=cut
--- /dev/null
+package YAML::Types;
+use strict; use warnings;
+use YAML::Base; use base 'YAML::Base';
+use YAML::Node;
+
+# XXX These classes and their APIs could still use some refactoring,
+# but at least they work for now.
+#-------------------------------------------------------------------------------
+package YAML::Type::blessed;
+use YAML::Base; # XXX
+sub yaml_dump {
+ my $self = shift;
+ my ($value) = @_;
+ my ($class, $type) = YAML::Base->node_info($value);
+ no strict 'refs';
+ my $kind = lc($type) . ':';
+ my $tag = ${$class . '::ClassTag'} ||
+ "!perl/$kind$class";
+ if ($type eq 'REF') {
+ YAML::Node->new(
+ {(&YAML::VALUE, ${$_[0]})}, $tag
+ );
+ }
+ elsif ($type eq 'SCALAR') {
+ $_[1] = $$value;
+ YAML::Node->new($_[1], $tag);
+ } else {
+ YAML::Node->new($value, $tag);
+ }
+}
+
+#-------------------------------------------------------------------------------
+package YAML::Type::undef;
+sub yaml_dump {
+ my $self = shift;
+}
+
+sub yaml_load {
+ my $self = shift;
+}
+
+#-------------------------------------------------------------------------------
+package YAML::Type::glob;
+sub yaml_dump {
+ my $self = shift;
+ my $ynode = YAML::Node->new({}, '!perl/glob:');
+ for my $type (qw(PACKAGE NAME SCALAR ARRAY HASH CODE IO)) {
+ my $value = *{$_[0]}{$type};
+ $value = $$value if $type eq 'SCALAR';
+ if (defined $value) {
+ if ($type eq 'IO') {
+ my @stats = qw(device inode mode links uid gid rdev size
+ atime mtime ctime blksize blocks);
+ undef $value;
+ $value->{stat} = YAML::Node->new({});
+ map {$value->{stat}{shift @stats} = $_} stat(*{$_[0]});
+ $value->{fileno} = fileno(*{$_[0]});
+ {
+ local $^W;
+ $value->{tell} = tell(*{$_[0]});
+ }
+ }
+ $ynode->{$type} = $value;
+ }
+ }
+ return $ynode;
+}
+
+sub yaml_load {
+ my $self = shift;
+ my ($node, $class, $loader) = @_;
+ my ($name, $package);
+ if (defined $node->{NAME}) {
+ $name = $node->{NAME};
+ delete $node->{NAME};
+ }
+ else {
+ $loader->warn('YAML_LOAD_WARN_GLOB_NAME');
+ return undef;
+ }
+ if (defined $node->{PACKAGE}) {
+ $package = $node->{PACKAGE};
+ delete $node->{PACKAGE};
+ }
+ else {
+ $package = 'main';
+ }
+ no strict 'refs';
+ if (exists $node->{SCALAR}) {
+ *{"${package}::$name"} = \$node->{SCALAR};
+ delete $node->{SCALAR};
+ }
+ for my $elem (qw(ARRAY HASH CODE IO)) {
+ if (exists $node->{$elem}) {
+ if ($elem eq 'IO') {
+ $loader->warn('YAML_LOAD_WARN_GLOB_IO');
+ delete $node->{IO};
+ next;
+ }
+ *{"${package}::$name"} = $node->{$elem};
+ delete $node->{$elem};
+ }
+ }
+ for my $elem (sort keys %$node) {
+ $loader->warn('YAML_LOAD_WARN_BAD_GLOB_ELEM', $elem);
+ }
+ return *{"${package}::$name"};
+}
+
+#-------------------------------------------------------------------------------
+package YAML::Type::code;
+my $dummy_warned = 0;
+my $default = '{ "DUMMY" }';
+sub yaml_dump {
+ my $self = shift;
+ my $code;
+ my ($dumpflag, $value) = @_;
+ my ($class, $type) = YAML::Base->node_info($value);
+ $class ||= '';
+ my $tag = "!perl/code:$class";
+ if (not $dumpflag) {
+ $code = $default;
+ }
+ else {
+ bless $value, "CODE" if $class;
+ eval { use B::Deparse };
+ return if $@;
+ my $deparse = B::Deparse->new();
+ eval {
+ local $^W = 0;
+ $code = $deparse->coderef2text($value);
+ };
+ if ($@) {
+ warn YAML::YAML_DUMP_WARN_DEPARSE_FAILED() if $^W;
+ $code = $default;
+ }
+ bless $value, $class if $class;
+ chomp $code;
+ $code .= "\n";
+ }
+ $_[2] = $code;
+ YAML::Node->new($_[2], $tag);
+}
+
+sub yaml_load {
+ my $self = shift;
+ my ($node, $class, $loader) = @_;
+ if ($loader->load_code) {
+ my $code = eval "package main; sub $node";
+ if ($@) {
+ $loader->warn('YAML_LOAD_WARN_PARSE_CODE', $@);
+ return sub {};
+ }
+ else {
+ CORE::bless $code, $class if $class;
+ return $code;
+ }
+ }
+ else {
+ return sub {};
+ }
+}
+
+#-------------------------------------------------------------------------------
+package YAML::Type::ref;
+sub yaml_dump {
+ my $self = shift;
+ YAML::Node->new({(&YAML::VALUE, ${$_[0]})}, '!perl/ref:')
+}
+
+sub yaml_load {
+ my $self = shift;
+ my ($node, $class, $loader) = @_;
+ $loader->die('YAML_LOAD_ERR_NO_DEFAULT_VALUE', 'ptr')
+ unless exists $node->{&YAML::VALUE};
+ return \$node->{&YAML::VALUE};
+}
+
+#-------------------------------------------------------------------------------
+package YAML::Type::regexp;
+# XXX Be sure to handle blessed regexps (if possible)
+sub yaml_dump {
+ my $self = shift;
+ my ($node, $class, $dumper) = @_;
+ my ($regexp, $modifiers);
+ if ("$node" =~ /^\(\?(\w*)(?:\-\w+)?\:(.*)\)$/) {
+ $regexp = $2;
+ $modifiers = $1 || '';
+ }
+ else {
+ $dumper->die('YAML_DUMP_ERR_BAD_REGEXP', $node);
+ }
+ my $tag = '!perl/regexp:';
+ $tag .= $class if $class;
+ my $ynode = YAML::Node->new({}, $tag);
+ $ynode->{REGEXP} = $regexp;
+ $ynode->{MODIFIERS} = $modifiers if $modifiers;
+ return $ynode;
+}
+
+sub yaml_load {
+ my $self = shift;
+ my ($node, $class, $loader) = @_;
+ my ($regexp, $modifiers);
+ if (defined $node->{REGEXP}) {
+ $regexp = $node->{REGEXP};
+ delete $node->{REGEXP};
+ }
+ else {
+ $loader->warn('YAML_LOAD_WARN_NO_REGEXP_IN_REGEXP');
+ return undef;
+ }
+ if (defined $node->{MODIFIERS}) {
+ $modifiers = $node->{MODIFIERS};
+ delete $node->{MODIFIERS};
+ }
+ else {
+ $modifiers = '';
+ }
+ for my $elem (sort keys %$node) {
+ $loader->warn('YAML_LOAD_WARN_BAD_REGEXP_ELEM', $elem);
+ }
+ my $qr = $regexp;
+ $qr = "(?$modifiers:$qr)";
+ return qr{$qr};
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+YAML::Transfer - Marshall Perl internal data types to/from YAML
+
+=head1 SYNOPSIS
+
+ $::foo = 42;
+ print YAML::Dump(*::foo);
+
+ print YAML::Dump(qr{match me});
+
+=head1 DESCRIPTION
+
+This module has the helper classes for transferring objects,
+subroutines, references, globs, regexps and file handles to and
+from YAML.
+
+=head1 AUTHOR
+
+Ingy döt Net <ingy@cpan.org>
+
+=head1 COPYRIGHT
+
+Copyright (c) 2006. Ingy döt Net. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+See L<http://www.perl.com/perl/misc/Artistic.html>
+
+=cut
--- /dev/null
+am.pl
\ No newline at end of file
--- /dev/null
+am.pl
\ No newline at end of file
--- /dev/null
+am.pl
\ No newline at end of file
--- /dev/null
+am.pl
\ No newline at end of file
--- /dev/null
+Order Allow,Deny
+Deny from all
--- /dev/null
+#!/usr/bin/perl
+#
+########################################################
+#
+# This script creates a 'tags' file in the style of ctags
+# out of the SL/ modules.
+# Tags file is usable in some editors (vim, joe, emacs, ...).
+# See your editors documentation for more information.
+#
+# (c) Udo Spallek, Aachen
+# Licenced under GNU/GPL.
+#
+########################################################
+
+use Perl::Tags;
+use IO::Dir;
+use Data::Dumper;
+
+use strict;
+use warnings FATAL =>'all';
+use diagnostics;
+
+my $dir = IO::Dir->new("SL/");
+
+my @files = grep {/\.pm$/} $dir->read();
+
+@files = grep { s{^}{SL\/}gxms } @files;
+
+#print Dumper(@files);
+
+#__END__
+my $naive_tagger = Perl::Tags::Naive->new( max_level=>1 );
+$naive_tagger->process(
+ files => [@files],
+ refresh=>1
+);
+
+my $tagsfile="tags";
+
+# of course, it may not even output, for example, if there's nothing new to process
+$naive_tagger->output( outfile => $tagsfile );
+
+
+1;
print("This tool must be run from the Lx-Office ERP base directory.\n");
exit(1);
}
+
+ unshift @INC, "modules/YAML"; # Use our own version of YAML.
+ push @INC, "modules"; # Only use our own versions of modules if there's no system version.
}
+use English '-no_match_vars';
+
use DBI;
use Data::Dumper;
use Getopt::Long;
$lxdebug = LXDebug->new();
use SL::Form;
+use SL::User;
+use SL::Locale;
use SL::DBUpgrade2;
+use SL::DBUtils;
#######
#######
#######
+my ($opt_list, $opt_tree, $opt_rtree, $opt_nodeps, $opt_graphviz, $opt_help);
+my ($opt_user, $opt_apply);
+
+our (%myconfig, $form, $user);
+
sub show_help {
- print("dbupgrade2_tool.pl [--list] [--tree] [--rtree] [--graphviz]\n" .
- " [--nodepds] [--help]\n");
+ my $help_text = <<'END_HELP'
+dbupgrade2_tool.pl [options]
+
+ A validation and information tool for the database upgrade scripts
+ in 'sql/Pg-upgrade2'.
+
+ At startup dbupgrade2_tool.pl will always check the consistency
+ of all database upgrade scripts (e.g. circular references, invalid
+ formats, missing meta information). You can but don't have to specifiy
+ additional actions.
+
+ Actions:
+ --list Lists all database upgrade tags
+ --tree Lists all database upgrades in tree form
+ --rtree Lists all database upgrades in reverse tree form
+ --graphviz[=file] Create a Postscript document showing a tree of
+ all database upgrades and their dependencies.
+ If no file name is given then the output is
+ written to 'db_dependencies.ps'.
+ --nodeps List all database upgrades that no other upgrade
+ depends on
+ --apply=tag Applies the database upgrades 'tag' and all
+ upgrades it depends on. If '--apply' is used
+ then the option '--user' must be used as well.
+ --help Show this help and exit.
+
+ Options:
+ --user=name The name of the user configuration to use for
+ database connectivity.
+END_HELP
+ ;
+
+ # Syntax-Highlighting-Fix für Emacs: '
+
+ print $help_text;
+
+ exit 0;
+}
+
+sub error {
}
sub calc_rev_depends {
}
sub dump_graphviz {
+ my $file_name = shift || "db_dependencies.ps";
+
print("GRAPHVIZ POSTCRIPT\n\n");
- print("Output will be written to db_dependencies.ps\n");
+ print("Output will be written to '${file_name}'\n");
+
+ calc_rev_depends();
+
$dot = "|dot -Tps ";
- open(OUT, "${dot}> db_dependencies.ps");
+ open OUT, "${dot}> \"${file_name}\"" || die;
+
print(OUT
"digraph db_dependencies {\n" .
- "node [shape=box];\n");
+ "node [shape=box style=filled fillcolor=white];\n");
my %ranks;
foreach my $c (values(%{$controls})) {
- $ranks{$c->{"depth"}} = [] unless ($ranks{$c->{"depth"}});
- push(@{$ranks{$c->{"depth"}}}, $c->{"tag"});
+ $ranks{$c->{"depth"}} ||= [];
+
+ my ($pre, $post) = ('node [fillcolor=lightgray] ', 'node [fillcolor=white] ') if !@{ $c->{"rev_depends"} };
+
+ push @{ $ranks{$c->{"depth"}} }, qq|${pre}"$c->{tag}"; ${post}|;
}
foreach (sort(keys(%ranks))) {
- print(OUT "{ rank = same; " .
- join("", map({ '"' . $_ . '"; ' } @{$ranks{$_}})) .
- " }\n");
+ print OUT "{ rank = same; ", join("", @{ $ranks{$_} }), " }\n";
}
foreach my $c (values(%{$controls})) {
print(OUT "$c->{tag};\n");
"\n\n");
}
+sub apply_upgrade {
+ my $name = shift;
+
+ my (@order, %tags, @all_tags);
+
+ if ($name eq "ALL") {
+ calc_rev_depends();
+ @all_tags = map { $_->{"tag"} } grep { !@{$_->{"rev_depends"}} } values %{$controls};
+
+ } else {
+ $form->error("Unknown dbupgrade tag '$name'") if (!$controls->{$name});
+ @all_tags = ($name);
+ }
+
+ foreach my $tag (@all_tags) {
+ build_upgrade_order($tag, \@order, \%tags);
+ }
+
+ my @upgradescripts = map { $controls->{$_}->{"applied"} = 0; $controls->{$_} } @order;
+
+ my $dbh = $form->dbconnect_noauto(\%myconfig);
+
+ $dbh->{PrintWarn} = 0;
+ $dbh->{PrintError} = 0;
+
+ $user->create_schema_info_table($form, $dbh);
+
+ my $query = qq|SELECT tag FROM schema_info|;
+ $sth = $dbh->prepare($query);
+ $sth->execute() || $form->dberror($query);
+ while (($tag) = $sth->fetchrow_array()) {
+ $controls->{$tag}->{"applied"} = 1 if defined $controls->{$tag};
+ }
+ $sth->finish();
+
+ @upgradescripts = sort { $a->{"priority"} <=> $b->{"priority"} } grep { !$_->{"applied"} } @upgradescripts;
+ if (!@upgradescripts) {
+ print "The upgrade has already been applied.\n";
+ exit 0;
+ }
+
+ foreach my $control (@upgradescripts) {
+ $control->{"file"} =~ /\.(sql|pl)$/;
+ my $file_type = $1;
+
+ # apply upgrade
+ print "Applying upgrade $control->{file}\n";
+
+ if ($file_type eq "sql") {
+ $user->process_query($form, $dbh, "sql/$form->{dbdriver}-upgrade2/$control->{file}", $control);
+ } else {
+ $user->process_perl_script($form, $dbh, "sql/$form->{dbdriver}-upgrade2/$control->{file}", $control);
+ }
+ }
+
+ $dbh->disconnect();
+}
+
+sub build_upgrade_order {
+ my $name = shift;
+ my $order = shift;
+ my $tag = shift;
+
+ my $control = $controls->{$name};
+
+ foreach my $dependency (@{ $control->{"depends"} }) {
+ next if $tags->{$dependency};
+ $tags->{$dependency} = 1;
+ build_upgrade_order($dependency, $order, $tag);
+ }
+
+ push @{ $order }, $name;
+ $tags->{$name} = 1;
+}
+
#######
#######
#######
#######
#######
-my ($opt_list, $opt_tree, $opt_rtree, $opt_nodeps, $opt_graphviz, $opt_help);
-
GetOptions("list" => \$opt_list,
"tree" => \$opt_tree,
"rtree" => \$opt_rtree,
"nodeps" => \$opt_nodeps,
- "graphviz" => \$opt_graphviz,
+ "graphviz:s" => \$opt_graphviz,
+ "user=s" => \$opt_user,
+ "apply=s" => \$opt_apply,
"help" => \$opt_help,
);
if ($opt_help) {
show_help();
- exit(0);
}
$controls = parse_dbupdate_controls($form, "Pg");
dump_tree_reverse();
}
-if ($opt_graphviz) {
- dump_graphviz();
+if (defined $opt_graphviz) {
+ dump_graphviz($opt_graphviz);
}
if ($opt_nodeps) {
dump_nodeps();
}
+
+if ($opt_user) {
+ my $file_name = "users/${opt_user}.conf";
+
+ eval { require($file_name); };
+ $form->error("File '$file_name' was not found") if $@;
+ $locale = new Locale($myconfig{countrycode}, "all");
+ $user = new User("users/members", $opt_user);
+ map { $form->{$_} = $myconfig{$_} } keys %myconfig;
+}
+
+if ($opt_apply) {
+ $form->error("--apply used but no configuration file given with --user.") if (!$user);
+ apply_upgrade($opt_apply);
+}
#!/usr/bin/perl -w
-$| = 1;
-
-my @required_modules = (
- { "name" => "Class::Accessor", "url" => "http://search.cpan.org/~kasei/" },
- { "name" => "CGI", "url" => "http://search.cpan.org/~lds/" },
- { "name" => "CGI::Ajax", "url" => "http://search.cpan.org/~bct/" },
- { "name" => "DBI", "url" => "http://search.cpan.org/~timb/" },
- { "name" => "DBD::Pg", "url" => "http://search.cpan.org/~dbdpg/" },
- { "name" => "HTML::Template", "url" => "http://search.cpan.org/~samtregar/" },
- { "name" => "Archive::Zip", "url" => "http://search.cpan.org/~adamk/" },
- { "name" => "Text::Iconv", "url" => "http://search.cpan.org/~mpiotr/" },
- );
+BEGIN {
+ unshift @INC, "modules/YAML"; # Use our own version of YAML.
+ push @INC, "modules"; # Only use our own versions of modules if there's no system version.
+}
-sub module_available {
- my ($module) = @_;
+use SL::InstallationCheck;
- if (!defined(eval("require $module;"))) {
- return 0;
- } else {
- return 1;
- }
-}
+$| = 1;
-foreach my $module (@required_modules) {
+foreach my $module (@SL::InstallationCheck::required_modules) {
print("Looking for $module->{name}...");
- if (!module_available($module->{"name"})) {
+ if (!SL::InstallationCheck::module_available($module->{"name"})) {
print(" NOT found\n" .
" The module '$module->{name}' is not available on your system.\n" .
" Please install it with the CPAN shell, e.g.\n" .
- " perl -MCPAN -e install \"install $module->{name}\"\n" .
+ " perl -MCPAN -e \"install $module->{name}\"\n" .
" or download it from this URL and install it manually:\n" .
" $module->{url}\n\n");
} else {
+++ /dev/null
-#!/usr/bin/perl -l
-#
-$db = "Pg";
-$version = "0.2b";
-
-($name,$exec) = @ARGV;
-opendir SQLDIR, "sql/$db-upgrade" or die "Can't open sql dir";
-@ups = sort(cmp_script_version grep(/$db-upgrade-.*?\.(sql|pl)$/, readdir(SQLDIR)));
-closedir SQLDIR;
-$up = $ups[-1];
-$up =~ s/(.*de-)|(.sql$)|(.pl$)//g;
-($from, $to) = split /-/, $up;
-@next = split(/\./, $to);
-$newsub = (pop @next)+1;
-$next = join (".",@next).".".$newsub;
-
-$name =~ /\.([^\.]+)$/;
-$ext = $1;
-
-print qq|
-$db-upgrade Adder v$version
-
-USE: pgupadd [file] [!]
-
-Computes the next minor database version.
-If [file] is given, proposes a copy command to add this file to the upgrade dir.
-Use pgupadd [file] ! to let the adder copy and add it to svn for you (check the command first).
-
-Current highest upgrade: $up
-Proposed next version: $next
-Proposed name for upgrade: $db-upgrade-$to-$next.$ext |;
-
-$cmd = "cp $name sql/$db-upgrade/$db-upgrade-$to-$next.$ext; svn add sql/$db-upgrade/$db-upgrade-$to-$next.$ext;";
-print qq|Proposed copy/add command:
-
-$cmd
-| if $name;
-
-if ($name && !-f $name) {
- print qq|Warning! Given file does not exist!|;
- exit;
-}
-
-if ($name && -f "sql/$db-upgrade/$db-upgrade-$up.$ext" &&
- !`cmp $name sql/$db-upgrade/$db-upgrade-$up.$ext`) {
- print qq|Warning! Given file is identical to latest $db-upgrade!|;
- exit;
-}
-
-exec($cmd) if ($exec eq "!" and $name);
-
-
-# both functions stolen and slightly modified from SL/User.pm
-sub cmp_script_version {
- my ($a_from, $a_to, $b_from, $b_to);
- my ($i, $res_a, $res_b);
- my ($my_a, $my_b) = ($a, $b);
-
- $my_a =~ s/.*-upgrade-//;
- $my_a =~ s/.(sql|pl)$//;
- $my_b =~ s/.*-upgrade-//;
- $my_b =~ s/.(sql|pl)$//;
- ($my_a_from, $my_a_to) = split(/-/, $my_a);
- ($my_b_from, $my_b_to) = split(/-/, $my_b);
-
- $res_a = calc_version($my_a_from);
- $res_b = calc_version($my_b_from);
-
- if ($res_a == $res_b) {
- $res_a = calc_version($my_a_to);
- $res_b = calc_version($my_b_to);
- }
-
- return $res_a <=> $res_b;
-}
-sub calc_version {
- my $r = !(my @v = split(/\./, shift));
- map { $r = $r * 1000 + $v[$_] } 0..4;
- $r;
-}
#!/usr/bin/perl
+BEGIN {
+ unshift @INC, "modules/YAML"; # Use our own version of YAML.
+ push @INC, "modules"; # Only use our own versions of modules if there's no system version.
+}
+
use DBI;
use Data::Dumper;
$form = new Form;
$form->{"script"} = "oe.pl";
-$form->{"path"} = "bin/mozilla";
-
$ENV{'HOME'} = getcwd() . "/$userspath";
+++ /dev/null
--- Österreichischer Einheitskontenrahmen / Kontenplan (ÖSV Österreichischer Steuerverein)
---
-INSERT INTO gifi (accno, description) VALUES ('0', 'Anlagevermögen und Aufwendungen für das Ingangsetzen und Erweitern eines Betriebes');
---
-INSERT INTO gifi (accno, description) VALUES ('00', 'Aufwendungen für das Ingangsetzen und Erweitern eines Betriebes');
-INSERT INTO gifi (accno, description) VALUES ('001', 'Aufwendungen für das Ingangsetzen und Erweitern eines Betriebes');
-INSERT INTO gifi (accno, description) VALUES ('009', 'Kumulierte Abschreibungen');
---
-INSERT INTO gifi (accno, description) VALUES ('01', 'Immaterielle Vermögensgegenstände');
-INSERT INTO gifi (accno, description) VALUES ('010', 'Konzessionen');
-INSERT INTO gifi (accno, description) VALUES ('011', 'Patentrechte und Lizenzen');
-INSERT INTO gifi (accno, description) VALUES ('012', 'Datenverarbeitungsprogramme');
-INSERT INTO gifi (accno, description) VALUES ('013', 'Marken, Warenzeichen und Musterschutzrechte, sonstige Urheberrechte');
-INSERT INTO gifi (accno, description) VALUES ('014', 'Pacht- und Mietrechte');
-INSERT INTO gifi (accno, description) VALUES ('015', 'Geschäfts(Firmen)wert');
-INSERT INTO gifi (accno, description) VALUES ('018', 'Geleistete Anzahlungen');
-INSERT INTO gifi (accno, description) VALUES ('019', 'Kumulierte Abschreibungen');
---
-INSERT INTO gifi (accno, description) VALUES ('02-03', 'Grundstücke, grundstücksgleiche Rechte und Bauten, einschließlich der Bauten auf fremden Grund');
-INSERT INTO gifi (accno, description) VALUES ('020', 'Unbebaute Grundstücke');
-INSERT INTO gifi (accno, description) VALUES ('021', 'Bebaute Grundstücke (Grundwert)');
-INSERT INTO gifi (accno, description) VALUES ('022', 'Grundstücksgleiche Rechte');
-INSERT INTO gifi (accno, description) VALUES ('030', 'Betriebs- und Geschäftsgebäude auf eigenem Grund');
-INSERT INTO gifi (accno, description) VALUES ('031', 'Wohn- und Sozialgebäude auf eigenem Grund');
-INSERT INTO gifi (accno, description) VALUES ('032', 'Betriebs- und Geschäftsgebäude auf fremdem Grund');
-INSERT INTO gifi (accno, description) VALUES ('033', 'Wohn- und Sozialgebäude auf fremdem Grund');
-INSERT INTO gifi (accno, description) VALUES ('034', 'Grundstückseinrichtungen auf eigenem Grund');
-INSERT INTO gifi (accno, description) VALUES ('035', 'Grundstückseinrichtungen auf fremdem Grund');
-INSERT INTO gifi (accno, description) VALUES ('036', 'Bauliche Investitionen in fremden (gepachteten) Betriebs- und Geschäftsgebäuden');
-INSERT INTO gifi (accno, description) VALUES ('037', 'Bauliche Investitionen in fremden (gepachteten) Wohn- und Sozialgebäuden');
-INSERT INTO gifi (accno, description) VALUES ('039', 'Kumulierte Abschreibungen');
---
-INSERT INTO gifi (accno, description) VALUES ('04-05', 'Technische Anlagen und Maschinen');
-INSERT INTO gifi (accno, description) VALUES ('040', 'Fertigungsmaschinen');
-INSERT INTO gifi (accno, description) VALUES ('041', 'Antriebsmaschinen');
-INSERT INTO gifi (accno, description) VALUES ('042', 'Energieversorgungsanlagen');
-INSERT INTO gifi (accno, description) VALUES ('043', 'Transportanlagen');
-INSERT INTO gifi (accno, description) VALUES ('044-049', 'Sonstige Maschinen und maschinelle Anlagen');
-INSERT INTO gifi (accno, description) VALUES ('050', 'Maschinenwerkzeuge');
-INSERT INTO gifi (accno, description) VALUES ('051', 'Allgemeine Werkzeuge und Handwerkzeuge');
-INSERT INTO gifi (accno, description) VALUES ('052', 'Vorrichtungen, Formen und Modelle');
-INSERT INTO gifi (accno, description) VALUES ('053', 'Andere Erzeugungshilfsmittel');
-INSERT INTO gifi (accno, description) VALUES ('054', 'Hebezeuge und Montageanlagen');
-INSERT INTO gifi (accno, description) VALUES ('055', 'Geringwertige Vermögensgegenstände, soweit im Erzeugungsprozeß verwendet');
---
-INSERT INTO gifi (accno, description) VALUES ('06', 'Andere Anlagen, Betriebs- und Geschäftsausstattung');
-INSERT INTO gifi (accno, description) VALUES ('060', 'Beheizungs- und Beleuchtungsanlagen');
-INSERT INTO gifi (accno, description) VALUES ('061', 'Nachrichten- und Kontrollanlagen');
-INSERT INTO gifi (accno, description) VALUES ('062', 'Büromaschinen, EDV-Anlagen');
-INSERT INTO gifi (accno, description) VALUES ('063', 'PKW');
-INSERT INTO gifi (accno, description) VALUES ('064', 'LKW');
-INSERT INTO gifi (accno, description) VALUES ('065', 'Andere Beförderungsmittel');
-INSERT INTO gifi (accno, description) VALUES ('066', 'Andere Betriebs- und Geschäftsausstattung');
-INSERT INTO gifi (accno, description) VALUES ('067', 'Gebinde');
-INSERT INTO gifi (accno, description) VALUES ('068', 'Geringwertige Vermögensgegenstände, soweit nicht im Erzeugungsprozeß verwendet');
-INSERT INTO gifi (accno, description) VALUES ('069', 'Kumulierte Abschreibungen');
---
-INSERT INTO gifi (accno, description) VALUES ('07', 'Geleistete Anzahlungen und Anlagen in Bau');
-INSERT INTO gifi (accno, description) VALUES ('070', 'Geleistete Anzahlungen');
-INSERT INTO gifi (accno, description) VALUES ('071', 'Anlagen in Bau');
-INSERT INTO gifi (accno, description) VALUES ('079', 'Kumulierte Abschreibungen');
---
-INSERT INTO gifi (accno, description) VALUES ('08-09', 'Finanzanlagen');
-INSERT INTO gifi (accno, description) VALUES ('080', 'Anteile an verbundenen Unternehmen');
-INSERT INTO gifi (accno, description) VALUES ('081', 'Beteiligungen an Gemeinschaftsunternehmen');
-INSERT INTO gifi (accno, description) VALUES ('082', 'Beteiligungen an angeschlossenen (assoziierten) Unternehmen');
-INSERT INTO gifi (accno, description) VALUES ('083', 'Sonstige Beteiligungen');
-INSERT INTO gifi (accno, description) VALUES ('084', 'Ausleihungen an verbundene Unternehmen');
-INSERT INTO gifi (accno, description) VALUES ('085', 'Ausleihungen an Unternehmen, mit denen ein Beteiligungsverhältnis besteht');
-INSERT INTO gifi (accno, description) VALUES ('086', 'Sonstige Ausleihungen');
-INSERT INTO gifi (accno, description) VALUES ('087', 'Anteile an Kapitalgesellschaften ohne Beteiligungscharakter');
-INSERT INTO gifi (accno, description) VALUES ('088', 'Anteile an Personengesellschaften ohne Beteiligungscharakter');
-INSERT INTO gifi (accno, description) VALUES ('090', 'Genossenschaftsanteile ohne Beteiligungscharakter');
-INSERT INTO gifi (accno, description) VALUES ('091', 'Anteile an Investmentfonds');
-INSERT INTO gifi (accno, description) VALUES ('092-093', 'Festverzinsliche Wertpapiere des Anlagevermögens');
-INSERT INTO gifi (accno, description) VALUES ('094-097', 'Sonstige Finanzanlagen, Wertrechte');
-INSERT INTO gifi (accno, description) VALUES ('098', 'Geleistete Anzahlungen');
-INSERT INTO gifi (accno, description) VALUES ('099', 'Kumulierte Abschreibungen');
---
-INSERT INTO gifi (accno, description) VALUES ('1', 'Vorräte');
-INSERT INTO gifi (accno, description) VALUES ('100-109', 'Bezugsverrechnung');
-INSERT INTO gifi (accno, description) VALUES ('110-119', 'Rohstoffe');
-INSERT INTO gifi (accno, description) VALUES ('120-129', 'Bezogene Teile');
-INSERT INTO gifi (accno, description) VALUES ('130-134', 'Hilfsstoffe');
-INSERT INTO gifi (accno, description) VALUES ('135-139', 'Betriebsstoffe');
-INSERT INTO gifi (accno, description) VALUES ('140-149', 'Unfertige Erzeugnisse');
-INSERT INTO gifi (accno, description) VALUES ('150-159', 'Fertige Erzeugnisse');
-INSERT INTO gifi (accno, description) VALUES ('160-169', 'Waren');
-INSERT INTO gifi (accno, description) VALUES ('170-179', 'Noch nicht abrechenbare Leistungen');
-INSERT INTO gifi (accno, description) VALUES ('180', 'Geleistete Anzahlungen');
-INSERT INTO gifi (accno, description) VALUES ('190-199', 'Wertberichtigungen');
---
-INSERT INTO gifi (accno, description) VALUES ('2', 'Sonstiges Umlaufvermögen, Rechnungsabgrenzungsposten');
-INSERT INTO gifi (accno, description) VALUES ('20-21', 'Forderungen aus Lieferungen und Leistungen');
-INSERT INTO gifi (accno, description) VALUES ('200-207', 'Forderungen aus Lieferungen und Leistungen Inland');
-INSERT INTO gifi (accno, description) VALUES ('208', 'Einzelwertberichtigungen zu Forderungen aus Lieferungen und Leistungen Inland');
-INSERT INTO gifi (accno, description) VALUES ('209', 'Pauschalwertberichtigungen zu Forderungen aus Lieferungen und Leistungen Inland');
-INSERT INTO gifi (accno, description) VALUES ('210-212', 'Forderungen aus Lieferungen und Leistungen Währungsunion');
-INSERT INTO gifi (accno, description) VALUES ('213', 'Einzelwertberichtigungen zu Forderungen aus Lieferungen und Leistungen Währungsunion');
-INSERT INTO gifi (accno, description) VALUES ('214', 'Pauschalwertberichtigungen zu Forderungen aus Lieferungen und Leistungen Währungsunion');
-INSERT INTO gifi (accno, description) VALUES ('215-217', 'Forderungen aus Lieferungen und Leistungen sonstiges Ausland');
-INSERT INTO gifi (accno, description) VALUES ('218', 'Einzelwertberichtigungen zu Forderungen aus Lieferungen und Leistungen sonstiges Ausland');
-INSERT INTO gifi (accno, description) VALUES ('219', 'Pauschalwertberichtigungen zu Forderungen aus Lieferungen und Leistungen sonstiges Ausland');
---
-INSERT INTO gifi (accno, description) VALUES ('22', 'Forderungen gegenüber verbundenen Unternehmen und Unternehmen, mit denen ein Beteiligungsverhältnis besteht');
-INSERT INTO gifi (accno, description) VALUES ('220-222', 'Forderungen gegenüber verbundenen Unternehmen');
-INSERT INTO gifi (accno, description) VALUES ('223', 'Einzelwertberichtigungen zu Forderungen gegenüber verbundenen Unternehmen');
-INSERT INTO gifi (accno, description) VALUES ('224', 'Pauschalwertberichtigungen zu Forderungen gegenüber verbundenen Unternehmen');
-INSERT INTO gifi (accno, description) VALUES ('225-227', 'Forderungen gegenüber Unternehmen, mit denen ein Beteiligungsverhältnis besteht');
-INSERT INTO gifi (accno, description) VALUES ('228', 'Einzelwertberichtigungen zu Forderungen gegenüber Unternehmen, mit denen ein Beteiligungsverhältnis besteht');
-INSERT INTO gifi (accno, description) VALUES ('229', 'Pauschalwertberichtigungen zu Forderungen gegenüber Unternehmen, mit denen ein Beteiligungsverhältnis besteht');
---
-INSERT INTO gifi (accno, description) VALUES ('23-24', 'Sonstige Forderungen und Vermögensgegenstände');
-INSERT INTO gifi (accno, description) VALUES ('230-246', 'Sonstige Forderungen und Vermögensgegenstände');
-INSERT INTO gifi (accno, description) VALUES ('247', 'Eingeforderte, aber noch nicht eingezahlte Einlagen');
-INSERT INTO gifi (accno, description) VALUES ('248', 'Einzelwertberichtigungen zu sonstigen Forderungen und Vermögensgegenständen');
-INSERT INTO gifi (accno, description) VALUES ('249', 'Pauschalwertberichtigungen zu sonstigen Forderungen und Vermögensgegenständen');
---
-INSERT INTO gifi (accno, description) VALUES ('25', 'Forderungen aus der Abgabenverrechnung');
-INSERT INTO gifi (accno, description) VALUES ('250-259', 'Forderungen aus der Abgabenverrechnung');
---
-INSERT INTO gifi (accno, description) VALUES ('26', 'Wertpapiere und Anteile');
-INSERT INTO gifi (accno, description) VALUES ('260', 'Eigene Anteile');
-INSERT INTO gifi (accno, description) VALUES ('261', 'Anteile an verbundenen Unternehmen');
-INSERT INTO gifi (accno, description) VALUES ('262', 'Sonstige Anteile');
-INSERT INTO gifi (accno, description) VALUES ('263-267', 'Sonstige Wertpapiere');
-INSERT INTO gifi (accno, description) VALUES ('268', 'Besitzwechsel, soweit dem Unternehmen nicht die der Ausstellung zugrundeliegenden Forderungen zustehen');
-INSERT INTO gifi (accno, description) VALUES ('269', 'Wertberichtigungen');
---
-INSERT INTO gifi (accno, description) VALUES ('27-28', 'Kassenbestand, Schecks, Guthaben bei Kreditinstituten');
-INSERT INTO gifi (accno, description) VALUES ('270-272', 'Kassenbestände in Inlandswährung');
-INSERT INTO gifi (accno, description) VALUES ('273', 'Postwertzeichen');
-INSERT INTO gifi (accno, description) VALUES ('274', 'Stempelmarken');
-INSERT INTO gifi (accno, description) VALUES ('275-277', 'Kassenbestände in Fremdwährung');
-INSERT INTO gifi (accno, description) VALUES ('278', 'Schecks in Inlandswährung');
-INSERT INTO gifi (accno, description) VALUES ('280-288', 'Guthaben bei Kreditinstituten');
-INSERT INTO gifi (accno, description) VALUES ('289', 'Wertberichtigungen');
---
-INSERT INTO gifi (accno, description) VALUES ('29', 'Rechnungsabgrenzungsposten');
-INSERT INTO gifi (accno, description) VALUES ('290', 'Aktive Rechnungsabgrenzungsposten');
-INSERT INTO gifi (accno, description) VALUES ('295', 'Disagio');
-INSERT INTO gifi (accno, description) VALUES ('296', 'Unterschiedsbetrag zur gebotenen Pensionsrückstellung');
-INSERT INTO gifi (accno, description) VALUES ('297', 'Unterschiedsbetrag gem. Abschnitt XII Pensionskassengesetz');
-INSERT INTO gifi (accno, description) VALUES ('298', 'Steuerabgrenzung');
---
-INSERT INTO gifi (accno, description) VALUES ('3', 'Rückstellungen, Verbindlichkeiten und Rechnungsabgrenzungsposten');
---
-INSERT INTO gifi (accno, description) VALUES ('30', 'Rückstellungen');
-INSERT INTO gifi (accno, description) VALUES ('300', 'Rückstellungen für Abfertigungen');
-INSERT INTO gifi (accno, description) VALUES ('301', 'Rückstellungen für Pensionen');
-INSERT INTO gifi (accno, description) VALUES ('302-303', 'Steuerrückstellungen');
-INSERT INTO gifi (accno, description) VALUES ('304-309', 'Sonstige Rückstellungen');
---
-INSERT INTO gifi (accno, description) VALUES ('31', 'Anleihen, Verbindlichkeiten gegenüber Kreditinstituten und Finanzinstituten');
-INSERT INTO gifi (accno, description) VALUES ('310', 'Anleihen (einschließlich konvertibler)');
-INSERT INTO gifi (accno, description) VALUES ('311-317', 'Verbindlichkeiten gegenüber Kreditinstituten');
-INSERT INTO gifi (accno, description) VALUES ('318-319', 'Verbindlichkeiten gegenüber Finanzinstituten');
---
-INSERT INTO gifi (accno, description) VALUES ('32', 'Erhaltene Anzahlungen auf Bestellungen');
-INSERT INTO gifi (accno, description) VALUES ('320', 'Erhaltene Anzahlungen auf Bestellungen');
-INSERT INTO gifi (accno, description) VALUES ('321', 'Umsatzsteuer-Evidenzkonto für erhaltene Anzahlungen auf Bestellungen');
---
-INSERT INTO gifi (accno, description) VALUES ('33', 'Verbindlichkeiten aus Lieferungen und Leistungen, Verbindlichkeiten aus der Annahme gezogener und der Ausstellung eigener Wechsel');
-INSERT INTO gifi (accno, description) VALUES ('330-335', 'Verbindlichkeiten aus Lieferungen und Leistungen Inland');
-INSERT INTO gifi (accno, description) VALUES ('336', 'Verbindlichkeiten aus Lieferungen und Leistungen Währungsunion');
-INSERT INTO gifi (accno, description) VALUES ('337', 'Verbindlichkeiten aus Lieferungen und Leistungen sonstiges Ausland');
-INSERT INTO gifi (accno, description) VALUES ('338-339', 'Verbindlichkeiten aus der Annahme gezogener Wechsel und der Ausstellung eigener Wechsel');
---
-INSERT INTO gifi (accno, description) VALUES ('34', 'Verbindlichkeiten gegenüber verbundenen Unternehmen, gegenüber Unternehmen, mit denen ein Beteiligungsverhältnis besteht und gegenüber Gesellschaftern');
-INSERT INTO gifi (accno, description) VALUES ('340-347', 'Verbindlichkeiten gegenüber verbundenen Unternehmen, Verbindlichkeiten gegenüber Unternehmen, mit denen ein Beteiligungsverhältnis besteht');
-INSERT INTO gifi (accno, description) VALUES ('348', 'Verbindlichkeiten gegenüber Gesellschaftern');
---
-INSERT INTO gifi (accno, description) VALUES ('35', 'Verbindlichkeiten aus Steuern');
-INSERT INTO gifi (accno, description) VALUES ('350-359', 'Verbindlichkeiten aus Steuern');
---
-INSERT INTO gifi (accno, description) VALUES ('36', 'Verbindlichkeiten im Rahmen der sozialen Sicherheit');
-INSERT INTO gifi (accno, description) VALUES ('360-369', 'Verbindlichkeiten im Rahmen der sozialen Sicherheit');
---
-INSERT INTO gifi (accno, description) VALUES ('37-38', 'Übrige sonstige Verbindlichkeiten');
-INSERT INTO gifi (accno, description) VALUES ('370-389', 'Übrige sonstige Verbindlichkeiten');
---
-INSERT INTO gifi (accno, description) VALUES ('39', 'Rechnungsabgrenzungsposten');
-INSERT INTO gifi (accno, description) VALUES ('390-399', 'Passive Rechnungsabgrenzungsposten');
---
-INSERT INTO gifi (accno, description) VALUES ('4', 'Betriebliche Erträge');
---
-INSERT INTO gifi (accno, description) VALUES ('40-44', 'Brutto-Umsatzerlöse und Erlösschmälerungen');
-INSERT INTO gifi (accno, description) VALUES ('400-439', 'Brutto-Umsatzerlöse');
-INSERT INTO gifi (accno, description) VALUES ('440-449', 'Erlösschmälerungen');
---
-INSERT INTO gifi (accno, description) VALUES ('45', 'Bestandsveränderungen und aktivierte Eigenleistungen');
-INSERT INTO gifi (accno, description) VALUES ('450-457', 'Veränderungen des Bestandes an fertigen und unfertigen Erzeugnissen sowie an noch nicht abrechenbaren Leistungen');
-INSERT INTO gifi (accno, description) VALUES ('458-459', 'andere aktivierte Eigenleistungen');
---
-INSERT INTO gifi (accno, description) VALUES ('46-49', 'Sonstige betriebliche Erträge');
-INSERT INTO gifi (accno, description) VALUES ('460-462', 'Erlöse aus dem Abgang vom Anlagevermögen, ausgenommen Finanzanlagen');
-INSERT INTO gifi (accno, description) VALUES ('463-465', 'Erträge aus dem Abgang vom Anlagevermögen, ausgenommen Finanzanlagen');
-INSERT INTO gifi (accno, description) VALUES ('466-467', 'Erträge aus der Zuschreibung zum Anlagevermögen, ausgenommen Finanzanlagen');
-INSERT INTO gifi (accno, description) VALUES ('470-479', 'Erträge aus der Auflösung von Rückstellungen');
-INSERT INTO gifi (accno, description) VALUES ('480-499', 'Übrige betriebliche Erträge');
---
-INSERT INTO gifi (accno, description) VALUES ('5', 'Materialaufwand und sonstige bezogene Herstellungsleistungen');
-INSERT INTO gifi (accno, description) VALUES ('500-509', 'Wareneinsatz');
-INSERT INTO gifi (accno, description) VALUES ('510-519', 'Verbrauch von Rohstoffen');
-INSERT INTO gifi (accno, description) VALUES ('520-529', 'Verbrauch von bezogenen Fertig- und Einzelteilen');
-INSERT INTO gifi (accno, description) VALUES ('530-539', 'Verbrauch von Hilfsstoffen');
-INSERT INTO gifi (accno, description) VALUES ('540-549', 'Verbrauch von Betriebsstoffen');
-INSERT INTO gifi (accno, description) VALUES ('550-559', 'Verbrauch von Werkzeugen und anderen Erzeugungshilfsmitteln');
-INSERT INTO gifi (accno, description) VALUES ('560-569', 'Verbrauch von Brenn- und Treibstoffen, Energie und Wasser');
-INSERT INTO gifi (accno, description) VALUES ('570-579', 'Sonstige bezogene Herstellungsleistungen');
-INSERT INTO gifi (accno, description) VALUES ('580', 'Skontoerträge auf Materialaufwand');
-INSERT INTO gifi (accno, description) VALUES ('581', 'Skontoerträge auf sonstige bezogene Herstellungsleistungen');
-INSERT INTO gifi (accno, description) VALUES ('590', 'Aufwandsstellenrechnung');
---
-INSERT INTO gifi (accno, description) VALUES ('6', 'Personalaufwand');
-INSERT INTO gifi (accno, description) VALUES ('600-619', 'Löhne');
-INSERT INTO gifi (accno, description) VALUES ('620-639', 'Gehälter');
-INSERT INTO gifi (accno, description) VALUES ('640-644', 'Aufwendungen für Abfertigungen');
-INSERT INTO gifi (accno, description) VALUES ('645-649', 'Aufwendungen für Altersversorgung');
-INSERT INTO gifi (accno, description) VALUES ('650-655', 'Gesetzlicher Sozialaufwand Arbeiter');
-INSERT INTO gifi (accno, description) VALUES ('656-659', 'Gesetzlicher Sozialaufwand Angestellte');
-INSERT INTO gifi (accno, description) VALUES ('660-665', 'Lohnabhängige Abgaben und Pflichtbeiträge');
-INSERT INTO gifi (accno, description) VALUES ('666-669', 'Gehaltsabhängige Abgaben und Pflichtbeiträge');
-INSERT INTO gifi (accno, description) VALUES ('670-689', 'Sonstige Sozialaufwendungen');
-INSERT INTO gifi (accno, description) VALUES ('690', 'Aufwandsstellenrechnung');
---
-INSERT INTO gifi (accno, description) VALUES ('7', 'Abschreibungen und sonstige betriebliche Aufwendunge');
---
-INSERT INTO gifi (accno, description) VALUES ('70', 'Abschreibungen');
-INSERT INTO gifi (accno, description) VALUES ('700', 'Abschreibungen auf aktivierte Aufwendungen für das Ingangsetzen und Erweitern eines Betriebes');
-INSERT INTO gifi (accno, description) VALUES ('701-708', 'Abschreibungen auf das Anlagevermögen (ausgenommen Finanzanlagen)');
-INSERT INTO gifi (accno, description) VALUES ('709', 'Abschreibungen vom Umlaufvermögen, soweit diese die im Unternehmen üblichen Abschreibungen übersteigen');
---
-INSERT INTO gifi (accno, description) VALUES ('71', 'Sonstige Steuern');
-INSERT INTO gifi (accno, description) VALUES ('710-719', 'Sonstige Steuern');
---
-INSERT INTO gifi (accno, description) VALUES ('72-78', 'Übrige betriebliche Aufwendungen');
---
-INSERT INTO gifi (accno, description) VALUES ('72', 'Instandhaltung und Reinigung durch Dritte, Entsorgung, Beleuchtung');
-INSERT INTO gifi (accno, description) VALUES ('720-729', 'Instandhaltung und Reinigung durch Dritte, Entsorgung, Beleuchtung');
---
-INSERT INTO gifi (accno, description) VALUES ('73', 'Transport-, Reise- und Fahrtaufwand, Nachrichtenaufwand');
-INSERT INTO gifi (accno, description) VALUES ('730-731', 'Transporte durch Dritte');
-INSERT INTO gifi (accno, description) VALUES ('732-733', 'Kfz-Aufwand');
-INSERT INTO gifi (accno, description) VALUES ('734-735', 'Reise- und Fahrtaufwand');
-INSERT INTO gifi (accno, description) VALUES ('736-737', 'Tag- und Nächtigungsgelder');
-INSERT INTO gifi (accno, description) VALUES ('738-739', 'Nachrichtenaufwand');
---
-INSERT INTO gifi (accno, description) VALUES ('74', 'Miet-, Pacht-, Leasing- und Lizenzaufwand');
-INSERT INTO gifi (accno, description) VALUES ('740-743', 'Miet- und Pachtaufwand');
-INSERT INTO gifi (accno, description) VALUES ('744-747', 'Leasingaufwand');
-INSERT INTO gifi (accno, description) VALUES ('748-749', 'Lizenzaufwand');
---
-INSERT INTO gifi (accno, description) VALUES ('75', 'Aufwand für beigestelltes Personal, Provisionen an Dritte, Aufsichtsratsvergütungen');
-INSERT INTO gifi (accno, description) VALUES ('750-753', 'Aufwand für beigestelltes Personal');
-INSERT INTO gifi (accno, description) VALUES ('754-757', 'Provisionen an Dritte');
-INSERT INTO gifi (accno, description) VALUES ('758-759', 'Aufsichtsratsvergütungen');
---
-INSERT INTO gifi (accno, description) VALUES ('76', 'Büro-, Werbe- und Repräsentationsaufwand');
-INSERT INTO gifi (accno, description) VALUES ('760', 'Büromaterial und Drucksorten');
-INSERT INTO gifi (accno, description) VALUES ('761-762', 'Druckerzeugnisse und Vervielfältigungen');
-INSERT INTO gifi (accno, description) VALUES ('763', 'Fachliteratur und Zeitungen');
-INSERT INTO gifi (accno, description) VALUES ('765-768', 'Werbung und Repräsentation');
-INSERT INTO gifi (accno, description) VALUES ('769', 'Spenden und Trinkgelder');
---
-INSERT INTO gifi (accno, description) VALUES ('77-78', 'Versicherungen, Übrige Aufwendungen');
-INSERT INTO gifi (accno, description) VALUES ('770-774', 'Versicherungen');
-INSERT INTO gifi (accno, description) VALUES ('775-776', 'Beratungs- und Prüfungsaufwand');
-INSERT INTO gifi (accno, description) VALUES ('777', 'Aus- und Fortbildung');
-INSERT INTO gifi (accno, description) VALUES ('778', 'Mitgliedsbeiträge');
-INSERT INTO gifi (accno, description) VALUES ('779', 'Spesen des Geldverkehrs');
-INSERT INTO gifi (accno, description) VALUES ('780-781', 'Schadensfälle');
-INSERT INTO gifi (accno, description) VALUES ('782', 'Buchwert abgegangener Anlagen, ausgenommen Finanzanlagen');
-INSERT INTO gifi (accno, description) VALUES ('783', 'Verluste aus dem Abgang vom Anlagevermögen, ausgenommen Finanzanlagen');
-INSERT INTO gifi (accno, description) VALUES ('784-788', 'Verschiedene betriebliche Aufwendungen');
-INSERT INTO gifi (accno, description) VALUES ('789', 'Skontoerträge auf sonstige betriebliche Aufwendungen');
---
-INSERT INTO gifi (accno, description) VALUES ('79', 'Konten für das Umsatzkostenverfahren');
-INSERT INTO gifi (accno, description) VALUES ('790', 'Aufwandsstellenrechnung');
-INSERT INTO gifi (accno, description) VALUES ('791-799', 'Aufwandsstellen im Rahmen des Umsatzkostenverfahrens');
-INSERT INTO gifi (accno, description) VALUES ('791-795', 'Aufwandsstellen der Herstellung');
-INSERT INTO gifi (accno, description) VALUES ('796', 'Herstellungskosten der zur Erzielung der Umsatzerlöse erbrachten Leistungen');
-INSERT INTO gifi (accno, description) VALUES ('797', 'Vertriebskosten');
-INSERT INTO gifi (accno, description) VALUES ('798', 'Verwaltungskosten');
-INSERT INTO gifi (accno, description) VALUES ('799', 'Sonstige betriebliche Aufwendungen');
---
-INSERT INTO gifi (accno, description) VALUES ('8', 'Finanzerträge und Finanzaufwendungen, a.o. Erträge und a.o. Aufwendungen, Steuern vom Einkommen und vom Ertrag, Rücklagenbewegung');
---
-INSERT INTO gifi (accno, description) VALUES ('80-83', 'Finanzerträge und Finanzaufwendungen');
-INSERT INTO gifi (accno, description) VALUES ('800-804', 'Erträge aus Beteiligungen');
-INSERT INTO gifi (accno, description) VALUES ('805-809', 'Erträge aus anderen Wertpapieren und Ausleihungen des Finanzanlagevermögens');
-INSERT INTO gifi (accno, description) VALUES ('810-813', 'Sonstige Zinsen und ähnliche Erträge');
-INSERT INTO gifi (accno, description) VALUES ('814', 'Erlöse aus dem Abgang von Beteiligungen');
-INSERT INTO gifi (accno, description) VALUES ('815', 'Erlöse aus dem Abgang von sonstigen Finanzanlagen');
-INSERT INTO gifi (accno, description) VALUES ('816', 'Erlöse aus dem Abgang von Wertpapieren des Umlaufvermögens');
-INSERT INTO gifi (accno, description) VALUES ('817', 'Buchwert abgegangener Beteiligungen');
-INSERT INTO gifi (accno, description) VALUES ('818', 'Buchwert abgegangener sonstiger Finanzanlagen');
-INSERT INTO gifi (accno, description) VALUES ('819', 'Buchwert abgegangener Wertpapiere des Umlaufvermögens');
-INSERT INTO gifi (accno, description) VALUES ('820', 'Erträge aus dem Abgang von und der Zuschreibung zu Finanzanlagen');
-INSERT INTO gifi (accno, description) VALUES ('821', 'Erträge aus dem Abgang von und der Zuschreibung zu Wertpapieren des Umlaufvermögens');
-INSERT INTO gifi (accno, description) VALUES ('822-825', 'Aufwendungen aus Beteiligungen');
-INSERT INTO gifi (accno, description) VALUES ('826-827', 'Aufwendungen aus sonstigen Finanzanlagen und aus Wertpapieren des Umlaufvermögens');
-INSERT INTO gifi (accno, description) VALUES ('828-834', 'Zinsen und ähnliche Aufwendungen');
-INSERT INTO gifi (accno, description) VALUES ('835', 'Nicht ausgenützte Lieferantenskonti');
---
-INSERT INTO gifi (accno, description) VALUES ('84', 'Außerordentliche Erträge und außerordentliche Aufwendungen');
-INSERT INTO gifi (accno, description) VALUES ('840-844', 'Außerordentliche Erträge');
-INSERT INTO gifi (accno, description) VALUES ('845-849', 'Außerordentliche Aufwendungen');
---
-INSERT INTO gifi (accno, description) VALUES ('85', 'Steuern vom Einkommen und vom Ertrag');
-INSERT INTO gifi (accno, description) VALUES ('850-859', 'Steuern vom Einkommen und vom Ertrag');
---
-INSERT INTO gifi (accno, description) VALUES ('86-89', 'Rücklagenbewegung, Ergebnisüberrechnung');
-INSERT INTO gifi (accno, description) VALUES ('860-869', 'Auflösung unversteuerter Rücklagen');
-INSERT INTO gifi (accno, description) VALUES ('870-874', 'Auflösung von Kapitalrücklagen');
-INSERT INTO gifi (accno, description) VALUES ('875-879', 'Auflösung von Gewinnrücklagen');
-INSERT INTO gifi (accno, description) VALUES ('880-889', 'Zuweisung zu unversteuerten Rücklagen');
-INSERT INTO gifi (accno, description) VALUES ('890-895', 'Zuweisung zu Gewinnrücklagen');
-INSERT INTO gifi (accno, description) VALUES ('899', 'Gewinnabfuhr bzw. Verlustüberrechnung aus Ergebnisabführungsverträgen');
---
-INSERT INTO gifi (accno, description) VALUES ('9', 'Eigenkapital, unversteuerte Rücklagen, Einlagen Stiller Gesellschafter, Abschluß- und Evidenzkonten');
---
-INSERT INTO gifi (accno, description) VALUES ('900-918', 'Gezeichnetes bzw. gewidmetes Kapital');
-INSERT INTO gifi (accno, description) VALUES ('919', 'Nicht eingeforderte ausstehende Einlagen');
-INSERT INTO gifi (accno, description) VALUES ('920-929', 'Kapitalrücklagen');
-INSERT INTO gifi (accno, description) VALUES ('930-938', 'Gewinnrücklagen');
-INSERT INTO gifi (accno, description) VALUES ('939', 'Bilanzgewinn (-verlust)');
-INSERT INTO gifi (accno, description) VALUES ('940-959', 'Bewertungsreserven und sonstige unversteuerte Rücklagen');
-INSERT INTO gifi (accno, description) VALUES ('960-969', 'Privat- und Verrechnungskonten bei Einzelunternehmen und Personengesellschaften');
-INSERT INTO gifi (accno, description) VALUES ('970-979', 'Einlagen Stiller Gesellschafter');
-INSERT INTO gifi (accno, description) VALUES ('980', 'Eröffnungsbilanz');
-INSERT INTO gifi (accno, description) VALUES ('985', 'Schlußbilanz');
-INSERT INTO gifi (accno, description) VALUES ('989', 'Gewinn- und Verlustrechnung');
-INSERT INTO gifi (accno, description) VALUES ('990-999', 'Evidenzkonten');
+++ /dev/null
--- contribué par Jens-Ingo Brodesser, jens-ingo@all2all.org, Moving Art Studio ASBL, ALL2ALL The Independent Network
--- le 15/07/2003
-
-INSERT INTO "gifi" ("accno","description") VALUES ('10','Capital');
-INSERT INTO "gifi" ("accno","description") VALUES ('30','Approvisionnements - Matières premières');
-INSERT INTO "gifi" ("accno","description") VALUES ('11','Primes d''émission');
-INSERT INTO "gifi" ("accno","description") VALUES ('12','Plus-values de réévaluation');
-INSERT INTO "gifi" ("accno","description") VALUES ('13','Réserves');
-INSERT INTO "gifi" ("accno","description") VALUES ('14','Bénéfice reporté [ou Perte reportée (-)]');
-INSERT INTO "gifi" ("accno","description") VALUES ('15','Subsides en capital');
-INSERT INTO "gifi" ("accno","description") VALUES ('16','Provisions pour risques et charges et impôts différés');
-INSERT INTO "gifi" ("accno","description") VALUES ('17','Dettes à plus d''un an');
-INSERT INTO "gifi" ("accno","description") VALUES ('40','Créances commerciales');
-INSERT INTO "gifi" ("accno","description") VALUES ('20','Frais d''établissement');
-INSERT INTO "gifi" ("accno","description") VALUES ('21','Immobilisations incorporelles');
-INSERT INTO "gifi" ("accno","description") VALUES ('22','Terrains et constructions');
-INSERT INTO "gifi" ("accno","description") VALUES ('23','Installations, machines et outillage');
-INSERT INTO "gifi" ("accno","description") VALUES ('24','Mobilier et matériel roulant');
-INSERT INTO "gifi" ("accno","description") VALUES ('25','Immobilisations détenues en location-finac. et droits similaires');
-INSERT INTO "gifi" ("accno","description") VALUES ('31','Approvis. - Fournitures');
-INSERT INTO "gifi" ("accno","description") VALUES ('27','Autres immobilisations corporelles en cours et acompts versés');
-INSERT INTO "gifi" ("accno","description") VALUES ('26','Autres immobilisations corporelles');
-INSERT INTO "gifi" ("accno","description") VALUES ('28','Immobilisations financières');
-INSERT INTO "gifi" ("accno","description") VALUES ('29','Créances à plus d''un an');
-INSERT INTO "gifi" ("accno","description") VALUES ('4115','TVA DUE TOTAL');
-INSERT INTO "gifi" ("accno","description") VALUES ('33','Produits finis');
-INSERT INTO "gifi" ("accno","description") VALUES ('32','Encours fabrication');
-INSERT INTO "gifi" ("accno","description") VALUES ('34','Marchandises');
-INSERT INTO "gifi" ("accno","description") VALUES ('35','Immeubles déstinés à la vente');
-INSERT INTO "gifi" ("accno","description") VALUES ('36','Acomptes s/achats stocks');
-INSERT INTO "gifi" ("accno","description") VALUES ('37','Commandes en cours d''exécution');
-INSERT INTO "gifi" ("accno","description") VALUES ('41','Autres créances');
-INSERT INTO "gifi" ("accno","description") VALUES ('42','Dettes à plus d''un an échéant dans l''année');
-INSERT INTO "gifi" ("accno","description") VALUES ('43','Dettes financières');
-INSERT INTO "gifi" ("accno","description") VALUES ('44','Dettes commerciales');
-INSERT INTO "gifi" ("accno","description") VALUES ('45','Dettes fiscales, salariales et sociales');
-INSERT INTO "gifi" ("accno","description") VALUES ('46','Acomptes réçus s/commandes');
-INSERT INTO "gifi" ("accno","description") VALUES ('48','Dettes diverses');
-INSERT INTO "gifi" ("accno","description") VALUES ('47','Dettes découlants de l''affectation du résultat');
-INSERT INTO "gifi" ("accno","description") VALUES ('49','Comptes de régularisation et comptes d''attente');
-INSERT INTO "gifi" ("accno","description") VALUES ('50','Actions propres');
-INSERT INTO "gifi" ("accno","description") VALUES ('51','Actions et parts');
-INSERT INTO "gifi" ("accno","description") VALUES ('52','Titres à revenu fixe');
-INSERT INTO "gifi" ("accno","description") VALUES ('53','Dépôts à terme');
-INSERT INTO "gifi" ("accno","description") VALUES ('54','Valeurs échues à l''encaissement');
-INSERT INTO "gifi" ("accno","description") VALUES ('55','Etablissements de crédit');
-INSERT INTO "gifi" ("accno","description") VALUES ('56','Office des chèques postaux');
-INSERT INTO "gifi" ("accno","description") VALUES ('57','Caisses');
-INSERT INTO "gifi" ("accno","description") VALUES ('58','Virements internes');
-INSERT INTO "gifi" ("accno","description") VALUES ('60','Approvis. et marchandises');
-INSERT INTO "gifi" ("accno","description") VALUES ('61','Services et biens divers');
-INSERT INTO "gifi" ("accno","description") VALUES ('62','Rémunérations, charges sociales, pensions');
-INSERT INTO "gifi" ("accno","description") VALUES ('63','Amortissements, réductions valeur, provisions risques et charges');
-INSERT INTO "gifi" ("accno","description") VALUES ('64','Autres charges d''exploitation');
-INSERT INTO "gifi" ("accno","description") VALUES ('65','Charges financières');
-INSERT INTO "gifi" ("accno","description") VALUES ('66','Charges exceptionnelles');
-INSERT INTO "gifi" ("accno","description") VALUES ('67','Impôts sur le résultat');
-INSERT INTO "gifi" ("accno","description") VALUES ('68','Transferts aux réserves immunisées et aux impôts différés');
-INSERT INTO "gifi" ("accno","description") VALUES ('69','Affectations et prélèvements');
-INSERT INTO "gifi" ("accno","description") VALUES ('70','Chiffre d''affaires');
-INSERT INTO "gifi" ("accno","description") VALUES ('71','Variation de stock et des commandes en cours d''éxécution');
-INSERT INTO "gifi" ("accno","description") VALUES ('72','Production immobilisée');
-INSERT INTO "gifi" ("accno","description") VALUES ('74','Autres produits d''exploitation');
-INSERT INTO "gifi" ("accno","description") VALUES ('75','Produits financiers');
-INSERT INTO "gifi" ("accno","description") VALUES ('76','Produits exceptionnels');
-INSERT INTO "gifi" ("accno","description") VALUES ('77','Régularisations d''impôts et reprises provisions fiscales');
-INSERT INTO "gifi" ("accno","description") VALUES ('78','Prélèvements s/réserves immunisées et impôts différés');
-INSERT INTO "gifi" ("accno","description") VALUES ('79','Affectations et prélèvements');
+++ /dev/null
--- GIFI codes as set by the Canadian Government
--- It's a dirty job, but it seems somebody allready did it
--- PDF Tammes, Tue , 02 Apr 2002
--- remarks or questions to finance@bermuda-holding.com
---
--- From the GIFI documentation:
---
--- The GIFI information has to balance. We use the following rules to verify the information you provide.
--- total assets = total liabilities + total shareholder equity
--- total revenue - total expenses = net non-farming income
--- total farm revenue - total farm expenses = net farm income
---
--- You have to provide certain line items so that we can verify the above equations. Each GIFI must include:
--- balance sheet
--- Item 2599 Total assets
--- Item 3499 Total liabilities
--- Item 3620 Total shareholder equity
--- non-farming income and expenses
--- Item 8299 Total revenue
--- Item 9368 Total expenses
--- and/or
--- farming income and expenses
--- Item 9659 Total farm revenue
--- Item 9898 Total farm expenses
--- when reporting a breakdown of retained earnings
--- Item 3849 Retained earnings/deficit end
--- extraordinary items and income taxes
--- Item 9999 Net income/loss after taxes and extraordinary items
--- If the amount of a required item is NIL, you have to enter 0.
---
-INSERT INTO gifi (accno,description) VALUES ('1000', 'Cash & Deposits');
-INSERT INTO gifi (accno,description) VALUES ('1001', 'Cash');
-INSERT INTO gifi (accno,description) VALUES ('1002', 'Deposits In Canadian Banks And Institutions - Canadian Currency');
-INSERT INTO gifi (accno,description) VALUES ('1003', 'Deposits In Canadian Banks And Institutions - Foreign Currency');
-INSERT INTO gifi (accno,description) VALUES ('1004', 'Deposits In Foreign Banks - Canadian Currency');
-INSERT INTO gifi (accno,description) VALUES ('1005', 'Deposits In Foreign Banks - Foreign Currency');
-INSERT INTO gifi (accno,description) VALUES ('1006', 'Credit Union Central Deposits');
-INSERT INTO gifi (accno,description) VALUES ('1007', 'Other Cash Like Instruments - Gold Bullion, Silver Bullion');
-INSERT INTO gifi (accno,description) VALUES ('1060', 'Accounts Receivable');
-INSERT INTO gifi (accno,description) VALUES ('1061', 'Allowance For Doubtfull Accounts Receivable');
-INSERT INTO gifi (accno,description) VALUES ('1062', 'Trade Accounts Receivable');
-INSERT INTO gifi (accno,description) VALUES ('1063', 'Allowance For Doubtfull Trade Accounts Receivable');
-INSERT INTO gifi (accno,description) VALUES ('1064', 'Trade Accounts Receivable Related Parties');
-INSERT INTO gifi (accno,description) VALUES ('1065', 'Allowance For Doubtfull Trade Accounts Receivable Related Parties');
-INSERT INTO gifi (accno,description) VALUES ('1066', 'Taxes Receivable');
-INSERT INTO gifi (accno,description) VALUES ('1067', 'Intrest Receivable');
-INSERT INTO gifi (accno,description) VALUES ('1068', 'Holdbacks Receivable');
-INSERT INTO gifi (accno,description) VALUES ('1069', 'Leases Receivable');
-INSERT INTO gifi (accno,description) VALUES ('1070', 'Allowance For Doubtfull Leases Receivable');
-INSERT INTO gifi (accno,description) VALUES ('1071', 'Accounts Receivable Employees');
-INSERT INTO gifi (accno,description) VALUES ('1072', 'Allowance For Doubtfull Accounts Receivable Employees');
-INSERT INTO gifi (accno,description) VALUES ('1073', 'Accounts Receivable From Members Of NPO');
-INSERT INTO gifi (accno,description) VALUES ('1120', 'Inventories');
-INSERT INTO gifi (accno,description) VALUES ('1121', 'Inventory Of Goods For Sale/Finished Goods');
-INSERT INTO gifi (accno,description) VALUES ('1122', 'Inventory Of Parts And Supplies');
-INSERT INTO gifi (accno,description) VALUES ('1125', 'Work In Progress');
-INSERT INTO gifi (accno,description) VALUES ('1126', 'Raw Materials');
-INSERT INTO gifi (accno,description) VALUES ('1180', 'Short Term Investments');
-INSERT INTO gifi (accno,description) VALUES ('1181', 'Canadian Term Deposits');
-INSERT INTO gifi (accno,description) VALUES ('1182', 'Canadian Shares');
-INSERT INTO gifi (accno,description) VALUES ('1183', 'Canadian Bonds');
-INSERT INTO gifi (accno,description) VALUES ('1184', 'Canadian Treasury Bills');
-INSERT INTO gifi (accno,description) VALUES ('1185', 'Securities Purchased Under Resale Agreement');
-INSERT INTO gifi (accno,description) VALUES ('1186', 'Other Short Term Canadian Investments');
-INSERT INTO gifi (accno,description) VALUES ('1187', 'Short Term Foreign Investments');
-INSERT INTO gifi (accno,description) VALUES ('1240', 'Loans & Notes Receivable');
-INSERT INTO gifi (accno,description) VALUES ('1241', 'Demand Loans Receivable');
-INSERT INTO gifi (accno,description) VALUES ('1242', 'Other Loans Receivable');
-INSERT INTO gifi (accno,description) VALUES ('1243', 'Notes Receivable');
-INSERT INTO gifi (accno,description) VALUES ('1244', 'Mortgages Receivable');
-INSERT INTO gifi (accno,description) VALUES ('1300', 'Due From Shareholder(s)/Director(s)');
-INSERT INTO gifi (accno,description) VALUES ('1301', 'Due From Individual Shareholder(s)');
-INSERT INTO gifi (accno,description) VALUES ('1302', 'Due From Corporate Shareholder(s)');
-INSERT INTO gifi (accno,description) VALUES ('1303', 'Due From Director(s)');
-INSERT INTO gifi (accno,description) VALUES ('1360', 'Investment In Joint Venture(s)/Partnership(s)');
-INSERT INTO gifi (accno,description) VALUES ('1380', 'Due From Joint Venture(s)/Partnership(s)');
-INSERT INTO gifi (accno,description) VALUES ('1400', 'Due From/Investment In Related Parties');
-INSERT INTO gifi (accno,description) VALUES ('1401', 'Demand Notes From Related Parties');
-INSERT INTO gifi (accno,description) VALUES ('1402', 'Interest Receivable From Related Parties');
-INSERT INTO gifi (accno,description) VALUES ('1403', 'Loans/Advances Due From Related Parties');
-INSERT INTO gifi (accno,description) VALUES ('1480', 'Other Current Assets');
-INSERT INTO gifi (accno,description) VALUES ('1481', 'Deferred Income Taxes');
-INSERT INTO gifi (accno,description) VALUES ('1482', 'Accrued Investment Income');
-INSERT INTO gifi (accno,description) VALUES ('1483', 'Taxes Recoverable/Refundable');
-INSERT INTO gifi (accno,description) VALUES ('1484', 'Prepaid Expenses');
-INSERT INTO gifi (accno,description) VALUES ('1485', 'Drilling Advances');
-INSERT INTO gifi (accno,description) VALUES ('1486', 'Security Deposits');
-INSERT INTO gifi (accno,description) VALUES ('1599', 'Total Current Assets');
-INSERT INTO gifi (accno,description) VALUES ('1600', 'Land');
-INSERT INTO gifi (accno,description) VALUES ('1601', 'Land Improvement');
-INSERT INTO gifi (accno,description) VALUES ('1602', 'Accumulated Amortization Of Land & Land Improvement');
-INSERT INTO gifi (accno,description) VALUES ('1620', 'Depletable Assets');
-INSERT INTO gifi (accno,description) VALUES ('1621', 'Accumulated Amortization Of Depletable Assets');
-INSERT INTO gifi (accno,description) VALUES ('1622', 'Petroleum & Natural Gas Properties');
-INSERT INTO gifi (accno,description) VALUES ('1623', 'Accumulated Amortization Of Petroleum & Natural Gas Properties');
-INSERT INTO gifi (accno,description) VALUES ('1624', 'Mining Properties');
-INSERT INTO gifi (accno,description) VALUES ('1625', 'Accumulated Amortization Of Mining Properties');
-INSERT INTO gifi (accno,description) VALUES ('1626', 'Deferred Exporation & Development charges');
-INSERT INTO gifi (accno,description) VALUES ('1627', 'Accumulated Amortization Of Petroleum & Deferred Exporation & Development charges');
-INSERT INTO gifi (accno,description) VALUES ('1628', 'Quarries');
-INSERT INTO gifi (accno,description) VALUES ('1629', 'Accumulated Amortization Of Quarries');
-INSERT INTO gifi (accno,description) VALUES ('1630', 'Gravel Pits');
-INSERT INTO gifi (accno,description) VALUES ('1631', 'Accumulated Amortization Of Gravel Pits');
-INSERT INTO gifi (accno,description) VALUES ('1632', 'Timber Limits');
-INSERT INTO gifi (accno,description) VALUES ('1633', 'Accumulated Amortization Of Timber Limits');
-INSERT INTO gifi (accno,description) VALUES ('1680', 'Buildings');
-INSERT INTO gifi (accno,description) VALUES ('1681', 'Accumulated Amortization Of Buildings');
-INSERT INTO gifi (accno,description) VALUES ('1682', 'Manufacturing And Processing Plant');
-INSERT INTO gifi (accno,description) VALUES ('1683', 'Accumulated Amortization Of Manufacturing and Processing Plant');
-INSERT INTO gifi (accno,description) VALUES ('1684', 'Buildings Under Construction');
-INSERT INTO gifi (accno,description) VALUES ('1740', 'Machinery, Equipment, furniture & fixtures');
-INSERT INTO gifi (accno,description) VALUES ('1741', 'Accumulated Amortization Of Machinery, Equipment, furniture & fixtures');
-INSERT INTO gifi (accno,description) VALUES ('1742', 'Motor Vehicles');
-INSERT INTO gifi (accno,description) VALUES ('1743', 'Accumulated Amortization Of Motor Vehicles');
-INSERT INTO gifi (accno,description) VALUES ('1744', 'Tools and Dies');
-INSERT INTO gifi (accno,description) VALUES ('1745', 'Accumulated Amortization Of Tools and Dies');
-INSERT INTO gifi (accno,description) VALUES ('1746', 'Construction & Excavating Equipment');
-INSERT INTO gifi (accno,description) VALUES ('1747', 'Accumulated Amortization Of Construction & Excavating Equipment');
-INSERT INTO gifi (accno,description) VALUES ('1748', 'Forestry & Logging Equipment');
-INSERT INTO gifi (accno,description) VALUES ('1749', 'Accumulated Amortization Of Forestry & Logging Equipment');
-INSERT INTO gifi (accno,description) VALUES ('1750', 'Fishing Gear & Nets');
-INSERT INTO gifi (accno,description) VALUES ('1751', 'Accumulated Amortization Of Fishing Gear & Nets');
-INSERT INTO gifi (accno,description) VALUES ('1752', 'Mining Equipment');
-INSERT INTO gifi (accno,description) VALUES ('1753', 'Accumulated Amortization Of Mining Equipment');
-INSERT INTO gifi (accno,description) VALUES ('1754', 'Oil & Gas Systems');
-INSERT INTO gifi (accno,description) VALUES ('1755', 'Accumulated Amortization Of Oil & Gas Systems');
-INSERT INTO gifi (accno,description) VALUES ('1756', 'Production Equipment for resource industries');
-INSERT INTO gifi (accno,description) VALUES ('1757', 'Accumulated Amortization Of Production Equipment for resource industries');
-INSERT INTO gifi (accno,description) VALUES ('1758', 'Production Equipment for other industries');
-INSERT INTO gifi (accno,description) VALUES ('1759', 'Accumulated Amortization Of Production Equipment for other industries');
-INSERT INTO gifi (accno,description) VALUES ('1760', 'Exploration Equipment');
-INSERT INTO gifi (accno,description) VALUES ('1761', 'Accumulated Amortization Of Exploration Equipment');
-INSERT INTO gifi (accno,description) VALUES ('1762', 'Shipping Equipment');
-INSERT INTO gifi (accno,description) VALUES ('1763', 'Accumulated Amortization Of Shipping Equipment');
-INSERT INTO gifi (accno,description) VALUES ('1764', 'Ships & Boats');
-INSERT INTO gifi (accno,description) VALUES ('1765', 'Accumulated Amortization Of Ships & Boats');
-INSERT INTO gifi (accno,description) VALUES ('1766', 'Aircraft');
-INSERT INTO gifi (accno,description) VALUES ('1767', 'Accumulated Amortization Of Aircraft');
-INSERT INTO gifi (accno,description) VALUES ('1768', 'Signs');
-INSERT INTO gifi (accno,description) VALUES ('1769', 'Accumulated Amortization Of Signs');
-INSERT INTO gifi (accno,description) VALUES ('1770', 'Small Tools');
-INSERT INTO gifi (accno,description) VALUES ('1771', 'Accumulated Amortization Of Small Tools');
-INSERT INTO gifi (accno,description) VALUES ('1772', 'Radio & Communication Equipment');
-INSERT INTO gifi (accno,description) VALUES ('1773', 'Accumulated Amortization Of Radio & Communication Equipment');
-INSERT INTO gifi (accno,description) VALUES ('1774', 'Computer Equipment/Software');
-INSERT INTO gifi (accno,description) VALUES ('1775', 'Accumulated Amortization Of Computer Equipment/software');
-INSERT INTO gifi (accno,description) VALUES ('1776', 'Musical Instruments');
-INSERT INTO gifi (accno,description) VALUES ('1777', 'Accumulated Amortization Of Musical Instruments');
-INSERT INTO gifi (accno,description) VALUES ('1778', 'Satellites');
-INSERT INTO gifi (accno,description) VALUES ('1779', 'Accumulated Amortization Of Satellites');
-INSERT INTO gifi (accno,description) VALUES ('1780', 'Earth Stations');
-INSERT INTO gifi (accno,description) VALUES ('1781', 'Accumulated Amortization Of Earth Stations');
-INSERT INTO gifi (accno,description) VALUES ('1782', 'Machinery & Equipment Under Construction');
-INSERT INTO gifi (accno,description) VALUES ('1783', 'Transportation Equipment');
-INSERT INTO gifi (accno,description) VALUES ('1784', 'Accumulated Amortization Of Transportation Equipment');
-INSERT INTO gifi (accno,description) VALUES ('1785', 'Other Machinery & Equipment');
-INSERT INTO gifi (accno,description) VALUES ('1786', 'Accumulated Amortization Of Other Machinery & Equipment');
-INSERT INTO gifi (accno,description) VALUES ('1787', 'Furniture & Fixtures');
-INSERT INTO gifi (accno,description) VALUES ('1788', 'Accumulated Amortization Of Furniture & Fixtures');
-INSERT INTO gifi (accno,description) VALUES ('1900', 'Other Tangible Capital Assets');
-INSERT INTO gifi (accno,description) VALUES ('1901', 'Accumulated Amortization Of Other Tangible Capital Assets');
-INSERT INTO gifi (accno,description) VALUES ('1902', 'Logging Roads');
-INSERT INTO gifi (accno,description) VALUES ('1903', 'Accumulated Amortization Of Logging Roads');
-INSERT INTO gifi (accno,description) VALUES ('1904', 'Asphalt & Parking Areas');
-INSERT INTO gifi (accno,description) VALUES ('1905', 'Accumulated Amortization Of Asphalt & Parking Areas');
-INSERT INTO gifi (accno,description) VALUES ('1906', 'Wharves, Docks & Marinas');
-INSERT INTO gifi (accno,description) VALUES ('1907', 'Accumulated Amortization Of Wharves, Docks & Marinas');
-INSERT INTO gifi (accno,description) VALUES ('1908', 'Fences');
-INSERT INTO gifi (accno,description) VALUES ('1909', 'Accumulated Amortization Of Fences');
-INSERT INTO gifi (accno,description) VALUES ('1910', 'Capital Leases - Buildings');
-INSERT INTO gifi (accno,description) VALUES ('1911', 'Accumulated Amortization Of Capital Leases - Buildings');
-INSERT INTO gifi (accno,description) VALUES ('1912', 'Capital Leases - Equipment');
-INSERT INTO gifi (accno,description) VALUES ('1913', 'Accumulated Amortization Of Capital Leases - Equipment');
-INSERT INTO gifi (accno,description) VALUES ('1914', 'Capital Leases - Vehicles');
-INSERT INTO gifi (accno,description) VALUES ('1915', 'Accumulated Amortization Of Capital Leases - Vehicles');
-INSERT INTO gifi (accno,description) VALUES ('1916', 'Capital Leases - Other');
-INSERT INTO gifi (accno,description) VALUES ('1917', 'Accumulated Amortization Of Capital Leases - Other');
-INSERT INTO gifi (accno,description) VALUES ('1918', 'Leasehold Improvements');
-INSERT INTO gifi (accno,description) VALUES ('1919', 'Accumulated Amortization Of Leasehold Improvements');
-INSERT INTO gifi (accno,description) VALUES ('1920', 'Other Capital Assets Under Construction');
-INSERT INTO gifi (accno,description) VALUES ('1921', 'Campsites');
-INSERT INTO gifi (accno,description) VALUES ('1922', 'Accumulated Amortization Of Campsites');
-INSERT INTO gifi (accno,description) VALUES ('2008', 'Total Tangible Capital Assets');
-INSERT INTO gifi (accno,description) VALUES ('2009', 'Total Accumulated Amortization Of Tangible Capital Assets');
-INSERT INTO gifi (accno,description) VALUES ('2010', 'Intangible Assets');
-INSERT INTO gifi (accno,description) VALUES ('2011', 'Accumulated Amortization Of Intangible Assets');
-INSERT INTO gifi (accno,description) VALUES ('2012', 'Goodwill');
-INSERT INTO gifi (accno,description) VALUES ('2013', 'Accumulated Amortization Of Goodwill');
-INSERT INTO gifi (accno,description) VALUES ('2014', 'Quota');
-INSERT INTO gifi (accno,description) VALUES ('2015', 'Accumulated Amortization Of Quota');
-INSERT INTO gifi (accno,description) VALUES ('2016', 'Licences');
-INSERT INTO gifi (accno,description) VALUES ('2017', 'Accumulated Amortization Of Licences');
-INSERT INTO gifi (accno,description) VALUES ('2018', 'Incorporation Costs');
-INSERT INTO gifi (accno,description) VALUES ('2019', 'Accumulated Amortization Of Incorporation Costs');
-INSERT INTO gifi (accno,description) VALUES ('2020', 'Trademarks & Patents');
-INSERT INTO gifi (accno,description) VALUES ('2021', 'Accumulated Amortization Of Trademarks & Patents');
-INSERT INTO gifi (accno,description) VALUES ('2022', 'Customer Lists');
-INSERT INTO gifi (accno,description) VALUES ('2023', 'Accumulated Amortization Of Customer Lists');
-INSERT INTO gifi (accno,description) VALUES ('2024', 'Rights');
-INSERT INTO gifi (accno,description) VALUES ('2025', 'Accumulated Amortization Of Rights');
-INSERT INTO gifi (accno,description) VALUES ('2026', 'Research & Development');
-INSERT INTO gifi (accno,description) VALUES ('2027', 'Accumulated Amortization Of Research & Development');
-INSERT INTO gifi (accno,description) VALUES ('2070', 'Resource Rights');
-INSERT INTO gifi (accno,description) VALUES ('2071', 'Accumulated Amortization Of Resource Rights');
-INSERT INTO gifi (accno,description) VALUES ('2072', 'Timber Rights');
-INSERT INTO gifi (accno,description) VALUES ('2073', 'Accumulated Amortization Of Timber Rights');
-INSERT INTO gifi (accno,description) VALUES ('2074', 'Mining Rights');
-INSERT INTO gifi (accno,description) VALUES ('2075', 'Accumulated Amortization Of Mining Rights');
-INSERT INTO gifi (accno,description) VALUES ('2076', 'Oil & Gas Rights');
-INSERT INTO gifi (accno,description) VALUES ('2077', 'Accumulated Amortization Of Oil & Gas Rights');
-INSERT INTO gifi (accno,description) VALUES ('2078', 'Total Intangible Capital Assets');
-INSERT INTO gifi (accno,description) VALUES ('2079', 'Total Accumulated Amortization Of Intangible Capital Assets');
-INSERT INTO gifi (accno,description) VALUES ('2180', 'Long Term Due From Shareholder(s)/Director(s)');
-INSERT INTO gifi (accno,description) VALUES ('2181', 'Long Term Due From Individual Shareholder(s)');
-INSERT INTO gifi (accno,description) VALUES ('2182', 'Long Term Due From Corporate Shareholder(s)');
-INSERT INTO gifi (accno,description) VALUES ('2183', 'Long Term Due From Director(s)');
-INSERT INTO gifi (accno,description) VALUES ('2200', 'Long Term Investment In Joint Venture(s)/Partnership(s)');
-INSERT INTO gifi (accno,description) VALUES ('2220', 'Long Term Due From Joint Venture(s)/Partnership(s)');
-INSERT INTO gifi (accno,description) VALUES ('2240', 'Long Term Due From/Investment In Related Parties');
-INSERT INTO gifi (accno,description) VALUES ('2241', 'Due From/Investment In Canadian Related Parties');
-INSERT INTO gifi (accno,description) VALUES ('2242', 'Shares In Canadian Related Corporations');
-INSERT INTO gifi (accno,description) VALUES ('2243', 'Loans/Advances To Canadian Related Corporations');
-INSERT INTO gifi (accno,description) VALUES ('2244', 'Investment In Canadian Related Corporations At Cost');
-INSERT INTO gifi (accno,description) VALUES ('2245', 'Investment In Canadian Related Corporations At Equity');
-INSERT INTO gifi (accno,description) VALUES ('2246', 'Due From/Investment In Foreign Related Parties');
-INSERT INTO gifi (accno,description) VALUES ('2247', 'Shares In Foreign Related Corporations');
-INSERT INTO gifi (accno,description) VALUES ('2248', 'Loans/Advances To Foreign Related Corporations');
-INSERT INTO gifi (accno,description) VALUES ('2249', 'Investment In Foreign Related Corporations At Cost');
-INSERT INTO gifi (accno,description) VALUES ('2250', 'Investment In Foreign Related Corporations At Equity');
-INSERT INTO gifi (accno,description) VALUES ('2280', 'Investment In Co-Tenancy');
-INSERT INTO gifi (accno,description) VALUES ('2300', 'Long Term Investments');
-INSERT INTO gifi (accno,description) VALUES ('2301', 'Foreign Shares');
-INSERT INTO gifi (accno,description) VALUES ('2302', 'Other Type Of Foreign Investments');
-INSERT INTO gifi (accno,description) VALUES ('2303', 'Canadian Shares');
-INSERT INTO gifi (accno,description) VALUES ('2304', 'Government Of Canada Debt');
-INSERT INTO gifi (accno,description) VALUES ('2305', 'Canadian Provinvial & Municipal Government Debt');
-INSERT INTO gifi (accno,description) VALUES ('2306', 'Canadian Corporate Bonds & Debentures');
-INSERT INTO gifi (accno,description) VALUES ('2307', 'Debt Securities');
-INSERT INTO gifi (accno,description) VALUES ('2308', 'Equity Securities');
-INSERT INTO gifi (accno,description) VALUES ('2309', 'Securities Purchased Under Resale Agreements');
-INSERT INTO gifi (accno,description) VALUES ('2310', 'Central Credit Union Shares');
-INSERT INTO gifi (accno,description) VALUES ('2311', 'Other Long Term Canadian Investments');
-INSERT INTO gifi (accno,description) VALUES ('2360', 'Long Term Loans');
-INSERT INTO gifi (accno,description) VALUES ('2361', 'Mortgages');
-INSERT INTO gifi (accno,description) VALUES ('2362', 'Personal & Credit Card Loans');
-INSERT INTO gifi (accno,description) VALUES ('2363', 'Business & Government Loans');
-INSERT INTO gifi (accno,description) VALUES ('2364', 'Line Of Credit');
-INSERT INTO gifi (accno,description) VALUES ('2420', 'Other Long Term Assets');
-INSERT INTO gifi (accno,description) VALUES ('2421', 'Deferred Income Taxes / Tax Reserves');
-INSERT INTO gifi (accno,description) VALUES ('2422', 'Deferred Pension Charges');
-INSERT INTO gifi (accno,description) VALUES ('2423', 'Deferred Unrealized Exchange Losses');
-INSERT INTO gifi (accno,description) VALUES ('2424', 'Other Deferred Items/Charges');
-INSERT INTO gifi (accno,description) VALUES ('2425', 'Accumulated Amortization Of Deferred Charges');
-INSERT INTO gifi (accno,description) VALUES ('2426', 'Reserve Fund');
-INSERT INTO gifi (accno,description) VALUES ('2427', 'Cash Surrender Value Of Life Insurance');
-INSERT INTO gifi (accno,description) VALUES ('2589', 'Total Long Term Assets');
-INSERT INTO gifi (accno,description) VALUES ('2590', 'Assets Held In Trust');
-INSERT INTO gifi (accno,description) VALUES ('2599', 'Total Assets');
-INSERT INTO gifi (accno,description) VALUES ('2600', 'Bank Overdraft');
-INSERT INTO gifi (accno,description) VALUES ('2620', 'Amounts Payable & Accrued Liabilities');
-INSERT INTO gifi (accno,description) VALUES ('2621', 'Accounts Payable Trade');
-INSERT INTO gifi (accno,description) VALUES ('2622', 'Accounts Payable To Related Parties');
-INSERT INTO gifi (accno,description) VALUES ('2623', 'Holdbacks Payable');
-INSERT INTO gifi (accno,description) VALUES ('2624', 'Wages Payable');
-INSERT INTO gifi (accno,description) VALUES ('2625', 'Management Fees Payable');
-INSERT INTO gifi (accno,description) VALUES ('2626', 'Bonuses Payable');
-INSERT INTO gifi (accno,description) VALUES ('2627', 'Employee Deductions Payable');
-INSERT INTO gifi (accno,description) VALUES ('2628', 'Withholding Taxes Payable');
-INSERT INTO gifi (accno,description) VALUES ('2629', 'Intrest Payable');
-INSERT INTO gifi (accno,description) VALUES ('2680', 'Taxes Payable');
-INSERT INTO gifi (accno,description) VALUES ('2681', 'Capital Taxes Payable');
-INSERT INTO gifi (accno,description) VALUES ('2682', 'Foreign Taxes Payable');
-INSERT INTO gifi (accno,description) VALUES ('2683', 'Federal Taxes Payable');
-INSERT INTO gifi (accno,description) VALUES ('2684', 'Provincial Taxes Payable');
-INSERT INTO gifi (accno,description) VALUES ('2685', 'GST Payable');
-INSERT INTO gifi (accno,description) VALUES ('2686', 'PST Payable');
-INSERT INTO gifi (accno,description) VALUES ('2700', 'Short Term Debt');
-INSERT INTO gifi (accno,description) VALUES ('2701', 'Loans From Canadian Banks');
-INSERT INTO gifi (accno,description) VALUES ('2702', 'Liability For Securities Sold Short');
-INSERT INTO gifi (accno,description) VALUES ('2703', 'Liability For Securities Sold Under Repurchase Agreements');
-INSERT INTO gifi (accno,description) VALUES ('2704', 'Gold & Silver Certificates');
-INSERT INTO gifi (accno,description) VALUES ('2705', 'Cheques & Other Items In Transit');
-INSERT INTO gifi (accno,description) VALUES ('2706', 'Lien Notes');
-INSERT INTO gifi (accno,description) VALUES ('2770', 'Deferred Income');
-INSERT INTO gifi (accno,description) VALUES ('2780', 'Due To Shareholder(s)/Director(s)');
-INSERT INTO gifi (accno,description) VALUES ('2781', 'Due To Individual Shareholder(s)');
-INSERT INTO gifi (accno,description) VALUES ('2782', 'Due To Corporate Shareholder(s)');
-INSERT INTO gifi (accno,description) VALUES ('2783', 'Due To Director(s)');
-INSERT INTO gifi (accno,description) VALUES ('2840', 'Due To Joint Venture(s)/Partnership(s)');
-INSERT INTO gifi (accno,description) VALUES ('2860', 'Due To Related Parties');
-INSERT INTO gifi (accno,description) VALUES ('2861', 'Demand Notes Due To Related Parties');
-INSERT INTO gifi (accno,description) VALUES ('2862', 'Interest Payable To Related Parties');
-INSERT INTO gifi (accno,description) VALUES ('2863', 'Advances Due To Related Parties');
-INSERT INTO gifi (accno,description) VALUES ('2920', 'Current Portion Of Long Term Liability');
-INSERT INTO gifi (accno,description) VALUES ('2960', 'Other Current Liabilities');
-INSERT INTO gifi (accno,description) VALUES ('2961', 'Deposits Received');
-INSERT INTO gifi (accno,description) VALUES ('2962', 'Dividends Payable');
-INSERT INTO gifi (accno,description) VALUES ('2963', 'Deferred Income Taxes');
-INSERT INTO gifi (accno,description) VALUES ('2964', 'Reserves For Guarantees, Warranties Or Indemnities');
-INSERT INTO gifi (accno,description) VALUES ('2965', 'General Reserves / Provisions');
-INSERT INTO gifi (accno,description) VALUES ('2966', 'Crew Shares');
-INSERT INTO gifi (accno,description) VALUES ('3139', 'Total Current Liabilities');
-INSERT INTO gifi (accno,description) VALUES ('3140', 'Long Term Debt');
-INSERT INTO gifi (accno,description) VALUES ('3141', 'Mortgages');
-INSERT INTO gifi (accno,description) VALUES ('3142', 'Farm Credit Corporation Loan');
-INSERT INTO gifi (accno,description) VALUES ('3143', 'Chartered Bank Loan');
-INSERT INTO gifi (accno,description) VALUES ('3144', 'Credit Union/Caisse Populaire Loan');
-INSERT INTO gifi (accno,description) VALUES ('3145', 'Provincial Government Loan');
-INSERT INTO gifi (accno,description) VALUES ('3146', 'Supply Company Loan');
-INSERT INTO gifi (accno,description) VALUES ('3147', 'Private Loan');
-INSERT INTO gifi (accno,description) VALUES ('3148', 'Central, Leagues And Federation Loans');
-INSERT INTO gifi (accno,description) VALUES ('3149', 'Line Of Credit');
-INSERT INTO gifi (accno,description) VALUES ('3150', 'Liability For Securities Sold Short');
-INSERT INTO gifi (accno,description) VALUES ('3151', 'Liability For Securities Sold Under Repurchase Agreements');
-INSERT INTO gifi (accno,description) VALUES ('3152', 'Lien Notes');
-INSERT INTO gifi (accno,description) VALUES ('3210', 'Bonds And Debentures');
-INSERT INTO gifi (accno,description) VALUES ('3220', 'Deferred Income');
-INSERT INTO gifi (accno,description) VALUES ('3240', 'Deferred Income Taxes');
-INSERT INTO gifi (accno,description) VALUES ('3260', 'Long Term Due To Shareholder(s)/Director(s)');
-INSERT INTO gifi (accno,description) VALUES ('3261', 'Long Term Due To Individual Shareholder(s)');
-INSERT INTO gifi (accno,description) VALUES ('3262', 'Long Term Due To Corporate Shareholder(s)');
-INSERT INTO gifi (accno,description) VALUES ('3263', 'Long Term Due To Director(s)');
-INSERT INTO gifi (accno,description) VALUES ('3280', 'Long Term Due To Joint Venture(s)/Partnership(s)');
-INSERT INTO gifi (accno,description) VALUES ('3300', 'Long Term Due To Related Parties');
-INSERT INTO gifi (accno,description) VALUES ('3301', 'Amounts Owing To Related Canadian Parties');
-INSERT INTO gifi (accno,description) VALUES ('3302', 'Amounts Owing To Related Foreign Parties');
-INSERT INTO gifi (accno,description) VALUES ('3320', 'Other Long Term Liabilities');
-INSERT INTO gifi (accno,description) VALUES ('3321', 'Long Term Obligations/Commitments/Leases');
-INSERT INTO gifi (accno,description) VALUES ('3322', 'Reserves For Guarantees, Warranties Or Indemnities');
-INSERT INTO gifi (accno,description) VALUES ('3323', 'Provision For Site Restoration');
-INSERT INTO gifi (accno,description) VALUES ('3324', 'Contributions To Qualifying Environmental Trust');
-INSERT INTO gifi (accno,description) VALUES ('3325', 'General Provisions / Reserves');
-INSERT INTO gifi (accno,description) VALUES ('3326', 'Preference Shares Restated');
-INSERT INTO gifi (accno,description) VALUES ('3327', 'Member Allocations');
-INSERT INTO gifi (accno,description) VALUES ('3328', 'Deferred Income From Incomplete Contracts');
-INSERT INTO gifi (accno,description) VALUES ('3450', 'Total Long Term Liabilities');
-INSERT INTO gifi (accno,description) VALUES ('3460', 'Subordinated Debt');
-INSERT INTO gifi (accno,description) VALUES ('3470', 'Amounts Held In Trust');
-INSERT INTO gifi (accno,description) VALUES ('3499', 'Total Liabilities');
-INSERT INTO gifi (accno,description) VALUES ('3500', 'Common Shares');
-INSERT INTO gifi (accno,description) VALUES ('3520', 'Preferred Shares');
-INSERT INTO gifi (accno,description) VALUES ('3540', 'Contributed & Other Surplus');
-INSERT INTO gifi (accno,description) VALUES ('3541', 'Contributed Surplus');
-INSERT INTO gifi (accno,description) VALUES ('3542', 'Appraisal Surplus');
-INSERT INTO gifi (accno,description) VALUES ('3543', 'General Reserve');
-INSERT INTO gifi (accno,description) VALUES ('3570', 'Head Office Account');
-INSERT INTO gifi (accno,description) VALUES ('3600', 'Retained Earnings/Deficit');
-INSERT INTO gifi (accno,description) VALUES ('3620', 'Total Shareholder Equity');
-INSERT INTO gifi (accno,description) VALUES ('3640', 'Total Liabilities & Shareholder Equity');
-INSERT INTO gifi (accno,description) VALUES ('3660', 'Retained Earnings/Deficit Start');
-INSERT INTO gifi (accno,description) VALUES ('3680', 'Net Income/Loss');
-INSERT INTO gifi (accno,description) VALUES ('3700', 'Dividend Declared');
-INSERT INTO gifi (accno,description) VALUES ('3701', 'Cash Dividend');
-INSERT INTO gifi (accno,description) VALUES ('3702', 'Patronage Dividend');
-INSERT INTO gifi (accno,description) VALUES ('3720', 'Prior Year Adjustments');
-INSERT INTO gifi (accno,description) VALUES ('3740', 'Other Items Affecting Retained Earnings');
-INSERT INTO gifi (accno,description) VALUES ('3741', 'Share Redemptions');
-INSERT INTO gifi (accno,description) VALUES ('3742', 'Special Reserves');
-INSERT INTO gifi (accno,description) VALUES ('3743', 'Currency Adjustments');
-INSERT INTO gifi (accno,description) VALUES ('3744', 'Unusual Revenue Items');
-INSERT INTO gifi (accno,description) VALUES ('3745', 'Interfund Transfers (NPO)');
-INSERT INTO gifi (accno,description) VALUES ('3849', 'Retained Earnings/Deficit End');
-INSERT INTO gifi (accno,description) VALUES ('8000', 'Trade Sales of Goods and Services');
-INSERT INTO gifi (accno,description) VALUES ('8020', 'Sales To Related Parties');
-INSERT INTO gifi (accno,description) VALUES ('8030', 'Interdivisional Sales');
-INSERT INTO gifi (accno,description) VALUES ('8040', 'Sales From Resource Properties');
-INSERT INTO gifi (accno,description) VALUES ('8041', 'Petroleum & Natural Gas Sales');
-INSERT INTO gifi (accno,description) VALUES ('8042', 'Petroleum & Natural Gas Sales To Related Parties');
-INSERT INTO gifi (accno,description) VALUES ('8043', 'Gas Marketing');
-INSERT INTO gifi (accno,description) VALUES ('8044', 'Processing Revenue');
-INSERT INTO gifi (accno,description) VALUES ('8045', 'Pipeline Revenue');
-INSERT INTO gifi (accno,description) VALUES ('8046', 'Seismic Sales');
-INSERT INTO gifi (accno,description) VALUES ('8047', 'Mining Revenue');
-INSERT INTO gifi (accno,description) VALUES ('8048', 'Coal Revenue');
-INSERT INTO gifi (accno,description) VALUES ('8049', 'Oil Sands Revenue');
-INSERT INTO gifi (accno,description) VALUES ('8050', 'Royalty Income');
-INSERT INTO gifi (accno,description) VALUES ('8051', 'Oil & Gas Partnership/Joint Venture Income/Loss');
-INSERT INTO gifi (accno,description) VALUES ('8052', 'Mining Partnership/Joint Venture Income/Loss');
-INSERT INTO gifi (accno,description) VALUES ('8053', 'Other Production Revenue');
-INSERT INTO gifi (accno,description) VALUES ('8089', 'Total Sales Of Goods And Services');
-INSERT INTO gifi (accno,description) VALUES ('8090', 'Investment Revenue');
-INSERT INTO gifi (accno,description) VALUES ('8091', 'Interest From Foreign Sources');
-INSERT INTO gifi (accno,description) VALUES ('8092', 'Interest From Canadian Bonds And Debentures');
-INSERT INTO gifi (accno,description) VALUES ('8093', 'Interest From Canadian Mortgage Loans');
-INSERT INTO gifi (accno,description) VALUES ('8094', 'Interest From Other Canadian Sources');
-INSERT INTO gifi (accno,description) VALUES ('8095', 'Dividend Income');
-INSERT INTO gifi (accno,description) VALUES ('8096', 'Dividend From Canadian Sources');
-INSERT INTO gifi (accno,description) VALUES ('8097', 'Interest From Foreign Sources');
-INSERT INTO gifi (accno,description) VALUES ('8120', 'Commission Revenue');
-INSERT INTO gifi (accno,description) VALUES ('8121', 'Commission Income On Real Estate Transactions');
-INSERT INTO gifi (accno,description) VALUES ('8140', 'Rental Revenue');
-INSERT INTO gifi (accno,description) VALUES ('8141', 'Real Estate Rental Revenue');
-INSERT INTO gifi (accno,description) VALUES ('8150', 'Vehicle Leasing');
-INSERT INTO gifi (accno,description) VALUES ('8160', 'Fishing Revenue');
-INSERT INTO gifi (accno,description) VALUES ('8161', 'Fish Products');
-INSERT INTO gifi (accno,description) VALUES ('8162', 'Other Marine Products');
-INSERT INTO gifi (accno,description) VALUES ('8163', 'Fishing Grants, Credits & Rebates');
-INSERT INTO gifi (accno,description) VALUES ('8164', 'Fishing Subsidies');
-INSERT INTO gifi (accno,description) VALUES ('8165', 'Compensation For Loss Of Fishing Income/Property');
-INSERT INTO gifi (accno,description) VALUES ('8166', 'Sharesman Income');
-INSERT INTO gifi (accno,description) VALUES ('8210', 'Realized Gains/Losses On Disposal Of Assets');
-INSERT INTO gifi (accno,description) VALUES ('8211', 'Realized Gains/Losses On Sale Of Investments');
-INSERT INTO gifi (accno,description) VALUES ('8212', 'Realized Gains/Losses On Sale Of Resource Properties');
-INSERT INTO gifi (accno,description) VALUES ('8220', 'NPO Amounts Received');
-INSERT INTO gifi (accno,description) VALUES ('8221', 'Membership Fees');
-INSERT INTO gifi (accno,description) VALUES ('8222', 'Assessments');
-INSERT INTO gifi (accno,description) VALUES ('8223', 'Gifts');
-INSERT INTO gifi (accno,description) VALUES ('8224', 'Gross Sales And Revenues From Organizational Activities');
-INSERT INTO gifi (accno,description) VALUES ('8230', 'Other Revenue');
-INSERT INTO gifi (accno,description) VALUES ('8231', 'Foreign Exchange Gains/Losses');
-INSERT INTO gifi (accno,description) VALUES ('8232', 'Income/Loss Of Subsidiaries/Affiliates');
-INSERT INTO gifi (accno,description) VALUES ('8233', 'Income/Loss Of Other Divisions');
-INSERT INTO gifi (accno,description) VALUES ('8234', 'Income/Loss Of Joint Ventures');
-INSERT INTO gifi (accno,description) VALUES ('8235', 'Income/Loss Of Partnerships');
-INSERT INTO gifi (accno,description) VALUES ('8236', 'RealizaTion Of Deferred Revenues');
-INSERT INTO gifi (accno,description) VALUES ('8237', 'Royalty Income Other Than Resource');
-INSERT INTO gifi (accno,description) VALUES ('8238', 'Alberta Royalty Tax Credits');
-INSERT INTO gifi (accno,description) VALUES ('8239', 'Management & Administration Fees');
-INSERT INTO gifi (accno,description) VALUES ('8240', 'Telecommunications Revenues');
-INSERT INTO gifi (accno,description) VALUES ('8241', 'Consulting Fees');
-INSERT INTO gifi (accno,description) VALUES ('8242', 'Subsidies & Grants');
-INSERT INTO gifi (accno,description) VALUES ('8243', 'Sale Of By-Products');
-INSERT INTO gifi (accno,description) VALUES ('8244', 'Deposit Services');
-INSERT INTO gifi (accno,description) VALUES ('8245', 'Credit Services');
-INSERT INTO gifi (accno,description) VALUES ('8246', 'Card Services');
-INSERT INTO gifi (accno,description) VALUES ('8247', 'Patronage Dividends');
-INSERT INTO gifi (accno,description) VALUES ('8248', 'Insurance Recoveries');
-INSERT INTO gifi (accno,description) VALUES ('8249', 'Expense Recoveries');
-INSERT INTO gifi (accno,description) VALUES ('8250', 'Bad Debt Recoveries');
-INSERT INTO gifi (accno,description) VALUES ('8299', 'Total Revenue');
-INSERT INTO gifi (accno,description) VALUES ('8300', 'Opening Inventory');
-INSERT INTO gifi (accno,description) VALUES ('8301', 'Opening Inventory - finished goods');
-INSERT INTO gifi (accno,description) VALUES ('8302', 'Opening Inventory - raw materials');
-INSERT INTO gifi (accno,description) VALUES ('8303', 'Opening Inventory - goods in process');
-INSERT INTO gifi (accno,description) VALUES ('8304', 'Opening Inventory - work in process');
-INSERT INTO gifi (accno,description) VALUES ('8320', 'Purchases / Cost of Materials');
-INSERT INTO gifi (accno,description) VALUES ('8321', 'Purchases Product A');
-INSERT INTO gifi (accno,description) VALUES ('8322', 'Purchases Product B');
-INSERT INTO gifi (accno,description) VALUES ('8331', 'Price Differences & Discounts On Purchases');
-INSERT INTO gifi (accno,description) VALUES ('8340', 'Direct Wages');
-INSERT INTO gifi (accno,description) VALUES ('8350', 'Benefits On Direct Wages');
-INSERT INTO gifi (accno,description) VALUES ('8360', 'Trades & Sub-contracts');
-INSERT INTO gifi (accno,description) VALUES ('8370', 'Production Costs Other Than Resource');
-INSERT INTO gifi (accno,description) VALUES ('8400', 'Resource Production Costs');
-INSERT INTO gifi (accno,description) VALUES ('8401', 'Pipeline Operations');
-INSERT INTO gifi (accno,description) VALUES ('8402', 'Drilling');
-INSERT INTO gifi (accno,description) VALUES ('8403', 'Site Restoration Costs');
-INSERT INTO gifi (accno,description) VALUES ('8404', 'Gross Overriding Royalty');
-INSERT INTO gifi (accno,description) VALUES ('8405', 'Freehold Royalties');
-INSERT INTO gifi (accno,description) VALUES ('8406', 'Other Producing Properties Rental');
-INSERT INTO gifi (accno,description) VALUES ('8407', 'Prospect & Geological');
-INSERT INTO gifi (accno,description) VALUES ('8408', 'Well Operating, Fuel & Equipment');
-INSERT INTO gifi (accno,description) VALUES ('8409', 'Well Abandonment & Dry Holes');
-INSERT INTO gifi (accno,description) VALUES ('8410', 'Other Lease Rentals');
-INSERT INTO gifi (accno,description) VALUES ('8411', 'Exploration Expenses, Aerial Surveys');
-INSERT INTO gifi (accno,description) VALUES ('8412', 'Development Expenses, stripping costs');
-INSERT INTO gifi (accno,description) VALUES ('8435', 'Crown Charges');
-INSERT INTO gifi (accno,description) VALUES ('8436', 'Crown royalties');
-INSERT INTO gifi (accno,description) VALUES ('8437', 'Crown lease rentals');
-INSERT INTO gifi (accno,description) VALUES ('8438', 'Freehold mineral tax');
-INSERT INTO gifi (accno,description) VALUES ('8439', 'Mining taxes');
-INSERT INTO gifi (accno,description) VALUES ('8440', 'Oil and Sand leases');
-INSERT INTO gifi (accno,description) VALUES ('8441', 'Saskatchewan resource surcharge');
-INSERT INTO gifi (accno,description) VALUES ('8450', 'Other Direct Costs');
-INSERT INTO gifi (accno,description) VALUES ('8451', 'Equipment Hire & Operation');
-INSERT INTO gifi (accno,description) VALUES ('8452', 'Log Yard');
-INSERT INTO gifi (accno,description) VALUES ('8453', 'Forestry costs');
-INSERT INTO gifi (accno,description) VALUES ('8454', 'Logging Road costs');
-INSERT INTO gifi (accno,description) VALUES ('8455', 'Stumpage costs');
-INSERT INTO gifi (accno,description) VALUES ('8456', 'Royalty costs');
-INSERT INTO gifi (accno,description) VALUES ('8457', 'Freight In & Customs Duty');
-INSERT INTO gifi (accno,description) VALUES ('8458', 'Inventory Write Down');
-INSERT INTO gifi (accno,description) VALUES ('8459', 'Direct cost amortization of tangible assets');
-INSERT INTO gifi (accno,description) VALUES ('8460', 'Direct cost amortization of natural resource assets');
-INSERT INTO gifi (accno,description) VALUES ('8461', 'Overhead expenses allocated to cost of sales');
-INSERT INTO gifi (accno,description) VALUES ('8500', 'Closing Inventory');
-INSERT INTO gifi (accno,description) VALUES ('8501', 'Closing Inventory - Finished Goods');
-INSERT INTO gifi (accno,description) VALUES ('8502', 'Closing Inventory - Raw Materials');
-INSERT INTO gifi (accno,description) VALUES ('8503', 'Closing Inventory - Goods In Process');
-INSERT INTO gifi (accno,description) VALUES ('8504', 'Closing Inventory - Work In Process');
-INSERT INTO gifi (accno,description) VALUES ('8518', 'Cost Of Sales');
-INSERT INTO gifi (accno,description) VALUES ('8519', 'Gross Profit/Loss');
-INSERT INTO gifi (accno,description) VALUES ('8520', 'Advertising & Promotion');
-INSERT INTO gifi (accno,description) VALUES ('8521', 'Advertising');
-INSERT INTO gifi (accno,description) VALUES ('8522', 'Donations');
-INSERT INTO gifi (accno,description) VALUES ('8523', 'Meals & Entertainment');
-INSERT INTO gifi (accno,description) VALUES ('8524', 'Promotion');
-INSERT INTO gifi (accno,description) VALUES ('8570', 'Amortization Of Intangible Assets');
-INSERT INTO gifi (accno,description) VALUES ('8590', 'Bad Debt Expense');
-INSERT INTO gifi (accno,description) VALUES ('8610', 'Loan Losses');
-INSERT INTO gifi (accno,description) VALUES ('8611', 'Provision for Loan Losses');
-INSERT INTO gifi (accno,description) VALUES ('8620', 'Employee Benefits');
-INSERT INTO gifi (accno,description) VALUES ('8621', 'Group Insurance Benefits');
-INSERT INTO gifi (accno,description) VALUES ('8622', 'Employers Portion Of Employee Benefits');
-INSERT INTO gifi (accno,description) VALUES ('8623', 'Contributions To Deferred Income Plans');
-INSERT INTO gifi (accno,description) VALUES ('8650', 'Amortization Of Natural Resource Assets');
-INSERT INTO gifi (accno,description) VALUES ('8670', 'Amortization Of Tangible Assets');
-INSERT INTO gifi (accno,description) VALUES ('8690', 'Insurance');
-INSERT INTO gifi (accno,description) VALUES ('8691', 'Life Insurance On Executives');
-INSERT INTO gifi (accno,description) VALUES ('8710', 'Interest & Bank Charges');
-INSERT INTO gifi (accno,description) VALUES ('8711', 'Interest On Short Term Debt');
-INSERT INTO gifi (accno,description) VALUES ('8712', 'Interest On Bonds And Debentures');
-INSERT INTO gifi (accno,description) VALUES ('8713', 'Interest On Mortgages');
-INSERT INTO gifi (accno,description) VALUES ('8714', 'Interest On Long Term Debt');
-INSERT INTO gifi (accno,description) VALUES ('8715', 'Bank Charges');
-INSERT INTO gifi (accno,description) VALUES ('8716', 'Credit Card Charges');
-INSERT INTO gifi (accno,description) VALUES ('8717', 'Collection & Credit costs');
-INSERT INTO gifi (accno,description) VALUES ('8760', 'Business Taxes, Licences & Memberships');
-INSERT INTO gifi (accno,description) VALUES ('8761', 'Memberships');
-INSERT INTO gifi (accno,description) VALUES ('8762', 'Business Taxes');
-INSERT INTO gifi (accno,description) VALUES ('8763', 'Franchise Fees');
-INSERT INTO gifi (accno,description) VALUES ('8764', 'Government Fees');
-INSERT INTO gifi (accno,description) VALUES ('8780', 'New Brunswick Tax On Large Corporations');
-INSERT INTO gifi (accno,description) VALUES ('8790', 'Nova Scotia Tax On Large Corporations');
-INSERT INTO gifi (accno,description) VALUES ('8810', 'Office Expenses');
-INSERT INTO gifi (accno,description) VALUES ('8811', 'Office Stationary And Supplies');
-INSERT INTO gifi (accno,description) VALUES ('8812', 'Office Utilities');
-INSERT INTO gifi (accno,description) VALUES ('8813', 'Data Processing');
-INSERT INTO gifi (accno,description) VALUES ('8860', 'Professional Fees');
-INSERT INTO gifi (accno,description) VALUES ('8861', 'Legal Fees');
-INSERT INTO gifi (accno,description) VALUES ('8862', 'Accounting Fees');
-INSERT INTO gifi (accno,description) VALUES ('8863', 'Consulting Fees');
-INSERT INTO gifi (accno,description) VALUES ('8864', 'Architect Fees');
-INSERT INTO gifi (accno,description) VALUES ('8865', 'Appraisal Fees');
-INSERT INTO gifi (accno,description) VALUES ('8866', 'Laboratory Fees');
-INSERT INTO gifi (accno,description) VALUES ('8867', 'Medical Fees');
-INSERT INTO gifi (accno,description) VALUES ('8868', 'Veterinary Fees');
-INSERT INTO gifi (accno,description) VALUES ('8869', 'Brokerage Fees');
-INSERT INTO gifi (accno,description) VALUES ('8870', 'Transfer Fees');
-INSERT INTO gifi (accno,description) VALUES ('8871', 'Management & Administration Fees');
-INSERT INTO gifi (accno,description) VALUES ('8872', 'Refining & Assay');
-INSERT INTO gifi (accno,description) VALUES ('8873', 'Registrar & Transfer Agent Fees');
-INSERT INTO gifi (accno,description) VALUES ('8874', 'Restructuring Costs');
-INSERT INTO gifi (accno,description) VALUES ('8875', 'Security & Exchange Commission Fees');
-INSERT INTO gifi (accno,description) VALUES ('8876', 'Training Expense');
-INSERT INTO gifi (accno,description) VALUES ('8877', 'Studio & Recording');
-INSERT INTO gifi (accno,description) VALUES ('8910', 'Rental');
-INSERT INTO gifi (accno,description) VALUES ('8911', 'Real Estate Rental');
-INSERT INTO gifi (accno,description) VALUES ('8912', 'Occupancy Costs');
-INSERT INTO gifi (accno,description) VALUES ('8913', 'Condominium Fees');
-INSERT INTO gifi (accno,description) VALUES ('8914', 'Equipment Rental');
-INSERT INTO gifi (accno,description) VALUES ('8915', 'Motor Vehicle Rental');
-INSERT INTO gifi (accno,description) VALUES ('8916', 'Moorage (Boat)');
-INSERT INTO gifi (accno,description) VALUES ('8917', 'Storage');
-INSERT INTO gifi (accno,description) VALUES ('8918', 'Quota Rental');
-INSERT INTO gifi (accno,description) VALUES ('8960', 'Repairs & Maintenance - Aircraft');
-INSERT INTO gifi (accno,description) VALUES ('8961', 'Repairs & Maintenance - Buildings');
-INSERT INTO gifi (accno,description) VALUES ('8962', 'Repairs & Maintenance - Vehicles');
-INSERT INTO gifi (accno,description) VALUES ('8963', 'Repairs & Maintenance - Boats');
-INSERT INTO gifi (accno,description) VALUES ('8964', 'Repairs & Maintenance - Machinery & Equipment');
-INSERT INTO gifi (accno,description) VALUES ('9010', 'Other Repairs & Maintenance - Janitor & Yard');
-INSERT INTO gifi (accno,description) VALUES ('9011', 'Machine Shop Expense');
-INSERT INTO gifi (accno,description) VALUES ('9012', 'Road Costs');
-INSERT INTO gifi (accno,description) VALUES ('9013', 'Security');
-INSERT INTO gifi (accno,description) VALUES ('9014', 'Garbage Removal');
-INSERT INTO gifi (accno,description) VALUES ('9060', 'Salaries & Wages');
-INSERT INTO gifi (accno,description) VALUES ('9061', 'Commissions');
-INSERT INTO gifi (accno,description) VALUES ('9062', 'Crew Share');
-INSERT INTO gifi (accno,description) VALUES ('9063', 'Bonuses');
-INSERT INTO gifi (accno,description) VALUES ('9064', 'Director\'s Fees');
-INSERT INTO gifi (accno,description) VALUES ('9065', 'Management Salaries');
-INSERT INTO gifi (accno,description) VALUES ('9066', 'Employee Salaries');
-INSERT INTO gifi (accno,description) VALUES ('9110', 'Sub-Contracts');
-INSERT INTO gifi (accno,description) VALUES ('9130', 'Supplies');
-INSERT INTO gifi (accno,description) VALUES ('9131', 'Small Tools');
-INSERT INTO gifi (accno,description) VALUES ('9132', 'Shop Expense');
-INSERT INTO gifi (accno,description) VALUES ('9133', 'Uniforms');
-INSERT INTO gifi (accno,description) VALUES ('9134', 'Laundry');
-INSERT INTO gifi (accno,description) VALUES ('9135', 'Food & Catering');
-INSERT INTO gifi (accno,description) VALUES ('9136', 'Fishing Gear');
-INSERT INTO gifi (accno,description) VALUES ('9137', 'Nets & Traps');
-INSERT INTO gifi (accno,description) VALUES ('9138', 'Salt, Bait & Ice');
-INSERT INTO gifi (accno,description) VALUES ('9139', 'Camp Supplies');
-INSERT INTO gifi (accno,description) VALUES ('9150', 'Computer Related Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9151', 'Upgrade');
-INSERT INTO gifi (accno,description) VALUES ('9152', 'Internet');
-INSERT INTO gifi (accno,description) VALUES ('9180', 'Property Taxes');
-INSERT INTO gifi (accno,description) VALUES ('9200', 'Travel Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9201', 'Meetings & Conventions');
-INSERT INTO gifi (accno,description) VALUES ('9220', 'Utilities');
-INSERT INTO gifi (accno,description) VALUES ('9221', 'Electricity');
-INSERT INTO gifi (accno,description) VALUES ('9222', 'Water');
-INSERT INTO gifi (accno,description) VALUES ('9223', 'Heat');
-INSERT INTO gifi (accno,description) VALUES ('9224', 'Fuel Costs');
-INSERT INTO gifi (accno,description) VALUES ('9225', 'Telephone & Communications');
-INSERT INTO gifi (accno,description) VALUES ('9270', 'Other Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9271', 'Cash Over/Short');
-INSERT INTO gifi (accno,description) VALUES ('9272', 'Reimbursement Of Parent Company Expense');
-INSERT INTO gifi (accno,description) VALUES ('9273', 'Selling Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9274', 'Shipping & Warehouse Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9275', 'Delivery, Freight & Express');
-INSERT INTO gifi (accno,description) VALUES ('9276', 'Warranty Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9277', 'Royalty Expenses - Resident');
-INSERT INTO gifi (accno,description) VALUES ('9278', 'Royalty Expenses - Non-Resident');
-INSERT INTO gifi (accno,description) VALUES ('9279', 'Dumping Charges');
-INSERT INTO gifi (accno,description) VALUES ('9280', 'Land Fill Fees');
-INSERT INTO gifi (accno,description) VALUES ('9281', 'Vehicle Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9282', 'Research & Development');
-INSERT INTO gifi (accno,description) VALUES ('9283', 'Withholding Taxes');
-INSERT INTO gifi (accno,description) VALUES ('9284', 'General & Administrative Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9285', 'Interdivisional Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9286', 'Interfund Transfer (NPO)');
-INSERT INTO gifi (accno,description) VALUES ('9367', 'Total Operating Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9368', 'Total Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9369', 'Net Non-Farming Income');
-INSERT INTO gifi (accno,description) VALUES ('9370', 'Grains And Oilseeds');
-INSERT INTO gifi (accno,description) VALUES ('9371', 'Wheat');
-INSERT INTO gifi (accno,description) VALUES ('9372', 'Oats');
-INSERT INTO gifi (accno,description) VALUES ('9373', 'Barley');
-INSERT INTO gifi (accno,description) VALUES ('9374', 'Mixed Grains');
-INSERT INTO gifi (accno,description) VALUES ('9375', 'Corn');
-INSERT INTO gifi (accno,description) VALUES ('9376', 'Canola');
-INSERT INTO gifi (accno,description) VALUES ('9377', 'Flaxseed');
-INSERT INTO gifi (accno,description) VALUES ('9378', 'Soya Beans');
-INSERT INTO gifi (accno,description) VALUES ('9379', 'Wheat Board Payments');
-INSERT INTO gifi (accno,description) VALUES ('9420', 'Other Crop Revenues');
-INSERT INTO gifi (accno,description) VALUES ('9321', 'Fruit');
-INSERT INTO gifi (accno,description) VALUES ('9322', 'Potatoes');
-INSERT INTO gifi (accno,description) VALUES ('9323', 'Vegetables');
-INSERT INTO gifi (accno,description) VALUES ('9324', 'Tobacco');
-INSERT INTO gifi (accno,description) VALUES ('9325', 'Greenhouse & Nursery Products');
-INSERT INTO gifi (accno,description) VALUES ('9326', 'Forage Crops');
-INSERT INTO gifi (accno,description) VALUES ('9470', 'Livestock & Animal Products Revenue');
-INSERT INTO gifi (accno,description) VALUES ('9471', 'Cattle');
-INSERT INTO gifi (accno,description) VALUES ('9472', 'Swine');
-INSERT INTO gifi (accno,description) VALUES ('9473', 'Poultry');
-INSERT INTO gifi (accno,description) VALUES ('9474', 'Sheep & Lambs');
-INSERT INTO gifi (accno,description) VALUES ('9475', 'Pregnant Mare Urine (PMU)');
-INSERT INTO gifi (accno,description) VALUES ('9476', 'Milk & Cream - Excluding Dairy Subsidies');
-INSERT INTO gifi (accno,description) VALUES ('9477', 'Eggs For Consumption');
-INSERT INTO gifi (accno,description) VALUES ('9478', 'Hatching Eggs');
-INSERT INTO gifi (accno,description) VALUES ('9479', 'Aquaculture');
-INSERT INTO gifi (accno,description) VALUES ('9480', 'Horses - Breeding & Meat');
-INSERT INTO gifi (accno,description) VALUES ('9520', 'Other Commodities');
-INSERT INTO gifi (accno,description) VALUES ('9521', 'Maple Products');
-INSERT INTO gifi (accno,description) VALUES ('9522', 'Artificial Insemination (AI)');
-INSERT INTO gifi (accno,description) VALUES ('9523', 'Semen Production');
-INSERT INTO gifi (accno,description) VALUES ('9524', 'Embryo Production');
-INSERT INTO gifi (accno,description) VALUES ('9540', 'Program Payment Revenues');
-INSERT INTO gifi (accno,description) VALUES ('9541', 'Dairy Subsidies');
-INSERT INTO gifi (accno,description) VALUES ('9542', 'Crop Insurance');
-INSERT INTO gifi (accno,description) VALUES ('9543', 'NISA Payments');
-INSERT INTO gifi (accno,description) VALUES ('9544', 'Disaster Assistance Program Payments');
-INSERT INTO gifi (accno,description) VALUES ('9570', 'Rebates');
-INSERT INTO gifi (accno,description) VALUES ('9571', 'Rebates - Fuel');
-INSERT INTO gifi (accno,description) VALUES ('9572', 'Rebates - Interest');
-INSERT INTO gifi (accno,description) VALUES ('9573', 'Rebates - Property Taxes');
-INSERT INTO gifi (accno,description) VALUES ('9574', 'Resales, Rebates, GST For NISA Eligible Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9575', 'Rebates, GST For NISA Non-Eligible Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9600', 'Other Farm Revenues/Losses');
-INSERT INTO gifi (accno,description) VALUES ('9601', 'Custom Or Contract Work');
-INSERT INTO gifi (accno,description) VALUES ('9602', 'Wood Sales');
-INSERT INTO gifi (accno,description) VALUES ('9603', 'Horse Racing');
-INSERT INTO gifi (accno,description) VALUES ('9604', 'Insurance Proceeds');
-INSERT INTO gifi (accno,description) VALUES ('9605', 'Patronage Dividends');
-INSERT INTO gifi (accno,description) VALUES ('9606', 'Rental Income');
-INSERT INTO gifi (accno,description) VALUES ('9607', 'Interest Income');
-INSERT INTO gifi (accno,description) VALUES ('9608', 'Dividend Income');
-INSERT INTO gifi (accno,description) VALUES ('9609', 'Gains/Losses On Disposal Of Assets');
-INSERT INTO gifi (accno,description) VALUES ('9610', 'Gravel');
-INSERT INTO gifi (accno,description) VALUES ('9611', 'Trucking');
-INSERT INTO gifi (accno,description) VALUES ('9612', 'Resale Of Commodities Purchased');
-INSERT INTO gifi (accno,description) VALUES ('9613', 'Leases');
-INSERT INTO gifi (accno,description) VALUES ('9614', 'Machine Rentals');
-INSERT INTO gifi (accno,description) VALUES ('9615', 'Farming Partnership Income/Loss');
-INSERT INTO gifi (accno,description) VALUES ('9616', 'Farming Joint Venture Income/Loss');
-INSERT INTO gifi (accno,description) VALUES ('9650', 'Non-Farming Income');
-INSERT INTO gifi (accno,description) VALUES ('9659', 'Total Farm Revenue');
-INSERT INTO gifi (accno,description) VALUES ('9660', 'Crop Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9661', 'Containers, Twine And Baling Wire');
-INSERT INTO gifi (accno,description) VALUES ('9662', 'Fertilizers And Lime');
-INSERT INTO gifi (accno,description) VALUES ('9663', 'Pesticides');
-INSERT INTO gifi (accno,description) VALUES ('9664', 'Seeds & Plants');
-INSERT INTO gifi (accno,description) VALUES ('9665', 'Insurance Premiums (Crop) NISA ACS');
-INSERT INTO gifi (accno,description) VALUES ('9710', 'Livestock Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9711', 'Feed, Supplements, Straw & Bedding');
-INSERT INTO gifi (accno,description) VALUES ('9712', 'Livestock Purchases');
-INSERT INTO gifi (accno,description) VALUES ('9713', 'Veterinary Fees, Medicine & Breeding Fees');
-INSERT INTO gifi (accno,description) VALUES ('9760', 'Machinery Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9761', 'Machinery Insurance');
-INSERT INTO gifi (accno,description) VALUES ('9762', 'Machinery Licences');
-INSERT INTO gifi (accno,description) VALUES ('9763', 'Machinery Repairs');
-INSERT INTO gifi (accno,description) VALUES ('9764', 'Machinery Fuel');
-INSERT INTO gifi (accno,description) VALUES ('9765', 'Machinery Lease');
-INSERT INTO gifi (accno,description) VALUES ('9790', 'General Farm Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9791', 'Amortization Of Tangible Assets');
-INSERT INTO gifi (accno,description) VALUES ('9792', 'Advertising, Marketing Costs & Promotion');
-INSERT INTO gifi (accno,description) VALUES ('9793', 'Bad Debt');
-INSERT INTO gifi (accno,description) VALUES ('9794', 'Benefits Related To Employee Salaries');
-INSERT INTO gifi (accno,description) VALUES ('9795', 'Building Repairs & Maintenance');
-INSERT INTO gifi (accno,description) VALUES ('9796', 'Clearing, Levelling & Draining Land');
-INSERT INTO gifi (accno,description) VALUES ('9797', 'Crop Insurance, GRIP and Stabilization Premiums');
-INSERT INTO gifi (accno,description) VALUES ('9798', 'Custom Or Contract Work');
-INSERT INTO gifi (accno,description) VALUES ('9799', 'Electricity');
-INSERT INTO gifi (accno,description) VALUES ('9800', 'Fence Repairs & Maintenance');
-INSERT INTO gifi (accno,description) VALUES ('9801', 'Freight & Trucking');
-INSERT INTO gifi (accno,description) VALUES ('9802', 'Heating Fuel & Curing Fuel');
-INSERT INTO gifi (accno,description) VALUES ('9803', 'Insurance Program Overpayment Recapture');
-INSERT INTO gifi (accno,description) VALUES ('9804', 'Other Insurance Premiums');
-INSERT INTO gifi (accno,description) VALUES ('9805', 'Interest & Bank Charges');
-INSERT INTO gifi (accno,description) VALUES ('9806', 'Marketing Board Fees');
-INSERT INTO gifi (accno,description) VALUES ('9807', 'Membership/Subscription Fees');
-INSERT INTO gifi (accno,description) VALUES ('9808', 'Office Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9809', 'Professional Fees');
-INSERT INTO gifi (accno,description) VALUES ('9810', 'Property Taxes');
-INSERT INTO gifi (accno,description) VALUES ('9811', 'Rent - Land & Buildings');
-INSERT INTO gifi (accno,description) VALUES ('9812', 'Rent - Machinery');
-INSERT INTO gifi (accno,description) VALUES ('9813', 'Other Rental Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9814', 'Salaries & Wages');
-INSERT INTO gifi (accno,description) VALUES ('9815', 'Salaries & Wages Other Than Spouse Or Dependants');
-INSERT INTO gifi (accno,description) VALUES ('9816', 'Salaries & Wages Paid To Dependants');
-INSERT INTO gifi (accno,description) VALUES ('9817', 'Selling Costs');
-INSERT INTO gifi (accno,description) VALUES ('9818', 'Supplies');
-INSERT INTO gifi (accno,description) VALUES ('9819', 'Motor Vehicle Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9820', 'Small Tools');
-INSERT INTO gifi (accno,description) VALUES ('9821', 'Soil Testing');
-INSERT INTO gifi (accno,description) VALUES ('9822', 'Storage/Drying');
-INSERT INTO gifi (accno,description) VALUES ('9823', 'Licences/Permits');
-INSERT INTO gifi (accno,description) VALUES ('9824', 'Telephone');
-INSERT INTO gifi (accno,description) VALUES ('9825', 'Quota Rental');
-INSERT INTO gifi (accno,description) VALUES ('9826', 'Gravel');
-INSERT INTO gifi (accno,description) VALUES ('9827', 'Purchases Of Commodities Resold');
-INSERT INTO gifi (accno,description) VALUES ('9828', 'Salaries & Wages Paid To Spouse');
-INSERT INTO gifi (accno,description) VALUES ('9829', 'Motor Vehicle Interest And Leasing Costs');
-INSERT INTO gifi (accno,description) VALUES ('9830', 'Prepared Feed');
-INSERT INTO gifi (accno,description) VALUES ('9831', 'Custom Feed');
-INSERT INTO gifi (accno,description) VALUES ('9832', 'Amortization Of Intangible Assets');
-INSERT INTO gifi (accno,description) VALUES ('9833', 'Amortization Of Milk Quota');
-INSERT INTO gifi (accno,description) VALUES ('9834', 'Travel Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9835', 'Capital/Business Taxes');
-INSERT INTO gifi (accno,description) VALUES ('9850', 'Non-Farming Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9870', 'Net Inventory Adjustment');
-INSERT INTO gifi (accno,description) VALUES ('9898', 'Total Farm Expenses');
-INSERT INTO gifi (accno,description) VALUES ('9899', 'Net Farm Income');
-INSERT INTO gifi (accno,description) VALUES ('9970', 'Net Income/Loss Before Taxes And Extraordinary Items');
-INSERT INTO gifi (accno,description) VALUES ('9975', 'Extraordinary Items');
-INSERT INTO gifi (accno,description) VALUES ('9976', 'Legal Settlements');
-INSERT INTO gifi (accno,description) VALUES ('9980', 'Unrealized Gains/Losses');
-INSERT INTO gifi (accno,description) VALUES ('9985', 'Unusual Items');
-INSERT INTO gifi (accno,description) VALUES ('9990', 'Current Income Taxes');
-INSERT INTO gifi (accno,description) VALUES ('9995', 'Deferred Income Tax Provision');
-INSERT INTO gifi (accno,description) VALUES ('9999', 'Net Income/Loss After Taxes And Extraordinary Items');
--- This item represents the net amount of:
--- Item 9970 - Net income/loss before taxes and extraordinary items minus
--- Item 9975 - Extraordinary item(s) minus
--- Item 9976 - Legal settlements plus
--- Item 9980 - Unrealized gains/losses minus
--- Item 9985 - Unusual items minus
--- Item 9990 - Current income taxes minus
--- Item 9995 - Deferred income tax provision
--- and must be reported.
--- Any amount reported in this item should be equal to the amount reported at Item 3680 - Net income/loss,
--- in the retained earnings section.
---
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4355', 'Ökosteuer', 'A', 'E', '', '4355', 0, NULL, 12, NULL, NULL, FALSE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4396', 'Steuerl.abzugs.Verspätungszuschl.u.Zwangsgelder', 'A', 'E', '', '4396', 0, NULL, NULL, NULL, 31, FALSE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4397', 'Steuerl.n.abzugsf.Verspätungszuschläge u.Zwangsgelder', 'A', 'E', '', '4397', 0, NULL, NULL, NULL, 31, FALSE);
-INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4500', 'Fahrzugkosten', 'A', 'E', 'AP_amount', '4500', 0, NULL, NULL, NULL, 17, FALSE);
+INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4500', 'Fahrzeugkosten', 'A', 'E', 'AP_amount', '4500', 0, NULL, NULL, NULL, 17, FALSE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4530', 'Laufende Kfz-Betriebskosten', 'A', 'E', 'AP_amount', '4530', 9, NULL, 14, NULL, 17, FALSE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8100', 'Steuerfreie Umsätze §4Nr.8ff UstG', 'A', 'I', 'AR_amount', '8100', 0, 0, 1, NULL, NULL, TRUE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8110', 'Sonstige steuerfreie Umsätze Inland', 'A', 'I', 'AR_amount', '8110', 0, NULL, NULL, NULL, 1, TRUE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8790', 'Gewährte Rabatte 16% Ust.', 'A', 'E', 'AR_paid', '8790', 3, 51, 1, NULL, 1, TRUE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8820', 'Erlöse aus Anlageverkäufen Sachanl.verm.b.Buchgewinn16%Ust', 'A', 'I', 'AR_amount', '8820', 3, 51, 5, NULL, 1, TRUE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8829', 'Erl.a.Anlagenverk.bei Buchgewinn', 'A', 'I', 'AR_amount', '8829', 3, NULL, NULL, NULL, 1, FALSE);
-INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8900', 'Unentgeldliche Wertabgaben', 'A', 'I', 'AR_amount', '8900', 0, NULL, NULL, NULL, 1, FALSE);
+INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8900', 'Unentgeltliche Wertabgaben', 'A', 'I', 'AR_amount', '8900', 0, NULL, NULL, NULL, 1, FALSE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8905', 'Entnahme v. Gegenst.o.USt.', 'A', 'I', '', '8905', 0, NULL, 5, NULL, 2, FALSE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8910', 'Entnahme des Untern.f.Zwecke ausserh.d.Untern 16%(Waren)', 'A', 'I', 'AR_amount', '8910', 3, 51, 5, NULL, 3, TRUE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8915', 'Entnah.d.Untern.f.Zwecke ausserh.d.Untern.7%USt', 'A', 'I', 'AR_amount', '8915', 2, 86, 5, NULL, 3, TRUE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8919', 'Entnahme durch den Untern.f.Zwecke außerhalb d.Untern.(Waren)o.USt', 'A', 'I', '', '8919', 0, NULL, 5, NULL, 3, FALSE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8924', 'Verwendung v.Gegenständen f.Zwecke außerhalb d.Untern.o.USt.', 'A', 'I', '', '8924', 0, NULL, NULL, NULL, 3, FALSE);
-INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8925', 'Unentgeldl.Erbring.sons.Leis.16%USt', 'A', 'I', 'AR_amount', '8925', 3, 51, NULL, NULL, 3, TRUE);
+INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8925', 'Unentgeltl.Erbring.sons.Leis.16%USt', 'A', 'I', 'AR_amount', '8925', 3, 51, NULL, NULL, 3, TRUE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8930', 'Verwendung v.Gegenst.f.Zwecke außerhalb d.Unternehmens 7% USt.', 'A', 'I', 'AR_amount', '8930', 2, 86, 5, NULL, 3, TRUE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8935', 'Unentgeltl.Zuwend.v.Gegens. 16% Ust', 'A', 'I', 'AR_amount', '8935', 3, 51, NULL, NULL, 3, TRUE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8950', 'Nicht steuerbare Umsätze', 'A', 'I', '', '8950', 0, NULL, 5, NULL, 1, FALSE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4635', 'Geschenke über 35EUR nicht abzugsf.', 'A', 'E', 'AP_amount', '4635', 0, NULL, 15, NULL, 18, FALSE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4655', 'Nicht abzugsf.Betriebsausg.a.Werbe-Repräsentatisonk.etc.', 'A', 'E', 'AP_amount', '4655', 9, NULL, 15, NULL, 24, FALSE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4805', 'Rep.u.Instandhalt.v.and.Anlagen u.Betriebs-u.Geschäftsausst.', 'A', 'E', 'AP_amount', '4805', 9, NULL, 18, NULL, 19, FALSE);
-INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8190', 'Erlöse,die mit den Durchschnittssätzen d.§24UStG vers.werd.', 'A', 'I', 'AR_amount', '8190', NULL, NULL, NULL, NULL, 1, FALSE);
-INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8195', 'Erlöse als Kleinunternehmer i.S.d.§19(1)UStG', 'A', 'I', 'AR_amount', '8195', NULL, NULL, 1, NULL, 1, FALSE);
+INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8190', 'Erlöse,die mit den Durchschnittssätzen d.§24UStG vers.werd.', 'A', 'I', 'AR_amount', '8190', 0, NULL, NULL, NULL, 1, FALSE);
+INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8195', 'Erlöse als Kleinunternehmer i.S.d.§19(1)UStG', 'A', 'I', 'AR_amount', '8195', 0, NULL, 1, NULL, 1, FALSE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8807', 'Erlöse a.Verk.Sachanlagen steuerfrei§4Nr.1aUStG(b.Buchverlust)', 'A', 'E', '', '8807', 0, NULL, NULL, NULL, 1, TRUE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8808', 'Erlöse a.Verk.Sachanlagen steuerfrei§4Nr.1bUStG(b.Buchverlust)', 'A', 'E', '', '8808', 0, NULL, NULL, NULL, 1, TRUE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8809', 'Erlöse aus Verk.Sachanlagevermögen16% USt (bei Buchverlust)', 'A', 'E', '', '8809', 0, NULL, NULL, NULL, 2, TRUE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('2739', 'Erträge Aufl. Sopo m.R.(Ansparafa)', 'A', 'I', '', '2739', 0, NULL, 5, NULL, NULL, FALSE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8590', 'Verrechnete sons. Sachbezüge keine Waren', 'A', 'I', 'AR_amount', '8590', 0, 0, 5, NULL, 2, FALSE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8920', 'Verw.v.Gegens.f.Zwecke ausserh.d.Untern.16%USt.', 'A', 'I', '', '8920', 3, 51, 5, NULL, 3, TRUE);
-INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8939', 'Unentgeldl.Zuw.v.Gegens.ohne Ust', 'A', 'I', '', '8939', 0, NULL, 5, NULL, 3, FALSE);
+INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8939', 'Unentgeltl.Zuw.v.Gegens.ohne Ust', 'A', 'I', '', '8939', 0, NULL, 5, NULL, 3, FALSE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8940', 'Unentgeltl.Zuw.v Waren 16% Ust', 'A', 'I', '', '8940', 3, 51, 5, NULL, 3, TRUE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8945', 'Unentgeltl.Zuw.von Waren 7% Ust', 'A', 'I', '', '8945', 2, 86, 5, NULL, 3, TRUE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('8949', 'Unentgeltl.Zuwendung v.Waren o.USt.', 'A', 'I', '', '8949', 0, NULL, 5, NULL, 3, FALSE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4180', 'Bedienungsgelder', 'A', 'E', '', '4180', 0, NULL, 10, NULL, 9, FALSE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4826', 'Außerplan.AfA a.immat.Vermögensgeg.', 'A', 'E', '', '4826', 0, NULL, 17, NULL, 25, FALSE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4850', 'Abschr.a.Sachanl.aufgr.steuerl.Sondervorschriften', 'A', 'E', '', '4850', 0, NULL, 17, NULL, 25, FALSE);
-INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4870', 'Abschreibungen auf Finanzanlagen', 'A', 'E', '', '4870', NULL, NULL, NULL, NULL, NULL, FALSE);
+INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4870', 'Abschreibungen auf Finanzanlagen', 'A', 'E', '', '4870', 0, NULL, NULL, NULL, NULL, FALSE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4875', 'Abschr.a.Wertp.d.Umlaufvermögens', 'A', 'E', '', '4875', 0, NULL, 17, NULL, NULL, FALSE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4880', 'Abschreibungen auf Umlaufverm. o.Wertpapiere (soweit unübl.Höhe', 'A', 'E', '', '4880', 0, NULL, 17, NULL, NULL, FALSE);
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('2208', 'Solidaritätszuschlag', 'A', 'E', '', '2208', 0, NULL, 35, NULL, NULL, FALSE);
+++ /dev/null
--- DATEV SKR03
--- Office-Service http://www.officeservice-einberger.de
---
-INSERT INTO gifi (accno,description) VALUES ('0001', 'Aufwand Geschäftsbetrieb');
-INSERT INTO gifi (accno,description) VALUES ('0002', 'Aufwendungen Umstellung a.d.Euro');
-INSERT INTO gifi (accno,description) VALUES ('0010', 'Konzession,gewerb.Schutzre.u.Werten');
-INSERT INTO gifi (accno,description) VALUES ('0015', 'Konzessionen');
-INSERT INTO gifi (accno,description) VALUES ('0020', 'Gewerbl.Schutzrechte');
-INSERT INTO gifi (accno,description) VALUES ('0025', 'Ähnl.Rechte und Werte');
-INSERT INTO gifi (accno,description) VALUES ('0027', 'EDV-Software');
-INSERT INTO gifi (accno,description) VALUES ('0030', 'Liz.a.gewerbl.Schutzre.u.ähnl.Re.u.Wert.');
-INSERT INTO gifi (accno,description) VALUES ('0035', 'Geschäfts-oder Firmenwert');
-INSERT INTO gifi (accno,description) VALUES ('0038', 'Anzahlungen a.Geschäft-o.Firmenwert');
-INSERT INTO gifi (accno,description) VALUES ('0039', 'Anz.a.immaterielle Vermögsgegenstän');
-INSERT INTO gifi (accno,description) VALUES ('0040', 'Verschmelzungsmehrwert');
-INSERT INTO gifi (accno,description) VALUES ('0050', 'Grundstücke,grundstücksgl.Rechte..');
-INSERT INTO gifi (accno,description) VALUES ('0060', 'Grundstücke u.grundstgl.Rech.o.Baut');
-INSERT INTO gifi (accno,description) VALUES ('0065', 'Unbebaute Grundstücke');
-INSERT INTO gifi (accno,description) VALUES ('0070', 'Grundstücksgl.Re.(Erbau-,Dauerwohnre.)');
-INSERT INTO gifi (accno,description) VALUES ('0075', 'Grundstücke m.Substanzverzehr');
-INSERT INTO gifi (accno,description) VALUES ('0079', 'Anz.a.Grundst.u.grundstücksgl.Re.ohne Bauten');
-INSERT INTO gifi (accno,description) VALUES ('0080', 'Bauten a.eig. Grundstücken,Grgl.Rec');
-INSERT INTO gifi (accno,description) VALUES ('0085', 'Grundstückswert eige.bebau.Grundst.');
-INSERT INTO gifi (accno,description) VALUES ('0090', 'Geschäftsbauten');
-INSERT INTO gifi (accno,description) VALUES ('0100', 'Fabrikbauten');
-INSERT INTO gifi (accno,description) VALUES ('0110', 'Garagen');
-INSERT INTO gifi (accno,description) VALUES ('0111', 'Außenanlagen');
-INSERT INTO gifi (accno,description) VALUES ('0112', 'Hof-und Wegebefestigung');
-INSERT INTO gifi (accno,description) VALUES ('0113', 'Einr.f.Geschäfts-u.Fabrikbauten');
-INSERT INTO gifi (accno,description) VALUES ('0115', 'Andere Bauten');
-INSERT INTO gifi (accno,description) VALUES ('0120', 'Geschäfts-,Fabrik-,andere Bau.imBau');
-INSERT INTO gifi (accno,description) VALUES ('0129', 'Anz.Geschäfts-,Fabrik u. and.Bauten');
-INSERT INTO gifi (accno,description) VALUES ('0140', 'Wohnbauten');
-INSERT INTO gifi (accno,description) VALUES ('0145', 'Garagen');
-INSERT INTO gifi (accno,description) VALUES ('0146', 'Aussenanlagen');
-INSERT INTO gifi (accno,description) VALUES ('0147', 'Hof-u.Wegebefestigungen');
-INSERT INTO gifi (accno,description) VALUES ('0148', 'Einr.f.Wohnbauten');
-INSERT INTO gifi (accno,description) VALUES ('0150', 'Wohnbauten im Bau');
-INSERT INTO gifi (accno,description) VALUES ('0159', 'Anz.a.Wohnb.a.eig.Grundst.u.grundstgl.Re.');
-INSERT INTO gifi (accno,description) VALUES ('0160', 'Bauten auf fremden Grundstücken');
-INSERT INTO gifi (accno,description) VALUES ('0165', 'Geschäftsbauten');
-INSERT INTO gifi (accno,description) VALUES ('0170', 'Fabrikbauten');
-INSERT INTO gifi (accno,description) VALUES ('0175', 'Garagen');
-INSERT INTO gifi (accno,description) VALUES ('0176', 'Außenanlage');
-INSERT INTO gifi (accno,description) VALUES ('0177', 'Hof-u.Wegebefestigungen');
-INSERT INTO gifi (accno,description) VALUES ('0178', 'Einr.f.Geschäfts-u.Fabrikbauten');
-INSERT INTO gifi (accno,description) VALUES ('0179', 'Andere Bauten');
-INSERT INTO gifi (accno,description) VALUES ('0180', 'Geschäfts,-Farbik-u.and.Bauten i.Bau');
-INSERT INTO gifi (accno,description) VALUES ('0189', 'Anz.a.Geschäfts-,Fabr.-u.and.Bauten a.fremd.Grundst.');
-INSERT INTO gifi (accno,description) VALUES ('0190', 'Wohnbauten');
-INSERT INTO gifi (accno,description) VALUES ('0191', 'Garagen');
-INSERT INTO gifi (accno,description) VALUES ('0192', 'Aussenanlagen');
-INSERT INTO gifi (accno,description) VALUES ('0193', 'Hof-u.Wegebefestigung');
-INSERT INTO gifi (accno,description) VALUES ('0194', 'Einr.für Wohnbauten');
-INSERT INTO gifi (accno,description) VALUES ('0195', 'Wohnbauten i.Bau');
-INSERT INTO gifi (accno,description) VALUES ('0199', 'Anz.a.Wohnb.a.fremd.Grundst.');
-INSERT INTO gifi (accno,description) VALUES ('0200', 'Techn.Anlagen und Maschinen');
-INSERT INTO gifi (accno,description) VALUES ('0210', 'Maschinen');
-INSERT INTO gifi (accno,description) VALUES ('0220', 'Maschinengebundene Werkzeuge');
-INSERT INTO gifi (accno,description) VALUES ('0240', 'Maschinelle Anlagen');
-INSERT INTO gifi (accno,description) VALUES ('0260', 'Transportanlagen u.ähnl.');
-INSERT INTO gifi (accno,description) VALUES ('0280', 'Betriebsvorrichtung');
-INSERT INTO gifi (accno,description) VALUES ('0290', 'Techn.Anlagen u.Maschinen im Bau');
-INSERT INTO gifi (accno,description) VALUES ('0299', 'Anz.a.techn.Anlagen und Maschinen');
-INSERT INTO gifi (accno,description) VALUES ('0300', 'Andere Anlagen,Betrieb-Geschäftsaus');
-INSERT INTO gifi (accno,description) VALUES ('0310', 'Andere Anlagen');
-INSERT INTO gifi (accno,description) VALUES ('0320', 'PKW');
-INSERT INTO gifi (accno,description) VALUES ('0350', 'LKW');
-INSERT INTO gifi (accno,description) VALUES ('0380', 'Sonst.Transportmittel');
-INSERT INTO gifi (accno,description) VALUES ('0400', 'Betriebsausstattung');
-INSERT INTO gifi (accno,description) VALUES ('0410', 'Geschäftsausstattung');
-INSERT INTO gifi (accno,description) VALUES ('0420', 'Büroeinrichtung');
-INSERT INTO gifi (accno,description) VALUES ('0430', 'Ladeneinrichtung');
-INSERT INTO gifi (accno,description) VALUES ('0440', 'Werkzeuge');
-INSERT INTO gifi (accno,description) VALUES ('0450', 'Einbauten');
-INSERT INTO gifi (accno,description) VALUES ('0460', 'Gerüst-u.Schalungsmaterial');
-INSERT INTO gifi (accno,description) VALUES ('0480', 'Geringwertige Wirtschaftsg.b.800DM');
-INSERT INTO gifi (accno,description) VALUES ('0490', 'Sons.Betriebs- Geschäftsausstattung');
-INSERT INTO gifi (accno,description) VALUES ('0498', 'And. Anlagen,Betrieb/Geschäf.im Bau');
-INSERT INTO gifi (accno,description) VALUES ('0499', 'Anz.and.Anlagen,Betrieb.Geschäftsau');
-INSERT INTO gifi (accno,description) VALUES ('0500', 'Anteile a.verb.Unternehmen');
-INSERT INTO gifi (accno,description) VALUES ('0504', 'Ant.a.herr.o.m.Mehrh.bet.Ges.schaft');
-INSERT INTO gifi (accno,description) VALUES ('0505', 'Ausleihung an verb.Unternehmen');
-INSERT INTO gifi (accno,description) VALUES ('0510', 'Beteiligungen');
-INSERT INTO gifi (accno,description) VALUES ('0513', 'Typisch stille Beteiligungen');
-INSERT INTO gifi (accno,description) VALUES ('0516', 'Atypische stille Beteiligungen');
-INSERT INTO gifi (accno,description) VALUES ('0517', 'And.Beteilig.an Kapitalgesellsch.');
-INSERT INTO gifi (accno,description) VALUES ('0518', 'And.Beteilig.an Personengesellsch.');
-INSERT INTO gifi (accno,description) VALUES ('0519', 'Beteilig.einer GmbH&Co.KGa.ein.Kompl.GmbH');
-INSERT INTO gifi (accno,description) VALUES ('0520', 'Ausl.a.Untern.m.Beteiligungsverhält');
-INSERT INTO gifi (accno,description) VALUES ('0525', 'Wertpapiere des Anlagevermögens');
-INSERT INTO gifi (accno,description) VALUES ('0530', 'Wertpap.m.Gewinnbeteiligungsanspr.');
-INSERT INTO gifi (accno,description) VALUES ('0535', 'Festverzinsliche Wertpapiere');
-INSERT INTO gifi (accno,description) VALUES ('0540', 'Sonstige Ausleihungen');
-INSERT INTO gifi (accno,description) VALUES ('0550', 'Darlehen');
-INSERT INTO gifi (accno,description) VALUES ('0570', 'Genossenschaftsant.z.langfr.Verbleib');
-INSERT INTO gifi (accno,description) VALUES ('0580', 'Ausleihungen an Gesellschafter');
-INSERT INTO gifi (accno,description) VALUES ('0590', 'Ausleihungen an nahe stehende Personen');
-INSERT INTO gifi (accno,description) VALUES ('0595', 'Rückdeckansp.Lebensvers.langf.Verbl');
-INSERT INTO gifi (accno,description) VALUES ('0600', 'Anleihen-nicht konvertibel');
-INSERT INTO gifi (accno,description) VALUES ('0601', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('0605', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('0610', '- Restlaufzeit grösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('0615', 'Anleihen konvertibel');
-INSERT INTO gifi (accno,description) VALUES ('0616', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('0620', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('0625', '- Restlaufzeit gösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('0630', 'Verbindl.gegenüber Kreditinstituten');
-INSERT INTO gifi (accno,description) VALUES ('0631', '- Restlaufzeit b.1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('0640', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('0650', '- Restlaufzeit grösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('0660', 'Vblk.geg.Kreditinst.aus TZ-Verträgen');
-INSERT INTO gifi (accno,description) VALUES ('0661', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('0670', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('0680', '- Restlaufzeit grösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('0690', '(fr.i.Bilanz k.Restlaufzeitvermerk');
-INSERT INTO gifi (accno,description) VALUES ('0699', 'Gegenkonto 630-689 b.Auft.d.Konten 690-698');
-INSERT INTO gifi (accno,description) VALUES ('0700', 'Verbind.gegenüber verb.Unternehmern');
-INSERT INTO gifi (accno,description) VALUES ('0701', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('0705', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('0710', '- Restlaufzeit grösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('0715', 'Vblk.geg.Untern.m.denen ein Beteiligungsverh.best.');
-INSERT INTO gifi (accno,description) VALUES ('0716', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('0720', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('0725', '- Restlaufzeit grösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('0730', 'Vblk.geg.Gesellschaftern');
-INSERT INTO gifi (accno,description) VALUES ('0731', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('0740', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('0750', '- Restlaufzeit grösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('0755', 'Vblk.geg.Gesellsch.f.offene Ausschüttungen');
-INSERT INTO gifi (accno,description) VALUES ('0760', 'Darl.typ.stiller Gesellschafter');
-INSERT INTO gifi (accno,description) VALUES ('0761', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('0764', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('0767', '- Restlaufzeit grösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('0770', 'Darlehen atyp.stiller Gesellsch.');
-INSERT INTO gifi (accno,description) VALUES ('0771', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('0774', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('0777', '- Restlaufzeit grösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('0780', 'Partiarische Darlehen');
-INSERT INTO gifi (accno,description) VALUES ('0781', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('0784', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('0787', '- Restlaufzeit über 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('0790', 'fr.in Bilanz k.Restlaufzeitvermerk');
-INSERT INTO gifi (accno,description) VALUES ('0799', 'Gegenk.730-789 b.Auft.d.Konten 790-798');
-INSERT INTO gifi (accno,description) VALUES ('0800', 'Gezeichnetes Kapital');
-INSERT INTO gifi (accno,description) VALUES ('0801', 'Ausst.Einl.a.gez.Kapital n.eingef.(Aktivausw.)');
-INSERT INTO gifi (accno,description) VALUES ('0810', '');
-INSERT INTO gifi (accno,description) VALUES ('0840', 'Kapitalrücklage');
-INSERT INTO gifi (accno,description) VALUES ('0846', 'Gesetzliche Rücklage');
-INSERT INTO gifi (accno,description) VALUES ('0850', 'Rücklage für eigene Anteile');
-INSERT INTO gifi (accno,description) VALUES ('0851', 'Satzungsmäßige Rücklagen');
-INSERT INTO gifi (accno,description) VALUES ('0860', 'Gewinnvortrag vor Verwendung');
-INSERT INTO gifi (accno,description) VALUES ('0868', 'Verlustvortrag vor Verwendung');
-INSERT INTO gifi (accno,description) VALUES ('0869', 'Vortrag auf neue Rechnungen (Bilanz)');
-INSERT INTO gifi (accno,description) VALUES ('0870', 'Festkapital');
-INSERT INTO gifi (accno,description) VALUES ('0880', 'Variables Kapital');
-INSERT INTO gifi (accno,description) VALUES ('0890', 'Gesellschafter-Darlehen');
-INSERT INTO gifi (accno,description) VALUES ('0900', 'Kommandit-Kapital');
-INSERT INTO gifi (accno,description) VALUES ('0910', 'Verlustausgleichskonto');
-INSERT INTO gifi (accno,description) VALUES ('0920', 'Gesellschafter-Darlehen');
-INSERT INTO gifi (accno,description) VALUES ('0930', 'Sonderposten mit Rücklagenanteil stfr.Rückl.');
-INSERT INTO gifi (accno,description) VALUES ('0931', 'Sopo m.Rückl.ant.nach §6b EstG');
-INSERT INTO gifi (accno,description) VALUES ('0932', 'Sopo m.Rückl.ant.Abschn.35 EstR');
-INSERT INTO gifi (accno,description) VALUES ('0935', 'Sopo aus Währungsumstellung Euro');
-INSERT INTO gifi (accno,description) VALUES ('0947', 'Sopo m.Rückl.ant. §7g Abs.1 EstG');
-INSERT INTO gifi (accno,description) VALUES ('0948', 'Sopo m.Rückl.ant. §7g Abs.3,7 EstG');
-INSERT INTO gifi (accno,description) VALUES ('0949', 'Sopo f.Zuschüsse u.Zulagen');
-INSERT INTO gifi (accno,description) VALUES ('0950', 'Rückst.f.Pensionen u.ähnl.Verpflichtungen');
-INSERT INTO gifi (accno,description) VALUES ('0955', 'Steuerrückstellung');
-INSERT INTO gifi (accno,description) VALUES ('0957', 'Gewerbesteuerrückstellung');
-INSERT INTO gifi (accno,description) VALUES ('0963', 'Körperschaftssteuerrückstellung');
-INSERT INTO gifi (accno,description) VALUES ('0969', 'Rückstellung für latente Steuern');
-INSERT INTO gifi (accno,description) VALUES ('0970', 'Sonstige Rückstellungen');
-INSERT INTO gifi (accno,description) VALUES ('0971', 'Rückst.f.unterl.Aufw.f.Instandh.,Nachh.i.d.erst.drei Mt.');
-INSERT INTO gifi (accno,description) VALUES ('0972', 'Rückst.f.unterl.Aufw.f.Instandh.,Nachh.inn.d.4-12.Mt.');
-INSERT INTO gifi (accno,description) VALUES ('0973', 'Rückst.f.Abraum-u.Abfallbeseitigung');
-INSERT INTO gifi (accno,description) VALUES ('0974', 'Rückstellungen für Gewährleistungen Gegenkto.4970');
-INSERT INTO gifi (accno,description) VALUES ('0976', 'Rücks.f.drohe.Verl.schweb.Geschäft');
-INSERT INTO gifi (accno,description) VALUES ('0977', 'Rücks.f.Abschluß-u.Prüfungskosten');
-INSERT INTO gifi (accno,description) VALUES ('0978', 'Aufwandsrückstellungen gem.§249 (2)');
-INSERT INTO gifi (accno,description) VALUES ('0979', 'Rückst.f.Umweltschutz');
-INSERT INTO gifi (accno,description) VALUES ('0980', 'Aktive Rechnungsabgrenzung');
-INSERT INTO gifi (accno,description) VALUES ('0983', 'Abgrenzung aktive latente Steuern');
-INSERT INTO gifi (accno,description) VALUES ('0984', 'Als Aufw.berücks.Zölle u.Verbrauchsst.a.Vorräte');
-INSERT INTO gifi (accno,description) VALUES ('0985', 'Als Aufw.berücks.Ust.auf Anzahlungen');
-INSERT INTO gifi (accno,description) VALUES ('0986', 'Damnum/Disagio');
-INSERT INTO gifi (accno,description) VALUES ('0990', 'Passive Rechnungsabgrenzung');
-INSERT INTO gifi (accno,description) VALUES ('0992', 'Wertberichtigungen z.unterjähhr.Kostenver.f.BWA');
-INSERT INTO gifi (accno,description) VALUES ('0996', 'Pauschalwertb.m.Restlaufzeit bis 1J.');
-INSERT INTO gifi (accno,description) VALUES ('0997', 'PWB a.Ford.m.einer RLZ v.mehr als 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('0998', 'Einzelwertber.m.Restlaufzeit bis.1 J.');
-INSERT INTO gifi (accno,description) VALUES ('0999', 'Einzelwertber.a.Ford.m.einer RLZ v.mehr als 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1000', 'Kasse');
-INSERT INTO gifi (accno,description) VALUES ('1100', 'Postbank');
-INSERT INTO gifi (accno,description) VALUES ('1200', 'Bank');
-INSERT INTO gifi (accno,description) VALUES ('1300', 'Wechsel a. Lieferungen u.Leistungen');
-INSERT INTO gifi (accno,description) VALUES ('1301', '- Restlaufzeit b.1Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1302', '- Restlaufzeit grösser als 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1305', 'Wechsel a.Lief.u.Leist.,bundesbankfähig');
-INSERT INTO gifi (accno,description) VALUES ('1310', 'Besitzwechsel geg.verb.Unternehmen');
-INSERT INTO gifi (accno,description) VALUES ('1311', '- Restlaufzeit b.1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1312', '- Restlaufzeit grösser als 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1315', 'Besitzwechsel geg.verb.Untern.,bundesbankfähig');
-INSERT INTO gifi (accno,description) VALUES ('1320', 'Besitzw.geg.Untern.m.Beteiligungsve');
-INSERT INTO gifi (accno,description) VALUES ('1321', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1322', '- Restlaufzeit grösser als 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1325', 'Besitzwechsel geg.Untern.m.denen e.Beteilig.Verh.best.bbf');
-INSERT INTO gifi (accno,description) VALUES ('1327', 'Finanzwechsel');
-INSERT INTO gifi (accno,description) VALUES ('1329', 'And.Wertpap.m.unwesentl.Wertschwank.i.S.Textz.18DRS 2');
-INSERT INTO gifi (accno,description) VALUES ('1330', 'Schecks (Eingang)');
-INSERT INTO gifi (accno,description) VALUES ('1340', 'Anteile verb.Untern.-Umlaufvermögen');
-INSERT INTO gifi (accno,description) VALUES ('1344', 'Anteil an herr.od.m.betei.Gesellschaft');
-INSERT INTO gifi (accno,description) VALUES ('1345', 'Eigene Anteile');
-INSERT INTO gifi (accno,description) VALUES ('1348', 'Sonstige Wertpapiere');
-INSERT INTO gifi (accno,description) VALUES ('1349', 'Wertpapieranl.i.Rahmen d.kurzfr.Finanzdisposition');
-INSERT INTO gifi (accno,description) VALUES ('1350', 'GmbH-Anteile z.kurzfr.Verbleib');
-INSERT INTO gifi (accno,description) VALUES ('1352', 'Genossenschaftsant.z.kurzfr.Verbleib');
-INSERT INTO gifi (accno,description) VALUES ('1355', 'Anspr.a.Rückdeckungsvers.');
-INSERT INTO gifi (accno,description) VALUES ('1360', 'Geldtransit');
-INSERT INTO gifi (accno,description) VALUES ('1370', 'Verrechnungskto.f.Gewinnerm.§4/3 EStG,ergebniswirks.');
-INSERT INTO gifi (accno,description) VALUES ('1371', 'Verrechnungskto.f.Gewinnerm.§4/3 EStG,n.ergebniswirks.');
-INSERT INTO gifi (accno,description) VALUES ('1380', 'Überleitungskonto Kostenstelle');
-INSERT INTO gifi (accno,description) VALUES ('1390', 'Verrechnungskonto Ist-Versteuerung');
-INSERT INTO gifi (accno,description) VALUES ('1400', 'Ford. a.Lieferungen und Leistungen');
-INSERT INTO gifi (accno,description) VALUES ('1401', 'Ford.a.Lieferungen und Leistungen');
-INSERT INTO gifi (accno,description) VALUES ('1410', 'Ford.a.Lief.u.Leist. ohne Kontokorrent');
-INSERT INTO gifi (accno,description) VALUES ('1450', 'Ford.n.§11(1)2EStG f.§4/3 EStG');
-INSERT INTO gifi (accno,description) VALUES ('1451', 'Ford.a.Lief.u.Leist.ohn.Kontok.-RLZ b.1Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1455', '- Restlaufzeit grösser als 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1460', 'Zweifelhafte Forderungen');
-INSERT INTO gifi (accno,description) VALUES ('1461', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1465', '- Restlaufzeit grösser als 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1470', 'Forder.a.Liefe.u.Leis.geg.verb.Unte');
-INSERT INTO gifi (accno,description) VALUES ('1471', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1475', '- Restlaufzeit grösser als 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1478', 'Wertb.a.Ford.m.Rest. bis 1j.geg.verb.Unt');
-INSERT INTO gifi (accno,description) VALUES ('1479', 'Wertber.a.Ford.m.e.RLZ v.mehr als 1J geg.verb.Untern.');
-INSERT INTO gifi (accno,description) VALUES ('1480', 'Ford. Lief.u.Leis.geg.Untern.m.Beteiligve');
-INSERT INTO gifi (accno,description) VALUES ('1481', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1485', '- Restlaufzeit grösser als 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1488', 'Wertb.a.Ford.m.Rest.bis 1j.Beteiligungs');
-INSERT INTO gifi (accno,description) VALUES ('1489', 'Wertber.a.Ford.m.e.RLZ v.mehr a.1J geg.Untern.m.Bet.verh.');
-INSERT INTO gifi (accno,description) VALUES ('1490', 'Forderung a.Leis.u.Lief.geg.Gesells');
-INSERT INTO gifi (accno,description) VALUES ('1491', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1495', '- Restlaufzeit gösser als 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1498', 'Gegenk.zu sonst.VG b.Buchungen ü.Debitorenkonto');
-INSERT INTO gifi (accno,description) VALUES ('1499', 'Gegenk. 1451-1497 b.Aufteilung Debiorenkonto');
-INSERT INTO gifi (accno,description) VALUES ('1500', 'Sonstige Vermögensgegenstände');
-INSERT INTO gifi (accno,description) VALUES ('1501', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1502', '- Restlaufzeit grösser als 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1503', 'Forde.geg.Vorstandsm.u.Geschäftsfüh RLZ b.1J');
-INSERT INTO gifi (accno,description) VALUES ('1504', 'Ford.geg.Vorstandsmitgl.u.Geschäftsf. RLZ > 1 J.');
-INSERT INTO gifi (accno,description) VALUES ('1505', 'Ford.geg.Aufsichtsrats-u.Beiratsmitgl. RLZ b.1J.');
-INSERT INTO gifi (accno,description) VALUES ('1506', 'Ford.geg.Aufsichtsrats-u.Beiratsmitgl. RLZ > 1 J.');
-INSERT INTO gifi (accno,description) VALUES ('1507', 'Ford.geg.Gesellschafter RLZ bis 1 J.');
-INSERT INTO gifi (accno,description) VALUES ('1508', 'Forderungen gegen Gesellschafter RLZ > 1J');
-INSERT INTO gifi (accno,description) VALUES ('1510', 'Geleistete Anzahlung auf Vorräte');
-INSERT INTO gifi (accno,description) VALUES ('1511', 'Geleistete Anzahlungen 7%');
-INSERT INTO gifi (accno,description) VALUES ('1517', 'Geleistete Anzahlung 16%');
-INSERT INTO gifi (accno,description) VALUES ('1521', 'Agenturwarenabrechnung');
-INSERT INTO gifi (accno,description) VALUES ('1525', 'Kautionen');
-INSERT INTO gifi (accno,description) VALUES ('1526', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1527', '- Restlaufzeit > 1 J.');
-INSERT INTO gifi (accno,description) VALUES ('1530', 'Forderungen aus Lohn-u.Gehaltsabrechnung');
-INSERT INTO gifi (accno,description) VALUES ('1531', '- Restlaufzeit b.1J.');
-INSERT INTO gifi (accno,description) VALUES ('1537', '- Restlaufzeit grösser als 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1540', 'Steuerüberzahlungen');
-INSERT INTO gifi (accno,description) VALUES ('1542', 'Steuererstattungsanspr.gegenüber and.EG-Länd.');
-INSERT INTO gifi (accno,description) VALUES ('1543', 'Ford.a.d.Finanzamt a.abgef.Bauabzugsbetrag');
-INSERT INTO gifi (accno,description) VALUES ('1545', 'Umsatzsteuerforderungen');
-INSERT INTO gifi (accno,description) VALUES ('1547', 'Ford.aus entrichteten Verbrauchsteuern');
-INSERT INTO gifi (accno,description) VALUES ('1548', 'Vorsteuer im Folgejahr abziehbar');
-INSERT INTO gifi (accno,description) VALUES ('1549', 'Körperschaftsteuerrückforderung');
-INSERT INTO gifi (accno,description) VALUES ('1550', 'Darlehen');
-INSERT INTO gifi (accno,description) VALUES ('1551', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1555', '- Restlaufzeit grösser als 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1556', 'Nachträgl.abziehb.Vorst.,§15aUStG,bewegl.WG');
-INSERT INTO gifi (accno,description) VALUES ('1557', 'Zurückzuzahlende Vorsteuer §15a UStG,bewegl.WG');
-INSERT INTO gifi (accno,description) VALUES ('1558', 'Nachträgl.abziehb.Vorst.§15aUStG,unbewegl.WG');
-INSERT INTO gifi (accno,description) VALUES ('1559', 'Zurückzuzahlende Vorst.§15aUStG,unbewegl.WG');
-INSERT INTO gifi (accno,description) VALUES ('1560', 'Aufzuteilende Vorsteuer');
-INSERT INTO gifi (accno,description) VALUES ('1561', 'Aufzuteilende Vorsteuer 7%');
-INSERT INTO gifi (accno,description) VALUES ('1562', 'Aufzuteilende Vorst.a.innergem.Erwerb');
-INSERT INTO gifi (accno,description) VALUES ('1565', 'Aufzuteilende Vorsteuer 16%');
-INSERT INTO gifi (accno,description) VALUES ('1567', 'Aufzuteilende Vorst.n.§13b UStG');
-INSERT INTO gifi (accno,description) VALUES ('1568', 'Aufzuteilende Vorst.n.§13b UStG 16%');
-INSERT INTO gifi (accno,description) VALUES ('1570', 'Abziehbare Vorsteuer');
-INSERT INTO gifi (accno,description) VALUES ('1571', 'Abziebare Vorsteuer 7%');
-INSERT INTO gifi (accno,description) VALUES ('1572', 'Abziehb. VorSt innergemein. Erwerb');
-INSERT INTO gifi (accno,description) VALUES ('1573', 'Abziehb.VorSt. innergem.Erwerb 16%');
-INSERT INTO gifi (accno,description) VALUES ('1575', 'Abziehbare Vorsteuer 16%');
-INSERT INTO gifi (accno,description) VALUES ('1577', 'Vorst.n.allgem.Durchschnittssätzen UStVA Kz.63');
-INSERT INTO gifi (accno,description) VALUES ('1578', 'Abziehb.VorSt. n. §13b UStG');
-INSERT INTO gifi (accno,description) VALUES ('1579', 'Abziehb.VorSt. n.§13b UStG 16%');
-INSERT INTO gifi (accno,description) VALUES ('1580', 'Gegenkonto Vorsteuer §4/3 EStG');
-INSERT INTO gifi (accno,description) VALUES ('1581', 'Auflösung Vorst.a.Vorjahr §4/3 EStG');
-INSERT INTO gifi (accno,description) VALUES ('1584', 'abziehb.VorSt IG Erwerb Neufzg.b.Lief. o. USt.Ident.Nr');
-INSERT INTO gifi (accno,description) VALUES ('1588', 'Bezahlte Einfuhrumsatzsteuer');
-INSERT INTO gifi (accno,description) VALUES ('1590', 'Durchlaufende Posten');
-INSERT INTO gifi (accno,description) VALUES ('1592', 'Fremdgeld');
-INSERT INTO gifi (accno,description) VALUES ('1593', 'Verrechnungskto.erh.Anz.bei Buchung über Debitorenkto.');
-INSERT INTO gifi (accno,description) VALUES ('1594', 'Forderungen geg. verb. Unternehmen');
-INSERT INTO gifi (accno,description) VALUES ('1595', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1596', '- Restlaufzeit grösser als 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1597', 'Ford.geg.Untern.m.Beteiligungsverh.');
-INSERT INTO gifi (accno,description) VALUES ('1598', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1599', '- Restlaufzeit grösser als 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1600', 'Verbindlichkeiten aus Lief.u.Leist.');
-INSERT INTO gifi (accno,description) VALUES ('1601', 'Verbindlichkeiten a.Lief.und Leist.');
-INSERT INTO gifi (accno,description) VALUES ('1610', 'Vblk.a.Lief.u.Leist.ohne Kontokorrent');
-INSERT INTO gifi (accno,description) VALUES ('1624', 'Vblk.a.Lief.u.Leist.f.Investitionen f.§4/3 EStG');
-INSERT INTO gifi (accno,description) VALUES ('1625', 'Vblk.a.Lief.u.Leist.o.Kontokorrent RLZ b.1Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1626', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1628', '- Restlaufzeit grösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1630', 'Verbindl.Lief.u.Leist.gegü.verb.Unt');
-INSERT INTO gifi (accno,description) VALUES ('1631', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1635', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1638', '- Restlaufzeit grösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1640', 'Verb.L.u.L gegü.Unter.m.Beteiligungsv');
-INSERT INTO gifi (accno,description) VALUES ('1641', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1645', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1648', '- Restlaufzeit grösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1650', 'Verb.L.u.L gegü.Gesellschaftern');
-INSERT INTO gifi (accno,description) VALUES ('1651', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1655', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1658', '- Restlaufzeit grösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1659', 'Gegenkto. 1625-1658 b.Aufteilung Kreditorenkonto');
-INSERT INTO gifi (accno,description) VALUES ('1660', 'Schuldwechsel');
-INSERT INTO gifi (accno,description) VALUES ('1661', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1680', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1690', '- Restlaufzeit grösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1700', 'Sonstige Verbindlichkeiten');
-INSERT INTO gifi (accno,description) VALUES ('1701', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1702', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1703', '- Restlaufzeit grösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1704', 'Sonst.Vblk.z.B.n.§11(2)S.2EStGf.§4/3EStG');
-INSERT INTO gifi (accno,description) VALUES ('1705', 'Darlehen');
-INSERT INTO gifi (accno,description) VALUES ('1706', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1707', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1708', '- Restlaufzeit grösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1709', 'Gewinnverfügungskonto stiller Ges.');
-INSERT INTO gifi (accno,description) VALUES ('1710', 'Erhaltene Anzahlungen-Verbindlichke');
-INSERT INTO gifi (accno,description) VALUES ('1711', 'Erhaltene,versteuerte Anzahlungen 7% (Vblk)');
-INSERT INTO gifi (accno,description) VALUES ('1716', 'Erhaltene verst.Anzahlungen 15% USt(Vblk.)');
-INSERT INTO gifi (accno,description) VALUES ('1717', 'Erhaltene,versteuerte Anzahl. 16%(Vblk)');
-INSERT INTO gifi (accno,description) VALUES ('1719', 'Erhaltene Anzahlungen bis 1j.');
-INSERT INTO gifi (accno,description) VALUES ('1720', '- Restlaufzeit 1 b.5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1721', '- Restlaufzeit grösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1722', 'Erhaltene Anzahlung v.Vorräten offen abgesetzt');
-INSERT INTO gifi (accno,description) VALUES ('1730', 'Kreditkartenabrechnung');
-INSERT INTO gifi (accno,description) VALUES ('1731', 'Agenturwarenabrechnung');
-INSERT INTO gifi (accno,description) VALUES ('1732', 'Erhaltene Kautionen');
-INSERT INTO gifi (accno,description) VALUES ('1733', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1734', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1735', '- Restlaufzeit grösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1736', 'Vblk.a.Betriebssteuern u.-abgaben');
-INSERT INTO gifi (accno,description) VALUES ('1737', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1738', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1739', '- Restlaufzeit grösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1740', 'Vblk.aus Lohn-u.Gehalt');
-INSERT INTO gifi (accno,description) VALUES ('1741', 'Verbindl.a.Lohn-und Kirchensteuer');
-INSERT INTO gifi (accno,description) VALUES ('1742', 'Vblk.i.Rahmen d.sozialen Sicherheit');
-INSERT INTO gifi (accno,description) VALUES ('1743', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1744', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1745', '- Restlaufzeit grösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1746', 'Vblk.aus Einbehaltungen (KapESt)');
-INSERT INTO gifi (accno,description) VALUES ('1747', 'Vblk.f.Verbrauchsteuern');
-INSERT INTO gifi (accno,description) VALUES ('1748', 'Vblk.f.Einbehaltungen v.Arbeitnehmern');
-INSERT INTO gifi (accno,description) VALUES ('1749', 'Vblk.a.das Finanzamt a.abzuführendem Bauabzugsbetrag');
-INSERT INTO gifi (accno,description) VALUES ('1750', 'Vblk.a.Vermögensbildung');
-INSERT INTO gifi (accno,description) VALUES ('1751', '- Restlaufzeit bis 1 Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1752', '- Restlaufzeit 1 bis 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1753', '- Restlaufzeit grösser als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1754', 'Steuerzahlungen an andere EG-Länder');
-INSERT INTO gifi (accno,description) VALUES ('1755', 'Lohn-und Gehaltsverrechnung');
-INSERT INTO gifi (accno,description) VALUES ('1758', 'USt-Abzugsverfahren 16% od.USt.n.§13bUStG');
-INSERT INTO gifi (accno,description) VALUES ('1760', 'Umsatzsteuer nicht fällig');
-INSERT INTO gifi (accno,description) VALUES ('1761', 'Umsatzsteuer nicht fällig 7%');
-INSERT INTO gifi (accno,description) VALUES ('1762', 'Umsatzsteuer nicht fällig a.im Inland stpfl.EG Lief.');
-INSERT INTO gifi (accno,description) VALUES ('1763', 'Umsatzsteuer nicht fällig a.i.Inland stpfl.EG-Lief.16%');
-INSERT INTO gifi (accno,description) VALUES ('1765', 'Umsatzsteuer n.fällig 16%');
-INSERT INTO gifi (accno,description) VALUES ('1767', 'Umsatzsteuer a.i.anderen EG-Land stpfl.Lieferungen');
-INSERT INTO gifi (accno,description) VALUES ('1768', 'Umsatzsteuer a.i.and.EG-Land stpfl.sonst.Leist./Werklief.');
-INSERT INTO gifi (accno,description) VALUES ('1770', 'Umsatzsteuer');
-INSERT INTO gifi (accno,description) VALUES ('1771', 'Umsatzsteuer 7%');
-INSERT INTO gifi (accno,description) VALUES ('1772', 'Umsatzsteuer aus innergem. Erwerb');
-INSERT INTO gifi (accno,description) VALUES ('1773', 'Umsatzsteuer innergem.Erwerb 16%');
-INSERT INTO gifi (accno,description) VALUES ('1775', 'Umsatzsteuer 16%');
-INSERT INTO gifi (accno,description) VALUES ('1777', 'Ust aus im Inland stpfl. EG-Lief16%');
-INSERT INTO gifi (accno,description) VALUES ('1779', 'Umsatzsteuer a.innergem.Erwerb ohne Vorsteuerabzug');
-INSERT INTO gifi (accno,description) VALUES ('1780', 'Umsatzsteuer-Vorauszahlungen');
-INSERT INTO gifi (accno,description) VALUES ('1781', 'Umsatzsteuer-Vorauszahlung 1/11');
-INSERT INTO gifi (accno,description) VALUES ('1782', 'Nachsteuer, UStVA Kz.65');
-INSERT INTO gifi (accno,description) VALUES ('1783', 'In Rechn unberecht.ausgew.geschuld.Steuerbetr.UStVAKz69');
-INSERT INTO gifi (accno,description) VALUES ('1784', 'Ust IG Erwerb Neufahrzeug o.Ust ID');
-INSERT INTO gifi (accno,description) VALUES ('1785', 'Umsatzsteuer n.§13b UStG');
-INSERT INTO gifi (accno,description) VALUES ('1786', 'Umsatzsteuer n.§13b UStG 16%');
-INSERT INTO gifi (accno,description) VALUES ('1788', 'Einfuhrumsatzsteuer augeschoben bis');
-INSERT INTO gifi (accno,description) VALUES ('1789', 'Umsatzsteuer laufendes Jahr');
-INSERT INTO gifi (accno,description) VALUES ('1790', 'Umsatzsteuer Vorjahr');
-INSERT INTO gifi (accno,description) VALUES ('1791', 'Umsatzsteuer frühere Jahre');
-INSERT INTO gifi (accno,description) VALUES ('1792', 'Sonstige Verrechnungskonten');
-INSERT INTO gifi (accno,description) VALUES ('1793', 'Verrechnungskto.geleist.Anz.b.Buchung über Kreditorenkto.');
-INSERT INTO gifi (accno,description) VALUES ('1800', 'Privatentnahme allgemein');
-INSERT INTO gifi (accno,description) VALUES ('1810', 'Privatsteuern');
-INSERT INTO gifi (accno,description) VALUES ('1820', 'Sonderausgaben beschränkt abzugsfähig');
-INSERT INTO gifi (accno,description) VALUES ('1830', 'Sonderausgaben unbeschr.anzugsfähig');
-INSERT INTO gifi (accno,description) VALUES ('1840', 'Zuwendungen, Spenden');
-INSERT INTO gifi (accno,description) VALUES ('1850', 'Aussergewöhnl.Belastungen');
-INSERT INTO gifi (accno,description) VALUES ('1860', 'Grundstücksaufwand');
-INSERT INTO gifi (accno,description) VALUES ('1870', 'Grundstücksertrag');
-INSERT INTO gifi (accno,description) VALUES ('1880', 'Unentgeltliche Wertabgaben');
-INSERT INTO gifi (accno,description) VALUES ('1890', 'Privateinlagen');
-INSERT INTO gifi (accno,description) VALUES ('1900', 'Privatentnahmen allgemein');
-INSERT INTO gifi (accno,description) VALUES ('1910', 'Privatsteuern');
-INSERT INTO gifi (accno,description) VALUES ('1920', 'Sonderausgaben beschränkt abzugsfähig');
-INSERT INTO gifi (accno,description) VALUES ('1930', 'Sonderausgaben unbeschr.anzugsfähig');
-INSERT INTO gifi (accno,description) VALUES ('1940', 'Zuwendungen, Spenden');
-INSERT INTO gifi (accno,description) VALUES ('1950', 'Aussergewöhnl.Belastungen');
-INSERT INTO gifi (accno,description) VALUES ('1960', 'Grundstücksaufwand');
-INSERT INTO gifi (accno,description) VALUES ('1970', 'Grundstücksertrag');
-INSERT INTO gifi (accno,description) VALUES ('1980', 'Unentgeltliche Wertabgaben');
-INSERT INTO gifi (accno,description) VALUES ('1990', 'Privateinlagen');
-INSERT INTO gifi (accno,description) VALUES ('2000', 'Außerordentliche Aufwendung');
-INSERT INTO gifi (accno,description) VALUES ('2001', 'Außerordentl.Aufwendungen finanzwirksam');
-INSERT INTO gifi (accno,description) VALUES ('2005', 'Außerordentl.Aufwendungen nicht finanzwirksam');
-INSERT INTO gifi (accno,description) VALUES ('2010', 'Betriebsfremde Aufwendungen soweit n.außerord.');
-INSERT INTO gifi (accno,description) VALUES ('2020', 'Periodenfremde Aufwend.(soweit n.außerordentlich');
-INSERT INTO gifi (accno,description) VALUES ('2100', 'Zinsen und ähnl.Aufwendungen');
-INSERT INTO gifi (accno,description) VALUES ('2103', 'Steuerl.abzugsfähig,and.Nebenl.zu Steuern');
-INSERT INTO gifi (accno,description) VALUES ('2104', 'Steuerl.nicht.abzugsf.ande.Nl.z.Ste');
-INSERT INTO gifi (accno,description) VALUES ('2107', 'Zinsaufwendung-betriebliche Steuern §223aAO');
-INSERT INTO gifi (accno,description) VALUES ('2108', 'Zinsaufwendung-Personensteuer');
-INSERT INTO gifi (accno,description) VALUES ('2109', 'Zinsaufwendungen an verb.Unternehm.');
-INSERT INTO gifi (accno,description) VALUES ('2110', 'Zinsaufwendung f.kurzf.Verbindlichk');
-INSERT INTO gifi (accno,description) VALUES ('2115', 'Zinsen u.ähnl.Aufwendungen 100%/50% n.abzugsf.(inländ.Kap.Ges)');
-INSERT INTO gifi (accno,description) VALUES ('2116', 'Zinsen u.ähnl.Aufwend.a.verb.Untern.100%/50% n.abzugsf.(inl.Kap.Ges)');
-INSERT INTO gifi (accno,description) VALUES ('2118', 'In Dauerschuldzinsen umqualifizierte Zinsen a.kurzf.Vblk.');
-INSERT INTO gifi (accno,description) VALUES ('2119', 'Zinsaufwend.f.kurzfr.Vblk.an verb.Unternehmen');
-INSERT INTO gifi (accno,description) VALUES ('2120', 'Zinsaufwendung f.langf.Verbindlichk');
-INSERT INTO gifi (accno,description) VALUES ('2126', 'Zinsen zur Finanzierung des Anlagevermögens');
-INSERT INTO gifi (accno,description) VALUES ('2127', 'Renten u.dauernde Lasten a.Gründung/Erwerb §8GewStG');
-INSERT INTO gifi (accno,description) VALUES ('2128', 'Zinsaufwend.an Mituntern.f.d.Hingabe v.langfr.Kapital §15EStG');
-INSERT INTO gifi (accno,description) VALUES ('2129', 'Zinsaufwend.f.langfr.Vblk.an verb.Unternehmen');
-INSERT INTO gifi (accno,description) VALUES ('2130', 'Diskontaufwendung');
-INSERT INTO gifi (accno,description) VALUES ('2139', 'Diskontaufwendungen an verb.Unternehmen');
-INSERT INTO gifi (accno,description) VALUES ('2140', 'Zinsähnliche Aufwendungen');
-INSERT INTO gifi (accno,description) VALUES ('2149', 'Zinsähnl.Aufwendungen an verb.Unternehmen');
-INSERT INTO gifi (accno,description) VALUES ('2150', 'Aufwendungen aus Kursdifferenzen');
-INSERT INTO gifi (accno,description) VALUES ('2165', 'Aufw.a.d.Währungsumstell.a.d.Euro');
-INSERT INTO gifi (accno,description) VALUES ('2166', 'Aufwendungen a.Bewertung Finanzmittelfonds');
-INSERT INTO gifi (accno,description) VALUES ('2170', 'Nicht abziehbare Vorsteuer');
-INSERT INTO gifi (accno,description) VALUES ('2171', 'Nicht abziehbare Vorsteuer 7%');
-INSERT INTO gifi (accno,description) VALUES ('2175', 'Nicht abziehbare Vorsteuer 16%');
-INSERT INTO gifi (accno,description) VALUES ('2200', 'Körperschaftssteuer');
-INSERT INTO gifi (accno,description) VALUES ('2203', 'Körperschaftssteuer für Vorjahr');
-INSERT INTO gifi (accno,description) VALUES ('2205', 'Anrechb.Körperschaftsst.auf vereinn.Kapitalertr.');
-INSERT INTO gifi (accno,description) VALUES ('2208', 'Solidaritätszuschlag');
-INSERT INTO gifi (accno,description) VALUES ('2209', 'Solidaritätszuschlag für Vorjahr');
-INSERT INTO gifi (accno,description) VALUES ('2210', 'Kapitalertragssteuer 25%');
-INSERT INTO gifi (accno,description) VALUES ('2213', 'Anrechb.Solidaritätszusch.Kapitalertragsst.25%');
-INSERT INTO gifi (accno,description) VALUES ('2214', 'Anrechenb.Soli auf Kapitalertragssteuer 20%');
-INSERT INTO gifi (accno,description) VALUES ('2215', 'Zinsabschlagsteuer');
-INSERT INTO gifi (accno,description) VALUES ('2218', 'Anrechb.Solidari.zuschlag a.Zinsabschlagst.');
-INSERT INTO gifi (accno,description) VALUES ('2223', 'Vermögensteuer für Vorjahre');
-INSERT INTO gifi (accno,description) VALUES ('2280', 'Stnachzahl.Vorj.v.Einkomm u.Ertrag');
-INSERT INTO gifi (accno,description) VALUES ('2282', 'Sterstat.Vorj.Steuer v.Eink.u.Ertrag');
-INSERT INTO gifi (accno,description) VALUES ('2284', 'Ertr.a.d.Aufl.v.Rücks.f.St.v.Ein.Er');
-INSERT INTO gifi (accno,description) VALUES ('2285', 'Steuernachzahlung Vorj.f.sons.Steue');
-INSERT INTO gifi (accno,description) VALUES ('2287', 'Steuererstattung Vorj.f.sons.Steuer');
-INSERT INTO gifi (accno,description) VALUES ('2289', 'Erträge a.d.Aufl.v. Rück.f.sons.Ste');
-INSERT INTO gifi (accno,description) VALUES ('2300', 'Sonstige Aufwendungen');
-INSERT INTO gifi (accno,description) VALUES ('2307', 'Sonst.Aufwend.betriebsfremd u.regelmässig');
-INSERT INTO gifi (accno,description) VALUES ('2309', 'Sonst.Aufwend. unregelmäßig');
-INSERT INTO gifi (accno,description) VALUES ('2310', 'Anlagenabgänge Sachanlagen Restbuchw.b.Buchverlust');
-INSERT INTO gifi (accno,description) VALUES ('2311', 'Anlagenabgänge immat.VG (Restbuchw.b.Buchverlust');
-INSERT INTO gifi (accno,description) VALUES ('2312', 'Anlagenabgänge Finanzanlagen (Restbuchw.b.Buchverlust');
-INSERT INTO gifi (accno,description) VALUES ('2313', 'Anlagenabgänge Finanzanl.100%/50% n.abzugsf.(Restbuchw.b.Buchverlust');
-INSERT INTO gifi (accno,description) VALUES ('2315', 'Anlagenabgänge Sachanlagen Restbuchw.b.Buchgewinn');
-INSERT INTO gifi (accno,description) VALUES ('2316', 'Anlagenabgänge immat.VG (Restbuchwert b.Buchgewinn');
-INSERT INTO gifi (accno,description) VALUES ('2317', 'Anlagenabgänge Finanzanlagen (Restbuchwert b.Buchgewinn');
-INSERT INTO gifi (accno,description) VALUES ('2318', 'Anlagenabgänge Finanzanlagen 100%/50% steuerfr.(Restbuchw.b.Buchgewinn');
-INSERT INTO gifi (accno,description) VALUES ('2320', 'Verluste Abgang Gegenst.d.Anlagever');
-INSERT INTO gifi (accno,description) VALUES ('2323', 'Verluste a.d.Veräußerung v.Anteilen a.Kapitalges.100%/50% n.abzugsf.');
-INSERT INTO gifi (accno,description) VALUES ('2325', 'Verlust a.d.Abg.v.Gegens.d.Umlaufve');
-INSERT INTO gifi (accno,description) VALUES ('2340', 'Einstellungen Sopo m.Rückanlageant.steuerfrei');
-INSERT INTO gifi (accno,description) VALUES ('2341', 'Einstellungen in SoPo m.Rücklageanteil (Ansparabschreibung');
-INSERT INTO gifi (accno,description) VALUES ('2345', 'Einstellungen Sopo m.R.(Sonderafa)');
-INSERT INTO gifi (accno,description) VALUES ('2346', 'Einst.in SoPo m.Rücklageanteil (§52 Abs.16 EStG');
-INSERT INTO gifi (accno,description) VALUES ('2347', 'Einst.in SoPo m.Rücklageanteil (aus der Währungsumst.EUR)');
-INSERT INTO gifi (accno,description) VALUES ('2348', 'Aufwend.a.d.Zuschreibung v.steuerlich niedriger bewert.Vblk.');
-INSERT INTO gifi (accno,description) VALUES ('2349', 'Aufwend.a.d.Zuschreibung v.steuerlich niedriger bewert.Rückst.');
-INSERT INTO gifi (accno,description) VALUES ('2350', 'Grundstücksaufwendungen');
-INSERT INTO gifi (accno,description) VALUES ('2375', 'Grundsteuer');
-INSERT INTO gifi (accno,description) VALUES ('2380', 'Zuwend.,Spenden,steuerlich n.abziehbar');
-INSERT INTO gifi (accno,description) VALUES ('2381', 'Zuwend.,Spenden f.wissenschaftl.u.kulturelle Zwecke');
-INSERT INTO gifi (accno,description) VALUES ('2382', 'Zuwend.,Spenden f.mildtätige Zwecke');
-INSERT INTO gifi (accno,description) VALUES ('2383', 'Zuwend.,Spenden f.kirchliche,religiöse u.gemeinnützige Zwecke');
-INSERT INTO gifi (accno,description) VALUES ('2384', 'Zuwend.,Spenden an politische Parteien');
-INSERT INTO gifi (accno,description) VALUES ('2385', 'Nicht abziehb.Hälfte der Aufsichtsratsvergütungen');
-INSERT INTO gifi (accno,description) VALUES ('2386', 'Abziehb.Aufsichtsratsvergütungen');
-INSERT INTO gifi (accno,description) VALUES ('2387', 'Zuwend.,Spenden an Stiftungen f.gemeinnützige Zwecke i.S.d.§52(2)Nr.1-3AO');
-INSERT INTO gifi (accno,description) VALUES ('2388', 'Zuwend.,Spenden an Stiftungen f.gemeinnützige Zwecke i.S.d.§52(2)Nr.4AO');
-INSERT INTO gifi (accno,description) VALUES ('2389', 'Zuwend.,Spenden an Stiftungen f.kirchl.,religöse u.gemeinnützige Zwecke');
-INSERT INTO gifi (accno,description) VALUES ('2390', 'Zuwend.,Spenden an Stiftungen f.wissenschaftl.,mildtätige,kulturelle Zwecke');
-INSERT INTO gifi (accno,description) VALUES ('2400', 'Forderungsverlust-übliche Höhe');
-INSERT INTO gifi (accno,description) VALUES ('2401', 'Forderungsverluste 7% USt.(übliche Höhe');
-INSERT INTO gifi (accno,description) VALUES ('2402', 'Forderungsverluste a.steuerfreien EG-Lief.(übliche Höhe');
-INSERT INTO gifi (accno,description) VALUES ('2403', 'Forderungsverluste a.im Inland steuerpfl.EG-Lieferungen 7% USt.(übliche Höhe');
-INSERT INTO gifi (accno,description) VALUES ('2404', 'Forderungsverluste a.im Inland steuerpfl.EG-Lief.16% USt.(übliche Höhe');
-INSERT INTO gifi (accno,description) VALUES ('2405', 'Forderungsverluste 16% USt.(übliche Höhe');
-INSERT INTO gifi (accno,description) VALUES ('2430', 'Forderungsverluste-unüblich hoch');
-INSERT INTO gifi (accno,description) VALUES ('2450', 'Einstell.i.d.Pauschalwertbe.z.Forde');
-INSERT INTO gifi (accno,description) VALUES ('2451', 'Einstell.i.d.Einzelwertb.z.Forderun');
-INSERT INTO gifi (accno,description) VALUES ('2490', 'Aufwendung aus Verlustübernahme');
-INSERT INTO gifi (accno,description) VALUES ('2492', 'Abgef.Gewinn aufgr.e.Gewinngemeinsc');
-INSERT INTO gifi (accno,description) VALUES ('2493', 'Abgef.Gewinnant.an stille Gesellsch §8GewsT');
-INSERT INTO gifi (accno,description) VALUES ('2494', 'Abgeführte Gewinne auf Grund eines Gewinn-od.Teilgewinnabführungsvertrages');
-INSERT INTO gifi (accno,description) VALUES ('2495', 'Einst.Kapitalrückl.n.Vorschr.über d.vereinf.Kapitalherabsetzung');
-INSERT INTO gifi (accno,description) VALUES ('2496', 'Einstellungen in die gesetzl.Rückla');
-INSERT INTO gifi (accno,description) VALUES ('2497', 'Einstellungen in satzungsmässige Rücklagen');
-INSERT INTO gifi (accno,description) VALUES ('2498', 'Einstellunen in die Rücklage für eigene Anteile');
-INSERT INTO gifi (accno,description) VALUES ('2499', 'Einstellungen in andere Gewinnrücklagen');
-INSERT INTO gifi (accno,description) VALUES ('2500', 'Außerordentliche Erträge');
-INSERT INTO gifi (accno,description) VALUES ('2501', 'Außerordentliche Erträge finanzwirksam');
-INSERT INTO gifi (accno,description) VALUES ('2505', 'Außerordentliche Erträge nicht finanzwirksam');
-INSERT INTO gifi (accno,description) VALUES ('2510', 'Betriebsfremde Erträge nichtaußerorden');
-INSERT INTO gifi (accno,description) VALUES ('2520', 'Periodenfremde Erträge nicht außero');
-INSERT INTO gifi (accno,description) VALUES ('2600', 'Erträge aus Beteiligungen');
-INSERT INTO gifi (accno,description) VALUES ('2615', 'Lfd.Erträge a.Anteilen an Kap.Ges.(Bet.100%/50% steuerfrei(inländ.Kap.Ges)');
-INSERT INTO gifi (accno,description) VALUES ('2616', 'Lfd.Erträge a.Ant.a.Kap.Ges.(verb.Untern)100%/50% steuerfr.(inländ.Kap.Ges)');
-INSERT INTO gifi (accno,description) VALUES ('2617', 'Gewinn aus Anteilen an nicht steuerpfl.inländ.Kapitalges.§92aGewS.');
-INSERT INTO gifi (accno,description) VALUES ('2618', 'Gewinnanteile aus Mitunternehmerschaft §9 GewStG');
-INSERT INTO gifi (accno,description) VALUES ('2619', 'Erträge a.Beteil.a.verb.Untérnehmer');
-INSERT INTO gifi (accno,description) VALUES ('2620', 'Erträge a.anderen Wertp u.Ausleihungen d.FinanzAV');
-INSERT INTO gifi (accno,description) VALUES ('2625', 'Lfd.Erträge a.Anteilen a.Kap.Ges.(FinanzAV)100%/50% steuerfr.(inländ.Kap.Ges)');
-INSERT INTO gifi (accno,description) VALUES ('2626', 'Lfd.Erträge a.Anteilen a.Kap.Ges.(verb.Untern)100%/50% steuerfr.(inländ.Kap.Ges)');
-INSERT INTO gifi (accno,description) VALUES ('2649', 'Erträge a.and.Wertpapieren u.Ausleih.des FinanzAV a.verbund.Untern.');
-INSERT INTO gifi (accno,description) VALUES ('2650', 'Sonstige Zinsen und ähnliche Erträge');
-INSERT INTO gifi (accno,description) VALUES ('2655', 'Lfd.Erträge a.Anteilen a.Kap.Ges.(UV)100%/50% steuerfr.(inländ.Kap.Ges)');
-INSERT INTO gifi (accno,description) VALUES ('2656', 'Lfd.Erträge a.Anteilen a.Kap.Ges.(verb.Untern.)100%/50% steuerfr.(inländ.Kap.Ges)');
-INSERT INTO gifi (accno,description) VALUES ('2657', 'Zinserträge-betriebliche Steuern');
-INSERT INTO gifi (accno,description) VALUES ('2658', 'Zinserträge-Körperschaftssteuer Vermögensst.');
-INSERT INTO gifi (accno,description) VALUES ('2659', 'Sons.Zinsen u.ähl.Ertr.a.verb.Unter');
-INSERT INTO gifi (accno,description) VALUES ('2660', 'Erträge aus Kursdifferenzen');
-INSERT INTO gifi (accno,description) VALUES ('2665', 'Erträge a.d.Währungumst.a.d. Euro');
-INSERT INTO gifi (accno,description) VALUES ('2666', 'Erträge a.Bewertung Finanzmittelfonds');
-INSERT INTO gifi (accno,description) VALUES ('2670', 'Diskonterträge');
-INSERT INTO gifi (accno,description) VALUES ('2679', 'Diskonterträge a.verb.Unternehmen');
-INSERT INTO gifi (accno,description) VALUES ('2680', 'Zinsähnliche Erträge');
-INSERT INTO gifi (accno,description) VALUES ('2689', 'Zinsähnliche Erträge aus verb.Unternehmen');
-INSERT INTO gifi (accno,description) VALUES ('2700', 'Sonstige Erträge');
-INSERT INTO gifi (accno,description) VALUES ('2705', 'Sons.Erträge betrieb. u. regelmäßig');
-INSERT INTO gifi (accno,description) VALUES ('2707', 'Sonst.Erträge betriebsfremd u.regelmäßig');
-INSERT INTO gifi (accno,description) VALUES ('2709', 'Sonst.Erträge unregelmäßig');
-INSERT INTO gifi (accno,description) VALUES ('2710', 'Ertrag a.d.Zuschreib.d.Anlagevermög');
-INSERT INTO gifi (accno,description) VALUES ('2711', 'Erträge aus Zuschreibungen des immat.Anlagevermögens');
-INSERT INTO gifi (accno,description) VALUES ('2712', 'Erträge aus Zuschreibungen des Finanzanlagevermögens');
-INSERT INTO gifi (accno,description) VALUES ('2713', 'Erträge aus Zuschreib. d.Finanzanlagevermögens 100%/50% steuerfrei');
-INSERT INTO gifi (accno,description) VALUES ('2714', 'Erträge aus Zuschreib. d.and.Anlagevermögens 100%/50% steuerfrei');
-INSERT INTO gifi (accno,description) VALUES ('2715', 'Ertr.a.Zuschreib.d.Umlaufvermögens');
-INSERT INTO gifi (accno,description) VALUES ('2716', 'Erträge aus Zuschreib.d.Umlaufvermögens 100%/50% steuerfrei');
-INSERT INTO gifi (accno,description) VALUES ('2720', 'Ertr.a.d.Abgang v.Gegens.d.Anlageve');
-INSERT INTO gifi (accno,description) VALUES ('2723', 'Erträge aus der Veräußerung v.Anteilen an Kap.Ges.100%/50% steuerfrei');
-INSERT INTO gifi (accno,description) VALUES ('2725', 'Ertr.a.d.Abg.v.Gegenst.d.Umlaufverm');
-INSERT INTO gifi (accno,description) VALUES ('2730', 'Ertr.a.Herabsetzung d.PWB zu Forderungen');
-INSERT INTO gifi (accno,description) VALUES ('2731', 'Ertr.a.Herab.d.Einzelw.z.Forderunge');
-INSERT INTO gifi (accno,description) VALUES ('2732', 'Ertr. aus abgeschriebenen Forderung');
-INSERT INTO gifi (accno,description) VALUES ('2734', 'Erträge aus der steuerlich niedrigeren Bewertung v.Vblk.');
-INSERT INTO gifi (accno,description) VALUES ('2735', 'Ertr.a.d.Auflösung v.Rückstellungen');
-INSERT INTO gifi (accno,description) VALUES ('2736', 'Ertr.a.d.steuerl.niedrig.Bewertung v.Rückst.');
-INSERT INTO gifi (accno,description) VALUES ('2737', 'Ertr.a.d..Aufl.v.Sonderp.m.Rücklage (a.Währungsumst.EUR');
-INSERT INTO gifi (accno,description) VALUES ('2738', 'Ertr.a.d.Aufl.v.Sopo.m.Rücklageant.');
-INSERT INTO gifi (accno,description) VALUES ('2739', 'Erträge Aufl. Sopo m.R.(Ansparafa)');
-INSERT INTO gifi (accno,description) VALUES ('2740', 'Erträge Auflösung Sopo (stfreie Rü)m.Rücklageanteil');
-INSERT INTO gifi (accno,description) VALUES ('2741', 'Ertr.a.d.Aufl.v.Sonderp.m.Rücklagen Sonderafa');
-INSERT INTO gifi (accno,description) VALUES ('2742', 'Versicherungsentschädigungen');
-INSERT INTO gifi (accno,description) VALUES ('2743', 'Investitionszuschüsse-steuerpflicht');
-INSERT INTO gifi (accno,description) VALUES ('2744', 'Investitionszulage-steuerfrei');
-INSERT INTO gifi (accno,description) VALUES ('2745', 'Erträge aus Kapitalherabsetzung');
-INSERT INTO gifi (accno,description) VALUES ('2750', 'Grundstückserträge');
-INSERT INTO gifi (accno,description) VALUES ('2790', 'Erträge aus Verlustübernahme');
-INSERT INTO gifi (accno,description) VALUES ('2792', 'Erhalt.Gewinne aufgr.e.Gewinngemein');
-INSERT INTO gifi (accno,description) VALUES ('2794', 'Erhalt.Gewinn aufgr.e.GAV-TeilGAV e.Gewinn-od.Teilgew.abf.vertr.');
-INSERT INTO gifi (accno,description) VALUES ('2795', 'Entnahme aus der Kapitalrücklage');
-INSERT INTO gifi (accno,description) VALUES ('2796', 'Entnahme a.d. gesetzlichen Rücklage');
-INSERT INTO gifi (accno,description) VALUES ('2798', 'Entnahmen aus der Rücklage für eigene Anteile');
-INSERT INTO gifi (accno,description) VALUES ('2799', 'Entnahmen aus anderen Gewinnrücklagen');
-INSERT INTO gifi (accno,description) VALUES ('2860', 'Gewinnvortrag nach Verwendung');
-INSERT INTO gifi (accno,description) VALUES ('2862', 'Gewinnvortrag 40% Vorbelastung');
-INSERT INTO gifi (accno,description) VALUES ('2864', 'Gewinnvortrag 0% Vorbelastung (steuerl.Einlagekonto');
-INSERT INTO gifi (accno,description) VALUES ('2866', 'Gewinnvortrag 0% Vorbelastung (EK02)');
-INSERT INTO gifi (accno,description) VALUES ('2868', 'Verlustvortrag nach Verwendung');
-INSERT INTO gifi (accno,description) VALUES ('2869', 'Vortrag auf neue Rechnungen (GuV');
-INSERT INTO gifi (accno,description) VALUES ('2870', 'Vorabausschüttung');
-INSERT INTO gifi (accno,description) VALUES ('2890', 'Verrechneter kalk.Unternehmerlohn');
-INSERT INTO gifi (accno,description) VALUES ('2891', 'Verrechneter kalk.Miete und Pacht');
-INSERT INTO gifi (accno,description) VALUES ('2892', 'Verrechnete kalkulatorische Zinsen');
-INSERT INTO gifi (accno,description) VALUES ('2893', 'Verrechnete kalkulatorische AfA');
-INSERT INTO gifi (accno,description) VALUES ('2894', 'Verrechnete kalk.Wagnisse');
-INSERT INTO gifi (accno,description) VALUES ('2895', 'Verrechneter kalk.Lohn f.unentgeltl.Mitarbeiter');
-INSERT INTO gifi (accno,description) VALUES ('2990', 'Aufwendung/Erträge Umrechnungsdiff');
-INSERT INTO gifi (accno,description) VALUES ('3000', 'Roh,-Hilfs,-und Betriebsstoffe');
-INSERT INTO gifi (accno,description) VALUES ('3090', 'Energiestoffe (Fertigung)');
-INSERT INTO gifi (accno,description) VALUES ('3100', 'Fremdleistungen');
-INSERT INTO gifi (accno,description) VALUES ('3110', 'Leist.v.ausländ.Untern. 7% VSt.u.7%USt.');
-INSERT INTO gifi (accno,description) VALUES ('3120', 'Leist.v.ausländ.Untern. 16% VSt.u.16%USt.');
-INSERT INTO gifi (accno,description) VALUES ('3130', 'Leist.v.ausländ.Untern.ohne Vorst.u.7%USt.');
-INSERT INTO gifi (accno,description) VALUES ('3140', 'Leist.v.ausländ.Untern.o.Vorst.u.16% USt.');
-INSERT INTO gifi (accno,description) VALUES ('3150', 'Leist.v.ausländ.Untern.(0-Regelung)');
-INSERT INTO gifi (accno,description) VALUES ('3200', 'Wareneingang');
-INSERT INTO gifi (accno,description) VALUES ('3300', 'Wareneingang 7% Vorsteuer');
-INSERT INTO gifi (accno,description) VALUES ('3400', 'Wareneingang 16% Vorsteuer');
-INSERT INTO gifi (accno,description) VALUES ('3420', 'Innergemein.Erwerb 7% VorSt u. Ust');
-INSERT INTO gifi (accno,description) VALUES ('3425', 'Innergem.Erwerb 16% VorSt u. Ust');
-INSERT INTO gifi (accno,description) VALUES ('3430', 'Innergem.Erwerb o.VSt.u.7% USt.');
-INSERT INTO gifi (accno,description) VALUES ('3435', 'Innergem.Erwerb o.VSt.u.16% USt.');
-INSERT INTO gifi (accno,description) VALUES ('3440', 'Innergem.Erwerb v.Neufahrz.v.Lief.o.USt.Identnr.16%VSt.u.16%USt.');
-INSERT INTO gifi (accno,description) VALUES ('3500', 'Wareneingang 5% Vorsteuer');
-INSERT INTO gifi (accno,description) VALUES ('3505', 'Wareneingang 6% Vosteuer');
-INSERT INTO gifi (accno,description) VALUES ('3530', 'Wareneingang 9% Vosteuer');
-INSERT INTO gifi (accno,description) VALUES ('3535', 'Wareneingang 10% Vosteuer');
-INSERT INTO gifi (accno,description) VALUES ('3540', 'Wareneingang 9% Vorsteuer');
-INSERT INTO gifi (accno,description) VALUES ('3550', 'Steuerfreier innergem.Erwerb');
-INSERT INTO gifi (accno,description) VALUES ('3600', 'Nicht abziehbare Vorsteuer');
-INSERT INTO gifi (accno,description) VALUES ('3610', 'Nicht abziehb.Vorsteuer 7%');
-INSERT INTO gifi (accno,description) VALUES ('3650', 'Nicht abziehb.Vorsteuer 16%');
-INSERT INTO gifi (accno,description) VALUES ('3700', 'Nachlässe');
-INSERT INTO gifi (accno,description) VALUES ('3710', 'Nachlässe 7% Vorsteuer');
-INSERT INTO gifi (accno,description) VALUES ('3720', 'Nachlässe 16% Vorsteuer');
-INSERT INTO gifi (accno,description) VALUES ('3723', 'Nachlässe 15% Vorsteuer');
-INSERT INTO gifi (accno,description) VALUES ('3724', 'Nachlässe a.innergem.Erwerb 7% VSt.u.7%USt.');
-INSERT INTO gifi (accno,description) VALUES ('3725', 'Nachlässe a.innergem.Erwerb 16% VSt.u.16%USt.');
-INSERT INTO gifi (accno,description) VALUES ('3727', 'Nachlässe a.innergem.Erwerb 15% VSt.u.15%USt.');
-INSERT INTO gifi (accno,description) VALUES ('3730', 'Erhaltene Skonti');
-INSERT INTO gifi (accno,description) VALUES ('3731', 'Erhaltene Skonti 7% Vorsteuer');
-INSERT INTO gifi (accno,description) VALUES ('3735', 'Erhaltene Skonti 16% Vorsteuer');
-INSERT INTO gifi (accno,description) VALUES ('3740', 'Erhaltene Boni');
-INSERT INTO gifi (accno,description) VALUES ('3750', 'Erhaltene Boni 7% Vorsteuer');
-INSERT INTO gifi (accno,description) VALUES ('3760', 'Erhaltene Boni 16% Vorsteuer');
-INSERT INTO gifi (accno,description) VALUES ('3770', 'Erhaltene Rabatte');
-INSERT INTO gifi (accno,description) VALUES ('3780', 'Erhaltene Rabatte 7% Vorsteuer');
-INSERT INTO gifi (accno,description) VALUES ('3790', 'Erhaltene Rabatte 16% Vorsteuer');
-INSERT INTO gifi (accno,description) VALUES ('3800', 'Bezugsnebenkosten');
-INSERT INTO gifi (accno,description) VALUES ('3830', 'Leergut');
-INSERT INTO gifi (accno,description) VALUES ('3850', 'Zölle und Einfuhrabgaben');
-INSERT INTO gifi (accno,description) VALUES ('3960', 'Bestandsver.Roh-,Hilfs-.Betriebs.sow.bez.Waren');
-INSERT INTO gifi (accno,description) VALUES ('3970', 'Bestand Roh-,Hilfs-,u.Betriebsstoff');
-INSERT INTO gifi (accno,description) VALUES ('3980', 'Bestand Waren');
-INSERT INTO gifi (accno,description) VALUES ('3990', 'Verrechnete Stoffkosten');
-INSERT INTO gifi (accno,description) VALUES ('4000', 'Material-und Stoffverbrauch');
-INSERT INTO gifi (accno,description) VALUES ('4100', 'Löhne und Gehälter');
-INSERT INTO gifi (accno,description) VALUES ('4110', 'Löhne');
-INSERT INTO gifi (accno,description) VALUES ('4120', 'Gehälter');
-INSERT INTO gifi (accno,description) VALUES ('4124', 'Geschäftsführ.gehälter GmbH-Gesell.');
-INSERT INTO gifi (accno,description) VALUES ('4125', 'Ehegattengehalt');
-INSERT INTO gifi (accno,description) VALUES ('4126', 'Tantiemen');
-INSERT INTO gifi (accno,description) VALUES ('4127', 'Geschäftsführergehälter');
-INSERT INTO gifi (accno,description) VALUES ('4128', 'Vergütung a.angestellte Mitunterneh §15EStG.');
-INSERT INTO gifi (accno,description) VALUES ('4130', 'Gesetzlich soziale Aufwendungen');
-INSERT INTO gifi (accno,description) VALUES ('4137', 'Gesetz.sozi.Aufw.f.Mitunternehmen §15EStG');
-INSERT INTO gifi (accno,description) VALUES ('4138', 'Beiträge zur Berufsgenossenschaftr');
-INSERT INTO gifi (accno,description) VALUES ('4139', 'Ausgleichsabgabe i.S.d.Schwerbehinterdengesetzes');
-INSERT INTO gifi (accno,description) VALUES ('4140', 'Freiwillig soziale Aufwendungen lohnsteuerfrei');
-INSERT INTO gifi (accno,description) VALUES ('4145', 'Freiwillige sozi.Aufw.lohnsteuerpflichtig.');
-INSERT INTO gifi (accno,description) VALUES ('4149', 'Pauschale Lohnsteuera.sons.Bezüge (z.B.Fahrtkostenzu)');
-INSERT INTO gifi (accno,description) VALUES ('4150', 'Krankengeldzuschüsse');
-INSERT INTO gifi (accno,description) VALUES ('4160', 'Versorgungskasse');
-INSERT INTO gifi (accno,description) VALUES ('4165', 'Aufwendung f.Altersversorgung');
-INSERT INTO gifi (accno,description) VALUES ('4167', 'Pauschale Lohnsteuer auf sonst.Bezüge(z.B.Direktversicherung');
-INSERT INTO gifi (accno,description) VALUES ('4168', 'Aufwend.f.Altersversorgung f.Mitunternehmer §15EStG');
-INSERT INTO gifi (accno,description) VALUES ('4169', 'Aufwendungen für Untersützung');
-INSERT INTO gifi (accno,description) VALUES ('4170', 'Vermögenswirksame Leistungen');
-INSERT INTO gifi (accno,description) VALUES ('4175', 'Fahrtkostenerst.Wohnung/Arbeitsstät');
-INSERT INTO gifi (accno,description) VALUES ('4180', 'Bedienungsgelder');
-INSERT INTO gifi (accno,description) VALUES ('4190', 'Aushilfslöhne');
-INSERT INTO gifi (accno,description) VALUES ('4199', 'Lohnsteuer für Aushilfe');
-INSERT INTO gifi (accno,description) VALUES ('4200', 'Raumkosten');
-INSERT INTO gifi (accno,description) VALUES ('4210', 'Miete');
-INSERT INTO gifi (accno,description) VALUES ('4218', 'Gewerbesteuerlich zu berücksichtigende Miete §8GewStG');
-INSERT INTO gifi (accno,description) VALUES ('4219', 'Vergütungen an Mituntern. f.d.mietweise Überlassung ihrer WG §15EStG');
-INSERT INTO gifi (accno,description) VALUES ('4220', 'Pacht');
-INSERT INTO gifi (accno,description) VALUES ('4228', 'Gewerbesteuerlich zu berücks.Pacht §8GewStG');
-INSERT INTO gifi (accno,description) VALUES ('4229', 'Vergütungen an Mituntern.f.d.pachtweise Überlassung ihrer WG§15EStG');
-INSERT INTO gifi (accno,description) VALUES ('4230', 'Heizung');
-INSERT INTO gifi (accno,description) VALUES ('4240', 'Gas,Strom, Wasser');
-INSERT INTO gifi (accno,description) VALUES ('4250', 'Reinigung');
-INSERT INTO gifi (accno,description) VALUES ('4260', 'Instandhaltung betrieb.Räume');
-INSERT INTO gifi (accno,description) VALUES ('4270', 'Abgaben f.betrieb.genutz.Grundbesitz');
-INSERT INTO gifi (accno,description) VALUES ('4280', 'Sonstige Raumkosten');
-INSERT INTO gifi (accno,description) VALUES ('4300', 'Nicht abziehbare Vorsteuer');
-INSERT INTO gifi (accno,description) VALUES ('4301', 'Nicht abziehbare Vorsteuer 7%');
-INSERT INTO gifi (accno,description) VALUES ('4305', 'Nicht abziehbare Vorsteuer 16%');
-INSERT INTO gifi (accno,description) VALUES ('4320', 'Gewerbesteuer');
-INSERT INTO gifi (accno,description) VALUES ('4340', 'Sonstige Betriebssteuern');
-INSERT INTO gifi (accno,description) VALUES ('4350', 'Verbrauchssteuer');
-INSERT INTO gifi (accno,description) VALUES ('4355', 'Ökosteuer');
-INSERT INTO gifi (accno,description) VALUES ('4360', 'Versicherungen');
-INSERT INTO gifi (accno,description) VALUES ('4370', 'Nettoprä.f.Rückdeckung künf.Versorgungsleist.');
-INSERT INTO gifi (accno,description) VALUES ('4380', 'Beiträge');
-INSERT INTO gifi (accno,description) VALUES ('4390', 'Sonstige Abgaben');
-INSERT INTO gifi (accno,description) VALUES ('4396', 'Steuerl.abzugs.Verspätungszuschl.u.Zwangsgelder');
-INSERT INTO gifi (accno,description) VALUES ('4397', 'Steuerl.n.abzugsf.Verspätungszuschläge u.Zwangsgelder');
-INSERT INTO gifi (accno,description) VALUES ('4500', 'Fahrzugkosten');
-INSERT INTO gifi (accno,description) VALUES ('4510', 'Kfz-Steuer');
-INSERT INTO gifi (accno,description) VALUES ('4520', 'Kfz-Versicherungen');
-INSERT INTO gifi (accno,description) VALUES ('4530', 'Laufende Kfz-Betriebskosten');
-INSERT INTO gifi (accno,description) VALUES ('4540', 'Kfz-Reparaturen');
-INSERT INTO gifi (accno,description) VALUES ('4550', 'Garagenmiete');
-INSERT INTO gifi (accno,description) VALUES ('4570', 'Fremdfahrzeuge');
-INSERT INTO gifi (accno,description) VALUES ('4580', 'Sonstige Kfz-Kosten');
-INSERT INTO gifi (accno,description) VALUES ('4600', 'Werbe-und Reisekosten');
-INSERT INTO gifi (accno,description) VALUES ('4610', 'Werbekosten');
-INSERT INTO gifi (accno,description) VALUES ('4630', 'Geschenke bis 40 EUR');
-INSERT INTO gifi (accno,description) VALUES ('4635', 'Geschenke über 40 EUR');
-INSERT INTO gifi (accno,description) VALUES ('4638', 'Geschenke ausschließl.betrieb.genut');
-INSERT INTO gifi (accno,description) VALUES ('4640', 'Repräsentationskosten');
-INSERT INTO gifi (accno,description) VALUES ('4650', 'Bewirtungskosten');
-INSERT INTO gifi (accno,description) VALUES ('4653', 'Aufmerksamkeiten');
-INSERT INTO gifi (accno,description) VALUES ('4654', 'Nicht abzugsfähige Bewirtungskosten');
-INSERT INTO gifi (accno,description) VALUES ('4655', 'Nicht abzugsfähige Betriebsausgaben');
-INSERT INTO gifi (accno,description) VALUES ('4660', 'Reisekosten Arbeitnehmer');
-INSERT INTO gifi (accno,description) VALUES ('4663', 'Reisekosten Arbeitn.m.Vorsteuerabzu f.öffentl.Verkehrsm.');
-INSERT INTO gifi (accno,description) VALUES ('4664', 'Reisekosten Arbeitn.Verpflegungmehr');
-INSERT INTO gifi (accno,description) VALUES ('4666', 'Reisekosten Arbeitn.Übernachtungsaufwand');
-INSERT INTO gifi (accno,description) VALUES ('4668', 'Kilometerentgelderstattung Arbeitnehmer');
-INSERT INTO gifi (accno,description) VALUES ('4670', 'Reisekosten Unternehmer');
-INSERT INTO gifi (accno,description) VALUES ('4673', 'Reisek.Untern.m.Vorsteuerabzug (f.öffentl.Verkehrsm.');
-INSERT INTO gifi (accno,description) VALUES ('4674', 'Reisekosten Untern.Verpflegungsmehr');
-INSERT INTO gifi (accno,description) VALUES ('4676', 'Reisekosten Untern.Übernachtungsauf');
-INSERT INTO gifi (accno,description) VALUES ('4678', 'Kilometererstattungsgeld Unternehme');
-INSERT INTO gifi (accno,description) VALUES ('4700', 'Kosten der Warenabgabe');
-INSERT INTO gifi (accno,description) VALUES ('4710', 'Verpackungsmaterial');
-INSERT INTO gifi (accno,description) VALUES ('4730', 'Ausgangsfracht');
-INSERT INTO gifi (accno,description) VALUES ('4750', 'Transportversicherung');
-INSERT INTO gifi (accno,description) VALUES ('4760', 'Verkaufsprovision');
-INSERT INTO gifi (accno,description) VALUES ('4780', 'Fremdarbeiten');
-INSERT INTO gifi (accno,description) VALUES ('4790', 'Aufwand für Gewährleistungen');
-INSERT INTO gifi (accno,description) VALUES ('4800', 'Rep.u.Instandhaltungen v.techn.Anlagen u.Maschinen');
-INSERT INTO gifi (accno,description) VALUES ('4805', 'Rep.u.Instandhaltungen v.and.Anlagen u.Betriebs-u.Geschäftsausst.');
-INSERT INTO gifi (accno,description) VALUES ('4806', 'Wartungskosten für Hard-u.Software');
-INSERT INTO gifi (accno,description) VALUES ('4809', 'Sonstige Reparaturen u.Instandhalt.');
-INSERT INTO gifi (accno,description) VALUES ('4810', 'Mietleasing');
-INSERT INTO gifi (accno,description) VALUES ('4814', 'Gewerbesteuerlich zu berücks.Mietleasing §8GewStG');
-INSERT INTO gifi (accno,description) VALUES ('4815', 'Kaufleasing');
-INSERT INTO gifi (accno,description) VALUES ('4820', 'AfA a.Aufw.f.d.Inga.u.Erw.Geschäfts');
-INSERT INTO gifi (accno,description) VALUES ('4821', 'AfA a.Aufw.f.d.Währungsumst.a.Euro');
-INSERT INTO gifi (accno,description) VALUES ('4822', 'Abschreibungen a.immat.Vermögensgeg');
-INSERT INTO gifi (accno,description) VALUES ('4824', 'Abschreibung a.d.Geschäft-o.Firmenw');
-INSERT INTO gifi (accno,description) VALUES ('4826', 'Außerplan.AfA a.immat.Vermögensgeg.');
-INSERT INTO gifi (accno,description) VALUES ('4830', 'Abschreibungen auf Sachanlagen');
-INSERT INTO gifi (accno,description) VALUES ('4840', 'Außerplanmäßig Abschr.a.Sachanlagen');
-INSERT INTO gifi (accno,description) VALUES ('4850', 'Abschr.a.Sachanl.aufgr.steuerl.Sondervorschriften');
-INSERT INTO gifi (accno,description) VALUES ('4855', 'Sofortabschreibung GWG');
-INSERT INTO gifi (accno,description) VALUES ('4860', 'Abschreibungen auf aktivierte GWG');
-INSERT INTO gifi (accno,description) VALUES ('4865', 'Außerplanmäßige AFA auf aktivierte geringwertige WG');
-INSERT INTO gifi (accno,description) VALUES ('4870', 'Abschreibungen auf Finanzanlagen');
-INSERT INTO gifi (accno,description) VALUES ('4871', 'Abschreibungen a.Finanzanlagen 100%/50% n.abzugsfähig');
-INSERT INTO gifi (accno,description) VALUES ('4872', 'Abschreibungen an Mitunternehmerschaften §8 GewStG');
-INSERT INTO gifi (accno,description) VALUES ('4873', 'Abschreibungen a.Finanzanlagen a.Grund steuerl.Sondervorschr.100%/50%n.abzf.');
-INSERT INTO gifi (accno,description) VALUES ('4874', 'Abschreibungen a.Finanzanlagen auf Grund steuerl.Sondervorschriften');
-INSERT INTO gifi (accno,description) VALUES ('4875', 'Abschr.a.Wertp.d.Umlaufvermögens');
-INSERT INTO gifi (accno,description) VALUES ('4876', 'Abschr.a.Wertpapiere d.Umlaufverm. 100%/50% n.abzugsf.');
-INSERT INTO gifi (accno,description) VALUES ('4879', 'Vorwegnahme künftiger Wertschwank.b.Wertpap.d.Umlaufvermögens');
-INSERT INTO gifi (accno,description) VALUES ('4880', 'Abschreibungen auf Umlaufverm. o.Wertpapiere (soweit unübl.Höhe');
-INSERT INTO gifi (accno,description) VALUES ('4882', 'Abschreibungen a.Umlaufverm.,steuerrechtl. bedingt (soweit unübl.Höhe');
-INSERT INTO gifi (accno,description) VALUES ('4885', 'Vorwegnahme künft.Wertschwank.i.Umlaufverm.außer Vorräte u.Wertpap.d.UV');
-INSERT INTO gifi (accno,description) VALUES ('4886', 'Abschr.a.UV außer Vorräte u.Wertpap.d.UV (soweit übliche Höhe');
-INSERT INTO gifi (accno,description) VALUES ('4887', 'Abschr.a.UV steuerrechtl.bedingt(soweit übliche Höhe');
-INSERT INTO gifi (accno,description) VALUES ('4890', 'Vorwegnahme künft.Wertschwank. i.UV (soweit übliche Höhe');
-INSERT INTO gifi (accno,description) VALUES ('4900', 'Sonstige betriebliche Aufwendungen');
-INSERT INTO gifi (accno,description) VALUES ('4905', 'Sons.Aufw.betriebl. und regelmäßig');
-INSERT INTO gifi (accno,description) VALUES ('4909', 'Fremdleistungen');
-INSERT INTO gifi (accno,description) VALUES ('4910', 'Porto');
-INSERT INTO gifi (accno,description) VALUES ('4920', 'Telefon');
-INSERT INTO gifi (accno,description) VALUES ('4925', 'Telefax');
-INSERT INTO gifi (accno,description) VALUES ('4930', 'Bürobedarf');
-INSERT INTO gifi (accno,description) VALUES ('4940', 'Zeitschriften, Bücher');
-INSERT INTO gifi (accno,description) VALUES ('4945', 'Fortbildungskosten');
-INSERT INTO gifi (accno,description) VALUES ('4946', 'Freiwillige Sozialleistungen');
-INSERT INTO gifi (accno,description) VALUES ('4948', 'Vergütungen an freiberufl.Mitunternehmer §15EStG');
-INSERT INTO gifi (accno,description) VALUES ('4949', 'Haftungsvergütung an Mitunternehmer §15EStG');
-INSERT INTO gifi (accno,description) VALUES ('4950', 'Rechts- und Beratungskosten');
-INSERT INTO gifi (accno,description) VALUES ('4955', 'Buchführungskosten');
-INSERT INTO gifi (accno,description) VALUES ('4957', 'Abschluß- und Prüfungskosten');
-INSERT INTO gifi (accno,description) VALUES ('4960', 'Mieten für Einrichtungen');
-INSERT INTO gifi (accno,description) VALUES ('4968', 'Gewerbesteuerl.zu berückst.Miete f.Einricht.§8GewStG');
-INSERT INTO gifi (accno,description) VALUES ('4969', 'Aufwend.f.Abraum-u.Abfallbeseitigung');
-INSERT INTO gifi (accno,description) VALUES ('4970', 'Nebenkosten des Geldverkehrs');
-INSERT INTO gifi (accno,description) VALUES ('4975', 'Aufwend.a.Anteilen an Kap.Ges.100%/50% n.abzugsf.(inländ.Kap.Ges.');
-INSERT INTO gifi (accno,description) VALUES ('4976', 'Aufwend.a.d.Veräußerung v.Anteilen an Kap.Ges.100%/50% n.abzugsf.');
-INSERT INTO gifi (accno,description) VALUES ('4980', 'Betriebsbedarf');
-INSERT INTO gifi (accno,description) VALUES ('4985', 'Werkzeuge und Kleingeräte');
-INSERT INTO gifi (accno,description) VALUES ('4990', 'Kalkulatorischer Unternehmerlohn');
-INSERT INTO gifi (accno,description) VALUES ('4992', 'Kalkulatorische Zinsen');
-INSERT INTO gifi (accno,description) VALUES ('4993', 'Kalkulatorische Aschreibungen');
-INSERT INTO gifi (accno,description) VALUES ('4994', 'Kalkulatorische Wagnisse');
-INSERT INTO gifi (accno,description) VALUES ('4995', 'Kalkulatorischer Lohn f.unentgeltl.Mitarbeiter');
-INSERT INTO gifi (accno,description) VALUES ('4996', 'Herstellungskosten');
-INSERT INTO gifi (accno,description) VALUES ('4997', 'Verwaltungskosten');
-INSERT INTO gifi (accno,description) VALUES ('4998', 'Vertriebskosten');
-INSERT INTO gifi (accno,description) VALUES ('7000', 'Unfertige Erzeu.unfert.Leistungen (Bestand)');
-INSERT INTO gifi (accno,description) VALUES ('7050', 'Unfertige Erzeugnisse (Bestand)');
-INSERT INTO gifi (accno,description) VALUES ('7080', 'Unfertige Leistungen (Bestand)');
-INSERT INTO gifi (accno,description) VALUES ('7090', 'In Ausführung befindl. Bauaufträge');
-INSERT INTO gifi (accno,description) VALUES ('7095', 'In Arbeit befindliche Aufträge');
-INSERT INTO gifi (accno,description) VALUES ('7100', 'Fertige Erzeugnisse und Waren(Bestand)');
-INSERT INTO gifi (accno,description) VALUES ('7110', 'Fertige Erzeugnisse (Bestand)');
-INSERT INTO gifi (accno,description) VALUES ('7140', 'Waren (Bestand)');
-INSERT INTO gifi (accno,description) VALUES ('8100', 'Steuerfreie Umsätze §4Nr.8ff UstG');
-INSERT INTO gifi (accno,description) VALUES ('8110', 'Sonstige steuerfreie Umsätze Inland');
-INSERT INTO gifi (accno,description) VALUES ('8120', 'Steuerfreie Umsätze §4Nr.1a UstG');
-INSERT INTO gifi (accno,description) VALUES ('8125', 'Steuerfrei innergem. Lieferungen §41bUStG');
-INSERT INTO gifi (accno,description) VALUES ('8130', 'Liefe.d.1.Abnehm.bei innergem.Dreiecksg §25b2UStG');
-INSERT INTO gifi (accno,description) VALUES ('8135', 'Steuerfr.innergem.Lief.v.Neufahrz.an Abn.o.USt-Ident-Nr.');
-INSERT INTO gifi (accno,description) VALUES ('8140', 'Steuerfreie Umsätze Offshore usw.');
-INSERT INTO gifi (accno,description) VALUES ('8150', 'Sonstige steuerfreie Umsätze §42-7UStG');
-INSERT INTO gifi (accno,description) VALUES ('8196', 'Erlöse aus Geldspielautomaten 16% USt.');
-INSERT INTO gifi (accno,description) VALUES ('8200', 'Erlöse');
-INSERT INTO gifi (accno,description) VALUES ('8300', 'Erlöse 7%USt');
-INSERT INTO gifi (accno,description) VALUES ('8310', 'Erlöse Inland stpfl. EG-Lieferung7%');
-INSERT INTO gifi (accno,description) VALUES ('8315', 'Erlös Inland stpfl.EG-Lieferung 16%');
-INSERT INTO gifi (accno,description) VALUES ('8320', 'Erlöse aus im and.EG-Land steuerpfl.Lieferungen');
-INSERT INTO gifi (accno,description) VALUES ('8339', 'Erl.EG-Land stpfl.so.Leist.(0-Regl)');
-INSERT INTO gifi (accno,description) VALUES ('8400', 'Erlöse 16% USt.');
-INSERT INTO gifi (accno,description) VALUES ('8500', 'Provisionserlöse');
-INSERT INTO gifi (accno,description) VALUES ('8504', 'Provisionserlöse,steuerfrei (§4Nr.8ff.UStG)');
-INSERT INTO gifi (accno,description) VALUES ('8505', 'Provisionserlöse,steuerfrei (§4Nr.5UStG)');
-INSERT INTO gifi (accno,description) VALUES ('8506', 'Provisionserlöse 7% USt.');
-INSERT INTO gifi (accno,description) VALUES ('8508', 'Provisionserlöse 16% USt.');
-INSERT INTO gifi (accno,description) VALUES ('8520', 'Erlöse Abfallverwertung');
-INSERT INTO gifi (accno,description) VALUES ('8540', 'Erlös Leergut');
-INSERT INTO gifi (accno,description) VALUES ('8590', 'Verrechnete sons. Sachbezüge keine Waren');
-INSERT INTO gifi (accno,description) VALUES ('8591', 'Sachbezüge 7% Ust (Waren)');
-INSERT INTO gifi (accno,description) VALUES ('8595', 'Sachbezüge 16% Ust (Waren)');
-INSERT INTO gifi (accno,description) VALUES ('8600', 'Sonstige Erlöse betriebl.u.regelmäß');
-INSERT INTO gifi (accno,description) VALUES ('8610', 'Verrechnete sonstige Sachbezüge');
-INSERT INTO gifi (accno,description) VALUES ('8611', 'Verr.sons.Sachbezüge 16%USt(Kfz-Gestellung)');
-INSERT INTO gifi (accno,description) VALUES ('8614', 'Verrechnete sons.Sachbezüge o. USt');
-INSERT INTO gifi (accno,description) VALUES ('8625', 'Sons. Erlöse betriebl.u.reg.steuerf');
-INSERT INTO gifi (accno,description) VALUES ('8650', 'Erlöse Zinsen und Diskotspesen');
-INSERT INTO gifi (accno,description) VALUES ('8630', 'Sonst.Erlöse betriebl.u.regelmäßig 7% USt');
-INSERT INTO gifi (accno,description) VALUES ('8640', 'Sonst.Erlöse betriebl.u.regelmäßig 16% USt');
-INSERT INTO gifi (accno,description) VALUES ('8660', 'Erlöse Zinsen u.Diskontspesen aus verb.Unternehmen');
-INSERT INTO gifi (accno,description) VALUES ('8700', 'Erlösschmälerungen');
-INSERT INTO gifi (accno,description) VALUES ('8705', 'Erlösschmälerungen aus steuerfr.Umsätzen §4 Nr.1a UStG');
-INSERT INTO gifi (accno,description) VALUES ('8710', 'Erlösschmälerung 7% USt.');
-INSERT INTO gifi (accno,description) VALUES ('8720', 'Erlösschmälerung 16% USt.');
-INSERT INTO gifi (accno,description) VALUES ('8724', 'Erlösschmäler.a.stfrei.IG Lieferung');
-INSERT INTO gifi (accno,description) VALUES ('8725', 'Erlösschmä.Inl.stpfl.EG-Lief. 7%USt');
-INSERT INTO gifi (accno,description) VALUES ('8726', 'Erlösschmä.Inl.stpfl.EG-Lief.16%USt');
-INSERT INTO gifi (accno,description) VALUES ('8727', 'Erlösschmä.and.EG Land stpfl.Liefer');
-INSERT INTO gifi (accno,description) VALUES ('8729', 'Erlösschmälerungen aus im Inland steuerpfl.EG-Lief.15% USt');
-INSERT INTO gifi (accno,description) VALUES ('8730', 'Gewährte Skonti');
-INSERT INTO gifi (accno,description) VALUES ('8731', 'Gewährte Skonti 7% USt');
-INSERT INTO gifi (accno,description) VALUES ('8735', 'Gewährte Skonti 16% USt.');
-INSERT INTO gifi (accno,description) VALUES ('8740', 'Gewährte Boni');
-INSERT INTO gifi (accno,description) VALUES ('8750', 'Gewährte Boni 7% USt.');
-INSERT INTO gifi (accno,description) VALUES ('8760', 'Gewährte Boni 16% USt.');
-INSERT INTO gifi (accno,description) VALUES ('8770', 'Gewährte Rabatte');
-INSERT INTO gifi (accno,description) VALUES ('8780', 'Gewährte Rabatte 7% USt.');
-INSERT INTO gifi (accno,description) VALUES ('8790', 'Gewährte Rabatte 16% Ust.');
-INSERT INTO gifi (accno,description) VALUES ('8800', 'Erlöse aus Anlagenverkäufen');
-INSERT INTO gifi (accno,description) VALUES ('8801', 'Erlöse aus Anlagenverkäufen Sachanl.verm.b.Buchverl.16%USt.');
-INSERT INTO gifi (accno,description) VALUES ('8817', 'Erlöse aus Verkäufen immat.VG (bei Buchverlust)');
-INSERT INTO gifi (accno,description) VALUES ('8818', 'Erlöse aus Verkäufen Finanzanlagen (bei Buchverlust)');
-INSERT INTO gifi (accno,description) VALUES ('8819', 'Erlöse aus Verkäufen Finanzanl.100%/50% nicht abzugsf.(b.Buchverlust)');
-INSERT INTO gifi (accno,description) VALUES ('8820', 'Erlöse aus Anlageverkäufen Sachanl.verm.b.Buchgewinn16%Ust');
-INSERT INTO gifi (accno,description) VALUES ('8829', 'Erl.a.Anlagenverk.bei Buchgewinn');
-INSERT INTO gifi (accno,description) VALUES ('8837', 'Erlöse aus Verk.immat.VG (bei Buchgewinn)');
-INSERT INTO gifi (accno,description) VALUES ('8838', 'Erlöse aus Verkäufen Finanzanlagen (bei Buchgewinn)');
-INSERT INTO gifi (accno,description) VALUES ('8839', 'Erlöse aus Verkäufen Finanzanlagen 100%/50% steuerfrei (bei Buchgewinn)');
-INSERT INTO gifi (accno,description) VALUES ('8900', 'Unentgeldliche Wertabgaben');
-INSERT INTO gifi (accno,description) VALUES ('8905', 'Entnahme v. Gegenst.o.USt.');
-INSERT INTO gifi (accno,description) VALUES ('8910', 'Entnahme des Untern.f.Zwecke ausserh.d.Untern 16%(Waren)');
-INSERT INTO gifi (accno,description) VALUES ('8915', 'Entnah.d.Untern.f.Zwecke ausserh.d.Untern.7%USt');
-INSERT INTO gifi (accno,description) VALUES ('8919', 'Entnahme durch den Untern.f.Zwecke außerhalb d.Untern.(Waren)o.USt');
-INSERT INTO gifi (accno,description) VALUES ('8920', 'Verw.v.Gegens.f.Zwecke ausserh.d.Untern.16%USt.');
-INSERT INTO gifi (accno,description) VALUES ('8924', 'Verwendung v.Gegenständen f.Zwecke außerhalb d.Untern.o.USt.');
-INSERT INTO gifi (accno,description) VALUES ('8925', 'Unentgeldl.Erbring.sons.Leis.16%USt');
-INSERT INTO gifi (accno,description) VALUES ('8929', 'Unentgeltliche Erbringung einer sonst.Leistung o.USt.');
-INSERT INTO gifi (accno,description) VALUES ('8930', 'Verwendung v.Gegenst.f.Zwecke außerhalb d.Unternehmens 7% USt.');
-INSERT INTO gifi (accno,description) VALUES ('8932', 'Unentgelt.Erbring.sons.Leist. 7%Ust');
-INSERT INTO gifi (accno,description) VALUES ('8935', 'Unentgeltl.Zuwend.v.Gegens. 16% Ust');
-INSERT INTO gifi (accno,description) VALUES ('8939', 'Unentgeldl.Zuw.v.Gegens.ohne Ust');
-INSERT INTO gifi (accno,description) VALUES ('8940', 'Unentgeltl.Zuw.v Waren 16% Ust');
-INSERT INTO gifi (accno,description) VALUES ('8945', 'Unentgeltl.Zuw.von Waren 7% Ust');
-INSERT INTO gifi (accno,description) VALUES ('8949', 'Unentgeltl.Zuwendung v.Waren o.USt.');
-INSERT INTO gifi (accno,description) VALUES ('8950', 'Nicht steuerbare Umsätze');
-INSERT INTO gifi (accno,description) VALUES ('8955', 'Umsatzsteuervergütungen');
-INSERT INTO gifi (accno,description) VALUES ('8960', 'Bestandsveränderung-unfertige Erzeu');
-INSERT INTO gifi (accno,description) VALUES ('8970', 'Bestandsveränderung-unfertige Leist');
-INSERT INTO gifi (accno,description) VALUES ('8975', 'Bestandsverä.i.Ausfü.befi.Bauaufträ');
-INSERT INTO gifi (accno,description) VALUES ('8977', 'Bestandsverä.i.Arbeit befindl.Auftr');
-INSERT INTO gifi (accno,description) VALUES ('8980', 'Bestandsverä.fertige Erzeugnisse');
-INSERT INTO gifi (accno,description) VALUES ('8990', 'Andere aktivierte Eigenleistungen');
-INSERT INTO gifi (accno,description) VALUES ('9000', 'Saldenverträge,Sachkonten');
-INSERT INTO gifi (accno,description) VALUES ('9008', 'Saldenverträge,Debitoren');
-INSERT INTO gifi (accno,description) VALUES ('9009', 'Saldenverträge,Kreditoren');
-INSERT INTO gifi (accno,description) VALUES ('9060', 'Offene Posten aus 1990');
-INSERT INTO gifi (accno,description) VALUES ('9069', 'Offene Posten aus 1999');
-INSERT INTO gifi (accno,description) VALUES ('9070', 'Offene Posten aus 2000');
-INSERT INTO gifi (accno,description) VALUES ('9071', 'Offene Posten aus 2001');
-INSERT INTO gifi (accno,description) VALUES ('9072', 'Offene Posten aus 2002');
-INSERT INTO gifi (accno,description) VALUES ('9090', 'Summenvortragskonto');
-INSERT INTO gifi (accno,description) VALUES ('9220', 'Gezeichnetes kapital in DM');
-INSERT INTO gifi (accno,description) VALUES ('9221', 'Gezeichnetes Kapital in Euro');
-INSERT INTO gifi (accno,description) VALUES ('9229', 'Gegenkonto zu 9220-9221');
-INSERT INTO gifi (accno,description) VALUES ('9230', 'Baukostenzuschüsse');
-INSERT INTO gifi (accno,description) VALUES ('9232', 'Investitionszulagen');
-INSERT INTO gifi (accno,description) VALUES ('9234', 'Investitionszuschüsse');
-INSERT INTO gifi (accno,description) VALUES ('9240', 'Investitionsverbindlichkeiten bei den Leistungsvblk.');
-INSERT INTO gifi (accno,description) VALUES ('9241', 'Investitionsvblk.aus Sachanlagenkäufen b.Leistungsvblk.');
-INSERT INTO gifi (accno,description) VALUES ('9242', 'Investitionsvblk.aus Käufen v.immat.VG bei Leistungsvblk.');
-INSERT INTO gifi (accno,description) VALUES ('9243', 'Investitionsvblk.aus Käufen v.Finanzanlagen bei Leistungsvblk.');
-INSERT INTO gifi (accno,description) VALUES ('9244', 'Gegenkonto zu Konten 9240-43');
-INSERT INTO gifi (accno,description) VALUES ('9245', 'Forde.a.Sachanlageverk.b.Sonst.VG');
-INSERT INTO gifi (accno,description) VALUES ('9246', 'Ford.a.Verk.immat.VG b.sonst.VG');
-INSERT INTO gifi (accno,description) VALUES ('9247', 'Ford.a.Verk.v.Finanzanlagen b.sonst.VG');
-INSERT INTO gifi (accno,description) VALUES ('9249', 'Gegenkonto zu Konten 9245-47');
-INSERT INTO gifi (accno,description) VALUES ('9250', 'Eigenkapitalersetzende Gesellschafterdarlehen');
-INSERT INTO gifi (accno,description) VALUES ('9255', 'Ungesicherte Gesellschafterdarl.m.Restlaufz. größer als 5 Jahre');
-INSERT INTO gifi (accno,description) VALUES ('9259', 'Gegenkonto zu 9250 und 9255');
-INSERT INTO gifi (accno,description) VALUES ('9260', 'Kurzfristige Rückstellung');
-INSERT INTO gifi (accno,description) VALUES ('9262', 'Mittelfristige Rückstellung');
-INSERT INTO gifi (accno,description) VALUES ('9264', 'Langfristige Rückstellungen');
-INSERT INTO gifi (accno,description) VALUES ('9269', 'Gegenkonto zu Konten 9260-9268');
-INSERT INTO gifi (accno,description) VALUES ('9270', 'Gegenkonto zu 9271-9278 (Soll-Buchung)');
-INSERT INTO gifi (accno,description) VALUES ('9271', 'Vblk.aus der Begebung u.Übertragung v.Wechseln');
-INSERT INTO gifi (accno,description) VALUES ('9272', 'Vblk.a.d.Begebung u.Übertragung v.Wechseln gegenüb.verb.Untern.');
-INSERT INTO gifi (accno,description) VALUES ('9273', 'Vblk.a.Bürgschaften,Wechseln-u.Scheckbürgschaften');
-INSERT INTO gifi (accno,description) VALUES ('9274', 'Vblk.a.Bürgschaften,Wechseln-u.Scheckbürgschaften geg.verb.Untern.');
-INSERT INTO gifi (accno,description) VALUES ('9275', 'Vblk.aus Gewährleistungsverträgen');
-INSERT INTO gifi (accno,description) VALUES ('9276', 'Vblk.a.Gewährleistungsverträgen geg.verb.Untern.');
-INSERT INTO gifi (accno,description) VALUES ('9277', 'Haftung aus der Bestellung v.Sicherheiten f.fremde Vblk.');
-INSERT INTO gifi (accno,description) VALUES ('9278', 'Haftung a.d.Bestellung v.Sicherh.f.fremde Vblk.geg.verb.Untern.');
-INSERT INTO gifi (accno,description) VALUES ('9280', 'Gegenkonto zu 9281-9284');
-INSERT INTO gifi (accno,description) VALUES ('9281', 'Verpfl.a.Miet-und Leasinggesch.');
-INSERT INTO gifi (accno,description) VALUES ('9282', 'Verpfl.geg.verb.Unternehmen');
-INSERT INTO gifi (accno,description) VALUES ('9283', 'Andere Verpflichtungen gem. §285 Nr.3HGB');
-INSERT INTO gifi (accno,description) VALUES ('9284', 'And.Verpfl.gem.§285 3 HGB verb.Untern.');
-INSERT INTO gifi (accno,description) VALUES ('9290', 'Statistisches Konto steuerfreie Auslagen');
-INSERT INTO gifi (accno,description) VALUES ('9291', 'Gegenkonto zu 9290');
-INSERT INTO gifi (accno,description) VALUES ('9292', 'Statistisches Konto Fremdgeld');
-INSERT INTO gifi (accno,description) VALUES ('9293', 'Gegenkonto zu 9292');
-INSERT INTO gifi (accno,description) VALUES ('9880', 'Ausgleichsposten f.aktivierte eigene Anteile');
-INSERT INTO gifi (accno,description) VALUES ('9882', 'Ausgleichsposten f.aktivierte Bilanzierungshilfen');
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4581', 'Erlöse zum ermä.Umsatzsteuersatz (EÜR)', 'A', 'I', '', '4581', 0, 0, 1, NULL, 1, FALSE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4582', 'Erlöse steuerfrei u.nicht steuerbar (EÜR)', 'A', 'I', '', '4582', 0, 0, 1, NULL, 1, FALSE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4589', 'Gegenkonto 8580-8582 b.Aufteilung d.Erlöse n.Steuersätzen(EÜR)', 'A', 'C', '', '4589', 0, NULL, NULL, NULL, NULL, FALSE);\r
-INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4600', 'Unentgeldliche Wertabgaben', 'A', 'I', 'AR_amount', '4600', 0, NULL, NULL, NULL, 1, FALSE);\r
+INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4600', 'Unentgeltliche Wertabgaben', 'A', 'I', 'AR_amount', '4600', 0, NULL, NULL, NULL, 1, FALSE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4605', 'Entnahme v. Gegenst.o.USt.', 'A', 'I', '', '4605', 0, NULL, 5, NULL, 2, FALSE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4610', 'Entnah.d.Untern.f.Zwecke ausserh.d.Untern.7%USt', 'A', 'I', 'AR_amount', '4610', 2, 86, 5, NULL, 3, TRUE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4619', 'Entnahme durch den Untern.f.Zwecke außerhalb d.Untern.(Waren)o.USt', 'A', 'I', '', '4619', 0, NULL, 5, NULL, 3, FALSE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4640', 'Verw.v.Gegens.f.Zwecke ausserh.d.Untern.16%USt.', 'A', 'I', '', '4640', 3, 51, 5, NULL, 3, TRUE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4645', 'Verwend.v.Gegenst.f.Zwecke außerh.d.Untern.16%USt(Kfz-Nutzung)', 'A', 'I', '', '4645', 0, 0, 5, NULL, 3, TRUE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4646', 'Verwend.f.Gegenst.f.Zwecke außerh.d.Untern.16%USt(Telefonnutzung)', 'A', 'I', '', '4646', 0, 0, 5, NULL, 3, TRUE);\r
-INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4660', 'Unentgeldl.Erbring.sons.Leis.16%USt', 'A', 'I', 'AR_amount', '4660', 3, 51, NULL, NULL, 3, TRUE);\r
+INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4660', 'Unentgeltl.Erbring.sons.Leis.16%USt', 'A', 'I', 'AR_amount', '4660', 3, 51, NULL, NULL, 3, TRUE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4670', 'Unentgeltl.Zuw.von Waren 7% Ust', 'A', 'I', '', '4670', 2, 86, 5, NULL, 3, TRUE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4679', 'Unentgeltl.Zuwendung v.Waren o.USt.', 'A', 'I', '', '4679', 0, NULL, 5, NULL, 3, FALSE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4680', 'Unentgeltl.Zuw.v Waren 16% Ust', 'A', 'I', '', '4680', 3, 51, 5, NULL, 3, TRUE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4686', 'Unentgeltl.Zuwend.v.Gegens. 16% Ust', 'A', 'I', 'AR_amount', '4686', 3, 51, NULL, NULL, 3, TRUE);\r
-INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4689', 'Unentgeldl.Zuw.v.Gegens.ohne Ust', 'A', 'I', '', '4689', 0, NULL, 5, NULL, 3, FALSE);\r
+INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4689', 'Unentgeltl.Zuw.v.Gegens.ohne Ust', 'A', 'I', '', '4689', 0, NULL, 5, NULL, 3, FALSE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4690', 'Nicht steuerbare Umsätze', 'A', 'I', '', '4690', 0, NULL, 5, NULL, 1, FALSE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4695', 'Umsatzsteuervergütungen', 'A', 'I', '', '4695', 0, NULL, NULL, NULL, 7, FALSE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('4700', 'Erlösschmälerungen', 'A', 'I', '', '4700', 0, NULL, 32, NULL, 1, FALSE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('6490', 'Sonstige Reparaturen u.Instandhalt.', 'A', 'E', 'AP_amount', '6490', 9, NULL, NULL, NULL, 19, FALSE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('6498', 'Mietleasing', 'A', 'E', 'AP_amount', '6498', 0, NULL, 20, NULL, 24, FALSE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('6499', 'Gewerbest.zu berücksicht.Mietleasing §8 GewStG', 'A', 'E', '', '6499', 0, NULL, NULL, NULL, 24, FALSE);\r
-INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('6500', 'Fahrzugkosten', 'A', 'E', 'AP_amount', '6500', 0, NULL, NULL, NULL, 17, FALSE);\r
+INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('6500', 'Fahrzeugkosten', 'A', 'E', 'AP_amount', '6500', 0, NULL, NULL, NULL, 17, FALSE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('6520', 'Kfz-Versicherungen', 'A', 'E', 'AP_amount', '6520', 0, NULL, 14, NULL, 16, FALSE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('6530', 'Laufende Kfz-Betriebskosten', 'A', 'E', 'AP_amount', '6530', 9, NULL, 14, NULL, 17, FALSE);\r
INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik) VALUES ('6540', 'Kfz-Reparaturen', 'A', 'E', 'AP_amount', '6540', 9, NULL, 14, NULL, 17, FALSE);\r
+++ /dev/null
--- DATEV SKR04\r
--- IT Systems Service http://www.itsystemsservice.de\r
---\r
-INSERT INTO gifi (accno,description) VALUES ('0135', 'EDV-Software');\r
-INSERT INTO gifi (accno,description) VALUES ('0150', 'Geschäfts- oder Firmenwert');\r
-INSERT INTO gifi (accno,description) VALUES ('0240', 'Geschäftsbauten');\r
-INSERT INTO gifi (accno,description) VALUES ('0400', 'Techn.Anlagen und Maschinen');\r
-INSERT INTO gifi (accno,description) VALUES ('0440', 'Maschinen');\r
-INSERT INTO gifi (accno,description) VALUES ('0500', 'Betriebs- und Geschäftsausstattung');\r
-INSERT INTO gifi (accno,description) VALUES ('0510', 'Andere Anlagen');\r
-INSERT INTO gifi (accno,description) VALUES ('0520', 'PKW');\r
-INSERT INTO gifi (accno,description) VALUES ('0560', 'Sonst.Transportmittel');\r
-INSERT INTO gifi (accno,description) VALUES ('0620', 'Werkzeuge');\r
-INSERT INTO gifi (accno,description) VALUES ('0640', 'Ladeneinrichtung');\r
-INSERT INTO gifi (accno,description) VALUES ('0650', 'Büroeinrichtung');\r
-INSERT INTO gifi (accno,description) VALUES ('0670', 'Geringwertige Wirtschaftsg. b. 410 Euro');\r
-INSERT INTO gifi (accno,description) VALUES ('1000', 'Roh,-Hilfs,-und Betriebsstoffe');\r
-INSERT INTO gifi (accno,description) VALUES ('1140', 'Waren');\r
-INSERT INTO gifi (accno,description) VALUES ('1200', 'Ford. aus Lieferungen und Leistungen');\r
-INSERT INTO gifi (accno,description) VALUES ('1215', 'Ford.a.LuL z.allg.USt-Satz');\r
-INSERT INTO gifi (accno,description) VALUES ('1216', 'Ford.a.LuL z.erm.USt.-Satz (EÜR)');\r
-INSERT INTO gifi (accno,description) VALUES ('1217', 'Ford.a.steuerfr.od.nicht steuerb.LuL (EÜR)');\r
-INSERT INTO gifi (accno,description) VALUES ('1218', 'Ford.a.LuL gem.§24UStG(EÜR)');\r
-INSERT INTO gifi (accno,description) VALUES ('1219', 'Gegenkto. bei Aufteil.d.Ford.n.Steuers.(EÜR)');\r
-INSERT INTO gifi (accno,description) VALUES ('1220', 'Ford.n.§11(1)2EStG f.§4/3 EStG');\r
-INSERT INTO gifi (accno,description) VALUES ('1248', 'Pauschalwertbe.z.Ford.bis1J.');\r
-INSERT INTO gifi (accno,description) VALUES ('1249', 'Pauschalwertbe.z.Ford.ueb1J.');\r
-INSERT INTO gifi (accno,description) VALUES ('1370', 'Durchlaufende Posten');\r
-INSERT INTO gifi (accno,description) VALUES ('1374', 'Fremdgeld');\r
-INSERT INTO gifi (accno,description) VALUES ('1400', 'Abziehbare Vorsteuer');\r
-INSERT INTO gifi (accno,description) VALUES ('1401', 'Abziebare Vorsteuer 7%');\r
-INSERT INTO gifi (accno,description) VALUES ('1402', 'Abziehbare Vorsteuer aus EG-Erwerb');\r
-INSERT INTO gifi (accno,description) VALUES ('1403', 'Abziehbare Vorsteuer aus EG-Erwerb 16%');\r
-INSERT INTO gifi (accno,description) VALUES ('1405', 'Abziehbare Vorsteuer 16%');\r
-INSERT INTO gifi (accno,description) VALUES ('1407', 'Abziehb.Vorst.n.allgem.Durchschnittssätzen UStVA Kz.63');\r
-INSERT INTO gifi (accno,description) VALUES ('1408', 'Abziehbare Vorsteuer n.§13b UStG');\r
-INSERT INTO gifi (accno,description) VALUES ('1409', 'Abziehbare Vorsteuer n.§13b UStG 16%');\r
-INSERT INTO gifi (accno,description) VALUES ('1433', 'Bezahlte Einfuhrumsatzsteuer');\r
-INSERT INTO gifi (accno,description) VALUES ('1460', 'Geldtransit');\r
-INSERT INTO gifi (accno,description) VALUES ('1480', 'Gegenkonto Vorsteuer §4/3 EStG');\r
-INSERT INTO gifi (accno,description) VALUES ('1481', 'Auflösung Vorst.a.Vorjahr §4/3 EStG');\r
-INSERT INTO gifi (accno,description) VALUES ('1482', 'Vorst.aus Investitionen §4/3 EStG');\r
-INSERT INTO gifi (accno,description) VALUES ('1484', 'abziehb.VorSt EU-Erwerb Neufzg.b.Lief. o. USt.Ident.Nr');\r
-INSERT INTO gifi (accno,description) VALUES ('1600', 'Kasse');\r
-INSERT INTO gifi (accno,description) VALUES ('1800', 'Bank');\r
-INSERT INTO gifi (accno,description) VALUES ('2100', 'Privatentnahmen allgemein');\r
-INSERT INTO gifi (accno,description) VALUES ('2150', 'Privatsteuern');\r
-INSERT INTO gifi (accno,description) VALUES ('2180', 'Privateinlagen');\r
-INSERT INTO gifi (accno,description) VALUES ('2200', 'Sonderausgaben beschränkt abzugsfähig');\r
-INSERT INTO gifi (accno,description) VALUES ('2230', 'Sonderausgaben unbeschr. abzugsfähig');\r
-INSERT INTO gifi (accno,description) VALUES ('2250', 'Zuwendungen, Spenden');\r
-INSERT INTO gifi (accno,description) VALUES ('2953', 'Satzungsm.Rücklagen 0% Vorbelast.EK02');\r
-INSERT INTO gifi (accno,description) VALUES ('3150', 'Verbindl.gegenüber Kreditinstituten');\r
-INSERT INTO gifi (accno,description) VALUES ('3151', '- Restlaufzeit b.1 Jahr');\r
-INSERT INTO gifi (accno,description) VALUES ('3160', '- Restlaufzeit 1 bis 5 Jahre');\r
-INSERT INTO gifi (accno,description) VALUES ('3170', '- Restlaufzeit grösser als 5 Jahre');\r
-INSERT INTO gifi (accno,description) VALUES ('3300', 'Verbindlichkeiten aus Lief.u.Leist.');\r
-INSERT INTO gifi (accno,description) VALUES ('3305', 'Vblk.a.LuL z.allg.Umsatzsteuersatz (EÜR)');\r
-INSERT INTO gifi (accno,description) VALUES ('3306', 'Vblk.a.LuL zum erm.Umsatzsteuersatz (EÜR)');\r
-INSERT INTO gifi (accno,description) VALUES ('3307', 'Vblk.a.LuL ohne Vorsteuer (EÜR)');\r
-INSERT INTO gifi (accno,description) VALUES ('3309', 'Gegenkonto 1605-1607 b.Aufteilung d.Vblk.n.Steuers.(EÜR)');\r
-INSERT INTO gifi (accno,description) VALUES ('3800', 'Umsatzsteuer');\r
-INSERT INTO gifi (accno,description) VALUES ('3801', 'Umsatzsteuer 7%');\r
-INSERT INTO gifi (accno,description) VALUES ('3802', 'Umsatzsteuer aus EG-Erwerb');\r
-INSERT INTO gifi (accno,description) VALUES ('3803', 'Umsatzsteuer aus EG-Erwerb 16%');\r
-INSERT INTO gifi (accno,description) VALUES ('3805', 'Umsatzsteuer 16%');\r
-INSERT INTO gifi (accno,description) VALUES ('3817', 'Umsatzsteuer a.i.anderen EG-Land stpfl.Lieferungen');\r
-INSERT INTO gifi (accno,description) VALUES ('3820', 'Umsatzsteuer-Vorauszahlungen');\r
-INSERT INTO gifi (accno,description) VALUES ('3830', 'Umsatzsteuer-Vorauszahlungen 1/11');\r
-INSERT INTO gifi (accno,description) VALUES ('3833', 'Umsatzsteuer n.§13b UStG');\r
-INSERT INTO gifi (accno,description) VALUES ('3841', 'Umsatzsteuer Vorjahr');\r
-INSERT INTO gifi (accno,description) VALUES ('3845', 'Umsatzsteuer frühere Jahre');\r
-INSERT INTO gifi (accno,description) VALUES ('4110', 'Sonstige steuerfreie Umsätze Inland');\r
-INSERT INTO gifi (accno,description) VALUES ('4120', 'Steuerfreie Umsätze §4Nr.1a UstG');\r
-INSERT INTO gifi (accno,description) VALUES ('4125', 'Steuerfrei innergem. Lieferungen §41bUStG');\r
-INSERT INTO gifi (accno,description) VALUES ('4130', 'Liefe.d.1.Abnehm.bei innergem.Dreiecksg §25b2UStG');\r
-INSERT INTO gifi (accno,description) VALUES ('4135', 'Steuerfr.innergem.Lief.v.Neufahrz.an Abn.o.USt-Ident-Nr.');\r
-INSERT INTO gifi (accno,description) VALUES ('4140', 'Steuerfreie Umsätze Offshore usw.');\r
-INSERT INTO gifi (accno,description) VALUES ('4150', 'Sonstige steuerfreie Umsätze §42-7UStG');\r
-INSERT INTO gifi (accno,description) VALUES ('4180', 'Erlöse,die mit den Durchschnittssätzen d.§24UStG vers.werd.');\r
-INSERT INTO gifi (accno,description) VALUES ('4185', 'Erlöse als Kleinunternehmer i.S.d.§19(1)UStG');\r
-INSERT INTO gifi (accno,description) VALUES ('4200', 'Erlöse');\r
-INSERT INTO gifi (accno,description) VALUES ('4300', 'Erlöse 7%USt');\r
-INSERT INTO gifi (accno,description) VALUES ('4310', 'Erlöse Inland stpfl. EG-Lieferung7%');\r
-INSERT INTO gifi (accno,description) VALUES ('4315', 'Erlös Inland stpfl.EG-Lieferung 16%');\r
-INSERT INTO gifi (accno,description) VALUES ('4320', 'Erlöse aus im and.EG-Land steuerpfl.Lieferungen');\r
-INSERT INTO gifi (accno,description) VALUES ('4400', 'Erlöse 16% USt.');\r
-INSERT INTO gifi (accno,description) VALUES ('4500', 'Provisionserlöse');\r
-INSERT INTO gifi (accno,description) VALUES ('4504', 'Provisionserlöse,steuerfrei (§4Nr.8ff.UStG)');\r
-INSERT INTO gifi (accno,description) VALUES ('4505', 'Provisionserlöse,steuerfrei (§4Nr.5UStG)');\r
-INSERT INTO gifi (accno,description) VALUES ('4506', 'Provisionserlöse 7% USt.');\r
-INSERT INTO gifi (accno,description) VALUES ('4508', 'Provisionserlöse 16% USt.');\r
-INSERT INTO gifi (accno,description) VALUES ('4510', 'Erlöse Abfallverwertung');\r
-INSERT INTO gifi (accno,description) VALUES ('4520', 'Erlös Leergut');\r
-INSERT INTO gifi (accno,description) VALUES ('4580', 'Erlöse zum allg.Umsatzsteuersatz (EÜR)');\r
-INSERT INTO gifi (accno,description) VALUES ('4581', 'Erlöse zum ermä.Umsatzsteuersatz (EÜR)');\r
-INSERT INTO gifi (accno,description) VALUES ('4582', 'Erlöse steuerfrei u.nicht steuerbar (EÜR)');\r
-INSERT INTO gifi (accno,description) VALUES ('4589', 'Gegenkonto 8580-8582 b.Aufteilung d.Erlöse n.Steuersätzen(EÜR)');\r
-INSERT INTO gifi (accno,description) VALUES ('4600', 'Unentgeldliche Wertabgaben');\r
-INSERT INTO gifi (accno,description) VALUES ('4605', 'Entnahme v. Gegenst.o.USt.');\r
-INSERT INTO gifi (accno,description) VALUES ('4610', 'Entnah.d.Untern.f.Zwecke ausserh.d.Untern.7%USt');\r
-INSERT INTO gifi (accno,description) VALUES ('4619', 'Entnahme durch den Untern.f.Zwecke außerhalb d.Untern.(Waren)o.USt');\r
-INSERT INTO gifi (accno,description) VALUES ('4620', 'Entnahme des Untern.f.Zwecke ausserh.d.Untern 16%(Waren)');\r
-INSERT INTO gifi (accno,description) VALUES ('4630', 'Verwendung v.Gegenst.f.Zwecke außerhalb d.Unternehmens 7% USt.');\r
-INSERT INTO gifi (accno,description) VALUES ('4639', 'Verwendung v.Gegenständen f.Zwecke außerhalb d.Untern.o.USt.');\r
-INSERT INTO gifi (accno,description) VALUES ('4640', 'Verw.v.Gegens.f.Zwecke ausserh.d.Untern.16%USt.');\r
-INSERT INTO gifi (accno,description) VALUES ('4645', 'Verwend.v.Gegenst.f.Zwecke außerh.d.Untern.16%USt(Kfz-Nutzung)');\r
-INSERT INTO gifi (accno,description) VALUES ('4646', 'Verwend.f.Gegenst.f.Zwecke außerh.d.Untern.16%USt(Telefonnutzung)');\r
-INSERT INTO gifi (accno,description) VALUES ('4660', 'Unentgeldl.Erbring.sons.Leis.16%USt');\r
-INSERT INTO gifi (accno,description) VALUES ('4670', 'Unentgeltl.Zuw.v Waren 7% Ust');\r
-INSERT INTO gifi (accno,description) VALUES ('4679', 'Unentgeltl.Zuwendung v.Waren o.USt.');\r
-INSERT INTO gifi (accno,description) VALUES ('4680', 'Unentgeltl.Zuw.von Waren 16% Ust');\r
-INSERT INTO gifi (accno,description) VALUES ('4686', 'Unentgeltl.Zuwend.v.Gegens. 16% Ust');\r
-INSERT INTO gifi (accno,description) VALUES ('4689', 'Unentgeldl.Zuw.v.Gegens.ohne Ust');\r
-INSERT INTO gifi (accno,description) VALUES ('4690', 'Nicht steuerbare Umsätze');\r
-INSERT INTO gifi (accno,description) VALUES ('4695', 'Umsatzsteuervergütungen');\r
-INSERT INTO gifi (accno,description) VALUES ('4700', 'Erlösschmälerungen');\r
-INSERT INTO gifi (accno,description) VALUES ('4705', 'Erlösschmälerungen aus steuerfr.Umsätzen §4 Nr.1a UStG');\r
-INSERT INTO gifi (accno,description) VALUES ('4710', 'Erlösschmälerung 7% USt.');\r
-INSERT INTO gifi (accno,description) VALUES ('4720', 'Erlösschmälerung 16% USt.');\r
-INSERT INTO gifi (accno,description) VALUES ('4724', 'Erlösschmäler.a.stfrei.IG Lieferung');\r
-INSERT INTO gifi (accno,description) VALUES ('4725', 'Erlösschmä.Inl.stpfl.EG-Lief. 7%USt');\r
-INSERT INTO gifi (accno,description) VALUES ('4726', 'Erlösschmä.Inl.stpfl.EG-Lief.16%USt');\r
-INSERT INTO gifi (accno,description) VALUES ('4727', 'Erlösschmä.and.EG Land stpfl.Liefer');\r
-INSERT INTO gifi (accno,description) VALUES ('4729', 'Erlösschmälerungen aus im Inland steuerpfl.EG-Lief.15% USt');\r
-INSERT INTO gifi (accno,description) VALUES ('4731', 'Gewährte Skonti 7% USt');\r
-INSERT INTO gifi (accno,description) VALUES ('4735', 'Gewährte Skonti 16% USt.');\r
-INSERT INTO gifi (accno,description) VALUES ('4750', 'Gewährte Boni 7% USt.');\r
-INSERT INTO gifi (accno,description) VALUES ('4760', 'Gewährte Boni 16% USt.');\r
-INSERT INTO gifi (accno,description) VALUES ('4780', 'Gewährte Rabatte 7% USt.');\r
-INSERT INTO gifi (accno,description) VALUES ('4790', 'Gewährte Rabatte 16% Ust.');\r
-INSERT INTO gifi (accno,description) VALUES ('4800', 'Bestandsverä.fertige Erzeugnisse');\r
-INSERT INTO gifi (accno,description) VALUES ('4810', 'Bestandsveränderung-unfertige Erzeu');\r
-INSERT INTO gifi (accno,description) VALUES ('4815', 'Bestandsveränderung-unfertige Leist');\r
-INSERT INTO gifi (accno,description) VALUES ('4820', 'Andere aktivierte Eigenleistungen');\r
-INSERT INTO gifi (accno,description) VALUES ('4830', 'Sonstige Erträge');\r
-INSERT INTO gifi (accno,description) VALUES ('4835', 'Sonstige Erlöse betriebl.u.regelmäß');\r
-INSERT INTO gifi (accno,description) VALUES ('4837', 'Betriebsfremde Erträge nichtaußerorden');\r
-INSERT INTO gifi (accno,description) VALUES ('4840', 'Erträge aus Kursdifferenzen');\r
-INSERT INTO gifi (accno,description) VALUES ('4844', 'Erlöse a.Verk.Sachanlagen steuerfrei§4Nr.1aUStG(b.Buchverlust)');\r
-INSERT INTO gifi (accno,description) VALUES ('4845', 'Erlöse aus Verk.Sachanlagevermögen16% USt (bei Buchverlust)');\r
-INSERT INTO gifi (accno,description) VALUES ('4848', 'Erlöse a.Verk.Sachanlagen steuerfrei§4Nr.1bUStG(b.Buchverlust)');\r
-INSERT INTO gifi (accno,description) VALUES ('4849', 'Erlöse aus Anlagenverkäufen');\r
-INSERT INTO gifi (accno,description) VALUES ('4860', 'Grundstückserträge');\r
-INSERT INTO gifi (accno,description) VALUES ('4900', 'Erträge aus Abgang von AV-Gegenständen');\r
-INSERT INTO gifi (accno,description) VALUES ('4905', 'Ertr.a.d.Abg.v.Gegenst.d.Umlaufverm');\r
-INSERT INTO gifi (accno,description) VALUES ('4910', 'Ertrag a.d.Zuschreib.d.Anlagevermög');\r
-INSERT INTO gifi (accno,description) VALUES ('4915', 'Ertr.a.Zuschreib.d.Umlaufvermögens');\r
-INSERT INTO gifi (accno,description) VALUES ('4920', 'Ertr.a.Herabsetzung d.PWB zu Forderungen');\r
-INSERT INTO gifi (accno,description) VALUES ('4925', 'Ertr. aus abgeschriebenen Forderung');\r
-INSERT INTO gifi (accno,description) VALUES ('4930', 'Ertr.a.d.Auflösung v.Rückstellungen');\r
-INSERT INTO gifi (accno,description) VALUES ('4934', 'Erträge a.d.Auflösung v.SoPo m.Rücklageant.(Exitenzgründungszusch.');\r
-INSERT INTO gifi (accno,description) VALUES ('4939', 'Erträge Aufl. Sopo m.R.(Ansparafa)');\r
-INSERT INTO gifi (accno,description) VALUES ('4941', 'Sachbezüge 7% Ust (Waren)');\r
-INSERT INTO gifi (accno,description) VALUES ('4945', 'Sachbezüge 16% Ust (Waren)');\r
-INSERT INTO gifi (accno,description) VALUES ('4946', 'Verrechnete sons. Sachbezüge keine Waren');\r
-INSERT INTO gifi (accno,description) VALUES ('4960', 'Periodenfremde Erträge nicht außero');\r
-INSERT INTO gifi (accno,description) VALUES ('4970', 'Versicherungsentschädigungen');\r
-INSERT INTO gifi (accno,description) VALUES ('4981', 'Steuerfr.Erträge a.d.Auflös.v.SoPo m.Rücklageanteil');\r
-INSERT INTO gifi (accno,description) VALUES ('4982', 'Sonst.steuerfreie Betriebseinnahmen');\r
-INSERT INTO gifi (accno,description) VALUES ('5190', 'Energiestoffe (Fertigung)');\r
-INSERT INTO gifi (accno,description) VALUES ('5300', 'Wareneingang 7% Vorsteuer');\r
-INSERT INTO gifi (accno,description) VALUES ('5400', 'Wareneingang 16% Vorsteuer');\r
-INSERT INTO gifi (accno,description) VALUES ('5420', 'Innergemein.Erwerb 7% VorSt u. Ust');\r
-INSERT INTO gifi (accno,description) VALUES ('5425', 'Innergem.Erwerb 16% VorSt u. Ust');\r
-INSERT INTO gifi (accno,description) VALUES ('5440', 'Innergem.Erwerb v.Neufahrz.v.Lief.o.USt.Identnr.16%VSt.u.16%USt.');\r
-INSERT INTO gifi (accno,description) VALUES ('5550', 'Steuerfreier innergem.Erwerb');\r
-INSERT INTO gifi (accno,description) VALUES ('5559', 'Steuerfreie Einfuhren');\r
-INSERT INTO gifi (accno,description) VALUES ('5580', 'Wareneinkauf z.allg.Umsatzsteuersatz (EÜR)');\r
-INSERT INTO gifi (accno,description) VALUES ('5581', 'Wareneinkauf z.erm.Umsatzsteuersatz(EÜR)');\r
-INSERT INTO gifi (accno,description) VALUES ('5582', 'Wareneinkauf ohne Vorsteuerabzug(EÜR)');\r
-INSERT INTO gifi (accno,description) VALUES ('5589', 'Gegenkto.3580-3582 b.Aufteilung d.WE n.Steuersätzen(EüR)');\r
-INSERT INTO gifi (accno,description) VALUES ('5600', 'Nicht abziehbare Vorsteuer');\r
-INSERT INTO gifi (accno,description) VALUES ('5610', 'Nicht abziehb.Vorsteuer 7%');\r
-INSERT INTO gifi (accno,description) VALUES ('5650', 'Nicht abziehb.Vorsteuer 16%');\r
-INSERT INTO gifi (accno,description) VALUES ('5731', 'Erhaltene Skonti 7% Vorsteuer');\r
-INSERT INTO gifi (accno,description) VALUES ('5735', 'Erhaltene Skonti 16% Vorsteuer');\r
-INSERT INTO gifi (accno,description) VALUES ('5750', 'Erhaltene Boni 7% Vorsteuer');\r
-INSERT INTO gifi (accno,description) VALUES ('5760', 'Erhaltene Boni 16% Vorsteuer');\r
-INSERT INTO gifi (accno,description) VALUES ('5780', 'Erhaltene Rabatte 7% Vorsteuer');\r
-INSERT INTO gifi (accno,description) VALUES ('5790', 'Erhaltene Rabatte 16% Vorsteuer');\r
-INSERT INTO gifi (accno,description) VALUES ('5800', 'Bezugsnebenkosten');\r
-INSERT INTO gifi (accno,description) VALUES ('5820', 'Leergut');\r
-INSERT INTO gifi (accno,description) VALUES ('5840', 'Zölle und Einfuhrabgaben');\r
-INSERT INTO gifi (accno,description) VALUES ('5860', 'Verrechnete Stoffkosten');\r
-INSERT INTO gifi (accno,description) VALUES ('5880', 'Bestandsver.Roh-,Hilfs-.Betriebs.sow.bez.Waren');\r
-INSERT INTO gifi (accno,description) VALUES ('5900', 'Fremdleistungen');\r
-INSERT INTO gifi (accno,description) VALUES ('5915', 'Leist.v.ausländ.Untern. 7% VSt.u.7%USt.');\r
-INSERT INTO gifi (accno,description) VALUES ('5925', 'Leist.v.ausländ.Untern. 16% VSt.u.16%USt.');\r
-INSERT INTO gifi (accno,description) VALUES ('6010', 'Löhne');\r
-INSERT INTO gifi (accno,description) VALUES ('6020', 'Gehälter');\r
-INSERT INTO gifi (accno,description) VALUES ('6026', 'Tantiemen');\r
-INSERT INTO gifi (accno,description) VALUES ('6027', 'Geschäftsführergehälter');\r
-INSERT INTO gifi (accno,description) VALUES ('6030', 'Aushilfslöhne');\r
-INSERT INTO gifi (accno,description) VALUES ('6040', 'Lohnsteuer für Aushilfe');\r
-INSERT INTO gifi (accno,description) VALUES ('6045', 'Bedienungsgelder');\r
-INSERT INTO gifi (accno,description) VALUES ('6050', 'Ehegattengehalt');\r
-INSERT INTO gifi (accno,description) VALUES ('6060', 'Freiwillige sozi.Aufw.lohnsteuerpflichtig.');\r
-INSERT INTO gifi (accno,description) VALUES ('6069', 'Pauschale Lohnsteuera.sons.Bezüge (z.B.Fahrtkostenzu)');\r
-INSERT INTO gifi (accno,description) VALUES ('6070', 'Krankengeldzuschüsse');\r
-INSERT INTO gifi (accno,description) VALUES ('6080', 'Vermögenswirksame Leistungen');\r
-INSERT INTO gifi (accno,description) VALUES ('6090', 'Fahrtkostenerst.Wohnung/Arbeitsstät');\r
-INSERT INTO gifi (accno,description) VALUES ('6110', 'Gesetzlich soziale Aufwendungen');\r
-INSERT INTO gifi (accno,description) VALUES ('6120', 'Beiträge zur Berufsgenossenschaftr');\r
-INSERT INTO gifi (accno,description) VALUES ('6130', 'Freiwillig soziale Aufwendungen lohnsteuerfrei');\r
-INSERT INTO gifi (accno,description) VALUES ('6147', 'Pauschale Lohnsteuer auf sonst.Bezüge(z.B.Direktversicherung');\r
-INSERT INTO gifi (accno,description) VALUES ('6200', 'Abschreibungen a.immat.Vermögensgeg');\r
-INSERT INTO gifi (accno,description) VALUES ('6205', 'Abschreibung a.d.Geschäft-o.Firmenw');\r
-INSERT INTO gifi (accno,description) VALUES ('6210', 'Außerplan.AfA a.immat.Vermögensgeg.');\r
-INSERT INTO gifi (accno,description) VALUES ('6220', 'Abschreibungen auf Sachanlagen');\r
-INSERT INTO gifi (accno,description) VALUES ('6221', 'Abschreibung auf Gebäude');\r
-INSERT INTO gifi (accno,description) VALUES ('6222', 'Abschreibungen auf Kfz');\r
-INSERT INTO gifi (accno,description) VALUES ('6230', 'Außerplanmäßig Abschr.a.Sachanlagen');\r
-INSERT INTO gifi (accno,description) VALUES ('6231', 'Absetzung f.außergew.techn.u.wirtschaftl.AfA bei Gebäuden');\r
-INSERT INTO gifi (accno,description) VALUES ('6232', 'Absetzung f.außergew.techn.u.wirtschaftl.AfA des Kfz');\r
-INSERT INTO gifi (accno,description) VALUES ('6233', 'Absetzung f.außergew.techn.u.wirtschaftl.AfA sonst.WG');\r
-INSERT INTO gifi (accno,description) VALUES ('6240', 'Abschr.a.Sachanl.aufgr.steuerl.Sondervorschriften');\r
-INSERT INTO gifi (accno,description) VALUES ('6241', 'Sonderabschreibung nach §7g(1)u.(2)EStG (ohne Kfz)');\r
-INSERT INTO gifi (accno,description) VALUES ('6242', 'Sonderabschreibung n.§7g(1)u.(2)EStG (für Kfz)');\r
-INSERT INTO gifi (accno,description) VALUES ('6250', 'Kaufleasing');\r
-INSERT INTO gifi (accno,description) VALUES ('6260', 'Sofortabschreibung GWG');\r
-INSERT INTO gifi (accno,description) VALUES ('6262', 'Abschreibungen auf aktivierte GWG');\r
-INSERT INTO gifi (accno,description) VALUES ('6270', 'Abschreibungen auf Finanzanlagen');\r
-INSERT INTO gifi (accno,description) VALUES ('6275', 'Abschr.a.Wertp.d.Umlaufvermögens');\r
-INSERT INTO gifi (accno,description) VALUES ('6280', 'Forderungsverlust-übliche Höhe');\r
-INSERT INTO gifi (accno,description) VALUES ('6281', 'Forderungsverluste 7% USt.(übliche Höhe');\r
-INSERT INTO gifi (accno,description) VALUES ('6285', 'Forderungsverluste 16% USt.(übliche Höhe');\r
-INSERT INTO gifi (accno,description) VALUES ('6300', 'Sonstige betriebliche Aufwendungen');\r
-INSERT INTO gifi (accno,description) VALUES ('6303', 'Fremdleistungen');\r
-INSERT INTO gifi (accno,description) VALUES ('6304', 'Sons.Aufw.betriebl. und regelmäßig');\r
-INSERT INTO gifi (accno,description) VALUES ('6305', 'Raumkosten');\r
-INSERT INTO gifi (accno,description) VALUES ('6310', 'Miete');\r
-INSERT INTO gifi (accno,description) VALUES ('6315', 'Pacht');\r
-INSERT INTO gifi (accno,description) VALUES ('6320', 'Heizung');\r
-INSERT INTO gifi (accno,description) VALUES ('6325', 'Gas,Strom, Wasser');\r
-INSERT INTO gifi (accno,description) VALUES ('6330', 'Reinigung');\r
-INSERT INTO gifi (accno,description) VALUES ('6335', 'Instandhaltung betrieb.Räume');\r
-INSERT INTO gifi (accno,description) VALUES ('6338', 'Instandhaltung betrieb.Räume nicht Betriebsverm.');\r
-INSERT INTO gifi (accno,description) VALUES ('6343', 'Abgaben f.betrieb.genutz.Grundbesitz nicht Betriebsverm.');\r
-INSERT INTO gifi (accno,description) VALUES ('6345', 'Sonstige Raumkosten');\r
-INSERT INTO gifi (accno,description) VALUES ('6348', 'Aufwend.f.ein häusliches Arbeitszimmer(abziehb.Anteil)');\r
-INSERT INTO gifi (accno,description) VALUES ('6349', 'Aufwend.f.ein häusliches Arbeitszimmer(nicht abziehb.Anteil)');\r
-INSERT INTO gifi (accno,description) VALUES ('6350', 'Grundstücksaufwendungen');\r
-INSERT INTO gifi (accno,description) VALUES ('6390', 'Zuwend.,Spenden,steuerlich n.abziehbar');\r
-INSERT INTO gifi (accno,description) VALUES ('6358', 'Gründstücksaufwend.f.Gebäude,die nicht z.Betriebsverm.gehören');\r
-INSERT INTO gifi (accno,description) VALUES ('6400', 'Versicherungen');\r
-INSERT INTO gifi (accno,description) VALUES ('6405', 'Versicherungen f.Gebäude,die zum BV gehören');\r
-INSERT INTO gifi (accno,description) VALUES ('6420', 'Beiträge');\r
-INSERT INTO gifi (accno,description) VALUES ('6430', 'Sonstige Abgaben');\r
-INSERT INTO gifi (accno,description) VALUES ('6436', 'Steuerl.abzugs.Verspätungszuschl.u.Zwangsgelder');\r
-INSERT INTO gifi (accno,description) VALUES ('6437', 'Steuerl.n.abzugsf.Verspätungszuschläge u.Zwangsgelder');\r
-INSERT INTO gifi (accno,description) VALUES ('6440', 'Ausgleichsabgabe i.S.d.Schwerbehinterdengesetzes');\r
-INSERT INTO gifi (accno,description) VALUES ('6460', 'Rep.u.Instandhaltungen v.techn.Anlagen u.Maschinen');\r
-INSERT INTO gifi (accno,description) VALUES ('6470', 'Rep.u.Instandhaltungen v.and.Anlagen u.Betriebs-u.Geschäftsausst.');\r
-INSERT INTO gifi (accno,description) VALUES ('6490', 'Sonstige Reparaturen u.Instandhalt.');\r
-INSERT INTO gifi (accno,description) VALUES ('6495', 'Wartungskosten für Hard-u.Software');\r
-INSERT INTO gifi (accno,description) VALUES ('6498', 'Mietleasing');\r
-INSERT INTO gifi (accno,description) VALUES ('6499', 'Gewerbest.zu berücksicht.Mietleasing §8 GewStG');\r
-INSERT INTO gifi (accno,description) VALUES ('6500', 'Fahrzugkosten');\r
-INSERT INTO gifi (accno,description) VALUES ('6520', 'Kfz-Versicherungen');\r
-INSERT INTO gifi (accno,description) VALUES ('6530', 'Laufende Kfz-Betriebskosten');\r
-INSERT INTO gifi (accno,description) VALUES ('6540', 'Kfz-Reparaturen');\r
-INSERT INTO gifi (accno,description) VALUES ('6550', 'Garagenmiete');\r
-INSERT INTO gifi (accno,description) VALUES ('6560', 'Fremdfahrzeuge');\r
-INSERT INTO gifi (accno,description) VALUES ('6595', 'Fremdfahrzeugkosten');\r
-INSERT INTO gifi (accno,description) VALUES ('6570', 'Sonstige Kfz-Kosten');\r
-INSERT INTO gifi (accno,description) VALUES ('6580', 'Mautgebühren');\r
-INSERT INTO gifi (accno,description) VALUES ('6590', 'Fahrzeugkosten f.Kfz,die nicht zum BV gehören');\r
-INSERT INTO gifi (accno,description) VALUES ('6600', 'Werbekosten');\r
-INSERT INTO gifi (accno,description) VALUES ('6610', 'Geschenke abzugsf.');\r
-INSERT INTO gifi (accno,description) VALUES ('6620', 'Geschenke nicht abzugsf.');\r
-INSERT INTO gifi (accno,description) VALUES ('6625', 'Geschenke ausschließl.betrieb.genut');\r
-INSERT INTO gifi (accno,description) VALUES ('6630', 'Repräsentationskosten');\r
-INSERT INTO gifi (accno,description) VALUES ('6640', 'Bewirtungskosten');\r
-INSERT INTO gifi (accno,description) VALUES ('6643', 'Aufmerksamkeiten');\r
-INSERT INTO gifi (accno,description) VALUES ('6644', 'Nicht abzugsfähige Bewirtungskosten');\r
-INSERT INTO gifi (accno,description) VALUES ('6645', 'Nicht abzugsfähige Betriebsausgaben');\r
-INSERT INTO gifi (accno,description) VALUES ('6650', 'Reisekosten Arbeitnehmer');\r
-INSERT INTO gifi (accno,description) VALUES ('6660', 'Reisekosten Arbeitn.Übernachtungsaufwand');\r
-INSERT INTO gifi (accno,description) VALUES ('6663', 'Reisekosten Arbeitn.m.Vorsteuerabzu f.öffentl.Verkehrsm.');\r
-INSERT INTO gifi (accno,description) VALUES ('6664', 'Reisekosten Arbeitn.Verpflegungmehr');\r
-INSERT INTO gifi (accno,description) VALUES ('6668', 'Kilometerentgelderstattung Arbeitnehmer');\r
-INSERT INTO gifi (accno,description) VALUES ('6670', 'Reisekosten Unternehmer');\r
-INSERT INTO gifi (accno,description) VALUES ('6673', 'Reisek.Untern.m.Vorsteuerabzug (f.öffentl.Verkehrsm.');\r
-INSERT INTO gifi (accno,description) VALUES ('6674', 'Reisekosten Untern.Verpflegungsmehr');\r
-INSERT INTO gifi (accno,description) VALUES ('6680', 'Reisekosten Untern.Übernachtungsauf');\r
-INSERT INTO gifi (accno,description) VALUES ('6688', 'Fahrten zw.Wohn.und Arbeitsstätte (nicht abziehb.Teil)');\r
-INSERT INTO gifi (accno,description) VALUES ('6689', 'Fahrten zw.Wohn.-und Arbeitsstätte (Haben)');\r
-INSERT INTO gifi (accno,description) VALUES ('6700', 'Kosten der Warenabgabe');\r
-INSERT INTO gifi (accno,description) VALUES ('6710', 'Verpackungsmaterial');\r
-INSERT INTO gifi (accno,description) VALUES ('6740', 'Ausgangsfracht');\r
-INSERT INTO gifi (accno,description) VALUES ('6760', 'Transportversicherung');\r
-INSERT INTO gifi (accno,description) VALUES ('6770', 'Verkaufsprovision');\r
-INSERT INTO gifi (accno,description) VALUES ('6780', 'Fremdarbeiten');\r
-INSERT INTO gifi (accno,description) VALUES ('6790', 'Aufwand für Gewährleistungen');\r
-INSERT INTO gifi (accno,description) VALUES ('6800', 'Porto');\r
-INSERT INTO gifi (accno,description) VALUES ('6805', 'Telefon');\r
-INSERT INTO gifi (accno,description) VALUES ('6810', 'Telefax');\r
-INSERT INTO gifi (accno,description) VALUES ('6815', 'Bürobedarf');\r
-INSERT INTO gifi (accno,description) VALUES ('6820', 'Zeitschriften, Bücher');\r
-INSERT INTO gifi (accno,description) VALUES ('6821', 'Fortbildungskosten');\r
-INSERT INTO gifi (accno,description) VALUES ('6822', 'Freiwillige Sozialleistungen');\r
-INSERT INTO gifi (accno,description) VALUES ('6825', 'Rechts- und Beratungskosten');\r
-INSERT INTO gifi (accno,description) VALUES ('6827', 'Abschluß- und Prüfungskosten');\r
-INSERT INTO gifi (accno,description) VALUES ('6830', 'Buchführungskosten');\r
-INSERT INTO gifi (accno,description) VALUES ('6835', 'Mieten für Einrichtungen');\r
-INSERT INTO gifi (accno,description) VALUES ('6840', 'Mieten für Einrichtungen');\r
-INSERT INTO gifi (accno,description) VALUES ('6845', 'Werkzeuge und Kleingeräte');\r
-INSERT INTO gifi (accno,description) VALUES ('6850', 'Betriebsbedarf');\r
-INSERT INTO gifi (accno,description) VALUES ('6855', 'Nebenkosten des Geldverkehrs');\r
-INSERT INTO gifi (accno,description) VALUES ('6859', 'Aufwend.f.Abraum-u.Abfallbeseitigung');\r
-INSERT INTO gifi (accno,description) VALUES ('6860', 'Nicht abziehbare Vorsteuer');\r
-INSERT INTO gifi (accno,description) VALUES ('6865', 'Nicht abziehbare Vorsteuer 7%');\r
-INSERT INTO gifi (accno,description) VALUES ('6870', 'Nicht abziehbare Vorsteuer 16%');\r
-INSERT INTO gifi (accno,description) VALUES ('6880', 'Aufwendungen aus Kursdifferenzen');\r
-INSERT INTO gifi (accno,description) VALUES ('6895', 'Abgänge Sachanlagen Restbuchwert');\r
-INSERT INTO gifi (accno,description) VALUES ('6900', 'Verluste aus Anlagenabgang');\r
-INSERT INTO gifi (accno,description) VALUES ('6926', 'Einstellungen in SoPo m.Rücklageanteil (Ansparabschreibung');\r
-INSERT INTO gifi (accno,description) VALUES ('6928', 'Einstellungen in SoPo m.Rücklageanteil (Existenzgründungsrücklage');\r
-INSERT INTO gifi (accno,description) VALUES ('6960', 'Periodenfremde Aufwend.(soweit n.außerordentlich');\r
-INSERT INTO gifi (accno,description) VALUES ('6967', 'Betriebsfremde Aufwendungen soweit n.außerord.');\r
-INSERT INTO gifi (accno,description) VALUES ('6970', 'Kalkulatorischer Unternehmerlohn');\r
-INSERT INTO gifi (accno,description) VALUES ('6974', 'Kalkulatorische Zinsen');\r
-INSERT INTO gifi (accno,description) VALUES ('6976', 'Kalkulatorische Aschreibungen');\r
-INSERT INTO gifi (accno,description) VALUES ('6978', 'Kalkulatorische Wagnisse');\r
-INSERT INTO gifi (accno,description) VALUES ('6979', 'Kalkulatorischer Lohn f.unentgeltl.Mitarbeiter');\r
-INSERT INTO gifi (accno,description) VALUES ('7000', 'Erträge aus Beteiligungen');\r
-INSERT INTO gifi (accno,description) VALUES ('7100', 'Sonstige Zinsen und ähnliche Erträge');\r
-INSERT INTO gifi (accno,description) VALUES ('7120', 'Zinsähnliche Erträge');\r
-INSERT INTO gifi (accno,description) VALUES ('7130', 'Diskonterträge');\r
-INSERT INTO gifi (accno,description) VALUES ('7300', 'Zinsen und ähnl.Aufwendungen');\r
-INSERT INTO gifi (accno,description) VALUES ('7305', 'Zinsaufwendung-betriebliche Steuern §223aAO');\r
-INSERT INTO gifi (accno,description) VALUES ('7310', 'Zinsaufwendung f.kurzf.Verbindlichk');\r
-INSERT INTO gifi (accno,description) VALUES ('7320', 'Zinsaufwendung f.langf.Verbindlichk');\r
-INSERT INTO gifi (accno,description) VALUES ('7325', 'Zinsaufwend.f.Gebäude,die z.Betriebsvermögen gehören');\r
-INSERT INTO gifi (accno,description) VALUES ('7326', 'Zinsen zur Finanzierung Anlagevermögen');\r
-INSERT INTO gifi (accno,description) VALUES ('7330', 'Zinsähnliche Aufwendungen');\r
-INSERT INTO gifi (accno,description) VALUES ('7340', 'Diskontaufwendung');\r
-INSERT INTO gifi (accno,description) VALUES ('7400', 'Außerordentliche Erträge');\r
-INSERT INTO gifi (accno,description) VALUES ('7401', 'Außerordentliche Erträge finanzwirksam');\r
-INSERT INTO gifi (accno,description) VALUES ('7450', 'Außerordentliche Erträge nicht finanzwirksam');\r
-INSERT INTO gifi (accno,description) VALUES ('7500', 'Außerordentliche Aufwendung');\r
-INSERT INTO gifi (accno,description) VALUES ('7600', 'Körperschaftssteuer');\r
-INSERT INTO gifi (accno,description) VALUES ('7608', 'Solidaritätszuschlag');\r
-INSERT INTO gifi (accno,description) VALUES ('7609', 'Solidaritätszuschlag für Vorjahr');\r
-INSERT INTO gifi (accno,description) VALUES ('7610', 'Gewerbesteuer');\r
-INSERT INTO gifi (accno,description) VALUES ('7632', 'Kapitalertragssteuer 20%');\r
-INSERT INTO gifi (accno,description) VALUES ('7634', 'Anrechenb.Soli auf Kapitalertragssteuer 20%');\r
-INSERT INTO gifi (accno,description) VALUES ('7635', 'Zinsabschlagsteuer');\r
-INSERT INTO gifi (accno,description) VALUES ('7638', 'Anrechb.Solidari.zuschlag a.Zinsabschlagst.');\r
-INSERT INTO gifi (accno,description) VALUES ('7640', 'Stnachzahl.Vorj.v.Einkomm u.Ertrag');\r
-INSERT INTO gifi (accno,description) VALUES ('7642', 'Sterstat.Vorj.Steuer v.Eink.u.Ertrag');\r
-INSERT INTO gifi (accno,description) VALUES ('7644', 'Ertr.a.d.Aufl.v.Rücks.f.St.v.Ein.Er');\r
-INSERT INTO gifi (accno,description) VALUES ('7650', 'Sonstige Betriebssteuern');\r
-INSERT INTO gifi (accno,description) VALUES ('7675', 'Verbrauchssteuer');\r
-INSERT INTO gifi (accno,description) VALUES ('7678', 'Ökosteuer');\r
-INSERT INTO gifi (accno,description) VALUES ('7680', 'Grundsteuer');\r
-INSERT INTO gifi (accno,description) VALUES ('7684', 'Grundsteuer f.Gebäude,die nicht z.Betriebsvermögen geh');\r
-INSERT INTO gifi (accno,description) VALUES ('7685', 'Kfz-Steuer');\r
-INSERT INTO gifi (accno,description) VALUES ('7690', 'Steuernachzahlung Vorj.f.sons.Steue');\r
-INSERT INTO gifi (accno,description) VALUES ('7692', 'Steuererstattung Vorj.f.sons.Steuer');\r
-INSERT INTO gifi (accno,description) VALUES ('7694', 'Erträge a.d.Aufl.v. Rück.f.sons.Ste');\r
-INSERT INTO gifi (accno,description) VALUES ('7745', 'Entnahmen a.satzungsmäßigen Rücklagen');\r
-INSERT INTO gifi (accno,description) VALUES ('9000', 'Saldenverträge,Sachkonten');\r
-INSERT INTO gifi (accno,description) VALUES ('9008', 'Saldenverträge,Debitoren');\r
-INSERT INTO gifi (accno,description) VALUES ('9009', 'Saldenverträge,Kreditoren');\r
-INSERT INTO gifi (accno,description) VALUES ('9090', 'Summenvortragskonto');\r
--- /dev/null
+-- Minimal Chart of Accounts
+
+INSERT INTO chart (
+ id, accno, description, charttype, category,
+
+ link, -- create links to all forms as default
+
+ gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz,
+ pos_eur, datevautomatik, new_chart_id, valid_from
+
+) VALUES (
+
+ 0, '0', 'Nicht zugeordnet', 'A', 'A',
+ 'AR:AP:IC:AR_amount:AR_paid:AP_amount:AP_paid:IC_sale:IC_cogs:IC_income:IC_expense',
+ '', 0, 0 , 0, 0,
+ 0, FALSE, 0 , now()
+);
+
+-- Minimal Tax-o-matic Configuration
+
+INSERT INTO tax (
+ id, chart_id, rate, taxnumber, taxkey, taxdescription
+) VALUES (
+ '0', '0', '0', '0', '0', 'ohne Steuerautomatik');
+
+
+INSERT INTO taxkeys (
+ id, chart_id, tax_id, taxkey_id, pos_ustva, startdate
+) VALUES (
+ 0, 0, 0, 0, 0, '1970-01-01'
+);
+
+DELETE FROM tax_zones;
+
+INSERT INTO tax_zones (
+ id, description
+) VALUES (
+ 0, 'keiner'
+);
+
+
+-- Minimal buchungsgruppen
+INSERT INTO buchungsgruppen (
+ id, description, inventory_accno_id,
+ income_accno_id_0, expense_accno_id_0, income_accno_id_1,
+ expense_accno_id_1, income_accno_id_2, expense_accno_id_2,
+ income_accno_id_3, expense_accno_id_3
+) VALUES (
+ 0, 'keine', 0,
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0
+);
+
+-- Minimal
+
+INSERT INTO customer (
+ id, name
+) VALUES ( 0, ' keiner');
+
+INSERT INTO vendor (
+ id, name
+) VALUES ( 0, ' keiner');
+
+
+
+-- Minimal defaults
+
+update defaults set
+ inventory_accno_id = 0,
+ income_accno_id = 0,
+ expense_accno_id = 0,
+ fxgain_accno_id = 0,
+ fxloss_accno_id = 0,
+ invnumber = '1',
+ sonumber = '1',
+ ponumber = '1',
+ sqnumber = '1',
+ rfqnumber = '1',
+ customernumber = '1',
+ vendornumber = '1',
+ articlenumber = '1',
+ servicenumber = '1',
+ rmanumber = '1',
+ cnnumber = '1',
+ coa = 'Leerer-Kontenrahmen',
+ curr = 'EUR:USD',
+ weightunit = 'kg';
+
+
\ No newline at end of file
--- /dev/null
+-- @tag: COA_Account_Settings001
+-- @description: Aktualisierung des SKR03
+-- @depends: release_2_4_2
+
+UPDATE taxkeys
+ SET pos_ustva='861',
+ tax_id=(SELECT id FROM tax WHERE taxkey='2'),
+ taxkey_id='2'
+ WHERE startdate='1970-01-01'
+ AND chart_id = (SELECT id FROM chart WHERE accno ='1771')
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ );
+
--- /dev/null
+-- @tag: COA_Account_Settings002
+-- @description: Aktualisierung des SKR03, Bugfix 617
+-- @depends: release_2_4_2
+
+UPDATE chart
+ SET pos_eur='6'
+ WHERE
+ accno = '1771'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ );
+
--- /dev/null
+-- @tag: PgCommaAggregateFunction
+-- @description: Neue Postgres Funktion zur Abfrage mehrdeutiger Ergebniszeilen als kommagetrennte Liste
+-- @depends: release_2_4_1
+-- Taken from: http://www.zigo.dhs.org/postgresql/#comma_aggregate
+-- Copyright © 2005 Dennis Björklund
+-- License: Free
+-- Thx. to A. Kretschmer, http://archives.postgresql.org/pgsql-de-allgemein/2007-02/msg00006.php
+CREATE FUNCTION comma_aggregate(text,text) RETURNS text AS '
+ SELECT CASE WHEN $1 <> '''' THEN $1 || '', '' || $2
+ ELSE $2
+ END;
+' LANGUAGE sql IMMUTABLE STRICT;
+
+CREATE AGGREGATE comma (basetype=text, sfunc=comma_aggregate, stype=text, initcond='' );
+
--- /dev/null
+# @tag: USTVA_abstraction
+# @description: Abstraktion der USTVA Report Daten. Dies vereinfacht die Integration von Steuerberichten anderer Nationen in Lx-Office.
+# @depends: release_2_4_2
+
+# Abstraktionlayer between general Taxreports and USTVA
+# Most of the data and structures are not used yet, but maybe in future,
+# if there are other international customizings are requested...
+
+###################
+
+die("This script cannot be run from the command line.") unless ($main::form);
+
+sub mydberror {
+ my ($msg) = @_;
+ die($dbup_locale->text("Database update error:") .
+ "<br>$msg<br>" . $DBI::errstr);
+}
+
+sub do_query {
+ my ($query, $may_fail) = @_;
+
+ if (!$dbh->do($query)) {
+ mydberror($query) unless ($may_fail);
+ $dbh->rollback();
+ $dbh->begin_work();
+ }
+}
+
+
+sub create_tables {
+
+ # Watch out, SCHEMAs are new in Lx!
+ my @queries = ( # Watch out, it's a normal array!
+ q{ CREATE SCHEMA tax;
+ },
+ q{ CREATE TABLE tax.report_categorys (
+ id integer NOT NULL PRIMARY KEY,
+ description text,
+ subdescription text
+ );
+ },
+ q{ CREATE TABLE tax.report_headings (
+ id integer NOT NULL PRIMARY KEY,
+ category_id integer NOT NULL REFERENCES tax.report_categorys(id),
+ type text,
+ description text,
+ subdescription text
+ );
+ },
+ q{ CREATE TABLE tax.report_variables (
+ id integer NOT NULL PRIMARY KEY,
+ position text NOT NULL,
+ heading_id integer REFERENCES tax.report_headings(id),
+ description text,
+ taxbase text,
+ dec_places text,
+ valid_from date
+ );
+ },
+ );
+
+ do_query("DROP SCHEMA tax CASCADE;", 1);
+ map({ do_query($_, 0); } @queries);
+
+ return 1;
+
+}
+
+sub do_copy {
+
+ my @copy_statements = (
+ "INSERT INTO tax.report_categorys (id, description, subdescription) VALUES (?, ?, ?)",
+ "INSERT INTO tax.report_headings (id, category_id, type, description, subdescription) VALUES (?, ?, ?, ?, ?)",
+ "INSERT INTO tax.report_variables (id, position, heading_id, description, taxbase, dec_places, valid_from) VALUES (?, ?, ?, ?, ?, ?, ?)",
+ );
+
+ my @copy_data = (
+ [ "0;;",
+ "1;Lieferungen und sonstige Leistungen;(einschließlich unentgeltlicher Wertabgaben)",
+ "2;Innergemeinschaftliche Erwerbe;",
+ "3;Ergänzende Angaben zu Umsätzen;",
+ "99;Summe;",
+ ],
+ ["0;0;;;",
+ "1;1;received;Steuerfreie Umsätze mit Vorsteuerabzug;",
+ "2;1;recieved;Steuerfreie Umsätze ohne Vorsteuerabzug;",
+ "3;1;recieved;Steuerpflichtige Umsätze;(Lieferungen und sonstige Leistungen einschl. unentgeltlicher Wertabgaben)",
+ "4;2;recieved;Steuerfreie innergemeinschaftliche Erwerbe;",
+ "5;2;recieved;Steuerpflichtige innergemeinschaftliche Erwerbe;",
+ "6;3;recieved;Umsätze, für die als Leistungsempfänger die Steuer nach § 13b Abs. 2 UStG geschuldet wird;",
+ "66;3;recieved;;",
+ "7;3;paied;Abziehbare Vorsteuerbeträge;",
+ "8;3;paied;Andere Steuerbeträge;",
+ "99;99;;Summe;",
+ ],
+ ["0;keine;0;< < < keine UStVa Position > > >;;;19700101",
+ "1;41;1;Innergemeinschaftliche Lieferungen (§ 4 Nr. 1 Buchst. b UStG) an Abnehmer mit USt-IdNr.;0;0;19700101",
+ "2;44;1;neuer Fahrzeuge an Abnehmer ohne USt-IdNr.;0;0;19700101",
+ "3;49;1;neuer Fahrzeuge außerhalb eines Unternehmens (§ 2a UStG);0;0;19700101",
+ "4;43;1;Weitere steuerfreie Umsätze mit Vorsteuerabzug;0;0;19700101",
+ "5;48;2;Umsätze nach § 4 Nr. 8 bis 28 UStG;0;0;19700101",
+ "6;51;3;zum Steuersatz von 16 %;0;0;19700101",
+ "7;511;3;;6;2;19700101",
+ "8;81;3;zum Steuersatz von 19 %;0;0;19700101",
+ "9;811;3;;8;2;19700101",
+ "10;86;3;zum Steuersatz von 7 %;0;0;19700101",
+ "11;861;3;;10;2;19700101",
+ "12;35;3;Umsätze, die anderen Steuersätzen unterliegen;0;0;19700101",
+ "13;36;3;;12;2;19700101",
+ "14;77;3;Lieferungen in das übrige Gemeinschaftsgebiet an Abnehmer mit USt-IdNr.;0;0;19700101",
+ "15;76;3;Umsätze, für die eine Steuer nach § 24 UStG zu entrichten ist;0;0;19700101",
+ "16;80;3;;15;2;19700101",
+ "17;91;4;Erwerbe nach § 4b UStG;0;0;19700101",
+ "18;97;5;zum Steuersatz von 16 %;0;0;19700101",
+ "19;971;5;;18;2;19700101",
+ "20;89;5;zum Steuersatz von 19 %;0;0;19700101",
+ "21;891;5;;20;2;19700101",
+ "22;93;5;zum Steuersatz von 7 %;0;0;19700101",
+ "23;931;5;;22;2;19700101",
+ "24;95;5;zu anderen Steuersätzen;0;0;19700101",
+ "25;98;5;;24;2;19700101",
+ "26;94;5;neuer Fahrzeuge von Lieferern ohne USt-IdNr. zum allgemeinen Steuersatz;0;0;19700101",
+ "27;96;5;;26;2;19700101",
+ "28;42;66;Lieferungen des ersten Abnehmers bei innergemeinschaftlichen Dreiecksgeschäften (§ 25b Abs. 2 UStG);0;0;19700101",
+ "29;60;66;Steuerpflichtige Umsätze im Sinne des § 13b Abs. 1 Satz 1 Nr. 1 bis 5 UStG, für die der Leistungsempfänger die Steuer schuldet;0;0;19700101",
+ "30;45;66;Nicht steuerbare Umsätze (Leistungsort nicht im Inland);0;0;19700101",
+ "31;52;6;Leistungen eines im Ausland ansässigen Unternehmers (§ 13b Abs. 1 Satz 1 Nr. 1 und 5 UStG);0;0;19700101",
+ "32;53;6;;31;2;19700101",
+ "33;73;6;Lieferungen sicherungsübereigneter Gegenstände und Umsätze, die unter das GrEStG fallen (§ 13b Abs. 1 Satz 1 Nr. 2 und 3 UStG);0;0;19700101",
+ "34;74;6;;33;2;19700101",
+ "35;84;6;Bauleistungen eines im Inland ansässigen Unternehmers (§ 13b Abs. 1 Satz 1 Nr. 4 UStG);0;0;19700101",
+ "36;85;6;;35;2;19700101",
+ "37;65;6;Steuer infolge Wechsels der Besteuerungsform sowie Nachsteuer auf versteuerte Anzahlungen u. ä. wegen Steuersatzänderung;;2;19700101",
+ "38;66;7;Vorsteuerbeträge aus Rechnungen von anderen Unternehmern (§ 15 Abs. 1 Satz 1 Nr. 1 UStG), aus Leistungen im Sinne des § 13a Abs. 1 Nr. 6 UStG (§ 15 Abs. 1 Satz 1 Nr. 5 UStG) und aus innergemeinschaftlichen Dreiecksgeschäften (§ 25b Abs. 5 UStG);;2;19700101",
+ "39;61;7;Vorsteuerbeträge aus dem innergemeinschaftlichen Erwerb von Gegenständen (§ 15 Abs. 1 Satz 1 Nr. 3 UStG);;2;19700101",
+ "40;62;7;Entrichtete Einfuhrumsatzsteuer (§ 15 Abs. 1 Satz 1 Nr. 2 UStG);;2;19700101",
+ "41;67;7;Vorsteuerbeträge aus Leistungen im Sinne des § 13b Abs. 1 UStG (§ 15 Abs. 1 Satz 1 Nr. 4 UStG);;2;19700101",
+ "42;63;7;Vorsteuerbeträge, die nach allgemeinen Durchschnittssätzen berechnet sind (§§ 23 und 23a UStG);;2;19700101",
+ "43;64;7;Berichtigung des Vorsteuerabzugs (§ 15a UStG);;2;19700101",
+ "44;59;7;Vorsteuerabzug für innergemeinschaftliche Lieferungen neuer Fahrzeuge außerhalb eines Unternehmens (§ 2a UStG) sowie von Kleinunternehmern im Sinne des § 19 Abs. 1 UStG (§ 15 Abs. 4a UStG);;2;19700101",
+ "45;69;8;in Rechnungen unrichtig oder unberechtigt ausgewiesene Steuerbeträge (§ 14c UStG) sowie Steuerbeträge, die nach § 4 Nr. 4a Satz 1 Buchst. a Satz 2, § 6a Abs. 4 Satz 2, § 17 Abs. 1 Satz 6 oder § 25b Abs. 2 UStG geschuldet werden;;2;19700101",
+ "46;39;8;Anrechnung (Abzug) der festgesetzten Sondervorauszahlung für Dauerfristverlängerung (nur auszufüllen in der letzten Voranmeldung des Besteuerungszeitraums, in der Regel Dezember);;2;19700101",
+ ],
+ );
+
+ for my $statement ( 0 .. $#copy_statements ) {
+ my $query = $iconv->convert($copy_statements[$statement]);
+ my $sth = $dbh->prepare($query) || mydberror($query);
+
+ for my $copy_line ( 0 .. $#{$copy_data[$statement]} ) {
+ #print $copy_data[$statement][$copy_line] . "<br />"
+ $sth->execute(split m/;/, $iconv->convert($copy_data[$statement][$copy_line]), -1) || mydberror($query);
+ }
+ $sth->finish();
+ }
+ return 1;
+}
+
+
+return create_tables() && do_copy();
--- /dev/null
+# @tag: USTVA_at
+# @description: USTVA Report Daten fuer Oesterreich. Vielen Dank an Gerhard Winkler..
+# @depends: USTVA_abstraction
+
+unless ( $main::form ) {
+ die("This script cannot be run from the command line.");
+}
+
+if ( check_coa('Austria') ){
+
+ if ( coa_is_empty() ) {
+ print qq|Eine leere Datenbank mit Kontenrahmen Österreich vorgefunden. <br />
+ Die Aktualisierungen werden eingespielt...<br />
+ <b>Achtung: Dieses Update ist ungetestet und bedarf weiterer Konfiguration</b>|;
+
+ return 1
+ && clear_tables(( 'tax.report_variables', 'tax.report_headings',
+ 'tax.report_categorys', 'taxkeys',
+ 'tax', 'chart',
+ 'buchungsgruppen',
+ ))
+ && do_copy_tax_report_structure()
+ && do_insert_chart()
+ && do_insert_tax()
+ && do_insert_taxkeys()
+ && do_insert_buchungsgruppen()
+ ;
+ }
+ else {
+ print qq|Eine österreichische Datenbank in der bereits Buchungssätze enthalten sind, kann nicht aktualisiert werden.<br />
+ Bitte eine neue Datenbank mit Kontenrahmen 'Austria' anlegen.|;
+ return 1;
+ }
+
+}
+else {
+ print qq|Nichts zu tun in diesem Kontenrahmen.|;
+ return 1;
+}
+
+return 0;
+
+######################################################
+
+sub mydberror {
+ my ($msg) = @_;
+ die($dbup_locale->text("Database update error:") .
+ "<br>$msg<br>" . $DBI::errstr);
+}
+
+sub do_query {
+ my ($query, $may_fail) = @_;
+
+ if (!$dbh->do($query)) {
+ mydberror($query) unless ($may_fail);
+ $dbh->rollback();
+ $dbh->begin_work();
+ }
+}
+
+
+sub clear_tables {
+
+ my @clear = @_;
+
+ my @queries = (
+ q{ DELETE FROM tax.report_categorys; },
+ q{ DELETE FROM tax.report_headings; },
+ q{ DELETE FROM tax.report_variables; },
+ );
+
+ map({ do_query("DELETE FROM $_ ;", 0); } @clear);
+
+ return 1;
+
+}
+
+sub check_coa {
+
+ my ( $want_coa ) = @_;
+
+ my $query = q{ SELECT count(*) FROM defaults WHERE coa = ? };
+ my ($have_coa) = selectrow_query($form, $dbh, $query, $want_coa);
+
+ return $have_coa;
+
+}
+
+sub coa_is_empty {
+
+ my $query = q{ SELECT count(*)
+ FROM ar, ap, gl, invoice, acc_trans, customer, vendor, parts
+ };
+ my ($empty) = selectrow_query($form, $dbh, $query);
+
+ $empty = !$empty;
+
+ return $empty;
+}
+
+
+sub do_copy_tax_report_structure {
+
+ my @queries = (
+ "INSERT INTO tax.report_categorys (id, description, subdescription) VALUES (0, NULL, NULL)",
+ "INSERT INTO tax.report_headings (id, category_id, type, description, subdescription) VALUES (0, 0, NULL, NULL, NULL)",
+ );
+
+ map({ do_query($_); } @queries);
+
+
+ my @copy_statements = (
+ "INSERT INTO tax.report_variables (id, position, heading_id, description, dec_places, valid_from) VALUES (?, ?, ?, ?, ?, ?)",
+ );
+
+
+ my @copy_data = (
+ [
+ "1;000;0;a) Gesamtbetrag der Bemessungsgrundlage für Lieferungen und sonstige Leistungen (ohne den nachstehend angeführten Eigenverbrauch) einschließlich Anzahlungen (jeweils ohne Umsatzsteuer);2;1970-01-01",
+ "2;001;0;zuzüglich Eigenverbrauch (§1 Abs. 1 Z 2, § 3 Abs. 2 und § 3a Abs. 1a);2;1970-01-01",
+ "3;021;0;abzüglich Umsätze für die die Steuerschuld gemäß § 19 Abs. 1 zweiter Satz sowie gemäß § 19 Abs. 1a, Abs. 1b, Abs. 1c auf den Leistungsempfänger übergegangen ist.;2;1970-01-01",
+ "4;011;0;a) §6 Abs. 1 Z 1 iVm § 7 (Ausfuhrlieferungen);2;1970-01-01",
+ "5;012;0;b) §6 Abs. 1 Z 1 iVm § 8 (Lohnveredelungen);2;1970-01-01",
+ "6;015;0;c) §6 Abs. 1 Z 2 bis 6 sowie § 23 Abs. 5 (Seeschifffahrt, Luftfahrt, grenzüberschreitende Personenbeförderung, Diplomaten, Reisevorleistungen im Drittlandsgebiet usw.);2;1970-01-01",
+ "7;017;0;d) Art. 6 Abs. 1 (innergemeinschaftliche Lieferungen ohne die nachstehend gesondert anzuführenden Fahrzeuglieferungen);2;1970-01-01",
+ "8;018;0;e) Art. 6 Abs. 1, sofern Lieferungen neuer Fahrzeuge an Abnehmer ohne UID-Nummer bzw. durch Fahrzeuglieferer gemäß Art. 2 erfolgen.;2;1970-01-01",
+ "9;019;0;a) § 6 Abs. 1 Z 9 lit. a (Grundstücksumsätze);2;1970-01-01",
+ "10;016;0;b) §6 Abs. 1 Z 27 (Kleinunternehmer);2;1970-01-01",
+ "11;020;0;c) § 6 Abs. 1 Z ___ (übrige steuerfreie Umsätze ohne Vorsteuerabzug);2;1970-01-01",
+ "12;022_links;0;20% Nominalsteuersatz;2;1970-01-01",
+ "13;022_rechts;0;20% Nominalsteuersatz;2;1970-01-01",
+ "14;029_links;0;10% ermäßigter Steuersatz;2;1970-01-01",
+ "15;029_rechts;0;10% ermäßigter Steuersatz;2;1970-01-01",
+ "16;025_links;0;12% für Weinumsätze durch landwirtschaftliche Betriebe;2;1970-01-01",
+ "17;025_rechts;0;12% für Weinumsätze durch landwirtschaftliche Betriebe;2;1970-01-01",
+ "18;035_links;0;16% für Jungholz und Mittelberg;2;1970-01-01",
+ "19;035_rechts;0;16% für Jungholz und Mittelberg;2;1970-01-01",
+ "20;052_links;0;10% Zusatzsteuer für pauschalierte land- und forstwirtschaftliche Betriebe;2;1970-01-01",
+ "21;052_rechts;0;10% Zusatzsteuer für pauschalierte land- und forstwirtschaftliche Betriebe;2;1970-01-01",
+ "22;038_links;0;8% Zusatzsteuer für pauschalierte land- und forstwirtschaftliche Betriebe;2;1970-01-01",
+ "23;038_rechts;0;8% Zusatzsteuer für pauschalierte land- und forstwirtschaftliche Betriebe;2;1970-01-01",
+ "24;056;0;Steuerschuld gemäß § 11 Abs. 12 und 14, § 16 Abs. 2 sowie gemäß Art. 7 Abs. 4;2;1970-01-01",
+ "25;057;0;Steuerschuld gemäß § 19 Abs. 1 zweiter Satz, § 19 Abs. 1c sowie gemäß Art. 25 Abs. 5;2;1970-01-01",
+ "26;048;0;Steuerschuld gemäß § 19 Abs. 1a (Bauleistungen);2;1970-01-01",
+ "27;044;0;Steuerschuld gemäß § 19 Abs. 1b (Sicherungseigentum, Vorbehaltseigentum und Grundstücke im Zwangsversteigerungsverfahren);2;1970-01-01",
+ "28;070;0;Gesamtbetrag der Bemessungsgrundlagen für innergemeinschaftliche Erwerbe;2;1970-01-01",
+ "29;071;0;Davon Steuerfrei gemäß Art. 6 Abs 2;2;1970-01-01",
+ "30;072_links;0;20% Nominalsteuersatz;2;1970-01-01",
+ "31;072_rechts;0;20% Nominalsteuersatz;2;1970-01-01",
+ "32;073_links;0;10% ermäßigter Steuersatz;2;1970-01-01",
+ "33;073_rechts;0;10% ermäßigter Steuersatz;2;1970-01-01",
+ "34;075_links;0;16% für Jungholz und Mittelberg;2;1970-01-01",
+ "35;075_rechts;0;16% für Jungholz und Mittelberg;2;1970-01-01",
+ "36;076;0;Erwerbe gemäß Art. 3 Abs. 8 zweiter Satz, die im Mitgliedstaat des Bestimmungslandes besteuert worden sind;2;1970-01-01",
+ "37;077;0;Erwerbe gemäß Art. 3 Abs. 8 zweiter Satz, die gemäß Art. 25 Abs. 2 im Inland als besteuert gelten;2;1970-01-01",
+ "38;060;0;Gesamtbetrag der Vorsteuern (ohne die nachstehend gesondert anzuführenden Beträge);2;1970-01-01",
+ "39;061;0;Vorsteuern betreffend die entrichtete Einfuhrumsatzsteuer (§12 Abs. 1 Z 2 lit.a);2;1970-01-01",
+ "40;083;0;Vorsteuern betreffend die am Abgabenkonto verbuchte Einfuhrumsatzsteuer (§12 Abs. 1 Z 2 lit.b);2;1970-01-01",
+ "41;065;0;Vorsteuern aus dem innergemeinschaftlichen Erwerb;2;1970-01-01",
+ "42;066;0;Vorsteuern betreffend der Steuerschuld gemäß § 19 Abs. 1c sowie gemäß Art. 25 Abs. 5;2;1970-01-01",
+ "43;082;0;Vorsteuern betreffend der Steuerschuld gemäß § 19 Abs. 1a (Bauleistungen);2;1970-01-01",
+ "44;087;0;Vorsteuern betreffend die Steuerschuld gemäß § 19 Abs. 1b (Sicherungseigentum, Vorbehaltseigentum und Grundstücke im Zwangsversteigerungsverfahren);2;1970-01-01",
+ "45;064;0;Vorsteuern gemäß §12 Abs. 16 und Vorsteuern für innergemeinschaftliche Lieferungen neuer Fahrzeuge von Fahrzeuglieferanten gemäß Art. 2;2;1970-01-01",
+ "46;062;0;Davon gemäß § 12 Abs. 3 iVm Abs. 4 und 5;2;1970-01-01",
+ "47;063;0;Berichtigung gemäß § 12 Abs. 10 und 11;2;1970-01-01",
+ "48;067;0;Berichtigung gemäß § 16;2;1970-01-01",
+ "49;090;0;Sonstige Berichtigungen;2;1970-01-01",
+ "50;095;0;Zahllast/Gutschrift;2;1970-01-01",
+ ],
+ );
+
+ for my $statement ( 0 .. $#copy_statements ) {
+ my $query = $iconv->convert($copy_statements[$statement]);
+ my $sth = $dbh->prepare($query) || mydberror($query);
+
+ for my $copy_line ( 0 .. $#{$copy_data[$statement]} ) {
+ #print $copy_data[$statement][$copy_line] . "<br />"
+ $sth->execute(split m/;/, $iconv->convert($copy_data[$statement][$copy_line]), -1) || mydberror($query);
+ } #/
+ $sth->finish();
+ }
+ return 1;
+}
+
+sub do_insert_chart {
+
+ my @copy_statements = (
+ "INSERT INTO chart VALUES (1, '0000', 'AUFWENDUNGEN FÜR INGANGSETZEN UND ERWEITERN DES BETRIEBES', 'H', 'A', '', '00', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.276724', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (2, '0010', 'Firmenwert', 'A', 'A', 'AP_amount', '015', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.28365', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (3, '0100', 'IMMATERIELLE VERMÖGENSGEGENSTÄNDE', 'H', 'A', '', '01', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.288542', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (4, '0110', 'Rechte', 'A', 'A', 'AP_amount', '011', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.291937', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (5, '0200', 'GRUNDSTÜCKE', 'H', 'A', '', '02-03', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.294929', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (6, '0210', 'unbebaute Grundstücke', 'A', 'A', 'AP_amount', '020', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.297958', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (7, '0220', 'bebaute Grundstücke', 'A', 'A', 'AP_amount', '021', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.300987', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (8, '0229', 'kum. Abschreibung bebaute Grundstücke', 'A', 'A', '', '039', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.304114', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (10, '0410', 'Maschinen', 'A', 'A', 'AP_amount', '041', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.312216', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (11, '0419', 'kum. Abschreibung Maschinen', 'A', 'A', '', '069', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.316198', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (12, '0500', 'FAHRZEUGE', 'H', 'A', '', '06', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.319978', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (13, '0510', 'Fahrzeuge', 'A', 'A', 'AP_amount', '063', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.323002', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (14, '0519', 'kum. Abschreibung Fahrzeuge', 'A', 'A', '', '069', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.326041', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (15, '0600', 'BETRIEBS- UND GESCHÄFTSAUSSTATTUNG', 'H', 'A', '', '06', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.330691', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (16, '0620', 'Büroeinrichtungen', 'A', 'A', 'AP_amount', '066', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.33373', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (17, '0625', 'kum. Abschreibung Betriebs- und Geschäftsausstattung', 'A', 'A', '', '069', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.336939', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (18, '0700', 'GELEISTETE ANZAHLUNGEN', 'H', 'A', '', '07', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.340614', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (19, '0800', 'FINANZANLAGEN', 'H', 'A', '', '08-09', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.3436', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (20, '0810', 'Beteiligungen', 'A', 'A', 'AP_amount', '081', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.346638', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (21, '0820', 'Wertpapiere', 'A', 'A', 'AP_amount', '080', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.351452', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (22, '1100', 'ROHSTOFFE', 'H', 'A', '', '1', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.354419', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (23, '1120', 'Vorräte - Rohstoffe', 'A', 'A', 'IC', '110-119', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.357447', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (24, '1200', 'BEZOGENE TEILE', 'H', 'A', '', '1', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.360423', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (25, '1220', 'Vorräte - bezogene Teile', 'A', 'A', 'IC', '120-129', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.363627', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (26, '1300', 'HILFS- UND BETRIEBSSTOFFE', 'H', 'A', '', '1', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.368083', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (27, '1320', 'Hilfsstoffe', 'A', 'A', 'IC', '130-134', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.372229', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (28, '1350', 'Betriebssstoffe', 'A', 'A', 'IC', '135-139', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.375303', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (29, '1400', 'UNFERTIGE ERZEUGNISSE', 'H', 'A', '', '1', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.378277', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (30, '1420', 'Vorräte - unfertige Erzeugnisse', 'A', 'A', 'IC', '140-149', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.381463', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (31, '1500', 'FERTIGE ERZEUGNISSE', 'H', 'A', '', '1', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.384434', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (34, '1540', 'Vorräte - Gruppe C', 'A', 'A', 'IC', '150-159', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.395426', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (35, '1600', 'WAREN', 'H', 'A', '', '1', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.39872', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (36, '1700', 'NOCH NICHT ABGERECHNETE LEISTUNGEN', 'H', 'A', '', '1', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.401807', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (37, '1800', 'GELEISTETE ANZAHLUNGEN', 'H', 'A', '', '1', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.404851', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (38, '1900', 'WERTBERICHTIGUNGEN', 'H', 'A', '', '1', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.409611', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (39, '2000', 'FORDEUNGEN AUS LIEFERUNGEN UND LEISTUNGEN', 'H', 'A', '', '2', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.412995', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (41, '2019', 'Wertberichtigung uneinbringliche Forderungen', 'A', 'A', '', '20-21', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.420867', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (42, '2300', 'SONSTIGE FORDERUNGEN', 'H', 'A', '', '2', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.423897', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (43, '2320', 'sonstige Forderungen', 'A', 'A', 'AP_amount', '23-24', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.428868', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (44, '2500', 'FORDERUNGEN AUS ABGABENVERRECHNUNG', 'H', 'A', '', '2', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.432042', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (46, '2600', 'WERTPAPIERE UND ANTEILE', 'H', 'A', '', '2', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.438205', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (47, '2620', 'Wertpapiere Umlaufvermögen', 'A', 'A', 'AP_amount', '26', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.441382', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (48, '2700', 'KASSABESTAND', 'H', 'A', '', '2', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.444391', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (50, '2800', 'SCHECKS, GUTHABEN BEI KREDITINSTITUTEN', 'H', 'A', '', '2', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.45237', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (53, '3100', 'LANGFRISTIGE VERBINDLICHKEITEN', 'H', 'L', '', '3', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.461985', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (54, '3110', 'Bank Verbindlichkeiten', 'A', 'L', '', '31', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.465019', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (56, '3300', 'VERBINDLICHKEITEN AUS LIEFERUNGEN UND LEISTUNGEN', 'H', 'L', '', '33', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.474305', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (58, '3500', 'VERBINDLICHKEITEN FINANZAMT', 'H', 'L', '', '35', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.480487', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (105, '7611', 'Reinigungsmaterial', 'A', 'E', 'AP_amount', '', 9, NULL, 11, 3, NULL, false, '2006-01-28 18:22:52.649072', '2006-02-03 15:26:38.591173', NULL, NULL);",
+ "INSERT INTO chart VALUES (163, '7340', 'Reisekosten', 'A', 'E', 'AP_amount', '', 9, NULL, NULL, 3, NULL, false, '2006-02-03 15:38:11.636188', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (74, '4600', 'SONSTIGE ERLÖSE', 'H', 'I', '', '4', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.539718', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (95, '7120', 'Grundsteuer', 'A', 'E', '', '', 0, NULL, 12, 3, NULL, false, '2006-01-28 18:22:52.612982', '2006-02-03 15:07:18.076256', NULL, NULL);",
+ "INSERT INTO chart VALUES (94, '7110', 'Ertragssteuern', 'A', 'E', '', '', 0, NULL, 12, 3, NULL, false, '2006-01-28 18:22:52.60961', '2006-02-03 15:07:57.018877', NULL, NULL);",
+ "INSERT INTO chart VALUES (159, '7130', 'Gewerbl. Sozialversicherung', 'A', 'E', 'AP_amount', '', 0, NULL, 12, 3, NULL, false, '2006-02-03 15:16:10.635938', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (82, '6000', 'LOHNAUFWAND', 'H', 'E', '', '6', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.566594', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (83, '6010', 'Lohn ', 'A', 'E', '', '600-619', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.572154', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (84, '6200', 'GEAHLTSAUFWAND', 'H', 'E', '', '6', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.575155', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (85, '6210', 'Gehalt ', 'A', 'E', '', '620-639', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.578104', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (86, '6500', 'GESETZLICHER SOZIALAUFWAND', 'H', 'E', '', '6', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.581152', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (87, '6510', 'Dienstgeberanteile', 'A', 'E', '', '645-649', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.584214', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (88, '6700', 'FREIWILLIGER SOZIALAUFWAND', 'H', 'E', '', '6', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.589022', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (89, '6710', 'freiwilliger Sozialaufwand', 'A', 'E', '', '660-665', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.592541', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (90, '7000', 'ABSCHREIBUNGEN', 'H', 'E', '', '7', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.595566', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (91, '7010', 'Abschreibungen', 'A', 'E', '', '700', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.598657', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (92, '7020', 'geringwertige Wirtschaftsgüter', 'A', 'E', 'AP_amount', '701-708', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.601829', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (93, '7100', 'SONSTIGE STEUERN', 'H', 'E', '', '71', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.604871', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (96, '7200', 'INSTANDHALTUNGSAUFWAND', 'H', 'E', '', '7', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.6171', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (98, '7300', 'TRANSPORTKOSTEN', 'H', 'L', '', '73', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.623721', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (100, '7400', 'MIET-,PACHT-,LEASING-, LIZENZAUFWAND', 'H', 'E', '', '74', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.631869', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (113, '7710', 'Sachversicherung', 'A', 'E', 'AP_amount', '', 0, NULL, 13, NULL, NULL, false, '2006-01-28 18:22:52.677258', '2006-02-03 15:19:30.793109', NULL, NULL);",
+ "INSERT INTO chart VALUES (103, '7600', 'VERWALTUNGSKOSTEN', 'H', 'E', '', '76', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.641023', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (161, '7780', 'Beiträge zur Berufsvertretung', 'A', 'E', 'AP_amount', '', 0, NULL, NULL, 3, NULL, false, '2006-02-03 15:33:11.055578', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (102, '7420', 'Betriebsk. und ant. AfA Garage + Werkst.', 'A', 'E', 'AP_amount', '', 0, NULL, NULL, 3, NULL, false, '2006-01-28 18:22:52.637918', '2006-02-03 15:41:13.126408', NULL, NULL);",
+ "INSERT INTO chart VALUES (112, '7700', 'VERSICHERUNGEN UND ÜBRIGE AUFWÄNDUNGEN', 'H', 'E', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.674186', '2006-02-03 15:44:43.301845', NULL, NULL);",
+ "INSERT INTO chart VALUES (114, '8000', 'FINANZERTRÄGE UND FINANZAUFWÄNDUNGEN', 'H', 'L', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.680743', '2006-02-03 15:45:08.299546', NULL, NULL);",
+ "INSERT INTO chart VALUES (33, '1530', 'Vorräte Gruppe B', 'A', 'A', 'IC', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.392343', '2006-02-03 16:25:53.167131', NULL, NULL);",
+ "INSERT INTO chart VALUES (120, '9020', 'nicht einbezahltes Kapital', 'A', 'Q', '', '919', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.700926', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (121, '9200', 'KAPITALRÜCKLAGEN', 'H', 'Q', '', '9', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.703925', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (122, '9210', 'freie Rücklage', 'A', 'Q', '', '920-929', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.708819', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (123, '9300', 'GEWINN', 'H', 'Q', '', '939', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.712247', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (124, '9310', 'Gewinnvortrag Vorjahr', 'A', 'Q', '', '980', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.716177', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (125, '9320', 'Jahresgewinn', 'A', 'Q', '', '985', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.719991', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (126, '9400', 'RÜCKSTELLUNGEN', 'H', 'L', '', '3', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.723021', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (127, '9420', 'Abfertigungsrückstellung', 'A', 'L', '', '300', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.726006', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (128, '9430', 'Urlaubsrückstellung', 'A', 'L', '', '304-309', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.730698', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (129, '9700', 'EINLAGEN STILLER GESELLSCHAFTER', 'H', 'Q', '', '9', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.73381', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (71, '4300', 'UMSATZ DIENSTLEISTUNGEN', 'H', 'I', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.529746', '2006-01-28 18:34:28.843136', NULL, NULL);",
+ "INSERT INTO chart VALUES (9, '0300', 'BETRIEBS- UND GESCHÄFTSGEBÄUDE', 'H', 'A', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.308885', '2006-02-02 09:31:17.849895', NULL, NULL);",
+ "INSERT INTO chart VALUES (45, '2530', 'sonstige Forderungen aus Abgebenverrechnung', 'A', 'A', 'AP_amount', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.435243', '2006-02-02 09:59:42.729713', NULL, NULL);",
+ "INSERT INTO chart VALUES (67, '4000', 'BETRIEBLICHE ERTRÄGE', 'H', 'I', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.513926', '2006-02-02 10:05:21.278993', NULL, NULL);",
+ "INSERT INTO chart VALUES (75, '4630', 'Erlöse aus Abgang vom Anlagevermögen', 'A', 'I', 'AR_amount:IC_income', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.542817', '2006-02-02 10:09:41.959462', NULL, NULL);",
+ "INSERT INTO chart VALUES (131, '4450', 'Erlösschmälerung durch Skontoaufwand', 'A', 'I', 'AR_amount', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.740526', '2006-02-02 10:20:51.822294', NULL, NULL);",
+ "INSERT INTO chart VALUES (144, '4640', 'Erträge aus Abgang vom Anlagevermögen', 'A', 'I', 'AR_amount:IC_income', '', 0, NULL, NULL, NULL, NULL, false, '2006-02-02 10:24:49.118289', '2006-02-02 10:25:34.716838', NULL, NULL);",
+ "INSERT INTO chart VALUES (118, '9000', 'KAPITAL, UNVERSTEUERTE RÜCKLAGEN, ABSCHLUSS- UND EVIDENZKONTEN', 'H', 'Q', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.694841', '2006-02-02 10:28:27.424046', NULL, NULL);",
+ "INSERT INTO chart VALUES (147, '9410', 'Privatentnahme', 'A', 'Q', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-02-02 11:52:04.383364', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (76, '5000', 'MATERIALAUFWAND', 'H', 'E', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.545768', '2006-02-02 12:02:53.065559', NULL, NULL);",
+ "INSERT INTO chart VALUES (160, '7140', 'Fremdenverkehrsabgabe', 'A', 'E', 'AP_amount', '', 0, NULL, 12, 3, NULL, false, '2006-02-03 15:16:52.380825', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (99, '7310', 'Frachtaufwand durch Dritte', 'A', 'E', 'AP_amount:IC_expense', '', 9, NULL, NULL, 3, NULL, false, '2006-01-28 18:22:52.628717', '2006-02-03 15:22:49.082217', NULL, NULL);",
+ "INSERT INTO chart VALUES (152, '7320', 'KFZ-Aufwand', 'A', 'E', 'AP_amount:IC_expense', '', 9, NULL, NULL, 3, NULL, false, '2006-02-02 12:22:18.511562', '2006-02-03 15:23:31.584235', NULL, NULL);",
+ "INSERT INTO chart VALUES (80, '5600', 'VERBRAUCH BRENN- UND TREIBSTOFFE, ENERGIE UND WASSER', 'H', 'I', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.56006', '2006-02-02 12:17:24.198896', NULL, NULL);",
+ "INSERT INTO chart VALUES (109, '7390', 'Porto und Postgebühren', 'A', 'E', 'AP_amount:IC_expense', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.661848', '2006-02-02 12:28:47.456197', NULL, NULL);",
+ "INSERT INTO chart VALUES (101, '7410', 'Miete und Pachtaufwand', 'A', 'E', 'AP_amount', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.634888', '2006-02-02 12:29:27.184902', NULL, NULL);",
+ "INSERT INTO chart VALUES (107, '7620', 'Zeitungen und Zeitschriften', 'A', 'E', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.655683', '2006-02-02 12:32:43.287819', NULL, NULL);",
+ "INSERT INTO chart VALUES (106, '7670', 'Werbung und Marketing', 'A', 'E', 'AP_amount', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.652584', '2006-02-02 12:33:37.934111', NULL, NULL);",
+ "INSERT INTO chart VALUES (110, '7680', 'Repräsentationsaufwand', 'A', 'E', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.665034', '2006-02-02 12:35:16.950252', NULL, NULL);",
+ "INSERT INTO chart VALUES (111, '7750', 'Rechtsberatung', 'A', 'E', 'AP_amount', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.671109', '2006-02-02 12:36:56.116865', NULL, NULL);",
+ "INSERT INTO chart VALUES (153, '7755', 'Steuerberatung', 'A', 'E', 'AP_amount', '', 0, NULL, NULL, NULL, NULL, false, '2006-02-02 12:37:35.558667', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (115, '8280', 'Bankzinsen und Gebühren', 'A', 'E', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.683783', '2006-02-02 12:41:44.274229', NULL, NULL);",
+ "INSERT INTO chart VALUES (117, '8110', 'Erträge aus Zinsen', 'A', 'I', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.691802', '2006-02-02 12:42:41.520779', NULL, NULL);",
+ "INSERT INTO chart VALUES (132, '8050', 'Erträge aus Wertpapieren', 'A', 'E', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.743602', '2006-02-02 12:44:29.033245', NULL, NULL);",
+ "INSERT INTO chart VALUES (104, '7610', 'Büromaterial', 'A', 'E', 'AP_amount', '', 9, NULL, 11, 3, NULL, false, '2006-01-28 18:22:52.644151', '2006-02-03 15:25:38.53287', NULL, NULL);",
+ "INSERT INTO chart VALUES (116, '8010', 'Erträge aus Beteiligungen', 'A', 'I', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.688643', '2006-02-02 12:47:19.930787', NULL, NULL);",
+ "INSERT INTO chart VALUES (119, '9010', 'Kapital, Geschäftsanteile', 'A', 'Q', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.69788', '2006-02-02 12:48:41.514201', NULL, NULL);",
+ "INSERT INTO chart VALUES (108, '7380', 'Telefonkosten, Internetkosten', 'A', 'E', 'AP_amount', '', 9, NULL, 11, 3, NULL, false, '2006-01-28 18:22:52.658721', '2006-02-03 15:24:27.553821', NULL, NULL);",
+ "INSERT INTO chart VALUES (32, '1520', 'Vorräte Gruppe A', 'A', 'A', 'IC', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.389168', '2006-02-03 16:26:08.72507', NULL, NULL);",
+ "INSERT INTO chart VALUES (52, '2820', 'Bankguthaben', 'A', 'A', 'AR_paid:AP_paid', '', 0, NULL, NULL, 1, NULL, false, '2006-01-28 18:22:52.458922', '2006-02-04 15:00:18.424069', NULL, NULL);",
+ "INSERT INTO chart VALUES (59, '3550', 'Finanzamt Verrechnung Körperschaftssteuer', 'A', 'L', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.483655', '2006-02-08 20:09:47.697565', NULL, NULL);",
+ "INSERT INTO chart VALUES (60, '3540', 'Finanzamt Verrechnung Umsatzsteuer', 'A', 'L', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.48865', '2006-02-08 20:15:23.622013', NULL, NULL);",
+ "INSERT INTO chart VALUES (78, '5030', 'Warengruppe 1 10 %', 'A', 'E', 'AP_amount:IC_cogs', '', 7, NULL, 4, 2, NULL, false, '2006-01-28 18:22:52.553586', '2006-02-08 20:31:31.539794', NULL, NULL);",
+ "INSERT INTO chart VALUES (79, '5040', 'Warengruppe 2 20%', 'A', 'E', 'AP_amount:IC_cogs', '', 9, NULL, 4, 2, NULL, false, '2006-01-28 18:22:52.55679', '2006-02-03 14:44:38.100283', NULL, NULL);",
+ "INSERT INTO chart VALUES (155, '5210', 'Sonst. Verbrauchsmaterial', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 3, NULL, false, '2006-02-03 14:49:06.01478', '2006-02-03 14:54:51.813269', NULL, NULL);",
+ "INSERT INTO chart VALUES (146, '9850', 'Schlussbilanz', 'A', 'L', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-02-02 10:36:45.059659', '2006-02-02 10:38:05.014595', NULL, NULL);",
+ "INSERT INTO chart VALUES (150, '5640', 'Verbrauch von sonstigen Ölen und Schmierstoffen', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 1, 19, false, '2006-02-02 12:07:52.512006', '2006-02-03 15:01:09.867763', NULL, NULL);",
+ "INSERT INTO chart VALUES (130, '9810', 'Eröffnungsbilanz', 'A', 'L', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.736825', '2006-02-02 10:37:49.001565', NULL, NULL);",
+ "INSERT INTO chart VALUES (164, '9800', 'BILANZKONTEN', 'H', 'L', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-03-06 22:23:47.795675', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (148, '5620', 'Verbrauch von Treibstoffen (Diesel)', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 2, 17, false, '2006-02-02 11:59:26.297394', '2006-02-03 15:00:02.362976', NULL, NULL);",
+ "INSERT INTO chart VALUES (149, '5630', 'Verbrauch von Treib- und Schmierstoffen für Motorsägen', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 1, 19, false, '2006-02-02 12:01:05.969406', '2006-02-03 15:00:30.512596', NULL, NULL);",
+ "INSERT INTO chart VALUES (158, '5650', 'gasförmige Brennstoffe', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 2, 12, false, '2006-02-03 15:02:36.649746', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (156, '5710', 'Warenbezugskosten', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 2, 8, false, '2006-02-03 14:56:21.395879', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (157, '5750', 'Fremdarbeit', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 2, NULL, false, '2006-02-03 14:58:23.887944', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (154, '5310', 'Arbeitskleidung', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 1, NULL, false, '2006-02-03 14:48:10.349391', '2006-02-03 16:23:46.154559', NULL, NULL);",
+ "INSERT INTO chart VALUES (151, '5510', 'Verbrauchswerkzeug', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 2, NULL, false, '2006-02-02 12:19:18.193535', '2006-02-03 14:51:29.573924', NULL, NULL);",
+ "INSERT INTO chart VALUES (81, '5610', 'Energie (Strom und Wasser)', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 2, NULL, false, '2006-01-28 18:22:52.563249', '2006-02-03 14:59:32.292173', NULL, NULL);",
+ "INSERT INTO chart VALUES (97, '7210', 'Reparatur und Instandhaltung', 'A', 'E', 'AP_amount', '', 9, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.620315', '2006-02-03 15:14:08.186799', NULL, NULL);",
+ "INSERT INTO chart VALUES (72, '4320', 'Erlöse Beratung', 'A', 'I', 'AR_amount:IC_sale:IC_income', '', 3, 51, 1, 1, 2, false, '2006-01-28 18:22:52.533226', '2006-02-04 23:05:45.241847', NULL, NULL);",
+ "INSERT INTO chart VALUES (73, '4330', 'Erlöse Programmierung', 'A', 'I', 'AR_amount:IC_sale:IC_income', '', 3, 51, 1, 1, 1, false, '2006-01-28 18:22:52.536409', '2006-02-04 23:06:03.959353', NULL, NULL);",
+ "INSERT INTO chart VALUES (69, '4030', 'Erlöse - Softwareverkauf', 'A', 'I', 'AR_amount:IC_sale', '', 2, 86, 1, 1, 1, false, '2006-01-28 18:22:52.521819', '2006-02-02 10:06:58.91888', NULL, NULL);",
+ "INSERT INTO chart VALUES (70, '4040', 'Erlöse - Ersatzteilverkauf', 'A', 'I', 'AR_amount:IC_sale', '', 3, 51, 1, 1, 1, false, '2006-01-28 18:22:52.524987', '2006-02-02 10:07:34.327738', NULL, NULL);",
+ "INSERT INTO chart VALUES (57, '3310', 'Verbindlichkeiten aus Lieferungen & Leistungen', 'A', 'L', 'AP', '', 0, NULL, NULL, 1, NULL, false, '2006-01-28 18:22:52.477485', '2006-02-02 18:12:21.634302', NULL, NULL);",
+ "INSERT INTO chart VALUES (51, '2810', 'Schecks', 'A', 'A', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.455807', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (55, '3120', 'Kredite von Eigentümern', 'A', 'L', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.471098', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (49, '2710', 'Kassa', 'A', 'A', 'AR_paid', '', 0, NULL, NULL, 1, NULL, false, '2006-01-28 18:22:52.449148', '2006-02-04 14:59:14.410329', NULL, NULL);",
+ "INSERT INTO chart VALUES (77, '5020', 'Warengruppe 0', 'A', 'E', 'IC:IC_cogs:AP_amount', '', 7, NULL, NULL, NULL, 8, false, '2006-01-28 18:22:52.550381', '2006-02-08 20:30:42.871241', NULL, NULL);",
+ "INSERT INTO chart VALUES (68, '4020', 'Erlöse - Hardwareverkauf', 'A', 'I', 'AR_amount:IC_sale', '', 2, 86, 1, 1, 1, false, '2006-01-28 18:22:52.51796', '2006-02-04 23:05:12.810823', NULL, NULL);",
+ "INSERT INTO chart VALUES (40, '2010', 'Forderungen Lieferung & Leistung', 'A', 'A', 'AR', '200-207', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.41697', NULL, NULL, NULL);",
+ "INSERT INTO chart VALUES (65, '2510', 'Vorsteuer 10%', 'A', 'E', 'AR_tax:AP_tax:IC_taxpart:IC_taxservice', NULL, 0, 66, NULL, NULL, NULL, false, '2006-01-28 18:22:52.505337', '2006-02-02 17:38:40.373624', NULL, NULL);",
+ "INSERT INTO chart VALUES (64, '2512', 'Vorsteuer 12%', 'A', 'E', 'AR_tax:AP_tax:IC_taxpart:IC_taxservice', NULL, 0, 66, NULL, NULL, NULL, false, '2006-01-28 18:22:52.502023', '2006-02-08 20:14:19.543049', NULL, NULL);",
+ "INSERT INTO chart VALUES (66, '2520', 'Vorsteuer 20%', 'A', 'E', 'AR_tax:AP_tax:IC_taxpart:IC_taxservice', NULL, 0, 66, NULL, NULL, NULL, false, '2006-01-28 18:22:52.510324', '2006-02-02 18:07:25.987706', NULL, NULL);",
+ "INSERT INTO chart VALUES (61, '3501', 'Mehrwertsteuer 0%', 'A', 'I', 'AR_tax:AP_tax:IC_taxpart:IC_taxservice', NULL, 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.491959', '2006-02-08 20:17:24.589389', NULL, NULL);",
+ "INSERT INTO chart VALUES (62, '3510', 'Mehrwertsteuer 10%', 'A', 'I', 'AR_tax:AP_tax:IC_taxpart:IC_taxservice', NULL, 0, 861, NULL, NULL, NULL, false, '2006-01-28 18:22:52.495255', '2006-02-08 20:16:06.81373', NULL, NULL);",
+ "INSERT INTO chart VALUES (63, '3520', 'Mehrwertsteuer 20%', 'A', 'I', 'AR_tax:AP_tax:IC_taxpart:IC_taxservice', NULL, 0, 511, NULL, NULL, NULL, false, '2006-01-28 18:22:52.498543', '2006-02-08 20:16:30.014075', NULL, NULL);",
+ "insert into chart (accno,description,charttype,gifi_accno,category,link) values ('0400','MASCHINEN','H','04-05','A','');",
+ "insert into chart (accno,description,charttype,gifi_accno,category,link) values ('7411','Lizenzen','A','748-749','E','AP_amount');",
+ "insert into chart (accno,description,charttype,gifi_accno,category,link) values ('7631','Internetkosten','A','738-739','E','AP_amount:IC_expense');",
+ "insert into chart (accno,description,charttype,gifi_accno,category,link) values ('7632','Reise- und Repräsentationsaufwand','A','734-735','E','');",
+ "insert into chart (accno,description,charttype,gifi_accno,category,link) values ('7634','Registrierungsgebühren','A','748-749','E','AP_amount');",
+ "insert into chart (accno,description,charttype,gifi_accno,category,link) values ('8020','Bankzinsen und Gebühren','A','80-83','E','');",
+
+
+ );
+
+ for my $statement ( 0 .. $#copy_statements ) {
+ my $query = $iconv->convert($copy_statements[$statement]);
+ #print $query . "<br />"; # Diagnose only!
+ do_query($query, 0);
+ }
+
+ return 1;
+}
+sub do_insert_tax {
+
+ my @copy_statements = (
+ "INSERT INTO tax (chart_id, taxnumber, taxkey, taxdescription, itime, mtime, rate, id) VALUES (65, '2510', 7, 'Vorsteuer 10%', '2006-01-30 11:08:23.332857', '2006-02-08 20:28:09.63567', 0.10000, 173);",
+ "INSERT INTO tax (chart_id, taxnumber, taxkey, taxdescription, itime, mtime, rate, id) VALUES (64, '2512', 8, 'Vorsteuer 12%', '2006-02-02 17:39:18.535036', '2006-02-08 20:28:21.463869', 0.12000, 174);",
+ "INSERT INTO tax (chart_id, taxnumber, taxkey, taxdescription, itime, mtime, rate, id) VALUES (66, '2520', 9, 'Vorsteuer 20%', '2006-01-30 11:08:23.332857', '2006-02-08 19:57:47.648373', 0.20000, 175);",
+ "INSERT INTO tax (chart_id, taxnumber, taxkey, taxdescription, itime, mtime, rate, id) VALUES (61, '3501', 1, 'Mehrwertsteuerfrei', '2006-01-30 11:08:23.332857', '2006-02-08 20:23:14.242534', 0.00000, 176);",
+ "INSERT INTO tax (chart_id, taxnumber, taxkey, taxdescription, itime, mtime, rate, id) VALUES (62, '3510', 2, 'Mehrwertsteuer 10%', '2006-01-30 11:08:23.332857', '2006-02-08 20:23:32.978436', 0.10000, 177);",
+ "INSERT INTO tax (chart_id, taxnumber, taxkey, taxdescription, itime, mtime, rate, id) VALUES (63, '3520', 3, 'Mehrwertsteuer 20%', '2006-01-30 11:08:23.332857', '2006-02-08 20:23:47.331584', 0.20000, 178);",
+ "INSERT INTO tax (chart_id, taxnumber, taxkey, taxdescription, itime, mtime, rate, id) VALUES (NULL, NULL, 10, 'Im anderen EG-Staat steuerpfl. Lieferung', '2006-01-30 11:08:23.332857', '2006-02-08 12:45:36.44088', NULL, 171);",
+ "INSERT INTO tax (chart_id, taxnumber, taxkey, taxdescription, itime, mtime, rate, id) VALUES (NULL, NULL, 11, 'Steuerfreie EG-Lief. an Abn. mit UStIdNr', '2006-01-30 11:08:23.332857', '2006-02-08 12:45:36.44088', NULL, 172);",
+ "INSERT INTO tax (chart_id, taxnumber, taxkey, taxdescription, itime, mtime, rate, id) VALUES (NULL, NULL, 0, 'Keine Steuer', '2006-01-30 11:08:23.332857', '2006-02-08 12:45:36.44088', 0.00000, 0);",
+
+ );
+
+ for my $statement ( 0 .. $#copy_statements ) {
+ my $query = $iconv->convert($copy_statements[$statement]);
+ #print $query . "<br />"; # Diagnose only!
+ do_query($query, 0);
+ }
+ return 1;
+}
+
+sub do_insert_taxkeys {
+
+ my @copy_statements = (
+ "INSERT INTO taxkeys VALUES (230, 69, 177, 2, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (231, 72, 178, 3, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (232, 73, 178, 3, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (233, 70, 178, 3, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (234, 78, 173, 7, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (235, 77, 173, 7, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (236, 105, 175, 9, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (237, 163, 175, 9, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (238, 99, 175, 9, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (239, 152, 175, 9, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (240, 104, 175, 9, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (241, 108, 175, 9, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (242, 79, 175, 9, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (243, 155, 175, 9, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (244, 150, 175, 9, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (245, 148, 175, 9, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (246, 149, 175, 9, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (247, 158, 175, 9, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (248, 156, 175, 9, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (249, 157, 175, 9, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (250, 154, 175, 9, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (251, 151, 175, 9, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (252, 81, 175, 9, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (253, 97, 175, 9, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (258, 0, 171, 10, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (259, 0, 172, 11, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (260, 0, 173, 7, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (261, 0, 174, 8, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (262, 0, 175, 9, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (263, 0, 176, 1, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (264, 0, 177, 2, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (265, 0, 178, 3, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (266, 68, 177, 2, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (179, 95, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (180, 94, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (181, 159, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (182, 113, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (183, 161, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (184, 102, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (185, 112, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (186, 114, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (187, 33, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (188, 71, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (189, 9, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (190, 45, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (191, 67, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (192, 75, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (193, 131, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (194, 144, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (195, 118, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (196, 147, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (197, 76, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (198, 160, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (199, 80, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (200, 109, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (201, 101, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (202, 107, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (203, 106, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (204, 110, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (205, 111, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (206, 153, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (207, 115, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (208, 117, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (209, 132, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (210, 116, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (211, 119, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (212, 32, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (213, 52, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (214, 59, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (215, 60, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (217, 146, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (223, 130, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (224, 164, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (225, 57, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (226, 51, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (227, 55, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (228, 49, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (257, 0, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (267, 40, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (279, 65, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (280, 64, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (281, 66, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (282, 61, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (283, 62, 0, 0, NULL, '1970-01-01');",
+ "INSERT INTO taxkeys VALUES (284, 63, 0, 0, NULL, '1970-01-01');",
+
+ "ALTER TABLE taxkeys DROP COLUMN pos_ustva;",
+ "ALTER TABLE taxkeys ADD COLUMN pos_ustva text;",
+# "INSERT INTO taxkeys (chart_id, tax_id, taxkey_id, pos_ustva, startdate)
+# SELECT id, 0, 0, NULL, '01.01.1970' FROM chart WHERE charttype='A';",
+ "UPDATE chart SET taxkey_id = 0 WHERE taxkey_id ISNULL;",
+ "UPDATE taxkeys SET pos_ustva='000' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN (4010, 4015, 4020, 4025, 4030, 4035, 4040, 4045, 4050, 4310, 4315, 4320, 4322, 4325, 4330, 4335, 4340, 4345, 4350, 4450, 4029, 4329));",
+ "UPDATE taxkeys SET pos_ustva='011' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN (4029, 4329));",
+ "UPDATE taxkeys SET pos_ustva='017' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN (4015, 4025, 4035, 4045, 4315, 4325, 4335, 4345));",
+ "UPDATE taxkeys SET pos_ustva='022' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN (4040, 4045));",
+ "UPDATE taxkeys SET pos_ustva='122' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN (3520));",
+ "UPDATE taxkeys SET pos_ustva='029' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN (4010, 4015));",
+ "UPDATE taxkeys SET pos_ustva='129' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN (3510));",
+ "UPDATE taxkeys SET pos_ustva='025' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN (4012));",
+ "UPDATE taxkeys SET pos_ustva='125' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN (3512));",
+ "UPDATE taxkeys SET pos_ustva='035' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN (4016));",
+ "UPDATE taxkeys SET pos_ustva='135' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN (3516));",
+ "UPDATE taxkeys SET pos_ustva='070' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN (5015, 5025));",
+ "UPDATE taxkeys SET pos_ustva='072' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN (5025));",
+ "UPDATE taxkeys SET pos_ustva='172' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN (3502));",
+ "UPDATE taxkeys SET pos_ustva='073' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN (5015));",
+ "UPDATE taxkeys SET pos_ustva='173' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN (3501));",
+ "UPDATE taxkeys SET pos_ustva='060' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN (2510, 2512, 2516, 2519, 2520));",
+ "UPDATE taxkeys SET pos_ustva='065' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN (2515));",
+ );
+
+ for my $statement ( 0 .. $#copy_statements ) {
+ my $query = $iconv->convert($copy_statements[$statement]);
+ #print $query . "<br />"; # Diagnose only!
+ do_query($query, 0);
+ }
+
+return 1;
+
+}
+
+sub do_insert_buchungsgruppen {
+
+ my @copy_statements = (
+ "INSERT INTO buchungsgruppen VALUES (256, 'Erlöse aus Dienstleistungen', 23, 72, 99, 72, 77, 72, 77, 72, 77, 3);",
+ "INSERT INTO buchungsgruppen VALUES (254, 'Erlöse aus Warenlieferungen', 23, 68, 77, 72, 77, 72, 77, 72, 77, 2);",
+ "INSERT INTO buchungsgruppen VALUES (255, 'Erlöse aus Dienstleistungen', 23, 72, 77, 72, 77, 72, 77, 72, 77, 1);",
+ );
+
+ for my $statement ( 0 .. $#copy_statements ) {
+ my $query = $iconv->convert($copy_statements[$statement]);
+ #print $query . "<br />"; # Diagnose only!
+ do_query($query, 0);
+ }
+
+return 1;
+}
+
+
+
--- /dev/null
+-- @tag: ap_ar_orddate_quodate
+-- @description: Spalten für Angebots- und Auftragsdatum bei Einkaufs- und Verkaufsrechnungen
+-- @depends: release_2_4_1
+ALTER TABLE ar ADD COLUMN orddate date;
+ALTER TABLE ar ADD COLUMN quodate date;
+ALTER TABLE ap ADD COLUMN orddate date;
+ALTER TABLE ap ADD COLUMN quodate date;
--- /dev/null
+-- @tag: ap_storno
+-- @description: Spalten für Kreditorenbuchen zum Speichern für welche andere Buchung diese eine Stornobuchung ist
+-- @depends: release_2_4_2
+ALTER TABLE ap ADD COLUMN storno_id integer;
+ALTER TABLE ap ADD FOREIGN KEY (storno_id) REFERENCES ap (id);
--- /dev/null
+-- @tag: ar_ap_storno_id
+-- @description: Füllen der Spalte 'storno_id' in den Tabellen 'ar' und 'ap'
+-- @depends: ar_storno ap_storno
+UPDATE ar SET storno_id =
+ (SELECT id
+ FROM ar ar2
+ WHERE ar2.storno
+ AND ('Storno zu ' || ar2.invnumber = ar.invnumber)
+ AND (ar2.id < ar.id)
+ ORDER BY id DESC
+ LIMIT 1)
+ WHERE storno
+ AND (COALESCE(storno_id, 0) = 0)
+ AND (invnumber LIKE 'Storno zu %');
+
+UPDATE ap SET storno_id =
+ (SELECT id
+ FROM ap ap2
+ WHERE ap2.storno
+ AND ('Storno zu ' || ap2.invnumber = ap.invnumber)
+ AND (ap2.id < ap.id)
+ ORDER BY id DESC
+ LIMIT 1)
+ WHERE storno
+ AND (COALESCE(storno_id, 0) = 0)
+ AND (invnumber LIKE 'Storno zu %');
--- /dev/null
+-- @tag: ar_storno
+-- @description: Spalten für Debitorenbuchen zum Speichern für welche andere Buchung diese eine Stornobuchung ist
+-- @depends: release_2_4_2
+ALTER TABLE ar ADD COLUMN storno_id integer;
+ALTER TABLE ar ADD FOREIGN KEY (storno_id) REFERENCES ar (id);
--- /dev/null
+-- @tag: buchungsgruppen_sortkey
+-- @description: Neue Spalte für Sortierreihenfolge der Buchungsgruppen
+-- @depends: release_2_4_1
+ALTER TABLE buchungsgruppen ADD COLUMN sortkey integer;
+CREATE SEQUENCE tmp_counter;
+UPDATE buchungsgruppen SET sortkey = nextval('tmp_counter');
+DROP SEQUENCE tmp_counter;
+ALTER TABLE buchungsgruppen ALTER COLUMN sortkey SET NOT NULL;
--- /dev/null
+-- @tag: chart_category_to_sgn
+-- @description: Fuegt eine Hilfsfunktion ein mit der die interne Reprasentation der Konten (Haben positiv) in die Mehrungsrepraesentation gewandelt werden kann.
+-- @depends:
+
+ CREATE OR REPLACE FUNCTION chart_category_to_sgn(CHARACTER(1))
+ RETURNS INTEGER
+ LANGUAGE SQL
+ AS 'SELECT 1 WHERE $1 IN (''I'', ''L'', ''Q'')
+ UNION
+ SELECT -1 WHERE $1 IN (''E'', ''A'')';
+
--- /dev/null
+-- @tag: chart_names2
+-- @description: Behebt ein paar Schreibfehler in Kontennamen in den Kontenramen SKR03 und SKR04.
+-- @depends:
+UPDATE chart
+ SET description = 'Fahrzeugkosten'
+ WHERE
+ ((SELECT coa FROM defaults) IN ('Germany-DATEV-SKR03EU', 'Germany-DATEV-SKR04EU')) AND
+ (description = 'Fahrzugkosten');
+UPDATE chart
+ SET description = replace(description, 'Unentgeld', 'Unentgelt')
+ WHERE
+ ((SELECT coa FROM defaults) IN ('Germany-DATEV-SKR03EU', 'Germany-DATEV-SKR04EU')) AND
+ (description LIKE '%Unentgeld%');
--- /dev/null
+-- @tag: customer_vendor_taxzone_id
+-- @description: Die Spalte "taxzone_id" in den Tabellen customer und vendor darf nicht NULL sein.
+-- @depends: release_2_4_1
+UPDATE customer SET taxzone_id = 0 WHERE taxzone_id ISNULL;
+ALTER TABLE customer ALTER COLUMN taxzone_id SET DEFAULT 0;
+ALTER TABLE customer ALTER COLUMN taxzone_id SET NOT NULL;
+
+UPDATE vendor SET taxzone_id = 0 WHERE taxzone_id ISNULL;
+ALTER TABLE vendor ALTER COLUMN taxzone_id SET DEFAULT 0;
+ALTER TABLE vendor ALTER COLUMN taxzone_id SET NOT NULL;
--- /dev/null
+-- @tag: drafts
+-- @description: Neue Tabelle zum Speichern von Entwürfen
+-- @depends: release_2_4_1
+CREATE TABLE drafts (
+ id varchar(50) NOT NULL,
+ module varchar(50) NOT NULL,
+ submodule varchar(50) NOT NULL,
+ description text,
+ itime timestamp DEFAULT now(),
+ form text,
+ employee_id integer,
+
+ PRIMARY KEY (id),
+ FOREIGN KEY (employee_id) REFERENCES employee (id)
+);
--- /dev/null
+-- @tag: dunning_config_interest_rate
+-- @description: In der Tabelle dunning_config ist interest falsch benannt.
+-- @depends: release_2_4_2
+ALTER TABLE dunning_config RENAME interest TO interest_rate;
--- /dev/null
+-- @tag: dunning_dunning_id
+-- @description: In der Tabelle dunning ist dunning_id falsch benannt und es fehlt eine Spalte, die mehrere Einträge zusammenfasst.
+-- @depends: release_2_4_2
+ALTER TABLE dunning ADD COLUMN dunning_config_id integer;
+UPDATE dunning SET dunning_config_id = dunning_id;
+ALTER TABLE dunning ADD FOREIGN KEY (dunning_config_id) REFERENCES dunning_config (id);
+
+ALTER TABLE dunning ADD COLUMN itime timestamp;
+ALTER TABLE dunning ALTER COLUMN itime SET DEFAULT now();
+UPDATE dunning SET itime = now();
+
+ALTER TABLE dunning ADD COLUMN mtime timestamp;
+CREATE TRIGGER mtime_dunning
+ BEFORE UPDATE ON dunning
+ FOR EACH ROW
+ EXECUTE PROCEDURE set_mtime();
+
+UPDATE dunning SET dunning_id = nextval('id');
+
+ALTER TABLE ar RENAME COLUMN dunning_id TO dunning_config_id;
+ALTER TABLE ar ADD FOREIGN KEY (dunning_config_id) REFERENCES dunning_config (id);
--- /dev/null
+-- @tag: dunning_invoices_for_fees
+-- @description: Konfiguration für das automatische Erzeugen von Rechnungen über Mahngebühren sowie eine Verknüpfung zwischen Mahnungen und den dazu erzeugten Rechnungen.
+-- @depends: release_2_4_2
+ALTER TABLE defaults ADD COLUMN dunning_create_invoices_for_fees boolean;
+ALTER TABLE defaults ADD COLUMN dunning_AR_amount_fee integer;
+ALTER TABLE defaults ADD COLUMN dunning_AR_amount_interest integer;
+ALTER TABLE defaults ADD COLUMN dunning_AR integer;
+UPDATE defaults SET dunning_create_invoices_for_fees = 'f';
+
+ALTER TABLE dunning ADD COLUMN fee_interest_ar_id integer;
+ALTER TABLE dunning ADD FOREIGN KEY (fee_interest_ar_id) REFERENCES ar (id);
--- /dev/null
+-- @tag: dunning_invoices_per_dunning_level
+-- @description: Umstellung der Konfiguration für das automatische Erzeugen von Rechnungen über Mahngebühren von "global" auf "pro Mahnlevel"
+-- @depends: dunning_invoices_for_fees
+ALTER TABLE dunning_config ADD COLUMN create_invoices_for_fees boolean;
+ALTER TABLE dunning_config ALTER COLUMN create_invoices_for_fees SET DEFAULT TRUE;
+UPDATE dunning_config SET create_invoices_for_fees =
+ (SELECT dunning_create_invoices_for_fees FROM defaults LIMIT 1);
+ALTER TABLE defaults DROP COLUMN dunning_create_invoices_for_fees;
--- /dev/null
+-- @tag: employee_no_limits
+-- @description: Keine Längenbeschränkung für Spalten in der Tabelle employee.
+-- @depends: release_2_4_1
+ALTER TABLE employee ADD COLUMN tmp_name text;
+ALTER TABLE employee ADD COLUMN tmp_addr1 text;
+ALTER TABLE employee ADD COLUMN tmp_addr2 text;
+ALTER TABLE employee ADD COLUMN tmp_addr3 text;
+ALTER TABLE employee ADD COLUMN tmp_addr4 text;
+ALTER TABLE employee ADD COLUMN tmp_homephone text;
+ALTER TABLE employee ADD COLUMN tmp_workphone text;
+
+UPDATE employee SET tmp_name = name, tmp_addr1 = addr1, tmp_addr2 = addr2, tmp_addr3 = addr3, tmp_addr4 = addr4, tmp_homephone = homephone, tmp_workphone = workphone;
+
+ALTER TABLE employee DROP COLUMN name;
+ALTER TABLE employee RENAME tmp_name TO name;
+ALTER TABLE employee DROP COLUMN addr1;
+ALTER TABLE employee RENAME tmp_addr1 TO addr1;
+ALTER TABLE employee DROP COLUMN addr2;
+ALTER TABLE employee RENAME tmp_addr2 TO addr2;
+ALTER TABLE employee DROP COLUMN addr3;
+ALTER TABLE employee RENAME tmp_addr3 TO addr3;
+ALTER TABLE employee DROP COLUMN addr4;
+ALTER TABLE employee RENAME tmp_addr4 TO addr4;
+ALTER TABLE employee DROP COLUMN homephone;
+ALTER TABLE employee RENAME tmp_homephone TO homephone;
+ALTER TABLE employee DROP COLUMN workphone;
+ALTER TABLE employee RENAME tmp_workphone TO workphone;
+
+CREATE INDEX employee_name_key ON employee ( name );
--- /dev/null
+-- @tag: fix_taxdescription
+-- @description: Durch das Update wurden in der Taxdescription die Prozentangabgen entfernt. Ist ungünstig für die Druckausgabe
+-- @depends: ustva_setup_2007_update_chart_taxkeys_tax
+
+
+
+--#############################################################
+--#
+--# Taxdescription setzen
+--#
+--#############################################################
+
+UPDATE tax SET
+ taxdescription = 'USt-frei'
+WHERE taxkey = '1'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Umsatzsteuer 7%'
+WHERE taxkey = '2'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Umsatzsteuer 16%'
+WHERE taxkey = '3' AND rate=0.16
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Umsatzsteuer 19%'
+WHERE taxkey = '3' AND rate=0.19
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Vorsteuer 7%'
+WHERE taxkey = '8'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Vorsteuer 19%'
+WHERE taxkey = '9' AND rate=0.19
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Vorsteuer 16%'
+WHERE taxkey = '9' AND rate=0.16
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Im anderen EU-Staat steuerpflichtige Lieferung'
+WHERE taxkey = '10'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Steuerfreie innergem. Lieferung an Abnehmer mit Id.-Nr.'
+WHERE taxkey = '11'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Steuerpflichtige EG-Lieferung zum ermäßigten Steuersatz 7%'
+WHERE taxkey = '12'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Steuerpflichtige EG-Lieferung zum vollen Steuersatz 16%'
+WHERE taxkey = '13' AND rate=0.16
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Steuerpflichtige EG-Lieferung zum vollen Steuersatz 19%'
+WHERE taxkey = '13' AND rate=0.19
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+
+UPDATE tax SET
+ taxdescription = 'Steuerpflichtiger innergem. Erwerb zum ermäßigten Steuersatz 7%'
+WHERE taxkey = '18'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Steuerpflichtiger innergem. Erwerb zum vollen Steuersatz 19%'
+WHERE taxkey = '19' and rate=0.19
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Steuerpflichtiger innergem. Erwerb zum vollen Steuersatz 16%'
+WHERE taxkey = '19' and rate=0.16
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
\ No newline at end of file
--- /dev/null
+-- @tag: gl_storno
+-- @description: Spalten für Dialogbuchen zum Speichern, ob diese Buchung storniert wurde bzw. für welche andere Buchung diese eine Stornobuchung ist
+-- @depends: release_2_4_2
+ALTER TABLE gl ADD COLUMN storno boolean;
+ALTER TABLE gl ALTER COLUMN storno SET DEFAULT 'f';
+
+ALTER TABLE gl ADD COLUMN storno_id integer;
+ALTER TABLE gl ADD FOREIGN KEY (storno_id) REFERENCES gl (id);
+
+UPDATE gl SET storno = 'f';
+
+UPDATE gl SET storno = 't'
+ WHERE (reference LIKE 'Storno-%')
+ AND (description LIKE 'Storno-%')
+ AND EXISTS
+ (SELECT gl2.id
+ FROM gl gl2
+ WHERE ('Storno-' || gl2.reference = gl.reference)
+ AND ('Storno-' || gl2.description = gl.description)
+ AND (gl2.id < gl.id));
+
+UPDATE gl SET storno = 't'
+ WHERE (reference NOT LIKE 'Storno-%')
+ AND (description NOT LIKE 'Storno-%')
+ AND EXISTS
+ (SELECT gl2.id
+ FROM gl gl2
+ WHERE ('Storno-' || gl.reference = gl2.reference)
+ AND ('Storno-' || gl.description = gl2.description)
+ AND (gl2.id > gl.id));
+
+UPDATE gl SET storno_id =
+ (SELECT id
+ FROM gl gl2
+ WHERE ('Storno-' || gl2.reference = gl.reference)
+ AND ('Storno-' || gl2.description = gl.description)
+ AND (gl2.id < gl.id)
+ ORDER BY itime
+ LIMIT 1)
+ WHERE storno
+ AND (reference LIKE 'Storno-%')
+ AND (description LIKE 'Storno-%');
--- /dev/null
+# @tag: globalprojectnumber_ap_ar_oe
+# @description: Neue Spalte für eine globale Projektnummer in Einkaufs- und Verkaufsbelegen
+# @depends: release_2_4_1
+
+die("This script cannot be run from the command line.") unless ($main::form);
+
+sub mydberror {
+ my ($msg) = @_;
+ die($dbup_locale->text("Database update error:") .
+ "<br>$msg<br>" . $DBI::errstr);
+}
+
+sub do_query {
+ my ($query, $may_fail) = @_;
+
+ if (!$dbh->do($query)) {
+ mydberror($query) unless ($may_fail);
+ $dbh->rollback();
+ $dbh->begin_work();
+ }
+}
+
+sub do_update {
+ my @queries =
+ ("ALTER TABLE ap ADD COLUMN globalproject_id integer;",
+ "ALTER TABLE ap ADD FOREIGN KEY (globalproject_id) REFERENCES project (id);",
+ "ALTER TABLE ar ADD COLUMN globalproject_id integer;",
+ "ALTER TABLE ar ADD FOREIGN KEY (globalproject_id) REFERENCES project (id);",
+ "ALTER TABLE oe ADD COLUMN globalproject_id integer;",
+ "ALTER TABLE oe ADD FOREIGN KEY (globalproject_id) REFERENCES project (id);");
+
+ do_query("ALTER TABLE project ADD PRIMARY KEY (id);", 1);
+ map({ do_query($_, 0); } @queries);
+
+ return 1;
+}
+
+return do_update();
+
--- /dev/null
+-- @tag: history_erp
+-- @description: Entfernen der Spalten in Tabelle status zum Speichern der history und dafür eigene Tabelle für die history
+-- @depends: status_history
+ALTER TABLE status DROP COLUMN id;
+ALTER TABLE status DROP COLUMN employee_id;
+ALTER TABLE status DROP COLUMN addition;
+ALTER TABLE status DROP COLUMN what_done;
+
+CREATE TABLE history_erp (
+ id integer NOT NULL DEFAULT nextval('id'),
+ trans_id integer,
+ employee_id integer,
+ addition text,
+ what_done text,
+ itime timestamp DEFAULT now(),
+
+ PRIMARY KEY (id),
+ FOREIGN KEY (employee_id) REFERENCES employee (id)
+);
--- /dev/null
+-- @tag: history_erp_snumbers
+-- @description: Einführen der Buchungsnummern in die Historie
+-- @depends: history_erp
+ALTER TABLE history_erp ADD COLUMN snumbers text;
+
\ No newline at end of file
--- /dev/null
+-- @tag: invalid_taxkeys_2
+-- @description: Ungültige Steuerschlüssel in den Kontenrahmendefinitionen und daraus resultierende falsche Einträge in anderen Tabellen werden korrigiert.
+-- @depends: release_2_4_2
+SET datestyle = 'German';
+
+INSERT INTO taxkeys (chart_id, tax_id, taxkey_id, pos_ustva, startdate)
+ SELECT id, 0, 0, 0, '01.01.1970' FROM chart WHERE taxkey_id ISNULL;
+
+UPDATE chart SET taxkey_id = 0 WHERE taxkey_id ISNULL;
--- /dev/null
+-- @tag: marge_initial
+-- @description: Anzeigen des Ertrages pro Position bei Rechnungen und Auftraegen
+-- @depends: status_history
+ALTER TABLE ar add column marge_total NUMERIC(15,5);
+ALTER TABLE ar add column marge_percent NUMERIC(15,5);
+
+ALTER TABLE oe add column marge_total NUMERIC(15,5);
+ALTER TABLE oe add column marge_percent NUMERIC(15,5);
+
+ALTER TABLE invoice add column marge_total NUMERIC(15,5);
+ALTER TABLE invoice add column marge_percent NUMERIC(15,5);
+ALTER TABLE invoice add column lastcost NUMERIC(15,5);
+
+ALTER TABLE orderitems add column marge_total NUMERIC(15,5);
+ALTER TABLE orderitems add column marge_percent NUMERIC(15,5);
+ALTER TABLE orderitems add column lastcost NUMERIC(15,5);
--- /dev/null
+-- @tag: oe_delivered
+-- @description: Neues Feld für Status "geliefert" bei Auftragsbestätigungen und Lieferantenaufträgen
+-- @depends: release_2_4_1
+ALTER TABLE oe ADD COLUMN delivered boolean;
+ALTER TABLE oe ALTER COLUMN delivered SET DEFAULT 'f';
+UPDATE oe SET delivered = 'f';
--- /dev/null
+-- @tag: oe_is_salesman
+-- @description: Speichern eines Verkäufers bei Angeboten und Ausgangsrechnungen
+-- @depends: release_2_4_1
+ALTER TABLE oe ADD COLUMN salesman_id integer;
+ALTER TABLE oe ADD FOREIGN KEY (salesman_id) REFERENCES employee (id);
+ALTER TABLE ar ADD COLUMN salesman_id integer;
+ALTER TABLE ar ADD FOREIGN KEY (salesman_id) REFERENCES employee (id);
--- /dev/null
+-- @tag: parts_ean
+-- @description: Neues Feld für EAN-Code
+-- @depends: release_2_4_1
+ALTER TABLE parts ADD COLUMN ean text;
--- /dev/null
+-- @tag: payment_terms_sortkey
+-- @description: Neue Spalte für Sortierreihenfolge der Zahlungskonditionen
+-- @depends: release_2_4_1
+ALTER TABLE payment_terms ADD COLUMN sortkey integer;
+CREATE SEQUENCE tmp_counter;
+UPDATE payment_terms SET sortkey = nextval('tmp_counter');
+DROP SEQUENCE tmp_counter;
+ALTER TABLE payment_terms ALTER COLUMN sortkey SET NOT NULL;
--- /dev/null
+-- @tag: payment_terms_translation
+-- @description: Übersetzungen von Zahlungskonditionen
+-- @depends: release_2_4_1
+CREATE TABLE translation_payment_terms (
+ payment_terms_id integer NOT NULL,
+ language_id integer NOT NULL,
+ description_long text,
+
+ FOREIGN KEY (payment_terms_id) REFERENCES payment_terms (id),
+ FOREIGN KEY (language_id) REFERENCES language (id)
+);
--- /dev/null
+-- @tag: project
+-- @description: Spalte bei den Projekten zur Markierung auf aktiv/inaktiv
+-- @depends: release_2_4_1
+ALTER TABLE project ADD COLUMN active boolean;
+ALTER TABLE project ALTER COLUMN active SET DEFAULT 't';
+UPDATE project SET active = 't';
--- /dev/null
+-- @tag: release_2_4_2
+-- @description: Leeres Script, das von allen bis zum Release 2.4.2 hinzugefügten Upgradescripten abhängt, um ein fest definiertes Schema für 2.4.2 zu definieren.
+-- @depends: payment_terms_sortkey project globalprojectnumber_ap_ar_oe parts_ean drafts payment_terms_translation units_sortkey tax_description_without_percentage PgCommaAggregateFunction buchungsgruppen_sortkey history_erp ap_ar_orddate_quodate ustva_setup_2007_update_chart_taxkeys_tax_add_missing_tax_accounts oe_delivered
--- /dev/null
+-- @tag: release_2_4_3
+-- @description: Leeres Script, das von allen bis zum Release 2.4.3 hinzugefügten Upgradescripten abhängt, um ein fest definiertes Schema für 2.4.3 zu definieren.
+-- @depends: COA_Account_Settings001 USTVA_abstraction COA_Account_Settings002 chart_category_to_sgn employee_no_limits dunning_invoices_per_dunning_level gl_storno oe_is_salesman transaction_description tax_description_without_percentage_skr04 dunning_dunning_id ar_ap_storno_id dunning_config_interest_rate invalid_taxkeys_2 chart_names2 history_erp_snumbers marge_initial USTVA_at tax_report_table_name
+
--- /dev/null
+-- @tag: status_history
+-- @description: Spalten in Tabelle status zum Speichern der history
+-- @depends: release_2_4_1
+ALTER TABLE status ADD COLUMN id integer;
+UPDATE status SET id = nextval('id');
+ALTER TABLE status ALTER COLUMN id SET DEFAULT nextval('id');
+ALTER TABLE status ALTER COLUMN id SET NOT NULL;
+
+ALTER TABLE status ADD COLUMN employee_id integer;
+ALTER TABLE status ADD FOREIGN KEY (employee_id) REFERENCES employee(id);
+
+ALTER TABLE status ADD COLUMN addition text;
+ALTER TABLE status ADD COLUMN what_done text;
--- /dev/null
+-- @tag: tax_description_without_percentage
+-- @description: SKR03: Die Prozentangaben aus der tax.taxdescription entfernen. (Unter Berücksichtigung der Druckausgabe.)
+-- @depends: fix_taxdescription
+
+
+
+--#############################################################
+--#
+--# Taxdescription setzen
+--#
+--#############################################################
+
+UPDATE tax SET
+ taxdescription = 'USt-frei'
+WHERE taxkey = '1'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Umsatzsteuer'
+WHERE taxkey = '2'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Umsatzsteuer'
+WHERE taxkey = '3'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+
+UPDATE tax SET
+ taxdescription = 'Vorsteuer'
+WHERE taxkey = '8'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Vorsteuer'
+WHERE taxkey = '9'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Im anderen EU-Staat steuerpflichtige Lieferung'
+WHERE taxkey = '10'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Steuerfreie innergem. Lieferung an Abnehmer mit Id.-Nr.'
+WHERE taxkey = '11'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Steuerpflichtige EG-Lieferung zum ermäßigten Steuersatz'
+WHERE taxkey = '12'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+
+UPDATE tax SET
+ taxdescription = 'Steuerpflichtige EG-Lieferung zum vollen Steuersatz'
+WHERE taxkey = '13'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+
+UPDATE tax SET
+ taxdescription = 'Steuerpflichtiger innergem. Erwerb zum ermäßigten Steuersatz'
+WHERE taxkey = '18'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Steuerpflichtiger innergem. Erwerb zum vollen Steuersatz'
+WHERE taxkey = '19'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
--- /dev/null
+-- @tag: tax_description_without_percentage_skr04
+-- @description: SKR04: Die Prozentangaben aus der tax.taxdescription entfernen. (Unter Berücksichtigung der Druckausgabe.)
+-- @depends: ustva_setup_2007
+
+--#############################################################
+--#
+--# Taxdescription setzen
+--#
+--#############################################################
+
+UPDATE tax SET
+ taxdescription = 'USt-frei'
+WHERE taxkey = '1'
+ AND
+ EXISTS ( -- update only for SKR04
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR04EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Umsatzsteuer'
+WHERE taxkey = '2'
+ AND
+ EXISTS ( -- update only for SKR04
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR04EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Umsatzsteuer'
+WHERE taxkey = '3'
+ AND
+ EXISTS ( -- update only for SKR04
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR04EU'
+ )
+;
+
+
+UPDATE tax SET
+ taxdescription = 'Vorsteuer'
+WHERE taxkey = '8'
+ AND
+ EXISTS ( -- update only for SKR04
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR04EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Vorsteuer'
+WHERE taxkey = '9'
+ AND
+ EXISTS ( -- update only for SKR04
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR04EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Im anderen EU-Staat steuerpflichtige Lieferung'
+WHERE taxkey = '10'
+ AND
+ EXISTS ( -- update only for SKR04
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR04EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Steuerfreie innergem. Lieferung an Abnehmer mit Id.-Nr.'
+WHERE taxkey = '11'
+ AND
+ EXISTS ( -- update only for SKR04
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR04EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Steuerpflichtige EG-Lieferung zum ermäßigten Steuersatz'
+WHERE taxkey = '12'
+ AND
+ EXISTS ( -- update only for SKR04
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR04EU'
+ )
+;
+
+
+UPDATE tax SET
+ taxdescription = 'Steuerpflichtige EG-Lieferung zum vollen Steuersatz'
+WHERE taxkey = '13'
+ AND
+ EXISTS ( -- update only for SKR04
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR04EU'
+ )
+;
+
+
+UPDATE tax SET
+ taxdescription = 'Steuerpflichtiger innergem. Erwerb zum ermäßigten Steuersatz'
+WHERE taxkey = '18'
+ AND
+ EXISTS ( -- update only for SKR04
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR04EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Steuerpflichtiger innergem. Erwerb zum vollen Steuersatz'
+WHERE taxkey = '19'
+ AND
+ EXISTS ( -- update only for SKR04
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR04EU'
+ )
+;
--- /dev/null
+-- @tag: tax_report_table_name
+-- @description: Tabellenname den Regeln der englischen Grammatik angepasst
+-- @depends: USTVA_abstraction USTVA_at
+ALTER TABLE tax.report_categorys RENAME TO report_categories;
--- /dev/null
+-- @tag: transaction_description
+-- @description: Neue Spalte für ein Feld "Vorgangsbezeichnung" in Verkaufs- und Einkaufsmasken
+-- @depends: release_2_4_2
+ALTER TABLE ap ADD COLUMN transaction_description text;
+ALTER TABLE ar ADD COLUMN transaction_description text;
+ALTER TABLE oe ADD COLUMN transaction_description text;
--- /dev/null
+-- @tag: units_sortkey
+-- @description: Neue Spalte für Sortierreihenfolge der Einheiten
+-- @depends: release_2_4_1
+ALTER TABLE units ADD COLUMN sortkey integer;
+CREATE SEQUENCE tmp_counter;
+UPDATE units SET sortkey = nextval('tmp_counter');
+DROP SEQUENCE tmp_counter;
+ALTER TABLE units ALTER COLUMN sortkey SET NOT NULL;
--- /dev/null
+-- @tag: ustva_setup_2007
+-- @description: Aktualisierung des SKR03 für 2006
+-- @depends: customer_vendor_taxzone_id
+
+update taxkeys set pos_ustva='81' where startdate='2007-01-01'
+ AND pos_ustva ='51'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ );
+
+
+UPDATE taxkeys SET pos_ustva='511'
+ WHERE startdate='1970-01-01'
+ AND chart_id = (select id from chart where accno ='1775')
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ );
+
+
+INSERT INTO taxkeys (
+ chart_id, tax_id, taxkey_id, pos_ustva, startdate)
+ SELECT chart.id, tax.id, taxkey_id, '811', '2007-01-01'
+ FROM chart
+ LEFT JOIN tax ON (chart.id = tax.chart_id)
+ WHERE chart.accno = '1776'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
--- /dev/null
+-- @tag: ustva_setup_2007_update_chart_taxkeys_tax
+-- @description: Aktualisierung des SKR03 für 2006/2007. Es werden bisher nur Inland Buchungen 16%/19% in 2006/2007 unterstützt.
+-- @depends: ustva_setup_2007
+
+
+
+--#############################################################
+--#
+--# Neue Konten einfügen
+--#
+--#############################################################
+
+
+INSERT INTO chart (
+ accno, description,
+ charttype, category, link,
+ taxkey_id
+ )
+SELECT
+ '1570','Anrechenbare Vorsteuer',
+ 'A', 'E', 'AP_tax:IC_taxpart:IC_taxservice:CT_tax',
+ 0
+WHERE EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+);
+
+
+INSERT INTO chart (
+ accno, description,
+ charttype, category, link,
+ taxkey_id
+ )
+SELECT
+ '1574','Abziehbare Vorsteuer aus innergem. Erwerb 19 %',
+ 'A', 'E', 'AP_tax:IC_taxpart:IC_taxservice:CT_tax',
+ 0
+WHERE EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+);
+
+
+INSERT INTO chart (
+ accno, description,
+ charttype, category, link,
+ taxkey_id
+ )
+SELECT
+ '1774','Umsatzsteuer aus innergem. Erwerb 19 %',
+ 'A', 'I', 'AR_tax:IC_taxpart:IC_taxservice:CT_tax',
+ 0
+WHERE EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+);
+
+UPDATE chart SET description = 'Umsatzsteuer 7% innergem.Erwerb'
+WHERE accno='1772'
+AND EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+);
+
+UPDATE chart SET description = 'Umsatzsteuer 16% innergem.Erwerb'
+WHERE accno='1773'
+AND EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+);
+
+UPDATE chart SET description = 'Abziehbare Vorsteuer 7% innergem. Erwerb'
+WHERE accno='1572'
+AND EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+);
+
+UPDATE chart SET description = 'Abziehbare Vorsteuer 16% innergem. Erwerb'
+WHERE accno='1573'
+AND EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+);
+
+UPDATE chart SET description = 'Innergem. Erwerb 16%/19% VSt u. USt.'
+WHERE accno='3425'
+AND EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+);
+
+UPDATE chart SET description = 'Innergem. Erwerb 7% VSt u. USt.'
+WHERE accno='3420'
+AND EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+);
+
+--INSERT INTO chart (
+-- accno, description,
+-- charttype, category, link
+-- )
+--SELECT
+-- '3550','Steuerfreier innergem. Erwerb',
+-- 'A', 'E', 'AP_amount:IC_cogs'
+--WHERE EXISTS ( -- update only for SKR03
+-- SELECT coa FROM defaults
+-- WHERE defaults.coa='Germany-DATEV-SKR03EU'
+--);
+
+
+
+--#############################################################
+--#
+--# Anpassungen Tabelle tax
+--#
+--#############################################################
+
+-- Steuerkontenbenennung nach DATEV
+UPDATE tax SET
+ taxdescription = 'USt-frei'
+WHERE taxkey = '1'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Umsatzsteuer'
+WHERE taxkey = '2'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Umsatzsteuer'
+WHERE taxkey = '3'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+UPDATE tax SET
+ taxdescription = 'Vorsteuer'
+WHERE taxkey = '8'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Vorsteuer'
+WHERE taxkey = '9'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Im anderen EU-Staat steuerpflichtige Lieferung'
+WHERE taxkey = '10'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Steuerfreie innergem. Lieferung an Abnehmer mit Id.-Nr.'
+WHERE taxkey = '11'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Steuerpflichtige EG-Lieferung zum ermäßigten Steuersatz'
+WHERE taxkey = '12'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Steuerpflichtige EG-Lieferung zum vollen Steuersatz'
+WHERE taxkey = '13'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+
+UPDATE tax SET
+ taxdescription = 'Steuerpflichtiger innergem. Erwerb zum ermäßigten Steuersatz'
+WHERE taxkey = '18'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE tax SET
+ taxdescription = 'Steuerpflichtiger innergem. Erwerb zum vollen Steuersatz'
+WHERE taxkey = '19'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+-- Weitere Steuerschlüssel hinzufügen
+
+INSERT INTO tax (
+ chart_id,
+ taxnumber,
+ rate,
+ taxkey,
+ taxdescription
+ )
+ SELECT (SELECT id FROM chart WHERE accno = '1774'), '1774', '0.19000', taxkey, taxdescription
+ FROM tax
+ WHERE taxkey = '13'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+
+INSERT INTO tax (
+ chart_id,
+ rate,
+ taxnumber,
+ taxkey,
+ taxdescription
+ )
+ SELECT (SELECT id FROM chart WHERE accno = '1574'), '0.19000', '1574', taxkey, taxdescription
+ FROM tax
+ WHERE taxkey = '19'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+
+
+
+--#############################################################
+--#
+--# Anpassungen Tabelle taxkeys
+--#
+--#############################################################
+
+
+INSERT INTO taxkeys (
+ chart_id, tax_id, taxkey_id, pos_ustva, startdate)
+ SELECT chart.id, (SELECT id FROM tax WHERE taxnumber = '1576'), '9', '66', '1970-01-01'
+ FROM chart
+ LEFT JOIN tax ON (chart.id = tax.chart_id)
+ WHERE chart.accno = '1576'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+INSERT INTO taxkeys (
+ chart_id, tax_id, taxkey_id, pos_ustva, startdate)
+ SELECT chart.id, (SELECT id FROM tax WHERE taxnumber = '1574'), '19', '61', '1970-01-01'
+ FROM chart
+ LEFT JOIN tax ON (chart.id = tax.chart_id)
+ WHERE chart.accno = '1574'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+
+INSERT INTO taxkeys (
+ chart_id, tax_id, taxkey_id, pos_ustva, startdate)
+ SELECT chart.id, '0', '0', '891', '2007-01-01'
+ FROM chart
+ LEFT JOIN tax ON (chart.id = tax.chart_id)
+ WHERE chart.accno = '1774'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+UPDATE taxkeys SET pos_ustva = '63'
+WHERE chart_id in (SELECT id FROM chart WHERE accno in ('1577')
+AND startdate = '1970-01-01')
+AND EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+);
+
+UPDATE taxkeys SET pos_ustva = '67'
+WHERE chart_id in (SELECT id FROM chart WHERE accno in ('1578', '1579')
+AND startdate = '1970-01-01')
+AND EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+);
+
+
+INSERT INTO taxkeys (
+ chart_id, tax_id, taxkey_id, pos_ustva, startdate)
+ SELECT chart.id, '0', '0', '66', '1970-01-01'
+ FROM chart
+ LEFT JOIN tax ON (chart.id = tax.chart_id)
+ WHERE chart.accno in ('1570', '1576')
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+
+UPDATE taxkeys SET pos_ustva = '51'
+WHERE chart_id in (SELECT id FROM chart WHERE accno in ('8520')
+AND startdate = '1970-01-01')
+AND
+EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+);
+
+INSERT INTO taxkeys (
+ chart_id, tax_id, taxkey_id, pos_ustva, startdate)
+ SELECT chart.id, (SELECT id FROM tax WHERE taxnumber = '1776'), '0', '36', '1970-01-01'
+ FROM chart
+ LEFT JOIN tax ON (chart.id = tax.chart_id)
+ WHERE chart.accno = '1776'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+INSERT INTO taxkeys (
+ chart_id, tax_id, taxkey_id, pos_ustva, startdate)
+ SELECT chart.id, (SELECT id FROM tax WHERE taxnumber = '1775'), '0', '36', '2007-01-01'
+ FROM chart
+ LEFT JOIN tax ON (chart.id = tax.chart_id)
+ WHERE chart.accno = '1775'
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
--- /dev/null
+-- @tag: ustva_setup_2007_update_chart_taxkeys_tax_add_missing_tax_accounts
+-- @description: Aktualisierung des Kontenrahmens SKR03, einfuegen der fehlenden Steuerkonten in die Tabelle taxkeys
+-- @depends: ustva_setup_2007_update_chart_taxkeys_tax
+
+
+
+--#############################################################
+--#
+--# Anpassungen Tabelle taxkeys
+--#
+--#############################################################
+
+
+INSERT INTO taxkeys (
+ chart_id, tax_id, taxkey_id, pos_ustva, startdate)
+ SELECT chart.id, '0', '0', '66', '1970-01-01'
+ FROM chart
+ LEFT JOIN tax ON (chart.id = tax.chart_id)
+ WHERE chart.accno in ('1571', '1575')
+ AND
+ EXISTS ( -- update only for SKR03
+ SELECT coa FROM defaults
+ WHERE defaults.coa='Germany-DATEV-SKR03EU'
+ )
+;
+
+++ /dev/null
---
-INSERT INTO gifi (accno,description) VALUES ('1','AKTIVEN');
-INSERT INTO gifi (accno,description) VALUES ('2','PASSIVEN');
-INSERT INTO gifi (accno,description) VALUES ('4','AUFWAND FÜR MATERIAL, WAREN UND DIENSTLEISTUNGEN');
-INSERT INTO gifi (accno,description) VALUES ('5','PERSONALAUFWAND');
-INSERT INTO gifi (accno,description) VALUES ('10000','ANLAGEVERMÖGEN');
-INSERT INTO gifi (accno,description) VALUES ('11000','Forderungen');
-INSERT INTO gifi (accno,description) VALUES ('11100','Bank');
-INSERT INTO gifi (accno,description) VALUES ('11110','MWST Vorsteuer auf Investitionen');
-INSERT INTO gifi (accno,description) VALUES ('11120','Angefangene Arbeiten');
-INSERT INTO gifi (accno,description) VALUES ('14150','Büromaschinen, EDV');
-INSERT INTO gifi (accno,description) VALUES ('18000','Gründungsaufwand');
-INSERT INTO gifi (accno,description) VALUES ('20000','FREMDKAPITAL LANGFRISTIG');
-INSERT INTO gifi (accno,description) VALUES ('21000','Kurzfristige Finanzverbindlichkeiten');
-INSERT INTO gifi (accno,description) VALUES ('21200','Sozialversicherungen');
-INSERT INTO gifi (accno,description) VALUES ('21210','Gesellschafter');
-INSERT INTO gifi (accno,description) VALUES ('21220','MWST (3,6)');
-INSERT INTO gifi (accno,description) VALUES ('21230','Passive Rechnungsabgrenzung');
-INSERT INTO gifi (accno,description) VALUES ('24000','Gesellschafter');
-INSERT INTO gifi (accno,description) VALUES ('28000','Stammkapital');
-INSERT INTO gifi (accno,description) VALUES ('28290','Gewinnvortrag');
-INSERT INTO gifi (accno,description) VALUES ('30000','ÜBRIGER ERTRAG');
-INSERT INTO gifi (accno,description) VALUES ('31000','Computer');
-INSERT INTO gifi (accno,description) VALUES ('32000','Software kommerz.');
-INSERT INTO gifi (accno,description) VALUES ('34000','Beratung');
-INSERT INTO gifi (accno,description) VALUES ('36000','Essen');
-INSERT INTO gifi (accno,description) VALUES ('37000','Eigenleistungen');
-INSERT INTO gifi (accno,description) VALUES ('38000','Bestandesänderungen');
-INSERT INTO gifi (accno,description) VALUES ('39000','Rabatte, Preisnachlässe');
-INSERT INTO gifi (accno,description) VALUES ('40000','AUFWANDMINDERUNGEN');
-INSERT INTO gifi (accno,description) VALUES ('41000','Übrige Produkte');
-INSERT INTO gifi (accno,description) VALUES ('42000','Software kommerz.');
-INSERT INTO gifi (accno,description) VALUES ('44000','Aufwand für Drittleistungen');
-INSERT INTO gifi (accno,description) VALUES ('47000','Einkaufsspesen');
-INSERT INTO gifi (accno,description) VALUES ('48000','Bestandesänderungen');
-INSERT INTO gifi (accno,description) VALUES ('49000','Aufwandminderungen');
-INSERT INTO gifi (accno,description) VALUES ('50000','Löhne und Gehälter');
-INSERT INTO gifi (accno,description) VALUES ('57000','FAK');
-INSERT INTO gifi (accno,description) VALUES ('58000','Spesen');
-INSERT INTO gifi (accno,description) VALUES ('60000','VERWALTUNGS- UND INFORMATIKAUFWAND');
-INSERT INTO gifi (accno,description) VALUES ('61000','Reinigung');
-INSERT INTO gifi (accno,description) VALUES ('61900','Unterhalt');
-INSERT INTO gifi (accno,description) VALUES ('62000','Fahrzeugaufwand');
-INSERT INTO gifi (accno,description) VALUES ('63000','Betriebsversicherungen');
-INSERT INTO gifi (accno,description) VALUES ('65000','Übriger Verwaltungsaufwand');
-INSERT INTO gifi (accno,description) VALUES ('66000','Werbeaufwand');
-INSERT INTO gifi (accno,description) VALUES ('67000','Produkteentwicklung');
-INSERT INTO gifi (accno,description) VALUES ('68000','Finanzaufwand');
-INSERT INTO gifi (accno,description) VALUES ('69000','Abschreibungen');
-INSERT INTO gifi (accno,description) VALUES ('80000','AUSSERORDENTLICHER UND BETRIEBSFREMDER ERFOLG, STEUERN');
-INSERT INTO gifi (accno,description) VALUES ('90000','ABSCHLUSS');
-INSERT INTO gifi (accno,description) VALUES ('91000','ERFOLGSRECHNUNG');
-INSERT INTO gifi (accno,description) VALUES ('92000','BILANZ');
-INSERT INTO gifi (accno,description) VALUES ('93000','GEWINNVERWENDUNG');
-INSERT INTO gifi (accno,description) VALUES ('99000','SAMMEL- UND FEHLBUCHUNGEN');
--- /dev/null
+Order Allow,Deny
+Deny from all
ok(defined $lxtest->{dbuser}, "found dbuser in config");
ok(defined $lxtest->{dbpasswd}, "found dbpasswd in config");
- $lxtest->{lxadmin} = $lxtest->{lxbaseurl} . "admin.pl?path=$lxtest->{path}&rpw=$lxtest->{rpw}&nextsub=list_users&action=Weiter";
+ $lxtest->{lxadmin} = $lxtest->{lxbaseurl} . "admin.pl?rpw=$lxtest->{rpw}&nextsub=list_users&action=Weiter";
$lxtest->{testuserlogin} = $lxtest->{testlogin};
$lxtest->{db} = $lxtest->{db};
- $lxtest->{lxadmin} = $lxtest->{lxbaseurl} . "admin.pl?path=$lxtest->{path}&rpw=$lxtest->{rpw}&nextsub=list_users&action=Weiter";
+ $lxtest->{lxadmin} = $lxtest->{lxbaseurl} . "admin.pl?rpw=$lxtest->{rpw}&nextsub=list_users&action=Weiter";
eval { $sel = WWW::Selenium->new(
host => $lxtest->{seleniumhost},
#Lx defaults (usualy no need for editing)
rootlogin => "root login",
memberfile => "users/members",
- path => 'bin%2Fmozilla',
# Put your own setting for individual tests after here...
-};
\ No newline at end of file
+};
ok(defined $lxtest->{dbuser}, "found dbuser in config");
ok(defined $lxtest->{dbpasswd}, "found dbpasswd in config");
- $lxtest->{lxadmin} = $lxtest->{lxbaseurl} . "admin.pl?path=$lxtest->{path}&rpw=$lxtest->{rpw}&nextsub=list_users&action=Weiter";
+ $lxtest->{lxadmin} = $lxtest->{lxbaseurl} . "admin.pl?rpw=$lxtest->{rpw}&nextsub=list_users&action=Weiter";
$lxtest->{testuserlogin} = $lxtest->{testlogin};
$lxtest->{db} = $lxtest->{db};
- $lxtest->{lxadmin} = $lxtest->{lxbaseurl} . "admin.pl?path=$lxtest->{path}&rpw=$lxtest->{rpw}&nextsub=list_users&action=Weiter";
+ $lxtest->{lxadmin} = $lxtest->{lxbaseurl} . "admin.pl?rpw=$lxtest->{rpw}&nextsub=list_users&action=Weiter";
eval { $sel = WWW::Selenium->new(
host => $lxtest->{seleniumhost},
--- /dev/null
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>ustva-Inland-linet</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">ustva-Inland-linet</td></tr>
+</thead><tbody>
+<!--######################-->
+<!--# Start Testskript-->
+<!--# USTVA 2006/2007-->
+<!--######################-->
+<!--######################-->
+<!--# Datenbank & Benutzer-->
+<!--# Umgebung-->
+<!--######################-->
+<tr>
+ <td>break</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>setTimeout</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<!--Create new database-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>https://lx-office.linet-services.de/svn-installationen/unstable/admin.pl?path=bin/mozilla/&rpw=roXyrPyqv9wE2&nextsub=list_users&action=Weiter</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTitle</td>
+ <td>Lx-Office ERP Administration -</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.forms[0].action[2]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTitle</td>
+ <td>Lx-Office ERP / Datenbankadministration -</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectWindow</td>
+ <td>null</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTitle</td>
+ <td>Lx-Office ERP Datenbankadministration / Datenbank anlegen -</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>db</td>
+ <td>Selenium_Testdb-_SKR03_IST_1619_2006_2007</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>document.forms[0].chart[2]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<!--Benutzer anlegen-->
+<!--Achtung, Benutzer nicht neu anlegen, wg. Bug in der Benutzerverwaltung i.Zshg. mit neuen Vorlagen-->
+<!--Benutzer mit datanbank verknüpfen-->
+<tr>
+ <td>clickAndWait</td>
+ <td>link=demo-1619</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTitle</td>
+ <td>Lx-Office ERP Administration / Benutzerdaten bearbeiten -</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>dbname</td>
+ <td>Selenium_Testdb-_SKR03_IST_1619_2006_2007</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<!--Login-->
+<tr>
+ <td>assertTitle</td>
+ <td>Lx-Office ERP Administration -</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>login</td>
+ <td>demo-1619</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>password</td>
+ <td>demo</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.forms[1].action</td>
+ <td></td>
+</tr>
+<!--Datenbankaktualisierung-->
+<tr>
+ <td>assertTitle</td>
+ <td>Datenbankaktualisierung*</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>//input[@value='Weiter']</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTitle</td>
+ <td>Lx-Office Version*</td>
+ <td></td>
+</tr>
+<!--######################-->
+<!--# Waren, Lieferanten, Kunden-->
+<!--# Umgebung-->
+<!--######################-->
+<!--Testkunde anlegen-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Kunde erfassen</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>name</td>
+ <td>Testkunde</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<!--Testlieferant anlegen-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Lieferant erfassen</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>name</td>
+ <td>Testlieferant</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<!--Testware anlegen 7%-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Ware erfassen</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>partnumber</td>
+ <td>100-7%</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>description</td>
+ <td>Testware 7%</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>buchungsgruppen_id</td>
+ <td>label=Standard 7%</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>lastcost</td>
+ <td>50</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>sellprice</td>
+ <td>100</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.ic.action[1]</td>
+ <td></td>
+</tr>
+<!--Testware anlegen 16%-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Ware erfassen</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>partnumber</td>
+ <td>1</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>description</td>
+ <td>Testware 16%/19%</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>buchungsgruppen_id</td>
+ <td>label=Standard 16%/19%</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>lastcost</td>
+ <td>50</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>sellprice</td>
+ <td>100</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.ic.action[1]</td>
+ <td></td>
+</tr>
+<!--######################-->
+<!--# Testbuchungen-->
+<!--# anlegen-->
+<!--######################-->
+<!--### 1. Testbuchung-->
+<!--Rechnung:-->
+<!--03-2007 Rechnungsdatum-->
+<!--Kein Lieferdatum-->
+<!--03-2007 Zahlungsdatum-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Rechnung erfassen</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invnumber</td>
+ <td>1</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>partnumber_1</td>
+ <td>1</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invdate</td>
+ <td>1.3.2007</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>datepaid_1</td>
+ <td>10.3.2007</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>source_1</td>
+ <td>1</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>memo_1</td>
+ <td>1</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>paid_1</td>
+ <td>119</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.invoice.action[6]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>ndx</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.invoice.action[6]</td>
+ <td></td>
+</tr>
+<!--### 2.Testbuchung-->
+<!--Rechnung-->
+<!--11-2006 Rechnungsdatum-->
+<!--Kein Lieferdatum-->
+<!--01-2007 Zahlungsdatum-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Rechnung erfassen</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invnumber</td>
+ <td>2</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invdate</td>
+ <td>11.11.2006</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>datepaid_1</td>
+ <td>20.11.2006</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>partnumber_1</td>
+ <td>1</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>source_1</td>
+ <td>4</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>memo_1</td>
+ <td>4</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>paid_1</td>
+ <td>116</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.invoice.action[6]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>ndx</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.invoice.action[6]</td>
+ <td></td>
+</tr>
+<!--### 3.Testbuchung-->
+<!--Rechnung-->
+<!--12-2006 Rechnungsdatum-->
+<!--12-2006 Lieferdatum-->
+<!--12-2006 Zahlungsdatum-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Rechnung erfassen</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invnumber</td>
+ <td>3</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invdate</td>
+ <td>03.12.2006</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>duedate</td>
+ <td>10.12.2006</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>partnumber_1</td>
+ <td>1</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>update_button</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>ndx</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTextPresent</td>
+ <td>Umsatzsteuer</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTextPresent</td>
+ <td>16,00</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>deliverydate</td>
+ <td>15.12.2006</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>update_button</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTextPresent</td>
+ <td>Umsatzsteuer</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTextPresent</td>
+ <td>16,00</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>datepaid_1</td>
+ <td>20.12.2006</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>source_1</td>
+ <td>4</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>memo_1</td>
+ <td>4</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>paid_1</td>
+ <td>116</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.invoice.action[6]</td>
+ <td></td>
+</tr>
+<!--### 4. Testbuchung-->
+<!--Rechnung-->
+<!--08-2006 Rechnungsdatum-->
+<!--09-2006 Lieferdatum-->
+<!--02-2007 Zahlungsdatum-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Rechnung erfassen</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invnumber</td>
+ <td>4</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invdate</td>
+ <td>8.08.2006</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>deliverydate</td>
+ <td>10.09.2006</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>partnumber_1</td>
+ <td>1</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>update_button</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>ndx</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//td[3]/table/tbody/tr[2]/td</td>
+ <td>16,00</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>datepaid_1</td>
+ <td>2.2.2007</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>source_1</td>
+ <td>7</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>memo_1</td>
+ <td>7</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>paid_1</td>
+ <td>116</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.invoice.action[6]</td>
+ <td></td>
+</tr>
+<!--### 5. Testbuchung-->
+<!--Rechnung-->
+<!--06-2006 Rechnungsdatum-->
+<!--01-2007 Lieferdatum-->
+<!--07-2006 Zahlungsdatum-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Rechnung erfassen</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invnumber</td>
+ <td>5</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invdate</td>
+ <td>10.06.2006</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>deliverydate</td>
+ <td>13.1.2007</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>partnumber_1</td>
+ <td>1</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>datepaid_1</td>
+ <td>12.7.2006</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>source_1</td>
+ <td>45</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>memo_1</td>
+ <td>44</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>paid_1</td>
+ <td>119</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.invoice.action[6]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>ndx</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.invoice.action[6]</td>
+ <td></td>
+</tr>
+<!--### 6. Testbuchung-->
+<!--Bug: 526 Konto 1588 wird bei UStVA ignoriert-->
+<!--Dialogbuchung mit Konto 1588-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Dialogbuchen</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>accno_1</td>
+ <td>label=1588--Bezahlte Einfuhrumsatzsteuer</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>accno_2</td>
+ <td>label=1200--Bank</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>reference</td>
+ <td>Test 1588 Kz62</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>description</td>
+ <td>Test 1588 Kz62</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>transdate</td>
+ <td>1.10.2005</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>debit_1</td>
+ <td>143,2455</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>credit_2</td>
+ <td>143,2455</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.gl.action[1]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForTextPresent</td>
+ <td>gespeichert</td>
+ <td></td>
+</tr>
+<!--### 7. Testbuchung-->
+<!--Debitorenbuchung-->
+<!--02-2007 Rechnungsdatum-->
+<!--kein Lieferdatum-->
+<!--04-2007 Zahlungsdatum-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Debitorenbuchung</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>AR_amount_1</td>
+ <td>label=8400--Erlöse 16%/19% USt.</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>amount_1</td>
+ <td>2000</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>transdate</td>
+ <td>19.2.2007</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>datepaid_1</td>
+ <td>1.4.2007</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>source_1</td>
+ <td>2</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>memo_1</td>
+ <td>2</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>paid_1</td>
+ <td>2000</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>AR_paid_1</td>
+ <td>label=1200--Bank</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invnumber</td>
+ <td>Debitorenbuchung</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.arledger.action[1]</td>
+ <td></td>
+</tr>
+<!--### 8. Testbuchung-->
+<!--Kreditorenbuchung-->
+<!--05-2007 Rechnungsdatum-->
+<!--kein Lieferdatum-->
+<!--06-2007 Zahlungsdatum-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Kreditorenbuchung</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>AP_amount_1</td>
+ <td>label=0420--Büroeinrichtung</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invnumber</td>
+ <td>Kreditorenbuchung</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>amount_1</td>
+ <td>2000</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>transdate</td>
+ <td>20.05.2007</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>datepaid_1</td>
+ <td>1.6.2007</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>source_1</td>
+ <td>123</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>memo_1</td>
+ <td>123</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>paid_1</td>
+ <td>1000</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.forms[0].action[1]</td>
+ <td></td>
+</tr>
+<!--### 9. Testbuchung-->
+<!--Rechnung-->
+<!--01-2008 Rechnungsdatum-->
+<!--01-2008 Lieferdatum-->
+<!--01-2008 Zahlungsdatum-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Rechnung erfassen</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invnumber</td>
+ <td>9-7%</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invdate</td>
+ <td>1.1.2008</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>deliverydate</td>
+ <td>3.1.2008</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>partnumber_1</td>
+ <td>100-7%</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>datepaid_1</td>
+ <td>10.1.2008</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>source_1</td>
+ <td>45</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>memo_1</td>
+ <td>44</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>paid_1</td>
+ <td>107</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>update_button</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectWindow</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//td[3]/table/tbody/tr[2]/td</td>
+ <td>7,00</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.invoice.action[6]</td>
+ <td></td>
+</tr>
+<!--### 10. Testbuchung-->
+<!--Eingangsrechnung-->
+<!--01-2005 Rechnungsdatum-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Einkaufsrechnung erfassen</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invnumber</td>
+ <td>120</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invdate</td>
+ <td>1.1.2005</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>partnumber_1</td>
+ <td>1</td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>relative=up</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>update_button</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>ndx</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.forms[0].action[1]</td>
+ <td></td>
+</tr>
+<!--### 11. Testbuchung-->
+<!--Eingangsrechnung-->
+<!--01-2006 Rechnungsdatum-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Einkaufsrechnung erfassen</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invnumber</td>
+ <td>130</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invdate</td>
+ <td>1.1.2006</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>partnumber_1</td>
+ <td>1</td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>relative=up</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>update_button</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>ndx</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.forms[0].action[1]</td>
+ <td></td>
+</tr>
+<!--### 12. Testbuchung-->
+<!--Eingangsrechnung-->
+<!--02-2005 Rechnungsdatum-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Einkaufsrechnung erfassen</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invnumber</td>
+ <td>131</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invdate</td>
+ <td>1.2.2006</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>partnumber_1</td>
+ <td>1</td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>relative=up</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>update_button</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>ndx</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.forms[0].action[1]</td>
+ <td></td>
+</tr>
+<!--### 13. Testbuchung-->
+<!--Eingangsrechnung-->
+<!--01-2005 Rechnungsdatum-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Einkaufsrechnung erfassen</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invnumber</td>
+ <td>132</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invdate</td>
+ <td>1.3.2006</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>partnumber_1</td>
+ <td>1</td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>relative=up</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>update_button</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>ndx</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.forms[0].action[1]</td>
+ <td></td>
+</tr>
+<!--14. Testbuchung-->
+<!--Konteneinstellungen-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Konto erfassen</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>accno</td>
+ <td>1775Skonto</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>description</td>
+ <td>Umsatzsteuerkorrektur 16% bei Skonto</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>AccountType</td>
+ <td>label=Aufwandskonto (E)</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>AR_paid</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>AR_tax</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=1775Skonto</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>taxkey_startdate_0</td>
+ <td>1.1.1970</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>taxkey_pos_ustva_0</td>
+ <td>label=511</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<!--### 14. Testbuchung-->
+<!--Rechnung mit 3% Skonto-->
+<!--Beispiel aus Wiki: http://wiki.lx-system.de/index.php/Skonto#Zahlungseingang:_Gew.C3.A4hrte_Skonti-->
+<!--02-2003 Rechnungsdatum-->
+<!--02-2003 Lieferdatum-->
+<!--02-2003 Zahlungsdatum-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Rechnung erfassen</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invnumber</td>
+ <td>14-3%-SKONTO</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>invdate</td>
+ <td>1.2.2003</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>deliverydate</td>
+ <td>3.2.2003</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>partnumber_1</td>
+ <td>1</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>update_button</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>ndx</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>taxincluded</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>sellprice_1</td>
+ <td>1431,79</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>update_button</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>datepaid_1</td>
+ <td>04.02.2003</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>source_1</td>
+ <td>12345</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>paid_1</td>
+ <td>1388,84</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>AR_paid_1</td>
+ <td>label=1200--Bank</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>update_button</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>datepaid_2</td>
+ <td>04.02.2003</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>source_2</td>
+ <td>12345</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>paid_2</td>
+ <td>37,03</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>AR_paid_2</td>
+ <td>label=8735--Gewährte Skonti 16%/19% USt.</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>update_button</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>datepaid_3</td>
+ <td>04.02.2003</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>source_3</td>
+ <td>12345</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>memo_3</td>
+ <td>Skontokorrektur UST 16%</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>paid_3</td>
+ <td>5,92</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>AR_paid_3</td>
+ <td>label=1775Skonto--Umsatzsteuerkorrektur 16% bei Skonto</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>update_button</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.invoice.action[6]</td>
+ <td></td>
+</tr>
+<!--##############-->
+<!--# Steuerzone Inland Umsatzsteuer-->
+<!--##############-->
+<!--#############-->
+<!--# USTVA Einstellungen-->
+<!--# IST-Versteuert-->
+<!--# monatliche Abgabe-->
+<!--#############-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa Einstellungen</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>elsterland_new</td>
+ <td>label=Nordrhein Westfalen</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>elsterFFFF_new</td>
+ <td>label=Aachen-Innenstadt (5201)</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>cash</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>month</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>part_1_1</td>
+ <td>label=1</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>part_1_2</td>
+ <td>label=2</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>part_1_3</td>
+ <td>label=3</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>part_1_4</td>
+ <td>label=4</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>part_2_1</td>
+ <td>label=5</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>part_2_2</td>
+ <td>label=6</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>part_2_3</td>
+ <td>label=7</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>part_2_4</td>
+ <td>label=8</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.elsterform.action[1]</td>
+ <td></td>
+</tr>
+<!--### 1. Test-->
+<!--03-2007 Rechnungsdatum-->
+<!--Kein Lieferdatum-->
+<!--03-2007 Zahlungsdatum-->
+<!--USTVA2007-03-IST-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=up</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>year</td>
+ <td>label=2007</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>zeitraum</td>
+ <td>label=März</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[2]</td>
+ <td>(Spalte 81)</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[3]</td>
+ <td>100</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[5]</td>
+ <td>19,00</td>
+</tr>
+<!--### 2. Test-->
+<!--Rechnung-->
+<!--11-2006 Rechnungsdatum-->
+<!--Kein Lieferdatum-->
+<!--01-2007 Zahlungsdatum-->
+<!--USTVA-11-2006-IST-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>year</td>
+ <td>label=2006</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>zeitraum</td>
+ <td>label=November</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[2]</td>
+ <td>(Spalte 51)</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[3]</td>
+ <td>100</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[5]</td>
+ <td>16,00</td>
+</tr>
+<!--### 3. Test-->
+<!--USTVA2006-12-IST-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>year</td>
+ <td>label=2006</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>zeitraum</td>
+ <td>label=Dezember</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[2]</td>
+ <td>(Spalte 51)</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[3]</td>
+ <td>100</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[5]</td>
+ <td>16,00</td>
+</tr>
+<!--### 4. Test-->
+<!--Rechnung-->
+<!--08-2006 Rechnungsdatum-->
+<!--09-2006 Lieferdatum-->
+<!--02-2007 Zahlungsdatum-->
+<!--USTVA2007-02-IST-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>year</td>
+ <td>label=2007</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>zeitraum</td>
+ <td>label=Februar</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[11]/td[2]</td>
+ <td>35</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[11]/td[3]</td>
+ <td>100</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[11]/td[4]</td>
+ <td>36</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[11]/td[5]</td>
+ <td>16,00</td>
+</tr>
+<!--### 5. Test-->
+<!--Rechnung-->
+<!--06-2006 Rechnungsdatum-->
+<!--01-2007 Lieferdatum-->
+<!--07-2006 Zahlungsdatum-->
+<!--USTVA2006-07-IST-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>year</td>
+ <td>label=2006</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>zeitraum</td>
+ <td>label=Juli</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[11]/td[2]</td>
+ <td>35</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[11]/td[3]</td>
+ <td>100</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[11]/td[4]</td>
+ <td>36</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[11]/td[5]</td>
+ <td>19,00</td>
+</tr>
+<!--### 6. Test-->
+<!--Bug: 526 Konto 1588 wird bei UStVA ignoriert-->
+<!--Dialogbuchung mit Konto 1588-->
+<!--USTVA2005-10-IST-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>year</td>
+ <td>label=2005</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>zeitraum</td>
+ <td>label=Oktober</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>relative=up</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[39]/td[2]</td>
+ <td>62</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[39]/td[3]</td>
+ <td>143,25</td>
+</tr>
+<!--### 7. Test-->
+<!--Debitorenbuchung-->
+<!--02-2007 Rechnungsdatum-->
+<!--kein Lieferdatum-->
+<!--04-2007 Zahlungsdatum-->
+<!--USTVA2007-03-IST-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>year</td>
+ <td>label=2007</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>zeitraum</td>
+ <td>label=April</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>relative=up</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[2]</td>
+ <td>(Spalte 81)</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[3]</td>
+ <td>1681</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[5]</td>
+ <td>319,33</td>
+</tr>
+<!--### 8. Test-->
+<!--Kreditorenbuchung-->
+<!--05-2007 Rechnungsdatum-->
+<!--kein Lieferdatum-->
+<!--06-2007 Zahlungsdatum-->
+<!--USTVA2007-03-IST-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>year</td>
+ <td>label=2007</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>zeitraum</td>
+ <td>label=Mai</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>relative=up</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[37]/td[3]</td>
+ <td>319,33</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[37]/td[2]</td>
+ <td>(Spalte 66)</td>
+</tr>
+<!--### 9. Test-->
+<!--Rechnung-->
+<!--01-2008 Rechnungsdatum-->
+<!--01-2008 Lieferdatum-->
+<!--01-2008 Zahlungsdatum-->
+<!--USTVA2008-01-IST-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>year</td>
+ <td>label=2008</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>zeitraum</td>
+ <td>label=Januar</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>relative=up</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[10]/td[2]</td>
+ <td>(Spalte 86)</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[10]/td[3]</td>
+ <td>100</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[10]/td[5]</td>
+ <td>7,00</td>
+</tr>
+<!--### 10. Test-->
+<!--Einkaufsrechnung-->
+<!--01-2005 Rechnungsdatum-->
+<!--USTVA2005-01-IST-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>year</td>
+ <td>label=2005</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>zeitraum</td>
+ <td>label=Januar</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[37]/td[3]</td>
+ <td>8,00</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[37]/td[2]</td>
+ <td>(Spalte 66)</td>
+</tr>
+<!--### 14. Test-->
+<!--USTVA-->
+<!--2003-02-->
+<!--Skonto-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=up</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>year</td>
+ <td>label=2003</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>zeitraum</td>
+ <td>label=Februar</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[3]</td>
+ <td>1197</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[5]</td>
+ <td>191,57</td>
+</tr>
+<!--#############-->
+<!--# USTVA Einstellungen-->
+<!--# SOLL-Versteuert-->
+<!--# monatliche Abgabe-->
+<!--#############-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa Einstellungen</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>accrual</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>month</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>part_1_1</td>
+ <td>label=1</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>part_1_2</td>
+ <td>label=2</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>part_1_3</td>
+ <td>label=3</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>part_1_4</td>
+ <td>label=4</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>part_2_1</td>
+ <td>label=5</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>part_2_2</td>
+ <td>label=6</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>part_2_3</td>
+ <td>label=7</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>part_2_4</td>
+ <td>label=8</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.elsterform.action[1]</td>
+ <td></td>
+</tr>
+<!--Testkunde,-->
+<!--Testlieferant,-->
+<!--Testware,geerbt-->
+<!---->
+<!--##############-->
+<!--# Steuerzone Inland Umsatzsteuer-->
+<!--##############-->
+<!--### 14. Test-->
+<!--Rechnung:-->
+<!--03-2007 Rechnungsdatum-->
+<!--Kein Lieferdatum-->
+<!--03-2007 Zahlungsdatum-->
+<!--USTVA2007-03-SOLL-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=up</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>year</td>
+ <td>label=2007</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>zeitraum</td>
+ <td>label=März</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[2]</td>
+ <td>(Spalte 81)</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[3]</td>
+ <td>100</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[5]</td>
+ <td>19,00</td>
+</tr>
+<!--### 15. Test-->
+<!--Rechnung-->
+<!--11-2006 Rechnungsdatum-->
+<!--Kein Lieferdatum-->
+<!--01-2007 Zahlungsdatum-->
+<!--USTVA-11-2006-SOLL-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>year</td>
+ <td>label=2006</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>zeitraum</td>
+ <td>label=November</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[2]</td>
+ <td>(Spalte 51)</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[3]</td>
+ <td>100</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[5]</td>
+ <td>16,00</td>
+</tr>
+<!--### 16. Test-->
+<!--#s.a. tst3-->
+<!--Rechnung-->
+<!--12-2006 Rechnungsdatum-->
+<!--12-2006 Lieferdatum-->
+<!--12-2006 Zahlungsdatum-->
+<!--USTVA2006-12-SOLL-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>year</td>
+ <td>label=2006</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>zeitraum</td>
+ <td>label=Dezember</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[2]</td>
+ <td>(Spalte 51)</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[3]</td>
+ <td>100</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[5]</td>
+ <td>16,00</td>
+</tr>
+<!--### 17. Test-->
+<!--Rechnung-->
+<!--08-2006 Rechnungsdatum-->
+<!--09-2006 Lieferdatum-->
+<!--02-2007 Zahlungsdatum-->
+<!--USTVA2006-08-SOLL-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>year</td>
+ <td>label=2006</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>zeitraum</td>
+ <td>label=August</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[2]</td>
+ <td>(Spalte 51)</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[3]</td>
+ <td>100</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[4]</td>
+ <td>(Spalte 51 rechts)</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[5]</td>
+ <td>16,00</td>
+</tr>
+<!--### 18. Test-->
+<!--Rechnung-->
+<!--06-2006 Rechnungsdatum-->
+<!--01-2007 Lieferdatum-->
+<!--07-2006 Zahlungsdatum-->
+<!--USTVA2006-06-SOLL-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>year</td>
+ <td>label=2006</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>zeitraum</td>
+ <td>label=Juni</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[11]/td[2]</td>
+ <td>35</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[11]/td[3]</td>
+ <td>100</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[11]/td[4]</td>
+ <td>36</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[11]/td[5]</td>
+ <td>19,00</td>
+</tr>
+<!--### 19. Test-->
+<!--Bug: 526 Konto 1588 wird bei UStVA ignoriert-->
+<!--Dialogbuchung mit Konto 1588-->
+<!--USTVA2005-10-SOLL-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>year</td>
+ <td>label=2005</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>zeitraum</td>
+ <td>label=Oktober</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[39]/td[2]</td>
+ <td>62</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[39]/td[3]</td>
+ <td>143,25</td>
+</tr>
+<!--### 20. Test-->
+<!--Debitorenbuchung-->
+<!--02-2007 Rechnungsdatum-->
+<!--kein Lieferdatum-->
+<!--04-2007 Zahlungsdatum-->
+<!--USTVA2007-02-SOLL-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>year</td>
+ <td>label=2007</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>zeitraum</td>
+ <td>label=Februar</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[2]</td>
+ <td>(Spalte 81)</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[3]</td>
+ <td>1681</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[5]</td>
+ <td>319,33</td>
+</tr>
+<!--### 21. Test-->
+<!--Kreditorenbuchung-->
+<!--05-2007 Rechnungsdatum-->
+<!--kein Lieferdatum-->
+<!--06-2007 Zahlungsdatum-->
+<!--USTVA2007-03-SOLL-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>year</td>
+ <td>label=2007</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>zeitraum</td>
+ <td>label=Mai</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[37]/td[3]</td>
+ <td>319,33</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[37]/td[2]</td>
+ <td>(Spalte 66)</td>
+</tr>
+<!--### 22. Test-->
+<!--USTVA-->
+<!--2003-02-->
+<!--Skonto-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=up</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=UStVa</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForPageToLoad</td>
+ <td>120000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>year</td>
+ <td>label=2003</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>zeitraum</td>
+ <td>label=Februar</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>selectFrame</td>
+ <td>main_window</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[3]</td>
+ <td>1197</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//tr[9]/td[5]</td>
+ <td>191,57</td>
+</tr>
+<tr>
+ <td>break</td>
+ <td></td>
+ <td>Set the Startpoint to the next command manually</td>
+</tr>
+<!--#############-->
+<!--# Cleanup Test-->
+<!--#############-->
+<!--Benutzer von Datenbank lösen-->
+<tr>
+ <td>selectFrame</td>
+ <td>relative=top</td>
+ <td></td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>https://lx-office.linet-services.de/svn-installationen/unstable/admin.pl?path=bin/mozilla/&rpw=roXyrPyqv9wE2&nextsub=list_users&action=Weiter</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTitle</td>
+ <td>Lx-Office ERP Administration -</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=demo-1619</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>dbname</td>
+ <td>leer</td>
+</tr>
+<tr>
+ <td>assertTitle</td>
+ <td>Lx-Office ERP Administration / Benutzerdaten bearbeiten -</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.forms[0].action[0]</td>
+ <td></td>
+</tr>
+<!--Datenbank löschen-->
+<tr>
+ <td>clickAndWait</td>
+ <td>document.forms[0].action[2]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTitle</td>
+ <td>Lx-Office ERP / Datenbankadministration -</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>document.forms[0].action[2]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTitle</td>
+ <td>Lx-Office ERP Datenbankadministration / Datenbank löschen -</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>db</td>
+ <td>label=Selenium_Testdb-_SKR03_IST_1619_2006_2007</td>
+</tr>
+<!--... deleting databases needs time...-->
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTitle</td>
+ <td>Lx-Office ERP Datenbankadministration / Datenbank löschen -</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>action</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTitle</td>
+ <td>Lx-Office ERP Administration -</td>
+ <td></td>
+</tr>
+<!--######################-->
+<!--# Ende Testskript-->
+<!--######################-->
+
+</tbody></table>
+</body>
+</html>
--- /dev/null
+Order Allow,Deny
+Deny from all
-;; This file was produced using lx-office
+;; This file was produced by lx-office
;; for using in taxbird.
;; You probably don't want to touch this
;; file. In case you do want it anyway,
("zeitraum" . "<%taxbird_period%>")
("stnr" . "<%taxbird_steuernummer%>")
-<%if 10%>("Kz10" . "<%10%>")<%end 10%>
-<%if 22%>("Kz22" . "<%22%>")<%end 22%>
-<%if 26%>("Kz26" . "<%26%>")<%end 26%>
-<%if 29%>("Kz29" . "<%29%>")<%end 29%>
-<%if 35%>("Kz35" . "<%35%>")<%end 35%>
-<%if 36%>("Kz36" . "<%36%>")<%end 36%>
-<%if 39%>("Kz39" . "<%39%>")<%end 39%>
-<%if 41%>("Kz41" . "<%41%>")<%end 41%>
-<%if 42%>("Kz42" . "<%42%>")<%end 42%>
-<%if 43%>("Kz43" . "<%43%>")<%end 43%>
-<%if 44%>("Kz44" . "<%44%>")<%end 44%>
-<%if 45%>("Kz45" . "<%45%>")<%end 45%>
-<%if 48%>("Kz48" . "<%48%>")<%end 48%>
-<%if 49%>("Kz49" . "<%49%>")<%end 49%>
-<%if 51%>("Kz51" . "<%51%>")<%end 51%>
-<%if 511%>("Kz51-calc" . "<%511%>")<%end 511%>
-<%if 52%>("Kz52" . "<%52%>")<%end 52%>
-<%if 53%>("Kz53" . "<%53%>")<%end 53%>
-<%if 59%>("Kz59" . "<%59%>")<%end 59%>
-<%if 60%>("Kz60" . "<%60%>")<%end 60%>
-<%if 61%>("Kz61" . "<%61%>")<%end 61%>
-<%if 62%>("Kz62" . "<%62%>")<%end 62%>
-<%if 63%>("Kz63" . "<%63%>")<%end 63%>
-<%if 64%>("Kz64" . "<%64%>")<%end 64%>
-<%if 65%>("Kz65" . "<%65%>")<%end 65%>
-<%if 66%>("Kz66" . "<%66%>")<%end 66%>
-<%if 67%>("Kz67" . "<%67%>")<%end 67%>
-<%if 69%>("Kz69" . "<%69%>")<%end 69%>
-<%if 73%>("Kz73" . "<%73%>")<%end 73%>
-<%if 74%>("Kz74" . "<%74%>")<%end 74%>
-<%if 76%>("Kz76" . "<%76%>")<%end 76%>
-<%if 77%>("Kz77" . "<%77%>")<%end 77%>
-<%if 80%>("Kz80" . "<%80%>")<%end 80%>
-<%if 83%>("Kz83" . "<%83%>")<%end 83%>
-<%if 84%>("Kz84" . "<%84%>")<%end 84%>
-<%if 85%>("Kz85" . "<%85%>")<%end 85%>
-<%if 86%>("Kz86" . "<%86%>")<%end 86%>
-<%if 861%>("Kz86-calc" . "<%861%>")<%end 861%>
-<%if 91%>("Kz91" . "<%91%>")<%end 91%>
-<%if 93%>("Kz93" . "<%93%>")<%end 93%>
-<%if 931%>("Kz93-calc" . "<%931%>")<%end 931%>
-<%if 94%>("Kz94" . "<%94%>")<%end 94%>
-<%if 95%>("Kz95" . "<%95%>")<%end 95%>
-<%if 96%>("Kz96" . "<%96%>")<%end 96%>
-<%if 97%>("Kz97" . "<%97%>")<%end 97%>
-<%if 971%>("Kz97-calc" . "<%971%>")<%end 971%>
-<%if 98%>("Kz98" . "<%98%>")<%end 98%>
+<%foreach id%>
+("<%id%>" . "<%amount%>")<%end%>
))
\ No newline at end of file
<td class="text"><b class="h4">Steuerpflichtige Umsätze</b></td>
<td colspan="4"></td>
</tr>
+<%if not year2007%>
<tr>
<td class="text2">zum Steuersatz von 16 v.H.</td>
<td class="spalte ausfuellen"><span class="nodis">(Spalte </span>51<span class="nodis">)</span></td>
<td class="spalte"><span class="nodis">(Spalte 51 rechts)</span></td>
<td class="betrag"><%511%></td>
</tr>
+<%end year2007%>
+<%if year2007%>
+ <tr>
+ <td class="text2">zum Steuersatz von 19 v.H.</td>
+ <td class="spalte ausfuellen"><span class="nodis">(Spalte </span>81<span class="nodis">)</span></td>
+ <td class="betrag ausfuellen" width="70"><%81%><br></td>
+ <td class="spalte"><span class="nodis">(Spalte 81 rechts)</span></td>
+ <td class="betrag"><%811%></td>
+ </tr>
+<%end year2007%>
+
<tr>
<td class="text">zum Steuersatz von 7 v.H.</td>
<td class="spalte ausfuellen"><span class="nodis">(Spalte </span>86<span class="nodis">)</span></td>
<td class="spalte"><span class="nodis"></span></td>
<td class="betrag"></td>
</tr>
-
+<%if not year2007%>
<tr>
<td class="text">Steuerpflichtige zum Steuersatz von 16 v.H.</td>
<td class="spalte ausfuellen"><span class="nodis">(Spalte </span>97<span class="nodis">)</span></td>
<td class="spalte"><span class="nodis">(Spalte 97 rechts)</span></td>
<td class="betrag"><%971%></td>
</tr>
+<%end if year2007%>
+<%if year2007%>
+ <tr>
+ <td class="text">Steuerpflichtige zum Steuersatz von 19 v.H.</td>
+ <td class="spalte ausfuellen"><span class="nodis">(Spalte </span>89<span class="nodis">)</span></td>
+ <td class="betrag ausfuellen"><%89%><br></td>
+ <td class="spalte"><span class="nodis">(Spalte 89 rechts)</span></td>
+ <td class="betrag"><%891%></td>
+ </tr>
+<%end if year2007%>
<tr>
<td class="text2">zum Steuersatz von 7 v.H.</td>
<td class="spalte ausfuellen"><span class="nodis">(Spalte </span>93<span class="nodis">)</span></td>
<AnmeldeJahr><%year%></AnmeldeJahr>
<AnmeldeZeitraum><%period%></AnmeldeZeitraum>
- <%if 35%><Kennzahl Nr="35"><%35%></Kennzahl><%end 35%>
- <%if 36%><Kennzahl Nr="36"><%36%></Kennzahl><%end 36%>
- <%if 39%><Kennzahl Nr="39"><%39%></Kennzahl><%end 39%>
- <%if 41%><Kennzahl Nr="41"><%41%></Kennzahl><%end 41%>
- <%if 42%><Kennzahl Nr="42"><%42%></Kennzahl><%end 42%>
- <%if 43%><Kennzahl Nr="43"><%43%></Kennzahl><%end 43%>
- <%if 44%><Kennzahl Nr="44"><%44%></Kennzahl><%end 44%>
- <%if 45%><Kennzahl Nr="45"><%45%></Kennzahl><%end 45%>
- <%if 48%><Kennzahl Nr="48"><%48%></Kennzahl><%end 48%>
- <%if 49%><Kennzahl Nr="49"><%49%></Kennzahl><%end 49%>
- <%if 51%><Kennzahl Nr="51"><%51%></Kennzahl><%end 51%>
- <%if 511%><Kennzahl Nr="511"><%511%></Kennzahl><%end 511%>
- <%if 52%><Kennzahl Nr="52"><%52%></Kennzahl><%end 52%>
- <%if 53%><Kennzahl Nr="53"><%53%></Kennzahl><%end 53%>
- <%if 59%><Kennzahl Nr="59"><%59%></Kennzahl><%end 59%>
- <%if 60%><Kennzahl Nr="60"><%60%></Kennzahl><%end 60%>
- <%if 61%><Kennzahl Nr="61"><%61%></Kennzahl><%end 61%>
- <%if 62%><Kennzahl Nr="62"><%62%></Kennzahl><%end 62%>
- <%if 63%><Kennzahl Nr="63"><%63%></Kennzahl><%end 63%>
- <%if 64%><Kennzahl Nr="64"><%64%></Kennzahl><%end 64%>
- <%if 65%><Kennzahl Nr="65"><%65%></Kennzahl><%end 65%>
- <%if 66%><Kennzahl Nr="66"><%66%></Kennzahl><%end 66%>
- <%if 67%><Kennzahl Nr="67"><%67%></Kennzahl><%end 67%>
- <%if 69%><Kennzahl Nr="69"><%69%></Kennzahl><%end 69%>
- <%if 73%><Kennzahl Nr="73"><%73%></Kennzahl><%end 73%>
- <%if 74%><Kennzahl Nr="74"><%74%></Kennzahl><%end 74%>
- <%if 76%><Kennzahl Nr="76"><%76%></Kennzahl><%end 76%>
- <%if 77%><Kennzahl Nr="77"><%77%></Kennzahl><%end 77%>
- <%if 80%><Kennzahl Nr="80"><%80%></Kennzahl><%end 80%>
- <%if 83%><Kennzahl Nr="83"><%83%></Kennzahl><%end 83%>
- <%if 84%><Kennzahl Nr="84"><%84%></Kennzahl><%end 84%>
- <%if 85%><Kennzahl Nr="85"><%85%></Kennzahl><%end 85%>
- <%if 86%><Kennzahl Nr="86"><%86%></Kennzahl><%end 86%>
- <%if 861%><Kennzahl Nr="861"><%861%></Kennzahl><%end 861%>
- <%if 91%><Kennzahl Nr="91"><%91%></Kennzahl><%end 91%>
- <%if 93%><Kennzahl Nr="93"><%93%></Kennzahl><%end 93%>
- <%if 931%><Kennzahl Nr="931"><%931%></Kennzahl><%end 931%>
- <%if 94%><Kennzahl Nr="94"><%94%></Kennzahl><%end 94%>
- <%if 95%><Kennzahl Nr="95"><%95%></Kennzahl><%end 95%>
- <%if 96%><Kennzahl Nr="96"><%96%></Kennzahl><%end 96%>
- <%if 97%><Kennzahl Nr="97"><%97%></Kennzahl><%end 97%>
- <%if 971%><Kennzahl Nr="971"><%971%></Kennzahl><%end 971%>
- <%if 98%><Kennzahl Nr="98"><%98%></Kennzahl><%end 98%>
+<%foreach id%>
+ <Kennzahl nr="<%id%>"><%amount%></Kennzahl>
+<%end%>
</WinstonAusgang>
--- /dev/null
+\documentclass[10pt, oneside]{scrartcl}
+\usepackage[latin1]{inputenc}
+\usepackage{german}
+\usepackage{tabularx}
+\usepackage{xspace}
+\usepackage{ifthen}
+\usepackage{eso-pic}
+\usepackage{longtable}
+\usepackage{eurosym}
+
+\setlength{\voffset}{-0.3cm}
+\setlength{\hoffset}{-2.2cm}
+\setlength{\topmargin}{0cm}
+\setlength{\headheight}{0.5cm}
+\setlength{\headsep}{1cm}
+\setlength{\topskip}{0pt}
+\setlength{\oddsidemargin}{2cm}
+%\setlength{\evensidemargin}{2cm}
+\setlength{\textwidth}{16.4cm}
+% \setlength{\textwidth}{13.4cm}
+\setlength{\textheight}{23.5cm}
+\setlength{\footskip}{1cm}
+\setlength{\parindent}{0pt}
+\setlength{\tabcolsep}{0cm}
+
+\renewcommand{\baselinestretch}{1}
+
+\begin{document}
+\pagestyle{empty}
+\fontfamily{cmss}\fontsize{10pt}{10pt}\fontseries{m}\selectfont
+
+<%name%>
+
+<%street%>
+
+<%zipcode%> <%city%>
+
+\begin{flushright}<%invdate%>\end{flushright}
+
+\vspace*{2.5cm}
+
+\large
+\textbf{Rechnung <%invnumber%>}
+
+\vspace*{1cm}
+
+\normalsize
+Sehr geehrte Damen und Herren,
+
+\vspace*{1cm}
+Hiermit stellen wir Ihnen zu Mahnung <%dunning_id%> die folgenden Posten in Rechnung:
+
+\vspace*{0.5cm}
+
+\begin{tabularx}{\textwidth}{Xr}
+ \textbf{Posten} & \multicolumn{1}{l}{\textbf{Betrag}}\\
+ \hline
+ Mahngebühren & <%fee%> EUR \\
+ Zinsen & <%interest%> EUR \\
+ \cline{2-2}
+ Gesamtsumme & <%invamount%> EUR\\
+\end{tabularx}
+
+\vspace*{0.5cm}
+
+Bitte begleichen Sie diese Forderung bis zum <%duedate%>.
+
+\vspace*{0.5cm}
+
+Mit freundlichen Grüßen,
+
+\vspace*{2cm}
+<%employee_name%>
+
+\end{document}
--- /dev/null
+[% USE HTML %]<body class="admin" onload="document.getElementById('rpw').focus()">
+
+ <div align="center">
+
+ <a href="http://www.lx-office.org"><img src="image/lx-office-erp.png" border="0"></a>
+
+ <h1 class="login">Version [% HTML.escape(version) %]</h1>
+
+ <h2>Administration</h2>
+
+ <form method="post" action="admin.pl">
+
+ <table>
+ <tr>
+ <th>Passwort</th>
+ <td><input type="password" name="rpw" id="rpw"></td>
+ <td><input type="submit" class="submit" name="action" value="Anmeldung"></td>
+ </tr>
+ <input type="hidden" name="action" value="login">
+ </table>
+
+ </form>
+
+ <p><a href="http://www.lx-office.org/">Lx-Office-Webseite</a></p>
+
+ </div>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin" onload="document.getElementById('rpw').focus()">
+
+ <div align="center">
+
+ <a href="http://www.lx-office.org"><img src="image/lx-office-erp.png" border="0"></a>
+
+ <h1 class="login"><translate>Version</translate> [% HTML.escape(version) %]</h1>
+
+ <h2><translate>Administration</translate></h2>
+
+ <form method="post" action="admin.pl">
+
+ <table>
+ <tr>
+ <th><translate>Password</translate></th>
+ <td><input type="password" name="rpw" id="rpw"></td>
+ <td><input type="submit" class="submit" name="action" value="<translate>Login</translate>"></td>
+ </tr>
+ <input type="hidden" name="action" value="login">
+ </table>
+
+ </form>
+
+ <p><a href="http://www.lx-office.org/"><translate>Lx-Office website</translate></a></p>
+
+ </div>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin" onload="set_subject(); document.getElementsByName('to')[0].focus(); ">
+
+ <script type="text/javascript">
+ <!--
+ function set_subject() {
+ var subject_template = "Sicherung der Datenbank";
+ var subject = document.Form.subject.value;
+
+ if ((subject == "") || (subject.substr(0, subject_template.length) == subject_template)) {
+ document.Form.subject.value = subject_template + " " + document.Form.dbname.value;
+ }
+ }
+ -->
+ </script>
+
+ <h2>[% title %]</h2>
+
+ [% IF NO_DATABSES %]
+ Auf diesem Server wurden keine Datenbanken gefunden.
+
+ [% ELSE %]
+
+ <form name="Form" method="post" action="admin.pl">
+
+ <input type="hidden" name="dbdriver" value="Pg">
+ <input type="hidden" name="dbhost" value="[% HTML.escape(dbhost) %]">
+ <input type="hidden" name="dbport" value="[% HTML.escape(dbport) %]">
+ <input type="hidden" name="dbuser" value="[% HTML.escape(dbuser) %]">
+ <input type="hidden" name="dbpasswd" value="[% HTML.escape(dbpasswd) %]">
+
+ <p>
+ Bitte wählen Sie die zu sichernde Datenbank gefunden:
+ <select name="dbname" onchange="set_subject()">[% FOREACH row = DATABASES %]<option>[% HTML.escape(row.dbname) %]</option>[% END %]</select>
+ </p>
+
+ <table>
+ <tr>
+ <td valign="top"><input type="radio" name="destination" id="destination_download" value="download" checked></td>
+ <td valign="top"><label for="destination_download">Die Sicherungsdatei herunterladen</label></td>
+ </tr>
+
+ <tr>
+ <td valign="top"><input type="radio" name="destination" id="destination_email" value="email"></td>
+ <td valign="top">
+ <label for="destination_email">Die Sicherungsdatei per Email verschicken</label><br>
+
+ <table>
+ <tr>
+ <td valign="top" align="right">Von</td>
+ <td valign="top"><input name="from" size="40" value="[% HTML.escape(from) %]"></td>
+ </tr>
+
+ <tr>
+ <td valign="top" align="right">An</td>
+ <td valign="top"><input name="to" size="40"></td>
+ </tr>
+
+ <tr>
+ <td valign="top" align="right">Cc</td>
+ <td valign="top"><input name="cc" size="40"></td>
+ </tr>
+
+ <tr>
+ <td valign="top" align="right">Betreff</td>
+ <td valign="top"><input name="subject" size="40"></td>
+ </tr>
+
+ <tr>
+ <td valign="top" align="right">Nachricht</td>
+ <td valign="top"><textarea name="message" cols="40" rows="10"></textarea></td>
+ </tr>
+
+ </table>
+
+ </td>
+ </tr>
+
+ </table>
+
+ <input name="callback" type="hidden" value="admin.pl?action=list_users&rpw=[% HTML.url(rpw) %]">
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+ <input type="hidden" name="nextsub" value="backup_dataset_start">
+ <input type="hidden" name="back_nextsub" value="list_users">
+
+ <hr size="3" noshade>
+
+ <br>
+
+ <input type="submit" class="submit" name="action" value="Weiter">
+ <input type="submit" class="submit" name="action" value="Zurück">
+
+ </form>
+
+ [% END %]
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin">
+
+ <h2>[% title %]</h2>
+
+ <p>Die Datenbanksicherung wurde per Email an [% HTML.escape(to) %] verschickt.</p>
+
+ <form method="post" action="admin.pl">
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+ <input type="hidden" name="nextsub" value="list_users">
+ <input type="submit" name="action" value="Weiter">
+ </form>
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin">
+
+ <h2>[% title %]</h2>
+
+ <p><translate>The dataset backup has been sent via email to [% HTML.escape(to) %].</translate></p>
+
+ <form method="post" action="admin.pl">
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+ <input type="hidden" name="nextsub" value="list_users">
+ <input type="submit" name="action" value="<translate>Continue</translate>">
+ </form>
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin" onload="set_subject(); document.getElementsByName('to')[0].focus(); ">
+
+ <script type="text/javascript">
+ <!--
+ function set_subject() {
+ var subject_template = "<translate>Backup of dataset</translate>";
+ var subject = document.Form.subject.value;
+
+ if ((subject == "") || (subject.substr(0, subject_template.length) == subject_template)) {
+ document.Form.subject.value = subject_template + " " + document.Form.dbname.value;
+ }
+ }
+ -->
+ </script>
+
+ <h2>[% title %]</h2>
+
+ [% IF NO_DATABSES %]
+ <translate>No databases have been found on this server.</translate>
+
+ [% ELSE %]
+
+ <form name="Form" method="post" action="admin.pl">
+
+ <input type="hidden" name="dbdriver" value="Pg">
+ <input type="hidden" name="dbhost" value="[% HTML.escape(dbhost) %]">
+ <input type="hidden" name="dbport" value="[% HTML.escape(dbport) %]">
+ <input type="hidden" name="dbuser" value="[% HTML.escape(dbuser) %]">
+ <input type="hidden" name="dbpasswd" value="[% HTML.escape(dbpasswd) %]">
+
+ <p>
+ <translate>Please select the database you want to backup</translate>:
+ <select name="dbname" onchange="set_subject()">[% FOREACH row = DATABASES %]<option>[% HTML.escape(row.dbname) %]</option>[% END %]</select>
+ </p>
+
+ <table>
+ <tr>
+ <td valign="top"><input type="radio" name="destination" id="destination_download" value="download" checked></td>
+ <td valign="top"><label for="destination_download"><translate>Download the backup</translate></label></td>
+ </tr>
+
+ <tr>
+ <td valign="top"><input type="radio" name="destination" id="destination_email" value="email"></td>
+ <td valign="top">
+ <label for="destination_email"><translate>Send the backup via Email</translate></label><br>
+
+ <table>
+ <tr>
+ <td valign="top" align="right"><translate>From</translate></td>
+ <td valign="top"><input name="from" size="40" value="[% HTML.escape(from) %]"></td>
+ </tr>
+
+ <tr>
+ <td valign="top" align="right"><translate>To</translate></td>
+ <td valign="top"><input name="to" size="40"></td>
+ </tr>
+
+ <tr>
+ <td valign="top" align="right"><translate>Cc</translate></td>
+ <td valign="top"><input name="cc" size="40"></td>
+ </tr>
+
+ <tr>
+ <td valign="top" align="right"><translate>Subject</translate></td>
+ <td valign="top"><input name="subject" size="40"></td>
+ </tr>
+
+ <tr>
+ <td valign="top" align="right"><translate>Message</translate></td>
+ <td valign="top"><textarea name="message" cols="40" rows="10"></textarea></td>
+ </tr>
+
+ </table>
+
+ </td>
+ </tr>
+
+ </table>
+
+ <input name="callback" type="hidden" value="admin.pl?action=list_users&rpw=[% HTML.url(rpw) %]">
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+ <input type="hidden" name="nextsub" value="backup_dataset_start">
+ <input type="hidden" name="back_nextsub" value="list_users">
+
+ <hr size="3" noshade>
+
+ <br>
+
+ <input type="submit" class="submit" name="action" value="<translate>Continue</translate>">
+ <input type="submit" class="submit" name="action" value="<translate>Back</translate>">
+
+ </form>
+
+ [% END %]
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin">
+
+ <h2>Administratorpasswort ändern</h2>
+
+ <form method="post" action="admin.pl">
+
+ <table>
+ <tr>
+ <td><b>Passwort</b></td>
+ <td><input type="password" name="password" size="8"></td>
+ </tr>
+
+ <tr>
+ <td><b>Passwort wiederholen</b></td>
+ <td><input type="password" name="password_again" size="8"></td>
+ </tr>
+ </table>
+
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+
+ <p><input type="submit" class="submit" name="action" value="Passwort ändern"></p>
+
+ </form>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin">
+
+ <h2><translate>Change Admin Password</translate></h2>
+
+ <form method="post" action="admin.pl">
+
+ <table>
+ <tr>
+ <td><b><translate>Password</translate></b></td>
+ <td><input type="password" name="password" size="8"></td>
+ </tr>
+
+ <tr>
+ <td><b><translate>Repeat the password</translate></b></td>
+ <td><input type="password" name="password_again" size="8"></td>
+ </tr>
+ </table>
+
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+
+ <p><input type="submit" class="submit" name="action" value="<translate>Change Password</translate>"></p>
+
+ </form>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin">
+
+ <h2>[% title %]</h2>
+
+ <form method="post" action="admin.pl">
+
+ <table>
+ <tr>
+ <th valign="top" align="right" nowrap>existierende Datenbanken</th>
+ <td valign="top">[% HTML.escape(dbsources) %]</td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>Datenbank anlegen</th>
+ <td><input name="db"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>Schriftsatz</th>
+ <td>
+ <select name="encoding">
+ [% FOREACH row = DBENCODINGS %]<option value="[% HTML.escape(row.dbencoding) %]" [% IF row.selected %]selected[% END %]>[% HTML.escape(row.label) %]</option>[% END %]
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <th valign="top" align="right" nowrap>Kontenplan anlegen</th>
+ <td>
+ <select name="chart">
+ [% FOREACH row = CHARTS %]<option [% IF row.selected %]selected[% END %]>[% HTML.escape(row.name) %]</option>[% END %]
+ </select>
+ </td>
+ </tr>
+
+ </table>
+
+ <input type="hidden" name="dbdriver" value="[% HTML.escape(dbdriver) %]">
+ <input type="hidden" name="dbuser" value="[% HTML.escape(dbuser) %]">
+ <input type="hidden" name="dbhost" value="[% HTML.escape(dbhost) %]">
+ <input type="hidden" name="dbport" value="[% HTML.escape(dbport) %]">
+ <input type="hidden" name="dbpasswd" value="[% HTML.escape(dbpasswd) %]">
+ <input type="hidden" name="dbdefault" value="[% HTML.escape(dbdefault) %]">
+
+ <input type="hidden" name="callback" value="admin.pl?action=list_users&rpw=[% HTML.url(rpw) %]">
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+
+ <input type="hidden" name="nextsub" value="dbcreate">
+
+ <hr size="3" noshade>
+
+ <p><input type="submit" class="submit" name="action" value="Weiter"></p>
+
+ </form>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin">
+
+ <h2>[% title %]</h2>
+
+ <form method="post" action="admin.pl">
+
+ <table>
+ <tr>
+ <th valign="top" align="right" nowrap><translate>Existing Datasets</translate></th>
+ <td valign="top">[% HTML.escape(dbsources) %]</td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap><translate>Create Dataset</translate></th>
+ <td><input name="db"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap><translate>Multibyte Encoding</translate></th>
+ <td>
+ <select name="encoding">
+ [% FOREACH row = DBENCODINGS %]<option value="[% HTML.escape(row.dbencoding) %]" [% IF row.selected %]selected[% END %]>[% HTML.escape(row.label) %]</option>[% END %]
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <th valign="top" align="right" nowrap><translate>Create Chart of Accounts</translate></th>
+ <td>
+ <select name="chart">
+ [% FOREACH row = CHARTS %]<option [% IF row.selected %]selected[% END %]>[% HTML.escape(row.name) %]</option>[% END %]
+ </select>
+ </td>
+ </tr>
+
+ </table>
+
+ <input type="hidden" name="dbdriver" value="[% HTML.escape(dbdriver) %]">
+ <input type="hidden" name="dbuser" value="[% HTML.escape(dbuser) %]">
+ <input type="hidden" name="dbhost" value="[% HTML.escape(dbhost) %]">
+ <input type="hidden" name="dbport" value="[% HTML.escape(dbport) %]">
+ <input type="hidden" name="dbpasswd" value="[% HTML.escape(dbpasswd) %]">
+ <input type="hidden" name="dbdefault" value="[% HTML.escape(dbdefault) %]">
+
+ <input type="hidden" name="callback" value="admin.pl?action=list_users&rpw=[% HTML.url(rpw) %]">
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+
+ <input type="hidden" name="nextsub" value="dbcreate">
+
+ <hr size="3" noshade>
+
+ <p><input type="submit" class="submit" name="action" value="<translate>Continue</translate>"></p>
+
+ </form>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin">
+
+ <h2>[% title %]</h2>
+
+ <form method="post" action="admin.pl">
+
+ <table>
+ <tr>
+ <td>
+
+ <table>
+
+ <input type="hidden" name="dbdriver" value="[% HTML.escape(dbdriver) %]">
+
+ <tr>
+ <td>
+ <table>
+
+ <tr>
+
+ <th align="right">Datenbankcomputer</th>
+ <td><input name="dbhost" size="25" value="[% HTML.escape(dbhost) %]"></td>
+ <th align="right">Port</th>
+ <td><input name="dbport" size="5" value="[% HTML.escape(dbport) %]"></td>
+
+ </tr>
+
+ <tr>
+
+ <th align="right">Benutzer</th>
+ <td><input name="dbuser" size="10" value="[% HTML.escape(dbuser) %]"></td>
+ <th align="right">Passwort</th>
+ <td><input type="password" name="dbpasswd" size="10"></td>
+
+ </tr>
+
+ <tr>
+
+ <th align="right">Datenbankvorlage</th>
+ <td colspan="3"><input name="dbdefault" size="10" value="[% HTML.escape(dbdefault) %]"></td>
+
+ </tr>
+
+ </table>
+
+ </td>
+ </tr>
+ </table>
+
+ <input name="callback" type="hidden" value="admin.pl?action=list_users&rpw=[% HTML.url(rpw) %]">
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+
+ <br>
+
+ <input type="submit" class="submit" name="action" value="Datenbank anlegen">
+ <input type="submit" class="submit" name="action" value="Datenbank aktualisieren">
+ <input type="submit" class="submit" name="action" value="Datenbank löschen">
+ [% IF ALLOW_DBBACKUP %]
+ <input type="submit" class="submit" name="action" value="Datenbank sichern">
+ <input type="submit" class="submit" name="action" value="Datenbank wiederherstellen">
+ [% END %]
+ </td>
+ </tr>
+ </table>
+ </form>
+
+ <p>In diesem Schritt werden bestehende Datenbanken gesucht. Es werden noch keine Änderungen vorgenommen!</p>
+
+ <p>Für lokale Verbindungen "Rechner" und "Port" freilassen.</p>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin">
+
+ <h2>[% title %]</h2>
+
+ <form method="post" action="admin.pl">
+
+ <table>
+ <tr>
+ <td>
+
+ <table>
+
+ <input type="hidden" name="dbdriver" value="[% HTML.escape(dbdriver) %]">
+
+ <tr>
+ <td>
+ <table>
+
+ <tr>
+
+ <th align="right"><translate>Host</translate></th>
+ <td><input name="dbhost" size="25" value="[% HTML.escape(dbhost) %]"></td>
+ <th align="right"><translate>Port</translate></th>
+ <td><input name="dbport" size="5" value="[% HTML.escape(dbport) %]"></td>
+
+ </tr>
+
+ <tr>
+
+ <th align="right"><translate>User</translate></th>
+ <td><input name="dbuser" size="10" value="[% HTML.escape(dbuser) %]"></td>
+ <th align="right"><translate>Password</translate></th>
+ <td><input type="password" name="dbpasswd" size="10"></td>
+
+ </tr>
+
+ <tr>
+
+ <th align="right"><translate>Database template</translate></th>
+ <td colspan="3"><input name="dbdefault" size="10" value="[% HTML.escape(dbdefault) %]"></td>
+
+ </tr>
+
+ </table>
+
+ </td>
+ </tr>
+ </table>
+
+ <input name="callback" type="hidden" value="admin.pl?action=list_users&rpw=[% HTML.url(rpw) %]">
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+
+ <br>
+
+ <input type="submit" class="submit" name="action" value="<translate>Create Dataset</translate>">
+ <input type="submit" class="submit" name="action" value="<translate>Update Dataset</translate>">
+ <input type="submit" class="submit" name="action" value="<translate>Delete Dataset</translate>">
+ [% IF ALLOW_DBBACKUP %]
+ <input type="submit" class="submit" name="action" value="<translate>Backup Dataset</translate>">
+ <input type="submit" class="submit" name="action" value="<translate>Restore Dataset</translate>">
+ [% END %]
+ </td>
+ </tr>
+ </table>
+ </form>
+
+ <p><translate>This is a preliminary check for existing sources. Nothing will be created or deleted at this stage!</translate></p>
+
+ <p><translate>Leave host and port field empty unless you want to make a remote connection.</translate></p>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin">
+
+ <h2>[% title %]</h2>
+
+ <form method="post" action="admin.pl">
+
+ <p>Die Datenbank [% HTML.escape(db) %] wurde erfolgreich angelegt.</p>
+
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+ <input type="hidden" name="nextsub" value="list_users">
+
+ <p><input type="submit" class="submit" name="action" value="Weiter"></p>
+
+ </form>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin">
+
+ <h2>[% title %]</h2>
+
+ <form method="post" action="admin.pl">
+
+ <p><translate>The dataset [% HTML.escape(db) %] has been successfully created.</translate></p>
+
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+ <input type="hidden" name="nextsub" value="list_users">
+
+ <p><input type="submit" class="submit" name="action" value="<translate>Continue</translate>"></p>
+
+ </form>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin">
+
+ <h2>[% title %]</h2>
+
+ <form method="post" action="admin.pl">
+
+ <p>Die Datenbank [% HTML.escape(db) %] wurde erfolgreich gelöscht.</p>
+
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+ <input type="hidden" name="nextsub" value="list_users">
+
+ <p><input type="submit" class="submit" name="action" value="Weiter"></p>
+ </form>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin">
+
+ <h2>[% title %]</h2>
+
+ <form method="post" action="admin.pl">
+
+ <p><translate>The database [% HTML.escape(db) %] has been successfully deleted.</translate></p>
+
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+ <input type="hidden" name="nextsub" value="list_users">
+
+ <p><input type="submit" class="submit" name="action" value="<translate>Continue</translate>"></p>
+ </form>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML%]
+[% IF NOTHING_TO_DO %]
+ <p>Es wurden keine Datenbanken ausgewählt.</p>
+
+ [% ELSE %]
+
+ <hr>
+
+ <p>Alle Datenbankupdates wurden eingespielt.</p>
+[% END %]
+
+<form method="post" action="admin.pl">
+ <input type="hidden" name="nextsub" value="list_users">
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+
+ <input type="submit" name="action" value="Weiter">
+</form>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML%]
+[% IF NOTHING_TO_DO %]
+ <p><translate>No datasets have been selected.</translate></p>
+
+ [% ELSE %]
+
+ <hr>
+
+ <p><translate>All database upgrades have been applied.</translate></p>
+[% END %]
+
+<form method="post" action="admin.pl">
+ <input type="hidden" name="nextsub" value="list_users">
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+
+ <input type="submit" name="action" value="<translate>Continue</translate>">
+</form>
+
+</body>
+</html>
--- /dev/null
+<p>...fertig</p>
--- /dev/null
+<p><translate>...done</translate></p>
--- /dev/null
+[% USE HTML %]<div class="listtop" width="100%">Datenbankaktualisierung ([% HTML.escape(dbname) %])</div>
--- /dev/null
+[% USE HTML %]<div class="listtop" width="100%"><translate>Dataset upgrade</translate> ([% HTML.escape(dbname) %])</div>
--- /dev/null
+[% USE HTML %]<body class="admin">
+
+ <h2>[% title %]</h2>
+
+ <form method="post" action="admin.pl">
+
+ <p>Sie können nur Datenbanken löschen, die momentan nicht in Benutzung sind.
+ Wenn Sie eine solche Datenbank löschen wollen, so müssen Sie zuerst die Benutzer bearbeiten, die die fragliche Datenbank benutzen, und sie so ändern, dass sie eine andere Datenbank benutzen.</p>
+
+ <p>Bitte wählen Sie die zu löschende Datenbank aus:
+ <select name="db">[% FOREACH row = DBSOURCES %]<option>[% HTML.escape(row.name) %]</option>[% END %]</select>
+ </p>
+
+ <input type="hidden" name="dbdriver" value="[% HTML.escape(dbdriver) %]">
+ <input type="hidden" name="dbuser" value="[% HTML.escape(dbuser) %]">
+ <input type="hidden" name="dbhost" value="[% HTML.escape(dbhost) %]">
+ <input type="hidden" name="dbport" value="[% HTML.escape(dbport) %]">
+ <input type="hidden" name="dbpasswd" value="[% HTML.escape(dbpasswd) %]">
+ <input type="hidden" name="dbdefault" value="[% HTML.escape(dbdefault) %]">
+
+ <input name="callback" type="hidden" value="admin.pl?action=list_users&rpw=[% HTML.url(rpw) %]">
+
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+
+ <input type="hidden" name="nextsub" value="dbdelete">
+
+ <p><input type="submit" class="submit" name="action" value="Weiter"></p>
+
+ </form>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin">
+
+ <h2>[% title %]</h2>
+
+ <form method="post" action="admin.pl">
+
+ <p><translate>You can only delete datasets that are not in
+ use.</translate>
+ <translate>If you want to delete such a dataset you have to edit
+ the user(s) that are using the dataset in question and have them
+ use another dataset.</translate></p>
+
+ <p><translate>Please seletct the dataset you want to delete:</translate>
+ <select name="db">[% FOREACH row = DBSOURCES %]<option>[% HTML.escape(row.name) %]</option>[% END %]</select>
+ </p>
+
+ <input type="hidden" name="dbdriver" value="[% HTML.escape(dbdriver) %]">
+ <input type="hidden" name="dbuser" value="[% HTML.escape(dbuser) %]">
+ <input type="hidden" name="dbhost" value="[% HTML.escape(dbhost) %]">
+ <input type="hidden" name="dbport" value="[% HTML.escape(dbport) %]">
+ <input type="hidden" name="dbpasswd" value="[% HTML.escape(dbpasswd) %]">
+ <input type="hidden" name="dbdefault" value="[% HTML.escape(dbdefault) %]">
+
+ <input name="callback" type="hidden" value="admin.pl?action=list_users&rpw=[% HTML.url(rpw) %]">
+
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+
+ <input type="hidden" name="nextsub" value="dbdelete">
+
+ <p><input type="submit" class="submit" name="action" value="<translate>Continue</translate>"></p>
+
+ </form>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin">
+
+ <form method="post" action="admin.pl">
+
+ <div class="listtop" width="100%">[% title %]</div>
+
+ <table width="100%">
+ <tr valign="top">
+ <td>
+ <table>
+ <tr>
+ <th align="right">Anmeldung</th>
+ <td><input name="login" value="[% HTML.escape(myc_login) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right">Passwort</th>
+ <td><input type="password" name="password" size="8" value="[% HTML.escape(myc_password) %]"></td>
+ <input type="hidden" name="old_password" value="[% HTML.escape(myc_password) %]">
+ </tr>
+
+ <tr>
+ <th align="right">Name</th>
+ <td><input name="name" size="15" value="[% HTML.escape(myc_name) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right">eMail</th>
+ <td><input name="email" size="30" value="[% HTML.escape(myc_email) %]"></td>
+ </tr>
+
+ <tr valign="top">
+ <th align="right">Unterschrift</th>
+ <td><textarea name="signature" rows="3" cols="35">[% HTML.escape(myc_signature) %]</textarea></td>
+ </tr>
+
+ <tr>
+ <th align="right">Telefon</th>
+ <td><input name="tel" size="14" value="[% HTML.escape(myc_tel) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right">Fax</th>
+ <td><input name="fax" size="14" value="[% HTML.escape(myc_fax) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right">Firma</th>
+ <td><input name="company" size="35" value="[% HTML.escape(myc_company) %]"></td>
+ </tr>
+
+ <tr valign="top">
+ <th align="right">Adresse</th>
+ <td><textarea name="address" rows="4" cols="35">[% HTML.escape(myc_address) %]</textarea></td>
+ </tr>
+
+ <tr valign="top">
+ <th align="right">Steuernummer</th>
+ <td><input name="taxnumber" size="14" value="[% HTML.escape(myc_taxnumber) %]"></td>
+ </tr>
+
+ <tr valign="top">
+ <th align="right">USt-IdNr.</th>
+ <td><input name="co_ustid" size="14" value="[% HTML.escape(myc_co_ustid) %]"></td>
+ </tr>
+
+ <tr valign="top">
+ <th align="right">DUNS-Nr.</th>
+ <td><input name="duns" size="14" value="[% HTML.escape(myc_duns) %]"></td>
+ </tr>
+ </table>
+ </td>
+
+ <td>
+ <table>
+ <tr>
+ <th align="right">Datumsformat</th>
+ <td>
+ <select name="dateformat">
+ [% FOREACH row = ALL_DATEFORMATS %]<option [% IF row.selected %]selected[% END %]>[% HTML.escape(row.format) %]</option>
+ [% END %]
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right">Zahlenformat</th>
+ <td>
+ <select name="numberformat">
+ [% FOREACH row = ALL_NUMBERFORMATS %]<option [% IF row.selected %]selected[% END %]>[% HTML.escape(row.format) %]</option>
+ [% END %]
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right">Auswahllistenbegrenzung</th>
+ <td><input name="vclimit" value="[% HTML.escape(myc_vclimit) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right">Sprache</th>
+ <td>
+ <select name="countrycode">
+ [% FOREACH row = ALL_COUNTRYCODES %]<option value="[% HTML.escape(row.value) %]" [% IF row.selected %]selected[% END %]>[% HTML.escape(row.name) %]</option>
+ [% END %]
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right">Stilvorlage</th>
+ <td>
+ <select name="userstylesheet">
+ [% FOREACH row = ALL_STYLESHEETS %]<option [% IF row.selected %]selected[% END %]>[% HTML.escape(row.name) %]</option>
+ [% END %]
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right">Drucker</th>
+ <td><input name="printer" size="20" value="[% HTML.escape(myc_printer) %]"></td>
+ </tr>
+ <tr>
+ <th align="right">benutze Vorlagen</th>
+ <td>
+ <select name="usetemplates">
+ [% FOREACH row = ALL_TEMPLATES %]<option [% IF row.selected %]selected[% END %]>[% HTML.escape(row.name) %]</option>
+ [% END %]
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th align="right">neue Vorlagen</th>
+ <td><input name="newtemplates"></td>
+ </tr>
+ <tr>
+ <th align="right">Vorlagen auswählen</th>
+ <td>
+ <select name="mastertemplates">
+ [% FOREACH row = ALL_MASTER_TEMPLATES %]<option [% IF row.selected %]selected[% END %]>[% HTML.escape(row.name) %]</option>
+ [% END %]
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th align="right">Menüsetup</th>
+ <td>
+ <input name="menustyle" type="radio" class="radio" value="v3" [% IF menustyle_v3 %]checked[% END %]> Oben (mit CSS)
+ <input name="menustyle" type="radio" class="radio" value="neu" [% IF menustyle_neu %]checked[% END %]> Oben (mit Javascript)
+ <input name="menustyle" type="radio" class="radio" value="old" [% IF menustyle_old %]checked[% END %]> Alt (seitlich)
+ </td>
+ </tr>
+
+ <input type="hidden" name="templates" value="[% HTML.escape(myc_templates) %]">
+ </table>
+ </td>
+ </tr>
+
+ <tr class="listheading">
+ <th colspan="2">Datenbank</th>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table>
+ <tr>
+ <th align="right">Treiber</th>
+ <td>PostgreSQL</td>
+ <th align="right">Datenbankcomputer</th>
+ <td><input name="dbhost" size="30" value="[% HTML.escape(myc_dbhost) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right">Datenbank</th>
+ <td><input name="dbname" size="15" value="[% HTML.escape(myc_dbname) %]"></td>
+ <th align="right">Port</th>
+ <td><input name="dbport" size="4" value="[% HTML.escape(myc_dbport) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right">Benutzer</th>
+ <td><input name="dbuser" size="15" value="[% HTML.escape(myc_dbuser) %]"></td>
+ <th align="right">Passwort</th>
+ <td><input name="dbpasswd" type="password" size="10" value="[% HTML.escape(myc_dbpasswd) %]"></td>
+ </tr>
+
+ <input type="hidden" name="old_dbpasswd" value="[% HTML.escape(myc_dbpasswd) %]">
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2"><hr size="2" noshade></td>
+ </tr>
+
+ <tr class="listheading"><th colspan="2">Zugriffkontrolle</th></tr>
+
+ [% FOREACH acl = ACLS %]
+ <tr>
+ <td valign="top">
+ <input type="checkbox" name="ACS_[% HTML.escape(acl.name) %]" id="ACS_[% HTML.escape(acl.name) %]" value="1" [% IF acl.checked %]checked[% END %]>
+ <label for="ACS_[% HTML.escape(acl.name) %]">[% HTML.escape(acl.title) %]</label>
+ </td>
+
+ <td valign="top">
+ [% USE SUBACLS_it = Iterator(acl.SUBACLS) %][% FOREACH subacl = SUBACLS_it %]
+ <input type="checkbox" name="ACS_[% HTML.escape(subacl.name) %]" id="ACS_[% HTML.escape(subacl.name) %]" value="1" [% IF subacl.checked %]checked[% END %]>
+ <label for="ACS_[% HTML.escape(subacl.name) %]">[% HTML.escape(subacl.title) %]</label>
+ [% UNLESS SUBACLS_it.last %]<br>[% END %]
+ [% END %]
+ </td>
+ </tr>
+ [% END %]
+
+ <input type="hidden" name="all_acs" value="[% HTML.escape(all_acs) %]">
+
+ <tr><td colspan="2"><hr size="3" noshade></td></tr>
+
+ <tr class="listheading">
+ <th colspan="2">WEBDAV-Zugriff</th>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table>
+ <tr>
+ <td><input name="angebote" class="checkbox" type="checkbox" value="1" [% IF myc_angebote %]checked[% END %]> Angebot</td>
+ <td><input name="bestellungen" class="checkbox" type="checkbox" value="1" [% IF myc_bestellungen %]checked[% END %]> Bestellung</td>
+ <td><input name="rechnungen" class="checkbox" type="checkbox" value="1" [% IF myc_rechnung %]checked[% END %]> Rechnung</td>
+ </tr>
+
+ <tr>
+ <td><input name="anfragen" class="checkbox" type="checkbox" value="1" [% IF myc_anfragen %]checked[% END %]> Anfragen</td>
+ <td><input name="lieferantenbestellungen" class="checkbox" type="checkbox" value="1" [% IF myc_lieferantenbestellungen %]checked[% END %]> Lieferantenbestellung</td>
+ <td><input name="einkaufsrechnungen" class="checkbox" type="checkbox" value="1" [% IF myc_einkaufsrechnungen %]checked[% END %]> Einkaufsrechnung</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr><td colspan="2"><hr size="3" noshade></td></tr>
+
+ </table>
+
+ <input name="callback" type="hidden" value="admin.pl?action=list_users&rpw=[% HTML.url(rpw) %]">
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+
+ <input type="submit" class="submit" name="action" value="Speichern">
+
+ [% IF edit %]
+ <input type="submit" class="submit" name="action" value="Löschen">
+ <input type="hidden" name="edit" value="1">
+ [% END %]
+
+ </form>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin">
+
+ <form method="post" action="admin.pl">
+
+ <div class="listtop" width="100%">[% title %]</div>
+
+ <table width="100%">
+ <tr valign="top">
+ <td>
+ <table>
+ <tr>
+ <th align="right"><translate>Login</translate></th>
+ <td><input name="login" value="[% HTML.escape(myc_login) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right"><translate>Password</translate></th>
+ <td><input type="password" name="password" size="8" value="[% HTML.escape(myc_password) %]"></td>
+ <input type="hidden" name="old_password" value="[% HTML.escape(myc_password) %]">
+ </tr>
+
+ <tr>
+ <th align="right"><translate>Name</translate></th>
+ <td><input name="name" size="15" value="[% HTML.escape(myc_name) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right"><translate>E-mail</translate></th>
+ <td><input name="email" size="30" value="[% HTML.escape(myc_email) %]"></td>
+ </tr>
+
+ <tr valign="top">
+ <th align="right"><translate>Signature</translate></th>
+ <td><textarea name="signature" rows="3" cols="35">[% HTML.escape(myc_signature) %]</textarea></td>
+ </tr>
+
+ <tr>
+ <th align="right"><translate>Phone</translate></th>
+ <td><input name="tel" size="14" value="[% HTML.escape(myc_tel) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right"><translate>Fax</translate></th>
+ <td><input name="fax" size="14" value="[% HTML.escape(myc_fax) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right"><translate>Company</translate></th>
+ <td><input name="company" size="35" value="[% HTML.escape(myc_company) %]"></td>
+ </tr>
+
+ <tr valign="top">
+ <th align="right"><translate>Address</translate></th>
+ <td><textarea name="address" rows="4" cols="35">[% HTML.escape(myc_address) %]</textarea></td>
+ </tr>
+
+ <tr valign="top">
+ <th align="right"><translate>Tax number</translate></th>
+ <td><input name="taxnumber" size="14" value="[% HTML.escape(myc_taxnumber) %]"></td>
+ </tr>
+
+ <tr valign="top">
+ <th align="right"><translate>Ust-IDNr</translate></th>
+ <td><input name="co_ustid" size="14" value="[% HTML.escape(myc_co_ustid) %]"></td>
+ </tr>
+
+ <tr valign="top">
+ <th align="right"><translate>DUNS-Nr</translate></th>
+ <td><input name="duns" size="14" value="[% HTML.escape(myc_duns) %]"></td>
+ </tr>
+ </table>
+ </td>
+
+ <td>
+ <table>
+ <tr>
+ <th align="right"><translate>Date Format</translate></th>
+ <td>
+ <select name="dateformat">
+ [% FOREACH row = ALL_DATEFORMATS %]<option [% IF row.selected %]selected[% END %]>[% HTML.escape(row.format) %]</option>
+ [% END %]
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right"><translate>Number Format</translate></th>
+ <td>
+ <select name="numberformat">
+ [% FOREACH row = ALL_NUMBERFORMATS %]<option [% IF row.selected %]selected[% END %]>[% HTML.escape(row.format) %]</option>
+ [% END %]
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right"><translate>Dropdown Limit</translate></th>
+ <td><input name="vclimit" value="[% HTML.escape(myc_vclimit) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right"><translate>Language</translate></th>
+ <td>
+ <select name="countrycode">
+ [% FOREACH row = ALL_COUNTRYCODES %]<option value="[% HTML.escape(row.value) %]" [% IF row.selected %]selected[% END %]>[% HTML.escape(row.name) %]</option>
+ [% END %]
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right"><translate>Stylesheet</translate></th>
+ <td>
+ <select name="userstylesheet">
+ [% FOREACH row = ALL_STYLESHEETS %]<option [% IF row.selected %]selected[% END %]>[% HTML.escape(row.name) %]</option>
+ [% END %]
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right"><translate>Printer</translate></th>
+ <td><input name="printer" size="20" value="[% HTML.escape(myc_printer) %]"></td>
+ </tr>
+ <tr>
+ <th align="right"><translate>Use Templates</translate></th>
+ <td>
+ <select name="usetemplates">
+ [% FOREACH row = ALL_TEMPLATES %]<option [% IF row.selected %]selected[% END %]>[% HTML.escape(row.name) %]</option>
+ [% END %]
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th align="right"><translate>New Templates</translate></th>
+ <td><input name="newtemplates"></td>
+ </tr>
+ <tr>
+ <th align="right"><translate>Setup Templates</translate></th>
+ <td>
+ <select name="mastertemplates">
+ [% FOREACH row = ALL_MASTER_TEMPLATES %]<option [% IF row.selected %]selected[% END %]>[% HTML.escape(row.name) %]</option>
+ [% END %]
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th align="right"><translate>Setup Menu</translate></th>
+ <td>
+ <input name="menustyle" type="radio" class="radio" value="v3" [% IF menustyle_v3 %]checked[% END %]> <translate>Top (CSS)</translate>
+ <input name="menustyle" type="radio" class="radio" value="neu" [% IF menustyle_neu %]checked[% END %]> <translate>Top (Javascript)</translate>
+ <input name="menustyle" type="radio" class="radio" value="old" [% IF menustyle_old %]checked[% END %]> <translate>Old (on the side)</translate>
+ </td>
+ </tr>
+
+ <input type="hidden" name="templates" value="[% HTML.escape(myc_templates) %]">
+ </table>
+ </td>
+ </tr>
+
+ <tr class="listheading">
+ <th colspan="2"><translate>Database</translate></th>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table>
+ <tr>
+ <th align="right"><translate>Driver</translate></th>
+ <td>PostgreSQL</td>
+ <th align="right"><translate>Host</translate></th>
+ <td><input name="dbhost" size="30" value="[% HTML.escape(myc_dbhost) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right"><translate>Dataset</translate></th>
+ <td><input name="dbname" size="15" value="[% HTML.escape(myc_dbname) %]"></td>
+ <th align="right"><translate>Port</translate></th>
+ <td><input name="dbport" size="4" value="[% HTML.escape(myc_dbport) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right"><translate>User</translate></th>
+ <td><input name="dbuser" size="15" value="[% HTML.escape(myc_dbuser) %]"></td>
+ <th align="right"><translate>Password</translate></th>
+ <td><input name="dbpasswd" type="password" size="10" value="[% HTML.escape(myc_dbpasswd) %]"></td>
+ </tr>
+
+ <input type="hidden" name="old_dbpasswd" value="[% HTML.escape(myc_dbpasswd) %]">
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2"><hr size="2" noshade></td>
+ </tr>
+
+ <tr class="listheading"><th colspan="2"><translate>Access Control</translate></th></tr>
+
+ [% FOREACH acl = ACLS %]
+ <tr>
+ <td valign="top">
+ <input type="checkbox" name="ACS_[% HTML.escape(acl.name) %]" id="ACS_[% HTML.escape(acl.name) %]" value="1" [% IF acl.checked %]checked[% END %]>
+ <label for="ACS_[% HTML.escape(acl.name) %]">[% HTML.escape(acl.title) %]</label>
+ </td>
+
+ <td valign="top">
+ [% USE SUBACLS_it = Iterator(acl.SUBACLS) %][% FOREACH subacl = SUBACLS_it %]
+ <input type="checkbox" name="ACS_[% HTML.escape(subacl.name) %]" id="ACS_[% HTML.escape(subacl.name) %]" value="1" [% IF subacl.checked %]checked[% END %]>
+ <label for="ACS_[% HTML.escape(subacl.name) %]">[% HTML.escape(subacl.title) %]</label>
+ [% UNLESS SUBACLS_it.last %]<br>[% END %]
+ [% END %]
+ </td>
+ </tr>
+ [% END %]
+
+ <input type="hidden" name="all_acs" value="[% HTML.escape(all_acs) %]">
+
+ <tr><td colspan="2"><hr size="3" noshade></td></tr>
+
+ <tr class="listheading">
+ <th colspan="2"><translate>WEBDAV access</translate></th>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table>
+ <tr>
+ <td><input name="angebote" class="checkbox" type="checkbox" value="1" [% IF myc_angebote %]checked[% END %]> Angebot</td>
+ <td><input name="bestellungen" class="checkbox" type="checkbox" value="1" [% IF myc_bestellungen %]checked[% END %]> Bestellung</td>
+ <td><input name="rechnungen" class="checkbox" type="checkbox" value="1" [% IF myc_rechnung %]checked[% END %]> Rechnung</td>
+ </tr>
+
+ <tr>
+ <td><input name="anfragen" class="checkbox" type="checkbox" value="1" [% IF myc_anfragen %]checked[% END %]> Anfragen</td>
+ <td><input name="lieferantenbestellungen" class="checkbox" type="checkbox" value="1" [% IF myc_lieferantenbestellungen %]checked[% END %]> Lieferantenbestellung</td>
+ <td><input name="einkaufsrechnungen" class="checkbox" type="checkbox" value="1" [% IF myc_einkaufsrechnungen %]checked[% END %]> Einkaufsrechnung</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr><td colspan="2"><hr size="3" noshade></td></tr>
+
+ </table>
+
+ <input name="callback" type="hidden" value="admin.pl?action=list_users&rpw=[% HTML.url(rpw) %]">
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+
+ <input type="submit" class="submit" name="action" value="<translate>Save</translate>">
+
+ [% IF edit %]
+ <input type="submit" class="submit" name="action" value="<translate>Delete</translate>">
+ <input type="hidden" name="edit" value="1">
+ [% END %]
+
+ </form>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin" onload="">
+
+ <form method="post" action="admin.pl">
+
+ <div class="listtop" width="100%">[% title %]</div>
+
+ <p>
+ <table width="100%">
+ <tr>
+ <th class="listtop">Anmeldung</th>
+ <th class="listtop">Name</th>
+ <th class="listtop">Firma</th>
+ <th class="listtop">Treiber</th>
+ <th class="listtop">Datenbankcomputer</th>
+ <th class="listtop">Datenbank</th>
+ <th class="listtop">Vorlagen</th>
+ </tr>
+
+ [% SET row_odd = '1' %]
+ [% FOREACH row = MEMBERS %]
+ <tr class="listrow[% IF row_odd %]1[% SET row_odd = '0' %][% ELSE %]0[% SET row_odd = '1' %][% END %]">
+ <td><a href="admin.pl?action=edit&login=[% HTML.url(row.login) %]&rpw=[% HTML.url(rpw) %]">[% HTML.escape(row.login) %]</a></td>
+ <td>[% HTML.escape(row.name) %]</td>
+ <td>[% HTML.escape(row.company) %]</td>
+ <td>[% HTML.escape(row.dbdriver) %]</td>
+ <td>[% IF row.dbhost %][% HTML.escape(row.dbhost) %][% ELSE %]localhost[% END %]</td>
+ <td>[% HTML.escape(row.dbname) %]</td>
+ <td>[% HTML.escape(row.templates) %]</td>
+ </tr>
+ [% END %]
+
+ <td colspan="7"><hr size="3" noshade></td>
+ </table>
+ </p>
+
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+
+ <input type="submit" class="submit" name="action" value="Benutzer erfassen">
+ <input type="submit" class="submit" name="action" value="Administratorpasswort ändern">
+ <input type="submit" class="submit" name="action" value="Datenbankadministration">
+ [% IF LOCKED %]
+ <input type="submit" class="submit" name="action" value="System entsperren">
+ [% ELSE %]
+ <input type="submit" class="submit" name="action" value="System sperren">
+ [% END %]
+
+ <p>Zum Bearbeiten den Zugriffsnamen anklicken!</p>
+
+ <p>Um einer Gruppe einen neuen Benutzer hinzuzufügen, ändern und speichern Sie am einfachsten einen bestehen den Zugriffsnamen. Unter dem neuen Namen wird dann ein Benutzer mit denselben Einstellungen angelegt.</p>
+ </form>
+
+ <form method="post" action="login.pl">
+
+ <div class="listheading">Lx-Office ERP Anmeldung</div>
+
+ <table border="0">
+ <tr>
+ <th align="right">Name</th>
+ <td><input class="login" name="login"></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <th align="right">Passwort</th>
+ <td><input class="login" type="password" name="password"></td>
+ <td><input type="submit" name="action" value="Anmeldung"></td>
+ </tr>
+ </table>
+
+ </form>
+
+ <hr size="3" noshade>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin" onload="">
+
+ <form method="post" action="admin.pl">
+
+ <div class="listtop" width="100%">[% title %]</div>
+
+ <p>
+ <table width="100%">
+ <tr>
+ <th class="listtop"><translate>Login</translate></th>
+ <th class="listtop"><translate>Name</translate></th>
+ <th class="listtop"><translate>Company</translate></th>
+ <th class="listtop"><translate>Driver</translate></th>
+ <th class="listtop"><translate>Host</translate></th>
+ <th class="listtop"><translate>Dataset</translate></th>
+ <th class="listtop"><translate>Templates</translate></th>
+ </tr>
+
+ [% SET row_odd = '1' %]
+ [% FOREACH row = MEMBERS %]
+ <tr class="listrow[% IF row_odd %]1[% SET row_odd = '0' %][% ELSE %]0[% SET row_odd = '1' %][% END %]">
+ <td><a href="admin.pl?action=edit&login=[% HTML.url(row.login) %]&rpw=[% HTML.url(rpw) %]">[% HTML.escape(row.login) %]</a></td>
+ <td>[% HTML.escape(row.name) %]</td>
+ <td>[% HTML.escape(row.company) %]</td>
+ <td>[% HTML.escape(row.dbdriver) %]</td>
+ <td>[% IF row.dbhost %][% HTML.escape(row.dbhost) %][% ELSE %]localhost[% END %]</td>
+ <td>[% HTML.escape(row.dbname) %]</td>
+ <td>[% HTML.escape(row.templates) %]</td>
+ </tr>
+ [% END %]
+
+ <td colspan="7"><hr size="3" noshade></td>
+ </table>
+ </p>
+
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+
+ <input type="submit" class="submit" name="action" value="<translate>Add User</translate>">
+ <input type="submit" class="submit" name="action" value="<translate>Change Admin Password</translate>">
+ <input type="submit" class="submit" name="action" value="<translate>Pg Database Administration</translate>">
+ [% IF LOCKED %]
+ <input type="submit" class="submit" name="action" value="<translate>Unlock System</translate>">
+ [% ELSE %]
+ <input type="submit" class="submit" name="action" value="<translate>Lock System</translate>">
+ [% END %]
+
+ <p><translate>Click on login name to edit!</translate></p>
+
+ <p><translate>To add a user to a group edit a name, change the login name and save. A new user with the same variables will then be saved under the new login name.</translate></p>
+ </form>
+
+ <form method="post" action="login.pl">
+
+ <div class="listheading">Lx-Office ERP <translate>Login</translate></div>
+
+ <table border="0">
+ <tr>
+ <th align="right"><translate>Name</translate></th>
+ <td><input class="login" name="login"></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <th align="right"><translate>Password</translate></th>
+ <td><input class="login" type="password" name="password"></td>
+ <td><input type="submit" name="action" value="<translate>Login</translate>"></td>
+ </tr>
+ </table>
+
+ </form>
+
+ <hr size="3" noshade>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin" onload="document.getElementsByName('dbname')[0].focus(); ">
+
+ <h2>[% title %]</h2>
+
+ <form name="Form" method="post" action="admin.pl" enctype="multipart/form-data">
+
+ <input type="hidden" name="dbdriver" value="Pg">
+ <input type="hidden" name="dbhost" value="[% HTML.escape(dbhost) %]">
+ <input type="hidden" name="dbport" value="[% HTML.escape(dbport) %]">
+ <input type="hidden" name="dbuser" value="[% HTML.escape(dbuser) %]">
+ <input type="hidden" name="dbpasswd" value="[% HTML.escape(dbpasswd) %]">
+
+ <p>
+ Bitte geben Sie den Namen der Datenbank ein, in der Sie die Sicherung wiederherstellen wollen.
+ Die Datenbank muss vor der Wiederherstellung bereits angelegt worden sein.
+ Sie können eine fehlende Datenbank erstellen, indem Sie jetzt zuück gehen und den Punkt "Datenbank anlegen" wählen.
+ </p>
+
+ <p>
+ Die von Ihnen hochzuladende Sicherungsdatei muss mit dem Programm und den Parametern "pg_dump -o -Ft" erstellt worden sein.
+ Sie darf optional mit "gzip" komprimiert sein.
+ Dateien, die von Lx-Office' Funktion "Datenbank sichern" erstellt wurden, erfüllen diese Kriterien.
+ </p>
+
+ <table>
+ <tr>
+ <td valign="top">Datenbankname</td>
+ <td valign="top"><input name="new_dbname"></td>
+ </tr>
+
+ <tr>
+ <th valign="top">Schriftsatz</th>
+ <td>
+ <select name="dbencoding">
+ [% FOREACH row = DBENCODINGS %]<option value="[% HTML.escape(row.dbencoding) %]" [% IF row.selected %]selected[% END %]>[% HTML.escape(row.label) %]</option>[% END %]
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">Sicherungsdatei</td>
+ <td valign="top"><input type="file" accept="*" name="content"></td>
+ </tr>
+ </table>
+
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+ <input type="hidden" name="nextsub" value="restore_dataset_start">
+
+ <hr size="3" noshade>
+
+ <br>
+
+ <input type="submit" class="submit" name="action" value="Weiter">
+
+ </form>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin" onload="document.getElementsByName('dbname')[0].focus(); ">
+
+ <h2>[% title %]</h2>
+
+ <form name="Form" method="post" action="admin.pl" enctype="multipart/form-data">
+
+ <input type="hidden" name="dbdriver" value="Pg">
+ <input type="hidden" name="dbhost" value="[% HTML.escape(dbhost) %]">
+ <input type="hidden" name="dbport" value="[% HTML.escape(dbport) %]">
+ <input type="hidden" name="dbuser" value="[% HTML.escape(dbuser) %]">
+ <input type="hidden" name="dbpasswd" value="[% HTML.escape(dbpasswd) %]">
+
+ <p>
+ <translate>Please enter the name of the dataset you want to restore the backup in.</translate>
+ <translate>The dataset has to exist before a restoration can be started.</translate>
+ <translate>You can create a missing dataset by going back and chosing "Create Dataset".</translate>
+ </p>
+
+ <p>
+ <translate>The backup you upload here has to be a file created with "pg_dump -o -Ft".</translate>
+ <translate>It may optionally be compressed with "gzip".</translate>
+ <translate>Files created by Lx-Office's "Backup Dataset" function are such files.</translate>
+ </p>
+
+ <table>
+ <tr>
+ <td valign="top"><translate>Dataset name</translate></td>
+ <td valign="top"><input name="new_dbname"></td>
+ </tr>
+
+ <tr>
+ <th valign="top"><translate>Multibyte Encoding</translate></th>
+ <td>
+ <select name="dbencoding">
+ [% FOREACH row = DBENCODINGS %]<option value="[% HTML.escape(row.dbencoding) %]" [% IF row.selected %]selected[% END %]>[% HTML.escape(row.label) %]</option>[% END %]
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top"><translate>Backup file</translate></td>
+ <td valign="top"><input type="file" accept="*" name="content"></td>
+ </tr>
+ </table>
+
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+ <input type="hidden" name="nextsub" value="restore_dataset_start">
+
+ <hr size="3" noshade>
+
+ <br>
+
+ <input type="submit" class="submit" name="action" value="<translate>Continue</translate>">
+
+ </form>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %] </pre>
+
+ <hr>
+
+ <p>
+ Die Wiederherstellung ist abgeschlossen. Bitte sehen Sie sich die Ausgabe von "pg_restore" an, um festzustellen, ob die Wiederherstellung erfolgreich war.
+ Der Exitcode des Programms war [% HTML.escape(retval) %] ("0" bedeutet normalerweise, dass die Wiederherstellung erfolgreich war).
+ </p>
+
+ <form method="post" action="admin.pl">
+ <input type="hidden" name="nextsub" value="list_users">
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+ <input type="submit" name="action" value="Weiter">
+ </form>
+</body>
+</html>
--- /dev/null
+[% USE HTML %] </pre>
+
+ <hr>
+
+ <p>
+ <translate>The restoration process is complete. Please review "pg_restore"'s output to find out if the restoration was successful.</translate>
+ <translate>The program's exit code was [% HTML.escape(retval) %] ("0" usually means that everything went OK).</translate>
+ </p>
+
+ <form method="post" action="admin.pl">
+ <input type="hidden" name="nextsub" value="list_users">
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+ <input type="submit" name="action" value="<translate>Continue</translate>">
+ </form>
+</body>
+</html>
--- /dev/null
+<body class="admin">
+
+ <h2>[% title %]</h2>
+
+ <p>Der Wiederherstellungsprozess wurde gestartet. Hier ist die Ausgabe des "pg_restore"-Programmes:</p>
+
+ <hr>
+
+ <pre>
--- /dev/null
+<body class="admin">
+
+ <h2>[% title %]</h2>
+
+ <p><translate>The restoration process has started. Here's the output of the "pg_restore" command:</translate></p>
+
+ <hr>
+
+ <pre>
--- /dev/null
+[% USE HTML %]<body class="admin">
+
+ <h2>[% title %]</h2>
+
+ [% IF ALL_UPDATED %]
+ Alle Datenbanken sind auf aktuellem Stand.
+
+ [% ELSE %]
+
+ <form method="post" action="admin.pl">
+
+ <p>Folgende Datenbanken müssen aktualisiert werden:</p>
+
+ <table>
+ <tr>
+ <th class="listtop">Aktualisieren?</th>
+ <th class="listtop">Datenbank</th>
+ <th class="listtop">Treiber</th>
+ <th class="listtop">Datenbankcomputer</th>
+ <th class="listtop">Port</th>
+ <th class="listtop">Benutzer</th>
+ </tr>
+
+ [% SET odd = '1' %][% USE NEED_UPDATES_it = Iterator(NEED_UPDATES) %][% FOREACH row = NEED_UPDATES_it %]
+ <tr class="listrow[% IF odd %]1[% SET odd='0' %][% ELSE %]0[% SET odd = '1' %][% END %]">
+ <td><input type="checkbox" name="update_[% NEED_UPDATES_it.count %]" value="1" checked></td>
+ <td><input type="hidden" name="dbname_[% NEED_UPDATES_it.count %]" value="[% HTML.escape(row.dbname) %]">[% HTML.escape(row.dbname) %]</td>
+ <td><input type="hidden" name="dbdriver_[% NEED_UPDATES_it.count %]" value="Pg">PostgreSQL</td>
+ <td><input type="hidden" name="dbhost_[% NEED_UPDATES_it.count %]" value="[% HTML.escape(row.dbhost) %]">[% HTML.escape(row.dbhost) %]</td>
+ <td><input type="hidden" name="dbport_[% NEED_UPDATES_it.count %]" value="[% HTML.escape(row.dbport) %]">[% HTML.escape(row.dbport) %]</td>
+ <td><input type="hidden" name="dbuser_[% NEED_UPDATES_it.count %]" value="[% HTML.escape(row.dbuser) %]">[% HTML.escape(row.dbuser) %]</td>
+ </tr>
+
+ [% IF NEED_UPDATES_it.last %]
+ <input type="hidden" name="rowcount" value="[% NEED_UPDATES_it.size %]">
+ [% END %]
+ [% END %]
+ </table>
+
+ <input name="callback" type="hidden" value="admin.pl?action=list_users&rpw=[% HTML.url(rpw) %]">
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+ <input type="hidden" name="nextsub" value="dbupdate">
+
+ <hr size="3" noshade>
+
+ <br>
+
+ <input type="submit" class="submit" name="action" value="Weiter">
+
+ </form>
+
+ [% END %]
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body class="admin">
+
+ <h2>[% title %]</h2>
+
+ [% IF ALL_UPDATED %]
+ <translate>All Datasets up to date!</translate>
+
+ [% ELSE %]
+
+ <form method="post" action="admin.pl">
+
+ <p><translate>The following Datasets need to be updated</translate>:</p>
+
+ <table>
+ <tr>
+ <th class="listtop"><translate>Update?</translate></th>
+ <th class="listtop"><translate>Dataset</translate></th>
+ <th class="listtop"><translate>Driver</translate></th>
+ <th class="listtop"><translate>Host</translate></th>
+ <th class="listtop"><translate>Port</translate></th>
+ <th class="listtop"><translate>User</translate></th>
+ </tr>
+
+ [% SET odd = '1' %][% USE NEED_UPDATES_it = Iterator(NEED_UPDATES) %][% FOREACH row = NEED_UPDATES_it %]
+ <tr class="listrow[% IF odd %]1[% SET odd='0' %][% ELSE %]0[% SET odd = '1' %][% END %]">
+ <td><input type="checkbox" name="update_[% NEED_UPDATES_it.count %]" value="1" checked></td>
+ <td><input type="hidden" name="dbname_[% NEED_UPDATES_it.count %]" value="[% HTML.escape(row.dbname) %]">[% HTML.escape(row.dbname) %]</td>
+ <td><input type="hidden" name="dbdriver_[% NEED_UPDATES_it.count %]" value="Pg">PostgreSQL</td>
+ <td><input type="hidden" name="dbhost_[% NEED_UPDATES_it.count %]" value="[% HTML.escape(row.dbhost) %]">[% HTML.escape(row.dbhost) %]</td>
+ <td><input type="hidden" name="dbport_[% NEED_UPDATES_it.count %]" value="[% HTML.escape(row.dbport) %]">[% HTML.escape(row.dbport) %]</td>
+ <td><input type="hidden" name="dbuser_[% NEED_UPDATES_it.count %]" value="[% HTML.escape(row.dbuser) %]">[% HTML.escape(row.dbuser) %]</td>
+ </tr>
+
+ [% IF NEED_UPDATES_it.last %]
+ <input type="hidden" name="rowcount" value="[% NEED_UPDATES_it.size %]">
+ [% END %]
+ [% END %]
+ </table>
+
+ <input name="callback" type="hidden" value="admin.pl?action=list_users&rpw=[% HTML.url(rpw) %]">
+ <input type="hidden" name="rpw" value="[% HTML.escape(rpw) %]">
+ <input type="hidden" name="nextsub" value="dbupdate">
+
+ <hr size="3" noshade>
+
+ <br>
+
+ <input type="submit" class="submit" name="action" value="<translate>Continue</translate>">
+
+ </form>
+
+ [% END %]
+
+</body>
+</html>
--- /dev/null
+<script type="text/javascript" src="js/FormManager.js" >
+/****************************************************
+* Form Dependency Manager- By Twey- http://www.twey.co.uk
+* Visit Dynamic Drive for this script and more: http://www.dynamicdrive.com
+****************************************************/
+</script>
+
+<script type="text/javascript">
+window.onload = function() {
+ setupDependencies('EditAccount'); //name of form(s). Seperate each with a comma (ie: 'weboptions', 'myotherform' )
+ };
+</script>
+
+<body>
+<form method="post" name="EditAccount" action="<TMPL_VAR script>">
+
+<input type="hidden" name="id" value="<TMPL_VAR id>">
+<input type="hidden" name="type" value="account">
+<input type="hidden" name="orphaned" value="<TMPL_VAR orphaned>">
+<input type="hidden" name="new_chart_valid" value="<TMPL_VAR new_chart_valid>">
+<input type="hidden" name="inventory_accno_id" value="<TMPL_VAR inventory_accno_id>">
+<input type="hidden" name="income_accno_id" value="<TMPL_VAR income_accno_id>">
+<input type="hidden" name="expense_accno_id" value="<TMPL_VAR expense_accno_id>">
+<input type="hidden" name="fxgain_accno_id" value="<TMPL_VAR fxgain_accno_id>">
+<input type="hidden" name="fxloss_accno_id" value="<TMPL_VAR fxloss_accno_id>">
+
+<table border="0" width="100%">
+ <tr>
+ <th class="listtop"><TMPL_VAR title></th>
+ </tr>
+</table>
+
+<fieldset>
+ <legend>
+ Grundeinstellungen
+ </legend>
+ <table>
+ <tr>
+ <td>
+ <label>
+ Kontonummer
+ </label></td>
+ <td><input name="accno" size="20" value="<TMPL_VAR accno>"></td>
+ </tr>
+ <tr>
+ <td>
+ <label>
+ Beschreibung
+ </label>
+ </td>
+ <td><input name="description" size="40" value="<TMPL_VAR
+ description ESCAPE=HTML>"></td>
+ </tr>
+ <tr>
+ <td>
+ <label>
+ Kontentyp
+
+ </label>
+ </td>
+ <td><select name="charttype"><TMPL_VAR
+ select_charttype></select></td>
+ </tr>
+ </table>
+</fieldset>
+<fieldset class="DEPENDS ON charttype BEING A">
+ <legend>Kontoart</legend>
+ <select name="category" id="AccountType" class="DEPENDS ON charttype BEING A">
+ <TMPL_VAR select_category></select>
+</fieldset>
+
+<TMPL_IF ChartTypeIsAccount>
+<fieldset class="DEPENDS ON charttype BEING A">
+ <legend>Buchungskonto in</legend>
+ <input name="AR" type="checkbox" class="checkbox" value="AR" <TMPL_VAR AR ESCAPE=HTML>>
+ Verkauf
+ <input name="AP" type="checkbox" class="checkbox" value="AP" <TMPL_VAR AP ESCAPE=HTML>>
+ Einkauf
+ <input name="IC" type="checkbox" class="checkbox" value="IC" <TMPL_VAR IC ESCAPE=HTML>>
+ Inventar
+</fieldset>
+
+<fieldset class="DEPENDS ON charttype BEING A">
+ <legend>In Aufklappmenü aufnehmen</legend>
+ <table width="100%">
+ <tr>
+ <th align="left">Forderungen</th>
+ <th align="left">Verbindlichkeiten</th>
+ <th align="left">Warenliste</th>
+ <th align="left">Dienstleistungen</th>
+ </tr>
+ <tr>
+ <td>
+ <input name="AR_amount" type="checkbox" class="checkbox" value="AR_amount"
+ <TMPL_VAR AR_amount ESCAPE=HTML>>
+ Erlöskonto <br>
+ <input name="AR_paid" type="checkbox" class="checkbox" value="AR_paid"
+ <TMPL_VAR AR_paid ESCAPE=HTML>>
+ Zahlungseingang <br>
+ <input name="AR_tax" type="checkbox" class="checkbox" value="AR_tax"
+ <TMPL_VAR AR_tax ESCAPE=HTML>>
+ Steuer
+ </td>
+ <td>
+ <input name="AP_amount" type="checkbox" class="checkbox" value="AP_amount"
+ <TMPL_VAR AP_amount ESCAPE=HTML>>
+ Aufwand/Anlagen <br>
+ <input name="AP_paid" type="checkbox" class="checkbox" value="AP_paid"
+ <TMPL_VAR AP_paid ESCAPE=HTML>>
+ Zahlungsausgang <br>
+ <input name="AP_tax" type="checkbox" class="checkbox" value="AP_tax"
+ <TMPL_VAR AP_tax ESCAPE=HTML>>
+ Steuer
+ </td>
+ <td>
+ <input name="IC_sale" type="checkbox" class="checkbox" value="IC_sale"
+ <TMPL_VAR IC_sale ESCAPE=HTML>>
+ Erlöskonto <br>
+ <input name="IC_cogs" type="checkbox" class="checkbox" value="IC_cogs"
+ <TMPL_VAR IC_cogs ESCAPE=HTML>>
+ Aufwandskonto <br>
+ <input name="IC_taxpart" type="checkbox" class="checkbox" value="IC_taxpart"
+ <TMPL_VAR IC_taxpart ESCAPE=HTML>>
+ Steuer
+ </td>
+ <td>
+ <input name=IC_income type=checkbox class=checkbox value="IC_income"
+ <TMPL_VAR IC_income ESCAPE=HTML>>
+ Erlöskonto <br>
+ <input name=IC_expense type=checkbox class=checkbox value="IC_expense"
+ <TMPL_VAR IC_expense ESCAPE=HTML>>
+ Aufwandskonto <br>
+ <input name=IC_taxservice type=checkbox class=checkbox value="IC_taxservice"
+ <TMPL_VAR IC_taxservice ESCAPE=HTML>>
+ Steuer
+ </td>
+ </tr>
+ </table>
+</fieldset>
+
+<fieldset class="DEPENDS ON charttype BEING A">
+ <legend>
+ Steuerautomatik und UStVA
+ </legend>
+
+ <table>
+<TMPL_IF account_exists >
+ <tr>
+ <th align="left">Steuerschlüssel</th>
+ <th align="left">Gültig ab</th>
+ <th align="left">UStVA</th>
+ <th align="left">Löschen ? </th>
+ </tr>
+<TMPL_LOOP ACCOUNT_TAXKEYS >
+ <tr>
+ <TMPL_IF id>
+ <input type="hidden" name="taxkey_id_<TMPL_VAR runningnumber>" value="<TMPL_VAR id>">
+ <td><select name="taxkey_tax_<TMPL_VAR runningnumber>"><TMPL_VAR selecttaxkey></select></td>
+ <td><input name="taxkey_startdate_<TMPL_VAR runningnumber>" value="<TMPL_VAR startdate>"></td>
+ <td><select name="taxkey_pos_ustva_<TMPL_VAR runningnumber>"><TMPL_VAR select_tax></select></td>
+ <td><input name="taxkey_del_<TMPL_VAR runningnumber>" type="checkbox"
+ class="checkbox" value="delete"></td>
+ <TMPL_ELSE>
+ <input type="hidden" name="taxkey_id_<TMPL_VAR runningnumber>" value="NEW">
+ <td><select name="taxkey_tax_<TMPL_VAR runningnumber>"><TMPL_VAR selecttaxkey></select></td>
+ <td><input name="taxkey_startdate_<TMPL_VAR runningnumber>" value="<TMPL_VAR startdate>"></td>
+ <td><select name="taxkey_pos_ustva_<TMPL_VAR runningnumber>"><TMPL_VAR select_tax></select></td>
+ <td> </td>
+ </TMPL_IF>
+ </tr>
+
+</TMPL_LOOP>
+<TMPL_ELSE>
+<tr>
+ <td align="center" colspan="4"><p>Einstellungen sind nach
+ dem Speichern des Kontos verfügbar...</p>
+ </td>
+</tr>
+</TMPL_IF>
+ </table>
+</fieldset>
+
+<fieldset class="DEPENDS ON charttype BEING A">
+ <legend>Sonstige Einstellungen</legend>
+ <table>
+ <tr>
+ <th align="left">Einnahmen-/Überschussrechnung</th>
+ <td colspan="3"><select name="pos_eur"><TMPL_VAR select_eur></select></td>
+ </tr>
+ <tr>
+ <th align="left">BWA</th>
+ <td colspan="3"><select name="pos_bwa"><TMPL_VAR select_bwa></select></td>
+ </tr>
+ <tr>
+ <th align="left">Bilanz</th>
+ <td colspan="3"><select name="pos_bilanz"><TMPL_VAR select_bilanz></select></td>
+ </tr>
+ <tr>
+ <th align="left">Datevexport</th>
+ <td colspan="3"><input name="datevautomatik" type="checkbox"
+ class="checkbox" value="T" <TMPL_IF
+ datevautomatik>checked="checked" </TMPL_IF>></td>
+ </tr>
+ <tr>
+ <th align="left">Folgekonto</th>
+ <td><select name="new_chart_id"><TMPL_VAR selectnewaccount></select></td>
+ <th align="left">Gültig ab</th>
+ <td><input name="valid_from" value="<TMPL_VAR valid_from>"></td>
+ </tr>
+ </table>
+</TMPL_IF>
+</fieldset>
+<hr size="3" noshade>
+
--- /dev/null
+<script type="text/javascript" src="js/FormManager.js" >
+/****************************************************
+* Form Dependency Manager- By Twey- http://www.twey.co.uk
+* Visit Dynamic Drive for this script and more: http://www.dynamicdrive.com
+****************************************************/
+</script>
+
+<script type="text/javascript">
+window.onload = function() {
+ setupDependencies('EditAccount'); //name of form(s). Seperate each with a comma (ie: 'weboptions', 'myotherform' )
+ };
+</script>
+
+<body>
+<form method="post" name="EditAccount" action="<TMPL_VAR script>">
+
+<input type="hidden" name="id" value="<TMPL_VAR id>">
+<input type="hidden" name="type" value="account">
+<input type="hidden" name="orphaned" value="<TMPL_VAR orphaned>">
+<input type="hidden" name="new_chart_valid" value="<TMPL_VAR new_chart_valid>">
+<input type="hidden" name="inventory_accno_id" value="<TMPL_VAR inventory_accno_id>">
+<input type="hidden" name="income_accno_id" value="<TMPL_VAR income_accno_id>">
+<input type="hidden" name="expense_accno_id" value="<TMPL_VAR expense_accno_id>">
+<input type="hidden" name="fxgain_accno_id" value="<TMPL_VAR fxgain_accno_id>">
+<input type="hidden" name="fxloss_accno_id" value="<TMPL_VAR fxloss_accno_id>">
+
+<table border="0" width="100%">
+ <tr>
+ <th class="listtop"><TMPL_VAR title></th>
+ </tr>
+</table>
+
+<fieldset>
+ <legend>
+ <translate>Main Preferences</translate>
+ </legend>
+ <table>
+ <tr>
+ <td>
+ <label>
+ <translate>Account Number</translate>
+ </label></td>
+ <td><input name="accno" size="20" value="<TMPL_VAR accno>"></td>
+ </tr>
+ <tr>
+ <td>
+ <label>
+ <translate>Description</translate>
+ </label>
+ </td>
+ <td><input name="description" size="40" value="<TMPL_VAR
+ description ESCAPE=HTML>"></td>
+ </tr>
+ <tr>
+ <td>
+ <label>
+ <translate>Chart Type</translate>
+
+ </label>
+ </td>
+ <td><select name="charttype"><TMPL_VAR
+ select_charttype></select></td>
+ </tr>
+ </table>
+</fieldset>
+<fieldset class="DEPENDS ON charttype BEING A">
+ <legend><translate>Account Type</translate></legend>
+ <select name="category" id="AccountType" class="DEPENDS ON charttype BEING A">
+ <TMPL_VAR select_category></select>
+</fieldset>
+
+<TMPL_IF ChartTypeIsAccount>
+<fieldset class="DEPENDS ON charttype BEING A">
+ <legend><translate>Is this a summary account to record</translate></legend>
+ <input name="AR" type="checkbox" class="checkbox" value="AR" <TMPL_VAR AR ESCAPE=HTML>>
+ <translate>AR</translate>
+ <input name="AP" type="checkbox" class="checkbox" value="AP" <TMPL_VAR AP ESCAPE=HTML>>
+ <translate>AP</translate>
+ <input name="IC" type="checkbox" class="checkbox" value="IC" <TMPL_VAR IC ESCAPE=HTML>>
+ <translate>Inventory</translate>
+</fieldset>
+
+<fieldset class="DEPENDS ON charttype BEING A">
+ <legend><translate>Include in drop-down menus</translate></legend>
+ <table width="100%">
+ <tr>
+ <th align="left"><translate>Receivables</translate></th>
+ <th align="left"><translate>Payables</translate></th>
+ <th align="left"><translate>Parts Inventory</translate></th>
+ <th align="left"><translate>Service Items</translate></th>
+ </tr>
+ <tr>
+ <td>
+ <input name="AR_amount" type="checkbox" class="checkbox" value="AR_amount"
+ <TMPL_VAR AR_amount ESCAPE=HTML>>
+ <translate>Revenue</translate> <br>
+ <input name="AR_paid" type="checkbox" class="checkbox" value="AR_paid"
+ <TMPL_VAR AR_paid ESCAPE=HTML>>
+ <translate>Receipt</translate> <br>
+ <input name="AR_tax" type="checkbox" class="checkbox" value="AR_tax"
+ <TMPL_VAR AR_tax ESCAPE=HTML>>
+ <translate>Tax</translate>
+ </td>
+ <td>
+ <input name="AP_amount" type="checkbox" class="checkbox" value="AP_amount"
+ <TMPL_VAR AP_amount ESCAPE=HTML>>
+ <translate>Expense/Asset</translate> <br>
+ <input name="AP_paid" type="checkbox" class="checkbox" value="AP_paid"
+ <TMPL_VAR AP_paid ESCAPE=HTML>>
+ <translate>Payment</translate> <br>
+ <input name="AP_tax" type="checkbox" class="checkbox" value="AP_tax"
+ <TMPL_VAR AP_tax ESCAPE=HTML>>
+ <translate>Tax</translate>
+ </td>
+ <td>
+ <input name="IC_sale" type="checkbox" class="checkbox" value="IC_sale"
+ <TMPL_VAR IC_sale ESCAPE=HTML>>
+ <translate>Revenue</translate> <br>
+ <input name="IC_cogs" type="checkbox" class="checkbox" value="IC_cogs"
+ <TMPL_VAR IC_cogs ESCAPE=HTML>>
+ <translate>Expense</translate> <br>
+ <input name="IC_taxpart" type="checkbox" class="checkbox" value="IC_taxpart"
+ <TMPL_VAR IC_taxpart ESCAPE=HTML>>
+ <translate>Tax</translate>
+ </td>
+ <td>
+ <input name=IC_income type=checkbox class=checkbox value="IC_income"
+ <TMPL_VAR IC_income ESCAPE=HTML>>
+ <translate>Revenue</translate> <br>
+ <input name=IC_expense type=checkbox class=checkbox value="IC_expense"
+ <TMPL_VAR IC_expense ESCAPE=HTML>>
+ <translate>Expense</translate> <br>
+ <input name=IC_taxservice type=checkbox class=checkbox value="IC_taxservice"
+ <TMPL_VAR IC_taxservice ESCAPE=HTML>>
+ <translate>Tax</translate>
+ </td>
+ </tr>
+ </table>
+</fieldset>
+
+<fieldset class="DEPENDS ON charttype BEING A">
+ <legend>
+ <translate>Taxkeys and Taxreport Preferences</translate>
+ </legend>
+
+ <table>
+<TMPL_IF account_exists >
+ <tr>
+ <th align="left"><translate>Taxkey</translate></th>
+ <th align="left"><translate>valid from</translate></th>
+ <th align="left"><translate>pos_ustva</translate></th>
+ <th align="left"><translate>delete</translate> ? </th>
+ </tr>
+<TMPL_LOOP ACCOUNT_TAXKEYS >
+ <tr>
+ <TMPL_IF id>
+ <input type="hidden" name="taxkey_id_<TMPL_VAR runningnumber>" value="<TMPL_VAR id>">
+ <td><select name="taxkey_tax_<TMPL_VAR runningnumber>"><TMPL_VAR selecttaxkey></select></td>
+ <td><input name="taxkey_startdate_<TMPL_VAR runningnumber>" value="<TMPL_VAR startdate>"></td>
+ <td><select name="taxkey_pos_ustva_<TMPL_VAR runningnumber>"><TMPL_VAR select_tax></select></td>
+ <td><input name="taxkey_del_<TMPL_VAR runningnumber>" type="checkbox"
+ class="checkbox" value="delete"></td>
+ <TMPL_ELSE>
+ <input type="hidden" name="taxkey_id_<TMPL_VAR runningnumber>" value="NEW">
+ <td><select name="taxkey_tax_<TMPL_VAR runningnumber>"><TMPL_VAR selecttaxkey></select></td>
+ <td><input name="taxkey_startdate_<TMPL_VAR runningnumber>" value="<TMPL_VAR startdate>"></td>
+ <td><select name="taxkey_pos_ustva_<TMPL_VAR runningnumber>"><TMPL_VAR select_tax></select></td>
+ <td> </td>
+ </TMPL_IF>
+ </tr>
+
+</TMPL_LOOP>
+<TMPL_ELSE>
+<tr>
+ <td align="center" colspan="4"><p><translate>Save account first to insert taxkeys</translate></p>
+ </td>
+</tr>
+</TMPL_IF>
+ </table>
+</fieldset>
+
+<fieldset class="DEPENDS ON charttype BEING A">
+ <legend><translate>Report and misc. Preferences</translate></legend>
+ <table>
+ <tr>
+ <th align="left"><translate>EUER</translate></th>
+ <td colspan="3"><select name="pos_eur"><TMPL_VAR select_eur></select></td>
+ </tr>
+ <tr>
+ <th align="left"><translate>BWA</translate></th>
+ <td colspan="3"><select name="pos_bwa"><TMPL_VAR select_bwa></select></td>
+ </tr>
+ <tr>
+ <th align="left"><translate>Bilanz</translate></th>
+ <td colspan="3"><select name="pos_bilanz"><TMPL_VAR select_bilanz></select></td>
+ </tr>
+ <tr>
+ <th align="left"><translate>Datevautomatik</translate></th>
+ <td colspan="3"><input name="datevautomatik" type="checkbox"
+ class="checkbox" value="T" <TMPL_IF
+ datevautomatik>checked="checked" </TMPL_IF>></td>
+ </tr>
+ <tr>
+ <th align="left"><translate>Folgekonto</translate></th>
+ <td><select name="new_chart_id"><TMPL_VAR selectnewaccount></select></td>
+ <th align="left"><translate>Valid from</translate></th>
+ <td><input name="valid_from" value="<TMPL_VAR valid_from>"></td>
+ </tr>
+ </table>
+</TMPL_IF>
+</fieldset>
+<hr size="3" noshade>
+
--- /dev/null
+[% USE HTML %]<body>
+ <form method="post" action="am.pl">
+ <input type="hidden" name="id" value="[% HTML.escape(id) %]">
+ <input type="hidden" name="type" value="tax">
+
+ <div class="listtop">Steuer [% title %]</div>
+
+ <table width="100%">
+ <tr>
+ <td>Steuerschlüssel</td>
+ <td><input name="taxkey" size="2" value="[% HTML.escape(taxkey) %]"></td>
+ </tr>
+
+ <tr>
+ <td>Steuername</td>
+ <td><input name="taxdescription" size="60" value="[% HTML.escape(taxdescription) %]"></td>
+ </tr>
+
+ <tr>
+ <td>Prozentsatz</td>
+ <td><input name="rate" size="10" value="[% HTML.escape(rate) %]"> %</td>
+ </tr>
+
+ <tr>
+ <td>Automatikkonto</td>
+ <td><select name="chart_id"><option value="0">Kein</option>[% FOREACH row = ACCOUNTS %]<option value="[% HTML.escape(row.id) %]" [% IF row.selected %]selected[% END %]>[% HTML.escape(row.taxaccount) %]</option>[% END %]</select></td>
+ </tr>
+
+ </table>
+
+ [% UNLESS orphaned %]
+ <br />
+ Konten, die mit dieser Steuer verknüpft sind:
+ [% FOREACH row = TAXINUSE %]
+ <a href="am.pl?action=edit_account&id=[% HTML.url(row.id) %]&login=[% HTML.url(login) %]&password=[% HTML.url(password) %]&callback=[% HTML.url(callback) %]">[% HTML.escape(row.accno) %]</a>
+ [% END %]
+ <br />
+ [% END %]
+
+ <input type="hidden" name="callback" value="[% HTML.escape(callback) %]">
+ <input type="hidden" name="login" value="[% HTML.escape(login) %]">
+ <input type="hidden" name="password" value="[% HTML.escape(password) %]">
+
+ <input type="submit" class="submit" name="action" value="Speichern">
+
+ [% IF orphaned %]
+ <input type="submit" class="submit" name="action" value="Löschen">
+ [% END %]
+
+</form>
+</body>
+</html>
+
--- /dev/null
+[% USE HTML %]<body>
+ <form method="post" action="am.pl">
+ <input type="hidden" name="id" value="[% HTML.escape(id) %]">
+ <input type="hidden" name="type" value="tax">
+
+ <div class="listtop"><translate>Tax-O-Matic</translate> [% title %]</div>
+
+ <table width="100%">
+ <tr>
+ <td><translate>tax_taxkey</translate></td>
+ <td><input name="taxkey" size="2" value="[% HTML.escape(taxkey) %]"></td>
+ </tr>
+
+ <tr>
+ <td><translate>tax_taxdescription</translate></td>
+ <td><input name="taxdescription" size="60" value="[% HTML.escape(taxdescription) %]"></td>
+ </tr>
+
+ <tr>
+ <td><translate>tax_percent</translate></td>
+ <td><input name="rate" size="10" value="[% HTML.escape(rate) %]"> %</td>
+ </tr>
+
+ <tr>
+ <td><translate>tax_chartaccno</translate></td>
+ <td><select name="chart_id"><option value="0"><translate>None</translate></option>[% FOREACH row = ACCOUNTS %]<option value="[% HTML.escape(row.id) %]" [% IF row.selected %]selected[% END %]>[% HTML.escape(row.taxaccount) %]</option>[% END %]</select></td>
+ </tr>
+
+ </table>
+
+ [% UNLESS orphaned %]
+ <br />
+ <translate>Chartaccounts connected to this Tax:</translate>
+ [% FOREACH row = TAXINUSE %]
+ <a href="am.pl?action=edit_account&id=[% HTML.url(row.id) %]&login=[% HTML.url(login) %]&password=[% HTML.url(password) %]&callback=[% HTML.url(callback) %]">[% HTML.escape(row.accno) %]</a>
+ [% END %]
+ <br />
+ [% END %]
+
+ <input type="hidden" name="callback" value="[% HTML.escape(callback) %]">
+ <input type="hidden" name="login" value="[% HTML.escape(login) %]">
+ <input type="hidden" name="password" value="[% HTML.escape(password) %]">
+
+ <input type="submit" class="submit" name="action" value="<translate>Save</translate>">
+
+ [% IF orphaned %]
+ <input type="submit" class="submit" name="action" value="<translate>Delete</translate>">
+ [% END %]
+
+</form>
+</body>
+</html>
+
--- /dev/null
+<body>
+
+ <div class="listheading"><TMPL_VAR title></div>
+
+ <form method="post" name="Form" action="amtemplates.pl">
+
+ <TMPL_LOOP HIDDEN><input type="hidden" name="<TMPL_VAR name ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>"></TMPL_LOOP>
+
+ <TMPL_IF SHOW_EDIT_OPTIONS>
+ <p>
+ Druckvorlage
+ <select name="formname">
+ <TMPL_LOOP FORMNAME><option value="<TMPL_VAR value ESCAPE=HTML>" <TMPL_IF default>selected</TMPL_IF>><TMPL_VAR label ESCAPE=HTML></option></TMPL_LOOP>
+ </select>
+
+ <TMPL_IF SHOW_LANGUAGE>
+ Sprache
+ <select name="language">
+ <TMPL_LOOP LANGUAGE><option value="<TMPL_VAR value ESCAPE=HTML>" <TMPL_IF default>selected</TMPL_IF>><TMPL_VAR label ESCAPE=HTML></option></TMPL_LOOP>
+ </select>
+ </TMPL_IF>
+
+ <TMPL_IF SHOW_PRINTER>
+ Drucker
+ <select name="printer">
+ <TMPL_LOOP PRINTER><option value="<TMPL_VAR value ESCAPE=HTML>" <TMPL_IF default>selected</TMPL_IF>><TMPL_VAR label ESCAPE=HTML></option></TMPL_LOOP>
+ </select>
+ </TMPL_IF>
+
+ <input type="hidden" name="display_nextsub" value="display_template">
+
+ <input name="action" type="submit" class="submit" value="Anzeigen">
+
+ </p>
+
+ <hr>
+ </TMPL_IF>
+
+
+
+ <TMPL_IF SHOW_CONTENT>
+ <p>
+ <div class="listtop">
+ <TMPL_IF CAN_EDIT>Datei bearbeiten<TMPL_ELSE>Datei anzeigen</TMPL_IF> <TMPL_VAR display_filename ESCAPE=HTML>
+ </div>
+ </p>
+
+ <TMPL_IF CAN_EDIT>
+ <p><textarea name="content" id="content" cols="100" rows="25"><TMPL_VAR content ESCAPE=HTML></textarea></p>
+
+ <p>
+ <input type="hidden" name="save_nextsub" value="save_template">
+ <input type="submit" name="action" value="Speichern">
+ </p>
+
+ <TMPL_ELSE>
+
+ <input type="hidden" name="edit_nextsub" value="edit_template">
+
+ <p><input name="action" type="submit" class="submit" value="Bearbeiten"></p>
+
+ <p><pre class="filecontent"><TMPL_VAR content ESCAPE=HTML></pre></p>
+
+ <TMPL_IF SHOW_SECOND_EDIT_BUTTON>
+ <p><input name="action" type="submit" class="submit" value="Bearbeiten"></p>
+ </TMPL_IF>
+
+ </TMPL_IF> <!-- CAN_EDIT -->
+
+ </TMPL_IF> <!-- SHOW_CONTENT -->
+
+ </form>
+
+</body>
+</html>
--- /dev/null
+<body>
+
+ <div class="listheading"><TMPL_VAR title></div>
+
+ <form method="post" name="Form" action="amtemplates.pl">
+
+ <TMPL_LOOP HIDDEN><input type="hidden" name="<TMPL_VAR name ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>"></TMPL_LOOP>
+
+ <TMPL_IF SHOW_EDIT_OPTIONS>
+ <p>
+ <translate>Template</translate>
+ <select name="formname">
+ <TMPL_LOOP FORMNAME><option value="<TMPL_VAR value ESCAPE=HTML>" <TMPL_IF default>selected</TMPL_IF>><TMPL_VAR label ESCAPE=HTML></option></TMPL_LOOP>
+ </select>
+
+ <TMPL_IF SHOW_LANGUAGE>
+ <translate>Language</translate>
+ <select name="language">
+ <TMPL_LOOP LANGUAGE><option value="<TMPL_VAR value ESCAPE=HTML>" <TMPL_IF default>selected</TMPL_IF>><TMPL_VAR label ESCAPE=HTML></option></TMPL_LOOP>
+ </select>
+ </TMPL_IF>
+
+ <TMPL_IF SHOW_PRINTER>
+ <translate>Printer</translate>
+ <select name="printer">
+ <TMPL_LOOP PRINTER><option value="<TMPL_VAR value ESCAPE=HTML>" <TMPL_IF default>selected</TMPL_IF>><TMPL_VAR label ESCAPE=HTML></option></TMPL_LOOP>
+ </select>
+ </TMPL_IF>
+
+ <input type="hidden" name="display_nextsub" value="display_template">
+
+ <input name="action" type="submit" class="submit" value="<translate>Display</translate>">
+
+ </p>
+
+ <hr>
+ </TMPL_IF>
+
+
+
+ <TMPL_IF SHOW_CONTENT>
+ <p>
+ <div class="listtop">
+ <TMPL_IF CAN_EDIT><translate>Edit file</translate><TMPL_ELSE><translate>Display file</translate></TMPL_IF> <TMPL_VAR display_filename ESCAPE=HTML>
+ </div>
+ </p>
+
+ <TMPL_IF CAN_EDIT>
+ <p><textarea name="content" id="content" cols="100" rows="25"><TMPL_VAR content ESCAPE=HTML></textarea></p>
+
+ <p>
+ <input type="hidden" name="save_nextsub" value="save_template">
+ <input type="submit" name="action" value="<translate>Save</translate>">
+ </p>
+
+ <TMPL_ELSE>
+
+ <input type="hidden" name="edit_nextsub" value="edit_template">
+
+ <p><input name="action" type="submit" class="submit" value="<translate>Edit</translate>"></p>
+
+ <p><pre class="filecontent"><TMPL_VAR content ESCAPE=HTML></pre></p>
+
+ <TMPL_IF SHOW_SECOND_EDIT_BUTTON>
+ <p><input name="action" type="submit" class="submit" value="<translate>Edit</translate>"></p>
+ </TMPL_IF>
+
+ </TMPL_IF> <!-- CAN_EDIT -->
+
+ </TMPL_IF> <!-- SHOW_CONTENT -->
+
+ </form>
+
+</body>
+</html>
<form method="post" action="<TMPL_VAR NAME=script ESCAPE=HTML>">
- <input type="hidden" name="path" value="<TMPL_VAR NAME=path ESCAPE=HTML>">
<input type="hidden" name="login" value="<TMPL_VAR NAME=login ESCAPE=HTML>">
<input type="hidden" name="password" value="<TMPL_VAR NAME=password ESCAPE=HTML>">
<table>
<tr>
- <th class="listheading"> </th>
+ <th class="listheading" width="32" align="center" valign="center"><img alt="hoch" src="image/up.png"><img alt="runter" src="image/down.png"></th>
<th class="listheading">Löschen</th>
<th class="listheading">Einheit</th>
<th class="listheading">Basiseinheit</th>
<TMPL_LOOP NAME=UNITS>
<tr>
+ <td width="32" align="center" valign="center"><TMPL_IF __first__><img src="image/transparent16x16.gif"><TMPL_ELSE><a href="<TMPL_VAR updownlink>&dir=up&name=<TMPL_VAR name ESCAPE=URL>"><img alt="hoch" src="image/up.png"></a></TMPL_IF><TMPL_IF __last__><img src="image/transparent16x16.gif"><TMPL_ELSE><a href="<TMPL_VAR updownlink>&dir=down&name=<TMPL_VAR name ESCAPE=URL>"><img alt="runter" src="image/down.png"></a></TMPL_IF></td>
<TMPL_IF NAME=in_use>
- <td><TMPL_VAR NAME=__counter__></td>
<td>
<input type="hidden" name="unchangeable_<TMPL_VAR NAME=__counter__>" value="1">
<input type="hidden" name="old_name_<TMPL_VAR NAME=__counter__>" value="<TMPL_VAR NAME=name>">
<TMPL_ELSE>
- <td><TMPL_VAR NAME=__counter__></td>
<td align="center"><input type="checkbox" name="delete_<TMPL_VAR NAME=__counter__>"></td>
<td>
<input type="hidden" name="old_name_<TMPL_VAR NAME=__counter__>" value="<TMPL_VAR NAME=name>">
<form method="post" action="<TMPL_VAR NAME=script ESCAPE=HTML>">
- <input type="hidden" name="path" value="<TMPL_VAR NAME=path ESCAPE=HTML>">
<input type="hidden" name="login" value="<TMPL_VAR NAME=login ESCAPE=HTML>">
<input type="hidden" name="password" value="<TMPL_VAR NAME=password ESCAPE=HTML>">
<table>
<tr>
- <th class="listheading"> </th>
+ <th class="listheading" width="32" align="center" valign="center"><img alt="<translate>up</translate>" src="image/up.png"><img alt="<translate>down</translate>" src="image/down.png"></th>
<th class="listheading"><translate>Delete</translate></th>
<th class="listheading"><translate>Unit</translate></th>
<th class="listheading"><translate>Base unit</translate></th>
<TMPL_LOOP NAME=UNITS>
<tr>
+ <td width="32" align="center" valign="center"><TMPL_IF __first__><img src="image/transparent16x16.gif"><TMPL_ELSE><a href="<TMPL_VAR updownlink>&dir=up&name=<TMPL_VAR name ESCAPE=URL>"><img alt="<translate>up</translate>" src="image/up.png"></a></TMPL_IF><TMPL_IF __last__><img src="image/transparent16x16.gif"><TMPL_ELSE><a href="<TMPL_VAR updownlink>&dir=down&name=<TMPL_VAR name ESCAPE=URL>"><img alt="<translate>down</translate>" src="image/down.png"></a></TMPL_IF></td>
<TMPL_IF NAME=in_use>
- <td><TMPL_VAR NAME=__counter__></td>
<td>
<input type="hidden" name="unchangeable_<TMPL_VAR NAME=__counter__>" value="1">
<input type="hidden" name="old_name_<TMPL_VAR NAME=__counter__>" value="<TMPL_VAR NAME=name>">
<TMPL_ELSE>
- <td><TMPL_VAR NAME=__counter__></td>
<td align="center"><input type="checkbox" name="delete_<TMPL_VAR NAME=__counter__>"></td>
<td>
<input type="hidden" name="old_name_<TMPL_VAR NAME=__counter__>" value="<TMPL_VAR NAME=name>">
--- /dev/null
+ <TMPL_LOOP CA>
+ <table width="100%">
+
+ <colgroup>
+ <col width="10%">
+ <col width="10%">
+ <col width="10%">
+ <col width="50%">
+ <col width="10%">
+ <col width="10%">
+ </colgroup>
+
+ <TMPL_IF __odd__>
+ <tr class="coa_listrow1">
+ <TMPL_ELSE>
+ <tr class="coa_listrow0">
+ </TMPL_IF>
+
+ <td rowspan="8" class="coa_detail_emph"><TMPL_VAR id ESCAPE=HTML DEFAULT="-"></td>
+ <td colspan="5" class="coa_detail_emph"><TMPL_VAR category ESCAPE=HTML> </td>
+
+ </tr>
+ <TMPL_IF __odd__>
+ <tr class="coa_listrow1">
+ <TMPL_ELSE>
+ <tr class="coa_listrow0">
+ </TMPL_IF>
+ <td colspan="5" class="coa_detail_emph">
+ <TMPL_IF link>
+ <TMPL_VAR name="link" ESCAPE="HTML" DEFAULT="-">
+ <TMPL_ELSE>
+ -
+ </TMPL_IF>
+ </td>
+
+
+ </tr>
+
+ <TMPL_IF __odd__>
+ <tr class="coa_listrow1">
+ <TMPL_ELSE>
+ <tr class="coa_listrow0">
+ </TMPL_IF>
+ <td colspan="5" class="coa_details_header">Steuerautomatik</td>
+ </tr>
+
+ <TMPL_IF __odd__>
+ <tr class="coa_listrow1">
+ <TMPL_ELSE>
+ <tr class="coa_listrow0">
+ </TMPL_IF>
+ <td class="coa_details_header2">Steuerschlüssel</td>
+ <td class="coa_details_header2">Automatikkonto</td>
+ <td class="coa_details_header2">Steuer</td>
+ <td class="coa_details_header2">USTVA Kennz.</td>
+ <td class="coa_details_header2">Gültig ab</td>
+ </tr>
+
+ <TMPL_IF __odd__>
+ <tr class="coa_listrow1">
+ <TMPL_ELSE>
+ <tr class="coa_listrow0">
+ </TMPL_IF>
+
+ <td class="coa_detail_emph">
+ <TMPL_IF taxkey>
+ <TMPL_VAR taxkey DEFAULT="-" >
+ <TMPL_ELSE>
+ -
+ </TMPL_IF>
+ </td>
+ <td class="coa_detail_emph">
+ <TMPL_IF taxaccount>
+ <TMPL_VAR taxaccount DEFAULT="-" >
+ <TMPL_ELSE>
+ -
+ </TMPL_IF>
+ </td>
+ <td class="coa_detail_emph">
+ <TMPL_IF taxdescription>
+ <TMPL_VAR taxdescription DEFAULT="-" >
+ <TMPL_ELSE>
+ -
+ </TMPL_IF>
+ </td>
+ <td class="coa_detail_emph">
+ <TMPL_IF tk_ustva>
+ <TMPL_VAR tk_ustva DEFAULT="-" >
+ <TMPL_ELSE>
+ -
+ </TMPL_IF>
+ </td>
+ <td class="coa_detail_emph">
+ <TMPL_IF startdate>
+ <TMPL_VAR startdate DEFAULT="-" >
+ <TMPL_ELSE>
+ -
+ </TMPL_IF>
+ </td>
+ </tr>
+
+ <TMPL_IF __odd__>
+ <tr class="coa_listrow1">
+ <TMPL_ELSE>
+ <tr class="coa_listrow0">
+ </TMPL_IF>
+ <td colspan="5" class="coa_details_header">Berichte</td>
+ </tr>
+
+ <TMPL_IF __odd__>
+ <tr class="coa_listrow1">
+ <TMPL_ELSE>
+ <tr class="coa_listrow0">
+ </TMPL_IF>
+ <td class="coa_details_header2">BWA</td>
+ <td class="coa_details_header2">Bilanz</td>
+ <td class="coa_details_header2">E/ÜR</td>
+ <td colspan="2" class="coa_details_header2">Datevexport</td>
+ </tr>
+
+ <TMPL_IF __odd__>
+ <tr class="coa_listrow1">
+ <TMPL_ELSE>
+ <tr class="coa_listrow0">
+ </TMPL_IF>
+ <td class="coa_detail_emph"><TMPL_VAR pos_bwa ESCAPE=HTML DEFAULT="-"></td>
+ <td class="coa_detail_emph"><TMPL_VAR pos_bilanz ESCAPE=HTML DEFAULT="-"></td>
+ <td class="coa_detail_emph"><TMPL_VAR pos_eur ESCAPE=HTML DEFAULT="-"></td>
+ <td colspan="2" class="coa_detail_emph"><TMPL_VAR datevautomatik ESCAPE=HTML DEFAULT="-"></td>
+ </tr>
+ </table>
+
+</TMPL_LOOP CA>
--- /dev/null
+ <TMPL_LOOP CA>
+ <table width="100%">
+
+ <colgroup>
+ <col width="10%">
+ <col width="10%">
+ <col width="10%">
+ <col width="50%">
+ <col width="10%">
+ <col width="10%">
+ </colgroup>
+
+ <TMPL_IF __odd__>
+ <tr class="coa_listrow1">
+ <TMPL_ELSE>
+ <tr class="coa_listrow0">
+ </TMPL_IF>
+
+ <td rowspan="8" class="coa_detail_emph"><TMPL_VAR id ESCAPE=HTML DEFAULT="-"></td>
+ <td colspan="5" class="coa_detail_emph"><TMPL_VAR category ESCAPE=HTML> </td>
+
+ </tr>
+ <TMPL_IF __odd__>
+ <tr class="coa_listrow1">
+ <TMPL_ELSE>
+ <tr class="coa_listrow0">
+ </TMPL_IF>
+ <td colspan="5" class="coa_detail_emph">
+ <TMPL_IF link>
+ <TMPL_VAR name="link" ESCAPE="HTML" DEFAULT="-">
+ <TMPL_ELSE>
+ -
+ </TMPL_IF>
+ </td>
+
+
+ </tr>
+
+ <TMPL_IF __odd__>
+ <tr class="coa_listrow1">
+ <TMPL_ELSE>
+ <tr class="coa_listrow0">
+ </TMPL_IF>
+ <td colspan="5" class="coa_details_header"><translate>Taxlink_coa</translate></td>
+ </tr>
+
+ <TMPL_IF __odd__>
+ <tr class="coa_listrow1">
+ <TMPL_ELSE>
+ <tr class="coa_listrow0">
+ </TMPL_IF>
+ <td class="coa_details_header2"><translate>Taxkey_coa</translate></td>
+ <td class="coa_details_header2"><translate>Taxaccount_coa</translate></td>
+ <td class="coa_details_header2"><translate>Taxdescription_coa</translate></td>
+ <td class="coa_details_header2"><translate>Posustva_coa</translate></td>
+ <td class="coa_details_header2"><translate>Startdate_coa</translate></td>
+ </tr>
+
+ <TMPL_IF __odd__>
+ <tr class="coa_listrow1">
+ <TMPL_ELSE>
+ <tr class="coa_listrow0">
+ </TMPL_IF>
+
+ <td class="coa_detail_emph">
+ <TMPL_IF taxkey>
+ <TMPL_VAR taxkey DEFAULT="-" >
+ <TMPL_ELSE>
+ -
+ </TMPL_IF>
+ </td>
+ <td class="coa_detail_emph">
+ <TMPL_IF taxaccount>
+ <TMPL_VAR taxaccount DEFAULT="-" >
+ <TMPL_ELSE>
+ -
+ </TMPL_IF>
+ </td>
+ <td class="coa_detail_emph">
+ <TMPL_IF taxdescription>
+ <TMPL_VAR taxdescription DEFAULT="-" >
+ <TMPL_ELSE>
+ -
+ </TMPL_IF>
+ </td>
+ <td class="coa_detail_emph">
+ <TMPL_IF tk_ustva>
+ <TMPL_VAR tk_ustva DEFAULT="-" >
+ <TMPL_ELSE>
+ -
+ </TMPL_IF>
+ </td>
+ <td class="coa_detail_emph">
+ <TMPL_IF startdate>
+ <TMPL_VAR startdate DEFAULT="-" >
+ <TMPL_ELSE>
+ -
+ </TMPL_IF>
+ </td>
+ </tr>
+
+ <TMPL_IF __odd__>
+ <tr class="coa_listrow1">
+ <TMPL_ELSE>
+ <tr class="coa_listrow0">
+ </TMPL_IF>
+ <td colspan="5" class="coa_details_header"><translate>Report Positions</translate></td>
+ </tr>
+
+ <TMPL_IF __odd__>
+ <tr class="coa_listrow1">
+ <TMPL_ELSE>
+ <tr class="coa_listrow0">
+ </TMPL_IF>
+ <td class="coa_details_header2"><translate>pos_bwa</translate></td>
+ <td class="coa_details_header2"><translate>pos_bilanz</translate></td>
+ <td class="coa_details_header2"><translate>pos_eur</translate></td>
+ <td colspan="2" class="coa_details_header2"><translate>Datevautomatik</translate></td>
+ </tr>
+
+ <TMPL_IF __odd__>
+ <tr class="coa_listrow1">
+ <TMPL_ELSE>
+ <tr class="coa_listrow0">
+ </TMPL_IF>
+ <td class="coa_detail_emph"><TMPL_VAR pos_bwa ESCAPE=HTML DEFAULT="-"></td>
+ <td class="coa_detail_emph"><TMPL_VAR pos_bilanz ESCAPE=HTML DEFAULT="-"></td>
+ <td class="coa_detail_emph"><TMPL_VAR pos_eur ESCAPE=HTML DEFAULT="-"></td>
+ <td colspan="2" class="coa_detail_emph"><TMPL_VAR datevautomatik ESCAPE=HTML DEFAULT="-"></td>
+ </tr>
+ </table>
+
+</TMPL_LOOP CA>
\ No newline at end of file
--- /dev/null
+[% USE HTML %]<body>
+
+ <br/><div id='pjxdebugrequest'></div><br/>
+
+ <div class="coa_listtop">[% title %]</div>
+
+ <br />
+
+ <table width="100%">
+
+ <colgroup>
+ <col width="10%">
+ <col width="10%">
+ <col width="10%">
+ <col width="50%">
+ <col width="10%">
+ <col width="10%">
+ </colgroup>
+
+ <tr class="coa_listheading">
+ <td class="coa_listheading_element">Konto</td>
+ <td colspan="3" class="coa_listheading_element">Beschreibung (Klick
+ öffnet einzelne Kontendetails)</td>
+ <td class="coa_listheading_element">Soll</td>
+ <td class="coa_listheading_element">Haben</td>
+ </tr>
+
+ [% SET row_odd = '1' %][% FOREACH row = CA %]
+
+ [% IF row.heading %]
+ <tr>
+ <td class="accountlistheading"><a href="[% row.link_edit_account %]">[% HTML.escape(row.accno) %]</a></td>
+ <td colspan="5" class="accountlistheading">[% HTML.escape(row.description) %]</td>
+ </tr>
+
+ [% ELSE %]
+
+ <tr class="coa_listrow[% IF row_odd %]1[% SET row_odd = '0' %][% ELSE %]0[% SET row_odd = '1' %][% END %]">
+
+ <td class="coa_account_header">
+ <b><a href="[% row.link_edit_account %]" >[% HTML.escape(row.accno) %]</a></b>
+ </td>
+
+ <input type="hidden" name="chart_id" value="[% HTML.escape(row.id) %]" id="chart_id_[% HTML.escape(row.id) %]" >
+ <td colspan="3" id="accountcontent[% HTML.escape(row.id) %]-title" class="coa_account_header_sc"
+ onclick="list_account_details( ['chart_id_[% HTML.escape(row.id) %]'], ['ajaxcontent[% HTML.escape(row.id) %]'] )">
+ [% HTML.escape(row.description) %]
+ </td>
+
+ <td class="coa_account_header"><div class="coa_amount">[% HTML.escape(row.debit) %]</div></td>
+ <td class="coa_account_header"><div class="coa_amount">[% HTML.escape(row.credit) %]</div>
+ </td>
+ </tr>
+
+ <tr class="coa_detail">
+ <td colspan="6" width="100%"><div id="ajaxcontent[% HTML.escape(row.id) %]"></div></td>
+ </tr>
+
+ [% END %]
+
+ [% END %]
+
+ </table>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body>
+
+ <br/><div id='pjxdebugrequest'></div><br/>
+
+ <div class="coa_listtop">[% title %]</div>
+
+ <br />
+
+ <table width="100%">
+
+ <colgroup>
+ <col width="10%">
+ <col width="10%">
+ <col width="10%">
+ <col width="50%">
+ <col width="10%">
+ <col width="10%">
+ </colgroup>
+
+ <tr class="coa_listheading">
+ <td class="coa_listheading_element"><translate>Account</translate></td>
+ <td colspan="3" class="coa_listheading_element"><translate>Description (Click on Description for details)</translate></td>
+ <td class="coa_listheading_element"><translate>Debit</translate></td>
+ <td class="coa_listheading_element"><translate>Credit</translate></td>
+ </tr>
+
+ [% SET row_odd = '1' %][% FOREACH row = CA %]
+
+ [% IF row.heading %]
+ <tr>
+ <td class="accountlistheading"><a href="[% row.link_edit_account %]">[% HTML.escape(row.accno) %]</a></td>
+ <td colspan="5" class="accountlistheading">[% HTML.escape(row.description) %]</td>
+ </tr>
+
+ [% ELSE %]
+
+ <tr class="coa_listrow[% IF row_odd %]1[% SET row_odd = '0' %][% ELSE %]0[% SET row_odd = '1' %][% END %]">
+
+ <td class="coa_account_header">
+ <b><a href="[% row.link_edit_account %]" >[% HTML.escape(row.accno) %]</a></b>
+ </td>
+
+ <input type="hidden" name="chart_id" value="[% HTML.escape(row.id) %]" id="chart_id_[% HTML.escape(row.id) %]" >
+ <td colspan="3" id="accountcontent[% HTML.escape(row.id) %]-title" class="coa_account_header_sc"
+ onclick="list_account_details( ['chart_id_[% HTML.escape(row.id) %]'], ['ajaxcontent[% HTML.escape(row.id) %]'] )">
+ [% HTML.escape(row.description) %]
+ </td>
+
+ <td class="coa_account_header"><div class="coa_amount">[% HTML.escape(row.debit) %]</div></td>
+ <td class="coa_account_header"><div class="coa_amount">[% HTML.escape(row.credit) %]</div>
+ </td>
+ </tr>
+
+ <tr class="coa_detail">
+ <td colspan="6" width="100%"><div id="ajaxcontent[% HTML.escape(row.id) %]"></div></td>
+ </tr>
+
+ [% END %]
+
+ [% END %]
+
+ </table>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body>
+
+ <div class="listtop">[% title %]</div>
+
+ <table>
+ <tr>
+ <th class="listheading">Steuerschlüssel</th>
+ <th class="listheading">Steuername</th>
+ <th class="listheading">Prozent</th>
+ <th class="listheading">Automatikkonto</th>
+ <th class="listheading">Beschreibung</th>
+ </tr>
+
+ [% SET row_odd = '1' %][% FOREACH row = TAX %]
+ <tr class="listrow[% IF row_odd %]1[% SET row_odd = '0' %][% ELSE %]0[% SET row_odd = '1' %][% END %]">
+ <td align="right">[% HTML.escape(row.taxkey) %]</td>
+ <td><a href="am.pl?action=edit_tax&id=[% HTML.url(row.id) %]&login=[% HTML.url(login) %]&password=[% HTML.url(password) %]&callback=[% HTML.url(callback) %]">[% HTML.escape(row.taxdescription) %]</a></td>
+ <td align="right">[% HTML.escape(row.rate) %] %</td>
+ <td align="right">[% HTML.escape(row.taxnumber) %]</td>
+ <td>[% HTML.escape(row.account_description) %]</td>
+ </tr>
+ [% END %]
+ </table>
+
+ <p>
+ <form method="post" action="am.pl">
+
+ <input name="callback" type="hidden" value="[% HTML.escape(callback) %]">
+ <input type="hidden" name="type" value="tax">
+ <input type="hidden" name="login" value="[% HTML.escape(login) %]">
+ <input type="hidden" name="password" value="[% HTML.escape(password) %]">
+ <input class="submit" type="submit" name="action" value="Erfassen">
+ </form>
+ </p>
+
+</body>
+</html>
+
--- /dev/null
+[% USE HTML %]<body>
+
+ <div class="listtop">[% title %]</div>
+
+ <table>
+ <tr>
+ <th class="listheading"><translate>tax_taxkey</translate></th>
+ <th class="listheading"><translate>tax_taxdescription</translate></th>
+ <th class="listheading"><translate>tax_rate</translate></th>
+ <th class="listheading"><translate>taxnumber</translate></th>
+ <th class="listheading"><translate>account_description</translate></th>
+ </tr>
+
+ [% SET row_odd = '1' %][% FOREACH row = TAX %]
+ <tr class="listrow[% IF row_odd %]1[% SET row_odd = '0' %][% ELSE %]0[% SET row_odd = '1' %][% END %]">
+ <td align="right">[% HTML.escape(row.taxkey) %]</td>
+ <td><a href="am.pl?action=edit_tax&id=[% HTML.url(row.id) %]&login=[% HTML.url(login) %]&password=[% HTML.url(password) %]&callback=[% HTML.url(callback) %]">[% HTML.escape(row.taxdescription) %]</a></td>
+ <td align="right">[% HTML.escape(row.rate) %] %</td>
+ <td align="right">[% HTML.escape(row.taxnumber) %]</td>
+ <td>[% HTML.escape(row.account_description) %]</td>
+ </tr>
+ [% END %]
+ </table>
+
+ <p>
+ <form method="post" action="am.pl">
+
+ <input name="callback" type="hidden" value="[% HTML.escape(callback) %]">
+ <input type="hidden" name="type" value="tax">
+ <input type="hidden" name="login" value="[% HTML.escape(login) %]">
+ <input type="hidden" name="password" value="[% HTML.escape(password) %]">
+ <input class="submit" type="submit" name="action" value="<translate>Add</translate>">
+ </form>
+ </p>
+
+</body>
+</html>
+
--- /dev/null
+ <form method="post" action="ap.pl">
+
+ <input name="callback" type="hidden" value="<TMPL_VAR callback>">
+
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+
+ Neu erfassen<br>
+
+ <input class="submit" type="submit" name="action" value="Kreditorenbuchung">
+ <input class="submit" type="submit" name="action" value="Einkaufsrechnung">
+
+ </form>
+
+</body>
+</html>
--- /dev/null
+ <form method="post" action="ap.pl">
+
+ <input name="callback" type="hidden" value="<TMPL_VAR callback>">
+
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+
+ <translate>Create new</translate><br>
+
+ <input class="submit" type="submit" name="action" value="<translate>AP Transaction</translate>">
+ <input class="submit" type="submit" name="action" value="<translate>Vendor Invoice</translate>">
+
+ </form>
+
+</body>
+</html>
--- /dev/null
+ <form method="post" action="ar.pl">
+
+ <input name="callback" type="hidden" value="<TMPL_VAR callback>">
+
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+
+ Neu erfassen<br>
+
+ <input class="submit" type="submit" name="action" value="Debitorenbuchung">
+ <input class="submit" type="submit" name="action" value="Rechnung">
+
+ </form>
+
+</body>
+</html>
--- /dev/null
+ <form method="post" action="ar.pl">
+
+ <input name="callback" type="hidden" value="<TMPL_VAR callback>">
+
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+
+ <translate>Create new</translate><br>
+
+ <input class="submit" type="submit" name="action" value="<translate>AR Transaction</translate>">
+ <input class="submit" type="submit" name="action" value="<translate>Sales Invoice</translate>">
+
+ </form>
+
+</body>
+</html>
--- /dev/null
+<style type="text/css">@import url(js/jscalendar/calendar-win2k-1.css);</style>
+<script type="text/javascript" src="js/jscalendar/calendar.js"></script>
+<script type="text/javascript" src="js/jscalendar/lang/calendar-de.js"></script>
+<script type="text/javascript" src="js/jscalendar/calendar-setup.js"></script>
+<script type="text/javascript" src="js/show_am_history.js"></script>
+
+<form method="post" onSubmit="javascript:set_history_uri();">
+
+<input type="hidden" name="login" value="<TMPL_VAR NAME=login ESCAPE=HTML>">
+<input type="hidden" name="password" value="<TMPL_VAR NAME=password ESCAPE=HTML>">
+<input type="hidden" name="action" value="show_am_history">
+
+ <table>
+ <tr>
+ <th class ="listtop">Historien Suchmaschine</th>
+ </th>
+ </tr>
+ <tr>
+ <td>
+ <script type="text/javascript">
+ <!--
+ function uncheckOther(id) {
+ if(!(
+ (document.getElementById('non-deleted').checked == false)
+ &&
+ (document.getElementById('both').checked == false)
+ &&
+ (document.getElementById('deleted').checked == false)
+ )) {
+ if(id == "deleted") {
+ document.getElementById('non-deleted').checked = false;
+ document.getElementById('both').checked = false;
+ }
+ if(id == "non-deleted") {
+ document.getElementById('deleted').checked = false;
+ document.getElementById('both').checked = false;
+ }
+ if(id == "both") {
+ document.getElementById('non-deleted').checked = false;
+ document.getElementById('deleted').checked = false;
+ }
+ }
+ }
+
+ var defaults = new Array('SAVED', 'DELETED', 'ADDED', 'PAYMENT POSTED', 'POSTED', 'POSTED AS NEW', 'SAVED FOR DUNNING', 'DUNNING STARTED', 'PRINTED');
+ var translated = new Object();
+ translated['SAVED'] = 'Gespeichert';
+ translated['DELETED'] = 'Gelöscht';
+ translated['ADDED'] = 'Hinzugefügt';
+ translated['PAYMENT POSTED'] = 'Rechung gebucht';
+ translated['POSTED'] = 'Gebucht';
+ translated['POSTED AS NEW'] = 'Als neu gebucht'
+ translated['SAVED FOR DUNNING'] = 'Gespeichert';
+ translated['DUNNING STARTED'] = 'Mahnprozess gestartet';
+ translated['PRINTED'] = 'Gedruckt';
+
+ var jscalender = "<table valign=\"top\">"
+ + "<tr><td colspan=\"2\"><b>Zeitraum: </b></td></tr>"
+ + "<tr><td>von: "
+ + "<input name=\"transdate\" id=\"transdate\" size=\"11\" title=\"<TMPL_VAR NAME=myconfig_dateformat ESCAPE=HTML>\" value=\"<TMPL_VAR NAME=transdate ESCAPE=HTML>\" onChange=\"document.getElementById(\'transdate_hidden\').value=this.value;\">"
+ + "<input type=\"button\" name=\"transdate\" id=\"trigger1\" value=\"?\">"
+ + " </td><td>bis: "
+ + "<input name=\"reqdate\" id=\"reqdate\" size=\"11\" title=\"<TMPL_VAR NAME=myconfig_dateformat ESCAPE=HTML>\" value=\"<TMPL_VAR NAME=reqdate ESCAPE=HTML>\" onChange=\"document.getElementById(\'reqdate_hidden\').value=this.value;\">"
+ + "<input type=\"button\" name=\"reqdate\" id=\"trigger2\" value=\"?\"></td></tr></table>";
+ var mitarbeiter = "<table valign=\"top\">"
+ + "<tr><td><b>Mitarbeiter:</b> </td>"
+ + "<td><input type='text' name='mitarbeiter' id='mitarbeiter' onChange=\"document.getElementById(\'mitarbeiter_hidden\').value=this.value;\"></td>"
+ + "</tr></table>";
+
+ var tempString = "";
+ function addForm(last, remove) {
+ if(last == "INIT") {
+ tempString = "<select id='selectForm'><option></option>";
+ for(i=0;i<defaults.length;i++) {
+ tempString += "\<option value\=\'" + defaults[i] + "\'\ onClick=\"javascript:addForm(\'" + defaults[i] + "\', " + i + ");\">" + translated[defaults[i]] + "\<\/option\>" + "\n";
+ }
+ tempString += "</select>";
+ document.getElementById('selectEmployee').innerHTML = mitarbeiter;
+ document.getElementById('selectDate').innerHTML = jscalender;
+ document.getElementById('selectTable').innerHTML = tempString;
+
+ Calendar.setup(
+ {
+ inputField : "transdate",
+ ifFormat :"%d.%m.%Y",
+ align : "BL",
+ button : "trigger1"
+ });
+
+ Calendar.setup(
+ {
+ inputField : "reqdate",
+ ifFormat :"%d.%m.%Y",
+ align : "BL",
+ button : "trigger2"
+ });
+ }
+ else {
+ defaults.splice(remove,1);
+ document.getElementById('inputText').innerHTML += ((document.getElementById('inputText').innerHTML == "") ? ("<b>Sie haben bereits die folgenden Einschränkungen vorgenommen:</b><br>") : ("<br>")) + translated[last];
+ if(defaults.length > 0) {
+ document.getElementById('einschraenkungen').value += ((document.getElementById('einschraenkungen').value == "") ? ("") : (",")) + last;
+ tempString = "<select id='selectForm'><option></option>";
+ for(i=0;i<defaults.length;i++) {
+ tempString += "\<option value\=\'" + defaults[i] + "\'\ onClick=\"javascript:addForm(\'" + defaults[i] + "\', " + i + ");\">" + translated[defaults[i]] + "\<\/option\>" + "\n";
+ }
+ tempString += "</select>";
+ document.getElementById('selectTable').innerHTML = tempString;
+ }
+ else {
+ document.getElementById('selectTable').innerHTML = "";
+ }
+ }
+ }
+
+ function resetAll() {
+ document.getElementById('selectTable').innerHTML = "<a href=\"javascript:addForm('INIT')\">Ja";
+ document.getElementById('inputText').innerHTML = "";
+ }
+ //-->
+ </script>
+ <table>
+ <tr>
+ <td>
+ <b>Wonach</b> wollen Sie suchen?:
+ </td>
+ <td>
+ <select name="what2search" id="what2search">
+ <option name="Artikelnummer" value="Artikelnummer" id="Artikelnummer">Artikelnummer</option>
+ <option name="Kundennummer" value="Kundennummer" id="Kundennummer">Kundennummer</option>
+ <option name="Lieferantennummer" value="Lieferantennummer" id="Lieferantennummer">Lieferantennummer</option>
+ <option name="Projektnummer" value="Projektnummer" id="Projektnummer">Projektnummer</option>
+ <option name="Buchungsnummer" value="Buchungsnummer" id="Buchungsnummer">Buchungsnummer</option>
+ <option name="Eingangsrechnungnummer" value="Eingangsrechnungnummer" id="Eingangsrechnungnummer">Eingangsrechnungsnummer</option>
+ <option name="Ausgangsrechnungnummer" value="Ausgangsrechnungnummer" id="Ausgangsrechnungnummer">Ausgangsrechnungsnummer</option>
+ <option name="Mahnungsnummer" value="Mahnungsnummer" id="Mahnungsnummer">Mahnungsnummer</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Nach welchem <b>Begriff</b> wollen Sie suchen?
+ </td>
+ <td>
+ <input type="text" name="searchid" id="searchid" value="<TMPL_VAR NAME=searchid ESCAPE=HTML>">
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ Wollen Sie Ihre Suche <b>spezialisieren</b>?
+ </td>
+ <td>
+ <table valign=\"top\" cellpadding=\"0\" marginheight=\"0\" marginwidth=\"0\" cellspacing=\"0\" topmargin=\"0\" leftmargin=\"0\">
+ <tr>
+ <td>
+ <div id="selectTable"><a href="javascript:addForm('INIT')">Ja</div>
+ <div id="inputText"></div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="selectEmployee"></div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="selectDate"></div>
+ </td>
+ </tr>
+ </table>
+ <input type="hidden" name="einschraenkungen" id="einschraenkungen" value="">
+ </td>
+ </tr>
+ </tr>
+ <tr>
+ <td colspan="6">
+ <input type="hidden" value="" id="transdate_hidden">
+ <input type="hidden" value="" id="reqdate_hidden">
+ <input type="hidden" value="" id="mitarbeiter_hidden">
+ <input type="button" value="abschicken" onClick="javascript:set_history_uri();">
+ <input type="reset" value="zurücksetzen" onClick="javascript:resetAll();">
+ </td>
+ <td>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+</form>
--- /dev/null
+<style type="text/css">@import url(js/jscalendar/calendar-win2k-1.css);</style>
+<script type="text/javascript" src="js/jscalendar/calendar.js"></script>
+<script type="text/javascript" src="js/jscalendar/lang/calendar-de.js"></script>
+<script type="text/javascript" src="js/jscalendar/calendar-setup.js"></script>
+<script type="text/javascript" src="js/show_am_history.js"></script>
+
+<form method="post" onSubmit="javascript:set_history_uri();">
+
+<input type="hidden" name="login" value="<TMPL_VAR NAME=login ESCAPE=HTML>">
+<input type="hidden" name="password" value="<TMPL_VAR NAME=password ESCAPE=HTML>">
+<input type="hidden" name="action" value="show_am_history">
+
+ <table>
+ <tr>
+ <th class ="listtop"><translate>history search engine</translate></th>
+ </th>
+ </tr>
+ <tr>
+ <td>
+ <script type="text/javascript">
+ <!--
+ function uncheckOther(id) {
+ if(!(
+ (document.getElementById('non-deleted').checked == false)
+ &&
+ (document.getElementById('both').checked == false)
+ &&
+ (document.getElementById('deleted').checked == false)
+ )) {
+ if(id == "deleted") {
+ document.getElementById('non-deleted').checked = false;
+ document.getElementById('both').checked = false;
+ }
+ if(id == "non-deleted") {
+ document.getElementById('deleted').checked = false;
+ document.getElementById('both').checked = false;
+ }
+ if(id == "both") {
+ document.getElementById('non-deleted').checked = false;
+ document.getElementById('deleted').checked = false;
+ }
+ }
+ }
+
+ var defaults = new Array('SAVED', 'DELETED', 'ADDED', 'PAYMENT POSTED', 'POSTED', 'POSTED AS NEW', 'SAVED FOR DUNNING', 'DUNNING STARTED', 'PRINTED');
+ var translated = new Object();
+ translated['SAVED'] = '<translate>SAVED</translate>';
+ translated['DELETED'] = '<translate>DELETED</translate>';
+ translated['ADDED'] = '<translate>ADDED</translate>';
+ translated['PAYMENT POSTED'] = '<translate>PAYMENT POSTED</translate>';
+ translated['POSTED'] = '<translate>POSTED</translate>';
+ translated['POSTED AS NEW'] = '<translate>POSTED AS NEW</translate>'
+ translated['SAVED FOR DUNNING'] = '<translate>SAVED FOR DUNNING</translate>';
+ translated['DUNNING STARTED'] = '<translate>DUNNING STARTED</translate>';
+ translated['PRINTED'] = '<translate>PRINTED</translate>';
+
+ var jscalender = "<table valign=\"top\">"
+ + "<tr><td colspan=\"2\"><b><translate>Period</translate>: </b></td></tr>"
+ + "<tr><td><translate>from (time)</translate>: "
+ + "<input name=\"transdate\" id=\"transdate\" size=\"11\" title=\"<TMPL_VAR NAME=myconfig_dateformat ESCAPE=HTML>\" value=\"<TMPL_VAR NAME=transdate ESCAPE=HTML>\" onChange=\"document.getElementById(\'transdate_hidden\').value=this.value;\">"
+ + "<input type=\"button\" name=\"transdate\" id=\"trigger1\" value=\"?\">"
+ + " </td><td><translate>to (time)</translate>: "
+ + "<input name=\"reqdate\" id=\"reqdate\" size=\"11\" title=\"<TMPL_VAR NAME=myconfig_dateformat ESCAPE=HTML>\" value=\"<TMPL_VAR NAME=reqdate ESCAPE=HTML>\" onChange=\"document.getElementById(\'reqdate_hidden\').value=this.value;\">"
+ + "<input type=\"button\" name=\"reqdate\" id=\"trigger2\" value=\"?\"></td></tr></table>";
+ var mitarbeiter = "<table valign=\"top\">"
+ + "<tr><td><b>Mitarbeiter:</b> </td>"
+ + "<td><input type='text' name='mitarbeiter' id='mitarbeiter' onChange=\"document.getElementById(\'mitarbeiter_hidden\').value=this.value;\"></td>"
+ + "</tr></table>";
+
+ var tempString = "";
+ function addForm(last, remove) {
+ if(last == "INIT") {
+ tempString = "<select id='selectForm'><option></option>";
+ for(i=0;i<defaults.length;i++) {
+ tempString += "\<option value\=\'" + defaults[i] + "\'\ onClick=\"javascript:addForm(\'" + defaults[i] + "\', " + i + ");\">" + translated[defaults[i]] + "\<\/option\>" + "\n";
+ }
+ tempString += "</select>";
+ document.getElementById('selectEmployee').innerHTML = mitarbeiter;
+ document.getElementById('selectDate').innerHTML = jscalender;
+ document.getElementById('selectTable').innerHTML = tempString;
+
+ Calendar.setup(
+ {
+ inputField : "transdate",
+ ifFormat :"%d.%m.%Y",
+ align : "BL",
+ button : "trigger1"
+ });
+
+ Calendar.setup(
+ {
+ inputField : "reqdate",
+ ifFormat :"%d.%m.%Y",
+ align : "BL",
+ button : "trigger2"
+ });
+ }
+ else {
+ defaults.splice(remove,1);
+ document.getElementById('inputText').innerHTML += ((document.getElementById('inputText').innerHTML == "") ? ("<b><translate>You've already chosen the following limitations:</translate></b><br>") : ("<br>")) + translated[last];
+ if(defaults.length > 0) {
+ document.getElementById('einschraenkungen').value += ((document.getElementById('einschraenkungen').value == "") ? ("") : (",")) + last;
+ tempString = "<select id='selectForm'><option></option>";
+ for(i=0;i<defaults.length;i++) {
+ tempString += "\<option value\=\'" + defaults[i] + "\'\ onClick=\"javascript:addForm(\'" + defaults[i] + "\', " + i + ");\">" + translated[defaults[i]] + "\<\/option\>" + "\n";
+ }
+ tempString += "</select>";
+ document.getElementById('selectTable').innerHTML = tempString;
+ }
+ else {
+ document.getElementById('selectTable').innerHTML = "";
+ }
+ }
+ }
+
+ function resetAll() {
+ document.getElementById('selectTable').innerHTML = "<a href=\"javascript:addForm('INIT')\"><translate>Yes</translate>";
+ document.getElementById('inputText').innerHTML = "";
+ }
+ //-->
+ </script>
+ <table>
+ <tr>
+ <td>
+ <translate><b>What</b> do you want to look for?</translate>:
+ </td>
+ <td>
+ <select name="what2search" id="what2search">
+ <option name="Artikelnummer" value="Artikelnummer" id="Artikelnummer"><translate>Part Number</translate></option>
+ <option name="Kundennummer" value="Kundennummer" id="Kundennummer"><translate>Customer Number</translate></option>
+ <option name="Lieferantennummer" value="Lieferantennummer" id="Lieferantennummer"><translate>Vendor Number</translate></option>
+ <option name="Projektnummer" value="Projektnummer" id="Projektnummer"><translate>Project Number</translate></option>
+ <option name="Buchungsnummer" value="Buchungsnummer" id="Buchungsnummer"><translate>ID</translate></option>
+ <option name="Eingangsrechnungnummer" value="Eingangsrechnungnummer" id="Eingangsrechnungnummer"><translate>Incoming invoice number</translate></option>
+ <option name="Ausgangsrechnungnummer" value="Ausgangsrechnungnummer" id="Ausgangsrechnungnummer"><translate>Sales invoice number</translate></option>
+ <option name="Mahnungsnummer" value="Mahnungsnummer" id="Mahnungsnummer"><translate>Dunning number</translate></option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <translate>What's the <b>term</b> you're looking for?</translate>
+ </td>
+ <td>
+ <input type="text" name="searchid" id="searchid" value="<TMPL_VAR NAME=searchid ESCAPE=HTML>">
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <translate>Do you want to <b>limit</b> your search?</translate>
+ </td>
+ <td>
+ <table valign=\"top\" cellpadding=\"0\" marginheight=\"0\" marginwidth=\"0\" cellspacing=\"0\" topmargin=\"0\" leftmargin=\"0\">
+ <tr>
+ <td>
+ <div id="selectTable"><a href="javascript:addForm('INIT')"><translate>Yes</translate></div>
+ <div id="inputText"></div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="selectEmployee"></div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="selectDate"></div>
+ </td>
+ </tr>
+ </table>
+ <input type="hidden" name="einschraenkungen" id="einschraenkungen" value="">
+ </td>
+ </tr>
+ </tr>
+ <tr>
+ <td colspan="6">
+ <input type="hidden" value="" id="transdate_hidden">
+ <input type="hidden" value="" id="reqdate_hidden">
+ <input type="hidden" value="" id="mitarbeiter_hidden">
+ <input type="button" value="<translate>submit</translate>" onClick="javascript:set_history_uri();">
+ <input type="reset" value="<translate>reset</translate>" onClick="javascript:resetAll();">
+ </td>
+ <td>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+</form>
--- /dev/null
+<form>
+<input type="hidden" name="login" value="<TMPL_VAR NAME=login ESCAPE=HTML>">
+<input type="hidden" name="password" value="<TMPL_VAR NAME=password ESCAPE=HTML>">
+</form>
+<TMPL_IF NAME=SUCCESS>
+<script type="text/javascript">
+ function orderBy(order,desc) {
+ var reg = /\&order\=(.+)\-\-(\d)$/;
+ reg.exec(document.location.href);
+ if(RegExp.$1 == order) {
+ document.location.href = document.location.href.substring(0,document.location.href.lastIndexOf("&order=")) + "&order=" + order + "--" + desc;
+ }
+ else {
+ if(reg.test(document.location.href)) {
+ document.location.href = document.location.href.substring(0,document.location.href.lastIndexOf("&order=")) + "&order=" + order + "--" + desc;
+ }
+ else {
+ document.location.href = document.location.href + "&order=" + order + "--" + desc;
+ }
+ }
+ }
+</script>
+<div style="position: absolute; top:10px; left:10px; clip:rect(0px, 700px, 407px, 0px);">
+<table style="width: 700px; height: 360px;">
+ <tr>
+ <th class="listtop">
+ <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" border="0">
+ <tr>
+ <td align="center" valign="middle">
+ Zeitpunkt
+ </td>
+ <td valign="top">
+ <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" valign="top" border="0">
+ <TMPL_IF NAME=ITIME>
+ <TMPL_IF NAME=ITIMEBY>
+ <tr><td><a href="javascript:orderBy('h.itime',0);" title="Reihenfolge" style="border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td><a title="Reihenfolge" style="background: #ccccff; border: solid 1px #aaaade;">∨</a></td></tr>
+ <TMPL_ELSE>
+ <tr><td><a title="Reihenfolge" style="background: #ccccff; border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td><a href="javascript:orderBy('h.itime',1);" style="border: solid 1px #aaaade;">∨</a></td></tr>
+ </TMPL_IF>
+ <TMPL_ELSE>
+ <tr><td><a href="javascript:orderBy('h.itime',0);" title="Reihenfolge" style="border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td><a href="javascript:orderBy('h.itime',1);" title="Reihenfolge" style="border: solid 1px #aaaade;">∨</a></td></tr>
+ </TMPL_IF>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </th>
+ <th class=listtop>
+ <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" border="0">
+ <tr>
+ <td align="center" valign="middle">
+ Mitarbeiter
+ </td>
+ <td valign="top">
+ <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" valign="top" border="0">
+ <TMPL_IF NAME=NAME>
+ <TMPL_IF NAME=NAMEBY>
+ <tr><td height="0" width="0"><a href="javascript:orderBy('emp.name',0);" title="Reihenfolge" style="border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td height="0" width="0"><a title="Reihenfolge" style="background: #ccccff; border: solid 1px #aaaade;">∨</a></td></tr>
+ <TMPL_ELSE>
+ <tr><td><a title="Reihenfolge" style="background: #ccccff; border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td><a href="javascript:orderBy('emp.name',1);" style="border: solid 1px #aaaade;">∨</a></td></tr>
+ </TMPL_IF>
+ <TMPL_ELSE>
+ <tr><td><a href="javascript:orderBy('emp.name',0);" title="Reihenfolge" style="border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td><a href="javascript:orderBy('emp.name',1);" title="Reihenfolge" style="border: solid 1px #aaaade;">∨</a></td></tr>
+ </TMPL_IF>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </th>
+ <th class=listtop>
+ <table>
+ <tr>
+ <td>
+ Aktion
+ </td>
+ </tr>
+ </table>
+ </th>
+ <th class=listtop>
+ <table>
+ <tr>
+ <td>
+ Zusatz
+ </td>
+ </tr>
+ </table>
+ </th>
+ <th class=listtop>
+ <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" border="0">
+ <tr>
+ <td align="center" valign="middle">
+ ID-Nummer (intern)
+ </td>
+ <td valign="top">
+ <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" valign="top" border="0">
+ <TMPL_IF NAME=TRANS_ID>
+ <TMPL_IF NAME=TRANS_IDBY>
+ <tr><td height="0" width="0"><a href="javascript:orderBy('h.trans_id',0);" title="Reihenfolge" style="border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td height="0" width="0"><a title="Reihenfolge" style="background: #ccccff; border: solid 1px #aaaade;">∨</a></td></tr>
+ <TMPL_ELSE>
+ <tr><td><a title="Reihenfolge" style="background: #ccccff; border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td><a href="javascript:orderBy('h.trans_id',1);" style="border: solid 1px #aaaade;">∨</a></td></tr>
+ </TMPL_IF>
+ <TMPL_ELSE>
+ <tr><td><a href="javascript:orderBy('h.trans_id',0);" title="Reihenfolge" style="border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td><a href="javascript:orderBy('h.trans_id',1);" title="Reihenfolge" style="border: solid 1px #aaaade;">∨</a></td></tr>
+ </TMPL_IF>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </th>
+ <th class=listtop>
+ <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" border="0">
+ <tr>
+ <td align="center" valign="middle">
+ Buchungsnummer
+ </td>
+ <td valign="top">
+ <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" valign="top" border="0" >
+ <TMPL_IF NAME=SNUMBERS>
+ <TMPL_IF NAME=SNUMBERSBY>
+ <tr><td height="0" width="0"><a href="javascript:orderBy('h.snumbers',0);" title="Reihenfolge" style="border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td height="0" width="0"><a title="Reihenfolge" style="background: #ccccff; border: solid 1px #aaaade;">∨</a></td></tr>
+ <TMPL_ELSE>
+ <tr><td><a title="Reihenfolge" style="background: #ccccff; border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td><a href="javascript:orderBy('h.snumbers',1);" style="border: solid 1px #aaaade;">∨</a></td></tr>
+ </TMPL_IF>
+ <TMPL_ELSE>
+ <tr><td><a href="javascript:orderBy('h.snumbers',0);" title="Reihenfolge" style="border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td><a href="javascript:orderBy('h.snumbers',1);" title="Reihenfolge" style="border: solid 1px #aaaade;">∨</a></td></tr>
+ </TMPL_IF>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </th>
+ </tr>
+ <tbody height="380px" width="580px" style="overflow:auto;">
+<TMPL_LOOP NAME=DATEN>
+ <tr class="listrow<TMPL_IF __odd__>1<TMPL_ELSE>0</TMPL_IF>">
+ <td nowrap>
+ <TMPL_VAR NAME=itime ESCAPE=HTML>
+ </td>
+ <td nowrap>
+ <TMPL_VAR NAME=name ESCAPE=HTML>
+ </td>
+ <td>
+ <TMPL_VAR NAME=addition ESCAPE=HTML>
+ </td>
+ <td>
+ <TMPL_VAR NAME=what_done ESCAPE=HTML>
+ </td>
+ <td>
+ <TMPL_VAR NAME=id ESCAPE=HTML>
+ </td>
+ <td>
+ <TMPL_VAR NAME=snumbers ESCAPE=HTML>
+ </td>
+ </tr>
+</TMPL_LOOP>
+</tbody>
+</table>
+</div>
+<div style="position:absolute; bottom:10px; left:10px;">
+<TMPL_ELSE>
+<b>Keine Suchergebnisse gefunden!</b><br>
+</TMPL_IF>
+<p>
+<TMPL_IF NAME=NONEWWINDOW>
+<input type="button" onclick="javascript:history.back(-1);" value="zurück">
+<TMPL_ELSE>
+<input type="button" onclick="javascript:window.close();" value="schließen">
+</TMPL_IF>
+</p>
+</div>
--- /dev/null
+<form>
+<input type="hidden" name="login" value="<TMPL_VAR NAME=login ESCAPE=HTML>">
+<input type="hidden" name="password" value="<TMPL_VAR NAME=password ESCAPE=HTML>">
+</form>
+<TMPL_IF NAME=SUCCESS>
+<script type="text/javascript">
+ function orderBy(order,desc) {
+ var reg = /\&order\=(.+)\-\-(\d)$/;
+ reg.exec(document.location.href);
+ if(RegExp.$1 == order) {
+ document.location.href = document.location.href.substring(0,document.location.href.lastIndexOf("&order=")) + "&order=" + order + "--" + desc;
+ }
+ else {
+ if(reg.test(document.location.href)) {
+ document.location.href = document.location.href.substring(0,document.location.href.lastIndexOf("&order=")) + "&order=" + order + "--" + desc;
+ }
+ else {
+ document.location.href = document.location.href + "&order=" + order + "--" + desc;
+ }
+ }
+ }
+</script>
+<div style="position: absolute; top:10px; left:10px; clip:rect(0px, 700px, 407px, 0px);">
+<table style="width: 700px; height: 360px;">
+ <tr>
+ <th class="listtop">
+ <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" border="0">
+ <tr>
+ <td align="center" valign="middle">
+ <translate>Zeitpunkt</translate>
+ </td>
+ <td valign="top">
+ <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" valign="top" border="0">
+ <TMPL_IF NAME=ITIME>
+ <TMPL_IF NAME=ITIMEBY>
+ <tr><td><a href="javascript:orderBy('h.itime',0);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td><a title="<translate>order</translate>" style="background: #ccccff; border: solid 1px #aaaade;">∨</a></td></tr>
+ <TMPL_ELSE>
+ <tr><td><a title="<translate>order</translate>" style="background: #ccccff; border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td><a href="javascript:orderBy('h.itime',1);" style="border: solid 1px #aaaade;">∨</a></td></tr>
+ </TMPL_IF>
+ <TMPL_ELSE>
+ <tr><td><a href="javascript:orderBy('h.itime',0);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td><a href="javascript:orderBy('h.itime',1);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">∨</a></td></tr>
+ </TMPL_IF>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </th>
+ <th class=listtop>
+ <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" border="0">
+ <tr>
+ <td align="center" valign="middle">
+ <translate>Mitarbeiter</translate>
+ </td>
+ <td valign="top">
+ <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" valign="top" border="0">
+ <TMPL_IF NAME=NAME>
+ <TMPL_IF NAME=NAMEBY>
+ <tr><td height="0" width="0"><a href="javascript:orderBy('emp.name',0);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td height="0" width="0"><a title="<translate>order</translate>" style="background: #ccccff; border: solid 1px #aaaade;">∨</a></td></tr>
+ <TMPL_ELSE>
+ <tr><td><a title="<translate>order</translate>" style="background: #ccccff; border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td><a href="javascript:orderBy('emp.name',1);" style="border: solid 1px #aaaade;">∨</a></td></tr>
+ </TMPL_IF>
+ <TMPL_ELSE>
+ <tr><td><a href="javascript:orderBy('emp.name',0);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td><a href="javascript:orderBy('emp.name',1);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">∨</a></td></tr>
+ </TMPL_IF>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </th>
+ <th class=listtop>
+ <table>
+ <tr>
+ <td>
+ <translate>Aktion</translate>
+ </td>
+ </tr>
+ </table>
+ </th>
+ <th class=listtop>
+ <table>
+ <tr>
+ <td>
+ <translate>Zusatz</translate>
+ </td>
+ </tr>
+ </table>
+ </th>
+ <th class=listtop>
+ <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" border="0">
+ <tr>
+ <td align="center" valign="middle">
+ <translate>ID-Nummer</translate>
+ </td>
+ <td valign="top">
+ <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" valign="top" border="0">
+ <TMPL_IF NAME=TRANS_ID>
+ <TMPL_IF NAME=TRANS_IDBY>
+ <tr><td height="0" width="0"><a href="javascript:orderBy('h.trans_id',0);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td height="0" width="0"><a title="<translate>order</translate>" style="background: #ccccff; border: solid 1px #aaaade;">∨</a></td></tr>
+ <TMPL_ELSE>
+ <tr><td><a title="<translate>order</translate>" style="background: #ccccff; border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td><a href="javascript:orderBy('h.trans_id',1);" style="border: solid 1px #aaaade;">∨</a></td></tr>
+ </TMPL_IF>
+ <TMPL_ELSE>
+ <tr><td><a href="javascript:orderBy('h.trans_id',0);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td><a href="javascript:orderBy('h.trans_id',1);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">∨</a></td></tr>
+ </TMPL_IF>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </th>
+ <th class=listtop>
+ <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" border="0">
+ <tr>
+ <td align="center" valign="middle">
+ <translate>Belegnummer</translate>
+ </td>
+ <td valign="top">
+ <table height="0" width="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" valign="top" border="0" >
+ <TMPL_IF NAME=SNUMBERS>
+ <TMPL_IF NAME=SNUMBERSBY>
+ <tr><td height="0" width="0"><a href="javascript:orderBy('h.snumbers',0);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td height="0" width="0"><a title="<translate>order</translate>" style="background: #ccccff; border: solid 1px #aaaade;">∨</a></td></tr>
+ <TMPL_ELSE>
+ <tr><td><a title="<translate>order</translate>" style="background: #ccccff; border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td><a href="javascript:orderBy('h.snumbers',1);" style="border: solid 1px #aaaade;">∨</a></td></tr>
+ </TMPL_IF>
+ <TMPL_ELSE>
+ <tr><td><a href="javascript:orderBy('h.snumbers',0);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">∧</a></td></tr>
+ <tr><td><a href="javascript:orderBy('h.snumbers',1);" title="<translate>order</translate>" style="border: solid 1px #aaaade;">∨</a></td></tr>
+ </TMPL_IF>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </th>
+ </tr>
+ <tbody height="380px" width="580px" style="overflow:auto;">
+<TMPL_LOOP NAME=DATEN>
+ <tr class="listrow<TMPL_IF __odd__>1<TMPL_ELSE>0</TMPL_IF>">
+ <td nowrap>
+ <TMPL_VAR NAME=itime ESCAPE=HTML>
+ </td>
+ <td nowrap>
+ <TMPL_VAR NAME=name ESCAPE=HTML>
+ </td>
+ <td>
+ <TMPL_VAR NAME=addition ESCAPE=HTML>
+ </td>
+ <td>
+ <TMPL_VAR NAME=what_done ESCAPE=HTML>
+ </td>
+ <td>
+ <TMPL_VAR NAME=id ESCAPE=HTML>
+ </td>
+ <td>
+ <TMPL_VAR NAME=snumbers ESCAPE=HTML>
+ </td>
+ </tr>
+</TMPL_LOOP>
+</tbody>
+</table>
+</div>
+<div style="position:absolute; bottom:10px; left:10px;">
+<TMPL_ELSE>
+<b><translate>Keine Suchergebnisse gefunden!</translate></b><br>
+</TMPL_IF>
+<p>
+<TMPL_IF NAME=NONEWWINDOW>
+<input type="button" onclick="javascript:history.back(-1);" value="<translate>back</translate>">
+<TMPL_ELSE>
+<input type="button" onclick="javascript:window.close();" value="<translate>close</translate>">
+</TMPL_IF>
+</p>
+</div>
--- /dev/null
+<body>
+
+ <div width="100%" class="listtop">
+ <TMPL_IF is_customer>Kundendetails<TMPL_ELSE>Lieferantendetails</TMPL_IF> "<TMPL_VAR name ESCAPE=HTML>"
+ </div>
+
+ <p>Springe zu <a href="#billing">Rechnungsadresse</a>
+ <TMPL_LOOP SHIPTO>, <a href="#shipping<TMPL_VAR __counter__>">Lieferadresse "<TMPL_VAR shiptoname ESCAPE=HTML>"</a></TMPL_LOOP>
+ <TMPL_LOOP CONTACTS>, <a href="#contact<TMPL_VAR __counter__>">Ansprechpartner "<TMPL_VAR cp_name ESCAPE=HTML>"</a></TMPL_LOOP></p>
+
+ <hr>
+
+ <a name="billing"><div class="listheading">Rechnungsadresse</div></a>
+
+ <table>
+ <tr>
+ <td align="right">Kundennummer</td>
+ <td><TMPL_VAR customernumber ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Firmenname</td>
+ <td><TMPL_VAR name ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Abteilung</td>
+ <td><TMPL_VAR department_1 ESCAPE=HTML><TMPL_IF department_2><TMPL_IF department_1>; </TMPL_IF><TMPL_VAR department_2 ESCAPE=HTML></TMPL_IF></td>
+ </tr>
+
+ <tr>
+ <td align="right">Straße</td>
+ <td><TMPL_VAR street ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">PLZ, Ort</td>
+ <td><TMPL_VAR zipcode ESCAPE=HTML> <TMPL_VAR city ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Land</td>
+ <td><TMPL_VAR country ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Ansprechpartner</td>
+ <td><TMPL_IF greeting><TMPL_VAR greeting ESCAPE=HTML> </TMPL_IF><TMPL_VAR contact ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Telefon</td>
+ <td><TMPL_VAR phone ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Fax</td>
+ <td><TMPL_VAR fax ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">eMail</td>
+ <td><TMPL_VAR email ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Homepage</td>
+ <td><TMPL_VAR homepage ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Kreditlimit</td>
+ <td><TMPL_VAR creditlimit ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Rabatt</td>
+ <td><TMPL_VAR discount ESCAPE=HTML>%</td>
+ </tr>
+
+ <tr>
+ <td align="right">Zahlungskonditionen</td>
+ <td><TMPL_VAR payment_terms ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Steuernummer</td>
+ <td><TMPL_VAR taxnumber ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">USt-IdNr.</td>
+ <td><TMPL_VAR ustid ESCAPE=HTML></td>
+ </tr>
+
+ <TMPL_IF is_customer>
+ <tr>
+ <td align="right">KNr. beim Kunden</td>
+ <td><TMPL_VAR c_vendor_id ESCAPE=HTML></td>
+ </tr>
+ </TMPL_IF>
+
+ <tr>
+ <td align="right">Kontonummer</td>
+ <td><TMPL_VAR account_number ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">BLZ</td>
+ <td><TMPL_VAR bank_code ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Bank</td>
+ <td><TMPL_VAR bank ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><TMPL_IF is_customer>Kundentyp<TMPL_ELSE>Lieferantentyp</TMPL_IF></td>
+ <td><TMPL_VAR business ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Sprache</td>
+ <td><TMPL_VAR language ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top">Bemerkungen</td>
+ <td valign="top"><TMPL_VAR notes ESCAPE=HTML></td>
+ </tr>
+
+ </table>
+
+
+
+
+
+
+
+
+ <TMPL_LOOP SHIPTO>
+
+ <hr>
+
+ <p>Springe zu <a href="#billing">Rechnungsadresse</a>
+ <TMPL_LOOP SHIPTO>, <a href="#shipping<TMPL_VAR __counter__>">Lieferadresse "<TMPL_VAR shiptoname ESCAPE=HTML>"</a></TMPL_LOOP>
+ <TMPL_LOOP CONTACTS>, <a href="#contact<TMPL_VAR __counter__>">Ansprechpartner "<TMPL_VAR cp_name ESCAPE=HTML>"</a></TMPL_LOOP></p>
+
+ <hr>
+
+ <a name="shipping<TMPL_VAR __counter__>"><div class="listheading">Lieferadresse "<TMPL_VAR shiptoname ESCAPE=HTML>"</div></a>
+
+ <table>
+ <tr>
+ <td align="right">Firmenname</td>
+ <td><TMPL_VAR shiptoname ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Abteilung</td>
+ <td><TMPL_VAR shiptodepartment_1 ESCAPE=HTML><TMPL_IF shiptodepartment_2><TMPL_IF shiptodepartment_1>; </TMPL_IF><TMPL_VAR shiptodepartment_2 ESCAPE=HTML></TMPL_IF></td>
+ </tr>
+
+ <tr>
+ <td align="right">Straße</td>
+ <td><TMPL_VAR shiptostreet ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">PLZ, Ort</td>
+ <td><TMPL_VAR shiptozipcode ESCAPE=HTML> <TMPL_VAR shiptocity ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Land</td>
+ <td><TMPL_VAR shiptocountry ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Ansprechpartner</td>
+ <td><TMPL_VAR shiptocontact ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Telefon</td>
+ <td><TMPL_VAR shiptophone ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Fax</td>
+ <td><TMPL_VAR shiptofax ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">eMail</td>
+ <td><TMPL_VAR shiptoemail ESCAPE=HTML></td>
+ </tr>
+
+ </table>
+ </TMPL_LOOP>
+
+
+
+
+
+
+
+
+
+
+ <TMPL_LOOP CONTACTS>
+
+ <hr>
+
+ <p>Springe zu <a href="#billing">Rechnungsadresse</a>
+ <TMPL_LOOP SHIPTO>, <a href="#shipping<TMPL_VAR __counter__>">Lieferadresse "<TMPL_VAR shiptoname ESCAPE=HTML>"</a></TMPL_LOOP>
+ <TMPL_LOOP CONTACTS>, <a href="#contact<TMPL_VAR __counter__>">Ansprechpartner "<TMPL_VAR cp_name ESCAPE=HTML>"</a></TMPL_LOOP></p>
+
+ <hr>
+
+ <a name="contact<TMPL_VAR __counter__>"><div class="listheading">Ansprechpartner "<TMPL_VAR cp_name ESCAPE=HTML>"</div></a>
+
+ <table>
+ <tr>
+ <td align="right">Anrede</td>
+ <td><TMPL_VAR cp_greeting ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Titel</td>
+ <td><TMPL_VAR cp_title ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Vorname</td>
+ <td><TMPL_VAR cp_givenname ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Name</td>
+ <td><TMPL_VAR cp_name ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Abteilung</td>
+ <td><TMPL_VAR cp_abteilung ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Telefon 1 </td>
+ <td><TMPL_VAR cp_phone1 ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Telefon 2</td>
+ <td><TMPL_VAR cp_phone2 ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Fax</td>
+ <td><TMPL_VAR cp_fax ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Mobile 1</td>
+ <td><TMPL_VAR cp_mobile1 ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Mobile 2</td>
+ <td><TMPL_VAR cp_mobile2 ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Sat. Tel.</td>
+ <td><TMPL_VAR cp_satphone ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Sat. Fax</td>
+ <td><TMPL_VAR cp_satfax ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Projekt</td>
+ <td><TMPL_VAR cp_project ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">eMail</td>
+ <td><TMPL_VAR cp_email ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Privates Tel.</td>
+ <td><TMPL_VAR cp_privatphone ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Private eMail</td>
+ <td><TMPL_VAR cp_privatemail ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right">Geburtstag</td>
+ <td><TMPL_VAR cp_birthday ESCAPE=HTML></td>
+ </tr>
+
+ </table>
+
+ </TMPL_LOOP>
+
+</body>
+</html>
--- /dev/null
+<body>
+
+ <div width="100%" class="listtop">
+ <TMPL_IF is_customer><translate>Customer details</translate><TMPL_ELSE><translate>Vendor details</translate></TMPL_IF> "<TMPL_VAR name ESCAPE=HTML>"
+ </div>
+
+ <p><translate>Jump to</translate> <a href="#billing"><translate>Billing Address</translate></a>
+ <TMPL_LOOP SHIPTO>, <a href="#shipping<TMPL_VAR __counter__>"><translate>Shipping Address</translate> "<TMPL_VAR shiptoname ESCAPE=HTML>"</a></TMPL_LOOP>
+ <TMPL_LOOP CONTACTS>, <a href="#contact<TMPL_VAR __counter__>"><translate>Contact Person</translate> "<TMPL_VAR cp_name ESCAPE=HTML>"</a></TMPL_LOOP></p>
+
+ <hr>
+
+ <a name="billing"><div class="listheading"><translate>Billing Address</translate></div></a>
+
+ <table>
+ <tr>
+ <td align="right"><translate>Customer Number</translate></td>
+ <td><TMPL_VAR customernumber ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Company Name</translate></td>
+ <td><TMPL_VAR name ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Department</translate></td>
+ <td><TMPL_VAR department_1 ESCAPE=HTML><TMPL_IF department_2><TMPL_IF department_1>; </TMPL_IF><TMPL_VAR department_2 ESCAPE=HTML></TMPL_IF></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Street</translate></td>
+ <td><TMPL_VAR street ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Zip, City</translate></td>
+ <td><TMPL_VAR zipcode ESCAPE=HTML> <TMPL_VAR city ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Country</translate></td>
+ <td><TMPL_VAR country ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Contact Person</translate></td>
+ <td><TMPL_IF greeting><TMPL_VAR greeting ESCAPE=HTML> </TMPL_IF><TMPL_VAR contact ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Phone</translate></td>
+ <td><TMPL_VAR phone ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Fax</translate></td>
+ <td><TMPL_VAR fax ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>E-mail</translate></td>
+ <td><TMPL_VAR email ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Homepage</translate></td>
+ <td><TMPL_VAR homepage ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Credit Limit</translate></td>
+ <td><TMPL_VAR creditlimit ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Discount</translate></td>
+ <td><TMPL_VAR discount ESCAPE=HTML>%</td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Payment Terms</translate></td>
+ <td><TMPL_VAR payment_terms ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Tax Number</translate></td>
+ <td><TMPL_VAR taxnumber ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>USt-IdNr.</translate></td>
+ <td><TMPL_VAR ustid ESCAPE=HTML></td>
+ </tr>
+
+ <TMPL_IF is_customer>
+ <tr>
+ <td align="right"><translate>KNr. beim Kunden</translate></td>
+ <td><TMPL_VAR c_vendor_id ESCAPE=HTML></td>
+ </tr>
+ </TMPL_IF>
+
+ <tr>
+ <td align="right"><translate>Account Number</translate></td>
+ <td><TMPL_VAR account_number ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Bank Code</translate></td>
+ <td><TMPL_VAR bank_code ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Bank</translate></td>
+ <td><TMPL_VAR bank ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><TMPL_IF is_customer><translate>Customer type</translate><TMPL_ELSE><translate>Vendor type</translate></TMPL_IF></td>
+ <td><TMPL_VAR business ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Language</translate></td>
+ <td><TMPL_VAR language ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><translate>Notes</translate></td>
+ <td valign="top"><TMPL_VAR notes ESCAPE=HTML></td>
+ </tr>
+
+ </table>
+
+
+
+
+
+
+
+
+ <TMPL_LOOP SHIPTO>
+
+ <hr>
+
+ <p><translate>Jump to</translate> <a href="#billing"><translate>Billing Address</translate></a>
+ <TMPL_LOOP SHIPTO>, <a href="#shipping<TMPL_VAR __counter__>"><translate>Shipping Address</translate> "<TMPL_VAR shiptoname ESCAPE=HTML>"</a></TMPL_LOOP>
+ <TMPL_LOOP CONTACTS>, <a href="#contact<TMPL_VAR __counter__>"><translate>Contact Person</translate> "<TMPL_VAR cp_name ESCAPE=HTML>"</a></TMPL_LOOP></p>
+
+ <hr>
+
+ <a name="shipping<TMPL_VAR __counter__>"><div class="listheading"><translate>Shipping Address</translate> "<TMPL_VAR shiptoname ESCAPE=HTML>"</div></a>
+
+ <table>
+ <tr>
+ <td align="right"><translate>Company Name</translate></td>
+ <td><TMPL_VAR shiptoname ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Department</translate></td>
+ <td><TMPL_VAR shiptodepartment_1 ESCAPE=HTML><TMPL_IF shiptodepartment_2><TMPL_IF shiptodepartment_1>; </TMPL_IF><TMPL_VAR shiptodepartment_2 ESCAPE=HTML></TMPL_IF></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Street</translate></td>
+ <td><TMPL_VAR shiptostreet ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Zip, City</translate></td>
+ <td><TMPL_VAR shiptozipcode ESCAPE=HTML> <TMPL_VAR shiptocity ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Country</translate></td>
+ <td><TMPL_VAR shiptocountry ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Contact Person</translate></td>
+ <td><TMPL_VAR shiptocontact ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Phone</translate></td>
+ <td><TMPL_VAR shiptophone ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Fax</translate></td>
+ <td><TMPL_VAR shiptofax ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>E-mail</translate></td>
+ <td><TMPL_VAR shiptoemail ESCAPE=HTML></td>
+ </tr>
+
+ </table>
+ </TMPL_LOOP>
+
+
+
+
+
+
+
+
+
+
+ <TMPL_LOOP CONTACTS>
+
+ <hr>
+
+ <p><translate>Jump to</translate> <a href="#billing"><translate>Billing Address</translate></a>
+ <TMPL_LOOP SHIPTO>, <a href="#shipping<TMPL_VAR __counter__>"><translate>Shipping Address</translate> "<TMPL_VAR shiptoname ESCAPE=HTML>"</a></TMPL_LOOP>
+ <TMPL_LOOP CONTACTS>, <a href="#contact<TMPL_VAR __counter__>"><translate>Contact Person</translate> "<TMPL_VAR cp_name ESCAPE=HTML>"</a></TMPL_LOOP></p>
+
+ <hr>
+
+ <a name="contact<TMPL_VAR __counter__>"><div class="listheading"><translate>Contact Person</translate> "<TMPL_VAR cp_name ESCAPE=HTML>"</div></a>
+
+ <table>
+ <tr>
+ <td align="right"><translate>Greeting</translate></td>
+ <td><TMPL_VAR cp_greeting ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Title</translate></td>
+ <td><TMPL_VAR cp_title ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Given Name</translate></td>
+ <td><TMPL_VAR cp_givenname ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Name</translate></td>
+ <td><TMPL_VAR cp_name ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Department</translate></td>
+ <td><TMPL_VAR cp_abteilung ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Phone1</translate></td>
+ <td><TMPL_VAR cp_phone1 ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Phone2</translate></td>
+ <td><TMPL_VAR cp_phone2 ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Fax</translate></td>
+ <td><TMPL_VAR cp_fax ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Mobile1</translate></td>
+ <td><TMPL_VAR cp_mobile1 ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Mobile2</translate></td>
+ <td><TMPL_VAR cp_mobile2 ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Sat. Phone</translate></td>
+ <td><TMPL_VAR cp_satphone ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Sat. Fax</translate></td>
+ <td><TMPL_VAR cp_satfax ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Project</translate></td>
+ <td><TMPL_VAR cp_project ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>E-mail</translate></td>
+ <td><TMPL_VAR cp_email ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Private Phone</translate></td>
+ <td><TMPL_VAR cp_privatphone ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Private E-mail</translate></td>
+ <td><TMPL_VAR cp_privatemail ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Birthday</translate></td>
+ <td><TMPL_VAR cp_birthday ESCAPE=HTML></td>
+ </tr>
+
+ </table>
+
+ </TMPL_LOOP>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<form method="post" action="ct.pl">
+
+ <input name="callback" type="hidden" value="[% HTML.escape(callback) %]">
+ <input name="db" type="hidden" value="[% HTML.escape(db) %]">
+
+ <input name="login" type="hidden" value="[% HTML.escape(login) %]">
+ <input name="password" type="hidden" value="[% HTML.escape(password) %]">
+
+ [% IF IS_CUSTOMER %]Neuer Kunde[% ELSE %]Neuer Lieferant[% END %]<br>
+
+ <input class="submit" type="submit" name="action" value="Erfassen">
+
+</form>
--- /dev/null
+[% USE HTML %]<form method="post" action="ct.pl">
+
+ <input name="callback" type="hidden" value="[% HTML.escape(callback) %]">
+ <input name="db" type="hidden" value="[% HTML.escape(db) %]">
+
+ <input name="login" type="hidden" value="[% HTML.escape(login) %]">
+ <input name="password" type="hidden" value="[% HTML.escape(password) %]">
+
+ [% IF IS_CUSTOMER %]<translate>New customer</translate>[% ELSE %]<translate>New vendor</translate>[% END %]<br>
+
+ <input class="submit" type="submit" name="action" value="<translate>Add</translate>">
+
+</form>
--- /dev/null
+[% USE HTML %]<body onload="fokus()">
+
+ <form method="post" action="ct.pl" name="Form">
+
+ <input type="hidden" name="db" value="[% HTML.escape(db) %]">
+
+ <div class="listtop" width="100%">[% title %]</div>
+
+ <table>
+ <tr>
+ <th align="right" nowrap>[% IF IS_CUSTOMER %]Kundennummer[% ELSE %]Lieferantennummer[% END %]</th>
+ <td><input name="[% IF IS_CUSTOMER %]customer[% ELSE %]vendor[% END %]number" size="35"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>Firmenname</th>
+ <td><input name="name" size="35"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>Kontakt</th>
+ <td><input name="contact" size="35"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>eMail</th>
+ <td><input name="email" size="35"></td>
+ </tr>
+
+ [% IF SHOW_BUSINESS_TYPES %]
+ <tr>
+ <th align="right" nowrap>[% IF IS_CUSTOMER %]Kundentyp[% ELSE %]Lieferantentyp[% END %]</th>
+ <td>
+ <select name="business_id"><option value=""></option>
+ [% FOREACH bt = ALL_BUSINESS_TYPES %]<option value="[% HTML.escape(bt.id) %]">[% HTML.escape(bt.description) %]</option>[% END %]
+ </select>
+ </td>
+ </tr>
+ [% END %]
+
+ <tr>
+ <td></td>
+ <td>
+ <input name="status" class="radio" type="radio" value="all" checked> Alle
+ <input name="status" class="radio" type="radio" value="orphaned"> Nie benutzt
+ </td>
+ </tr>
+
+ <tr>
+ <td></td>
+ <td><input name="obsolete" class="radio" type="radio" value="all"> Alle
+ <input name="obsolete" class="radio" type="radio" value="Y"> Ungültig
+ <input name="obsolete" class="radio" type="radio" value="N" checked> Gültig
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>In Bericht aufnehmen</th>
+ <td>
+ <table>
+ <tr>
+ <td>
+ <input name="l_id" id="l_id" type="checkbox" class="checkbox" value="Y">
+ <label for="l_id">Buchungsnummer</label>
+ </td>
+ <td>
+ <input name="l_[% db %]number" id="l_[% db %]number" type="checkbox" class="checkbox" value="Y">
+ <label for="l_[% db %]number">[% IF IS_CUSTOMER %]Kundennummer[% ELSE %]Lieferantennummer[% END %]</label>
+ </td>
+ <td>
+ <input name="l_name" id="l_name" type="checkbox" class="checkbox" value="Y" checked>
+ <label for="l_name">Firmenname</label>
+ </td>
+ <td>
+ <input name="l_address" id="l_address" type="checkbox" class="checkbox" value="Y">
+ <label for="l_address">Adresse</label>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <input name="l_contact" id="l_contact" type="checkbox" class="checkbox" value="Y" checked>
+ <label for="l_contact">Kontakt</label>
+ </td>
+ <td>
+ <input name="l_phone" id="l_phone" type="checkbox" class="checkbox" value="Y" checked>
+ <label for="l_phone">Telefon</label>
+ </td>
+ <td>
+ <input name="l_fax" id="l_fax" type="checkbox" class="checkbox" value="Y">
+ <label for="l_fax">Fax</label>
+ </td>
+ <td>
+ <input name="l_email" id="l_email" type="checkbox" class="checkbox" value="Y" checked>
+ <label for="l_email">eMail</label>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <input name="l_taxnumber" id="l_taxnumber" type="checkbox" class="checkbox" value="Y">
+ <label for="l_taxnumber">Steuernummer</label>
+ </td>
+ <td>
+ <input name="l_sic_code" id="l_sic_code" type="checkbox" class="checkbox" value="Y">
+ <label for="l_sic_code">SIC</label>
+ </td>
+ <td>
+ <input name="l_business" id="l_business" type="checkbox" class="checkbox" value="Y">
+ <label for="l_business">[% IF IS_CUSTOMER %]Kundentyp[% ELSE %]Lieferantentyp[% END %]</label>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <input name="l_invnumber" id="l_invnumber" type="checkbox" class="checkbox" value="Y">
+ <label for="l_invnumber">Rechnungen</label>
+ </td>
+ <td>
+ <input name="l_ordnumber" id="l_ordnumber" type="checkbox" class="checkbox" value="Y">
+ <label for="l_ordnumber">[% IF IS_CUSTOMER %]Aufträge[% ELSE %]Lieferantenaufträge[% END %]</label>
+ </td>
+ <td>
+ <input name="l_quonumber" id="l_quonumber" type="checkbox" class="checkbox" value="Y">
+ <label for="l_quonumber">[% IF IS_CUSTOMER %]Angebote[% ELSE %]Preisanfragen[% END %]</label>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+
+ <input type="hidden" name="nextsub" value="list_names">
+
+ <input type="hidden" name="login" value="[% HTML.escape(login) %]">
+ <input type="hidden" name="password" value="[% HTML.escape(password) %]">
+
+ <input type="submit" class="submit" name="action" value="Weiter">
+ </form>
+
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body onload="fokus()">
+
+ <form method="post" action="ct.pl" name="Form">
+
+ <input type="hidden" name="db" value="[% HTML.escape(db) %]">
+
+ <div class="listtop" width="100%">[% title %]</div>
+
+ <table>
+ <tr>
+ <th align="right" nowrap>[% IF IS_CUSTOMER %]<translate>Customer Number</translate>[% ELSE %]<translate>Vendor Number</translate>[% END %]</th>
+ <td><input name="[% IF IS_CUSTOMER %]customer[% ELSE %]vendor[% END %]number" size="35"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap><translate>Company Name</translate></th>
+ <td><input name="name" size="35"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap><translate>Contact</translate></th>
+ <td><input name="contact" size="35"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap><translate>E-mail</translate></th>
+ <td><input name="email" size="35"></td>
+ </tr>
+
+ [% IF SHOW_BUSINESS_TYPES %]
+ <tr>
+ <th align="right" nowrap>[% IF IS_CUSTOMER %]<translate>Customer type</translate>[% ELSE %]<translate>Vendor type</translate>[% END %]</th>
+ <td>
+ <select name="business_id"><option value=""></option>
+ [% FOREACH bt = ALL_BUSINESS_TYPES %]<option value="[% HTML.escape(bt.id) %]">[% HTML.escape(bt.description) %]</option>[% END %]
+ </select>
+ </td>
+ </tr>
+ [% END %]
+
+ <tr>
+ <td></td>
+ <td>
+ <input name="status" class="radio" type="radio" value="all" checked> <translate>All</translate>
+ <input name="status" class="radio" type="radio" value="orphaned"> <translate>Orphaned</translate>
+ </td>
+ </tr>
+
+ <tr>
+ <td></td>
+ <td><input name="obsolete" class="radio" type="radio" value="all"> <translate>All</translate>
+ <input name="obsolete" class="radio" type="radio" value="Y"> <translate>Obsolete</translate>
+ <input name="obsolete" class="radio" type="radio" value="N" checked> <translate>Not obsolete</translate>
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap><translate>Include in Report</translate></th>
+ <td>
+ <table>
+ <tr>
+ <td>
+ <input name="l_id" id="l_id" type="checkbox" class="checkbox" value="Y">
+ <label for="l_id"><translate>ID</translate></label>
+ </td>
+ <td>
+ <input name="l_[% db %]number" id="l_[% db %]number" type="checkbox" class="checkbox" value="Y">
+ <label for="l_[% db %]number">[% IF IS_CUSTOMER %]<translate>Customer Number</translate>[% ELSE %]<translate>Vendor Number</translate>[% END %]</label>
+ </td>
+ <td>
+ <input name="l_name" id="l_name" type="checkbox" class="checkbox" value="Y" checked>
+ <label for="l_name"><translate>Company Name</translate></label>
+ </td>
+ <td>
+ <input name="l_address" id="l_address" type="checkbox" class="checkbox" value="Y">
+ <label for="l_address"><translate>Address</translate></label>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <input name="l_contact" id="l_contact" type="checkbox" class="checkbox" value="Y" checked>
+ <label for="l_contact"><translate>Contact</translate></label>
+ </td>
+ <td>
+ <input name="l_phone" id="l_phone" type="checkbox" class="checkbox" value="Y" checked>
+ <label for="l_phone"><translate>Phone</translate></label>
+ </td>
+ <td>
+ <input name="l_fax" id="l_fax" type="checkbox" class="checkbox" value="Y">
+ <label for="l_fax"><translate>Fax</translate></label>
+ </td>
+ <td>
+ <input name="l_email" id="l_email" type="checkbox" class="checkbox" value="Y" checked>
+ <label for="l_email"><translate>E-mail</translate></label>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <input name="l_taxnumber" id="l_taxnumber" type="checkbox" class="checkbox" value="Y">
+ <label for="l_taxnumber"><translate>Tax Number</translate></label>
+ </td>
+ <td>
+ <input name="l_sic_code" id="l_sic_code" type="checkbox" class="checkbox" value="Y">
+ <label for="l_sic_code"><translate>SIC</translate></label>
+ </td>
+ <td>
+ <input name="l_business" id="l_business" type="checkbox" class="checkbox" value="Y">
+ <label for="l_business">[% IF IS_CUSTOMER %]<translate>Customer type</translate>[% ELSE %]<translate>Vendor type</translate>[% END %]</label>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <input name="l_invnumber" id="l_invnumber" type="checkbox" class="checkbox" value="Y">
+ <label for="l_invnumber"><translate>Invoices</translate></label>
+ </td>
+ <td>
+ <input name="l_ordnumber" id="l_ordnumber" type="checkbox" class="checkbox" value="Y">
+ <label for="l_ordnumber">[% IF IS_CUSTOMER %]<translate>Sales Orders</translate>[% ELSE %]<translate>Purchase Orders</translate>[% END %]</label>
+ </td>
+ <td>
+ <input name="l_quonumber" id="l_quonumber" type="checkbox" class="checkbox" value="Y">
+ <label for="l_quonumber">[% IF IS_CUSTOMER %]<translate>Quotations</translate>[% ELSE %]<translate>RFQs</translate>[% END %]</label>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+
+ <input type="hidden" name="nextsub" value="list_names">
+
+ <input type="hidden" name="login" value="[% HTML.escape(login) %]">
+ <input type="hidden" name="password" value="[% HTML.escape(password) %]">
+
+ <input type="submit" class="submit" name="action" value="<translate>Continue</translate>">
+ </form>
+
+</body>
+</html>
<form name="Form" method="post" action="login.pl">
- <input type="hidden" name="path" value="<TMPL_VAR path ESCAPE=HTML>">
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
<input type="hidden" name="hashed_password" value="<TMPL_VAR password ESCAPE=HTML>">
<input type="hidden" name="type" value="parts">
<form name="Form" method="post" action="login.pl">
- <input type="hidden" name="path" value="<TMPL_VAR path ESCAPE=HTML>">
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
<input type="hidden" name="hashed_password" value="<TMPL_VAR password ESCAPE=HTML>">
<input type="hidden" name="type" value="parts">
<form name="Form" method="post" action="login.pl">
- <input type="hidden" name="path" value="<TMPL_VAR path ESCAPE=HTML>">
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
<input type="hidden" name="hashed_password" value="<TMPL_VAR password ESCAPE=HTML>">
<input type="hidden" name="type" value="parts">
<form name="Form" method="post" action="login.pl">
- <input type="hidden" name="path" value="<TMPL_VAR path ESCAPE=HTML>">
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
<input type="hidden" name="hashed_password" value="<TMPL_VAR password ESCAPE=HTML>">
<input type="hidden" name="type" value="parts">
<form name="Form" method="post" action="login.pl">
- <input type="hidden" name="path" value="<TMPL_VAR path ESCAPE=HTML>">
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
<input type="hidden" name="hashed_password" value="<TMPL_VAR password ESCAPE=HTML>">
<input type="hidden" name="type" value="parts">
<form name="Form" method="post" action="login.pl">
- <input type="hidden" name="path" value="<TMPL_VAR path ESCAPE=HTML>">
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
<input type="hidden" name="hashed_password" value="<TMPL_VAR password ESCAPE=HTML>">
<input type="hidden" name="type" value="parts">
<form name="Form" method="post" action="login.pl">
- <input type="hidden" name="path" value="<TMPL_VAR path ESCAPE=HTML>">
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
<input type="hidden" name="hashed_password" value="<TMPL_VAR password ESCAPE=HTML>">
<input type="hidden" name="action" value="login">
<form name="Form" method="post" action="login.pl">
- <input type="hidden" name="path" value="<TMPL_VAR path ESCAPE=HTML>">
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
<input type="hidden" name="hashed_password" value="<TMPL_VAR password ESCAPE=HTML>">
<input type="hidden" name="action" value="login">
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
<input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
- <input type="hidden" name="path" value="<TMPL_VAR path ESCAPE=HTML>">
<input type="hidden" name="action" value="display">
<p><input type="submit" value="Weiter"></p>
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
<input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
- <input type="hidden" name="path" value="<TMPL_VAR path ESCAPE=HTML>">
<input type="hidden" name="action" value="display">
<p><input type="submit" value="<translate>Continue</translate>"></p>
<form name="Form" method="post" action="login.pl">
- <input type="hidden" name="path" value="<TMPL_VAR path ESCAPE=HTML>">
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
<input type="hidden" name="hashed_password" value="<TMPL_VAR password ESCAPE=HTML>">
<input type="hidden" name="action" value="login">
<p><b>Fehler:</b> <TMPL_VAR message></p>
<form>
-<input type="button" onclick="history.back()" value="Zurück">
+<input type="button" onclick="history.back()" value="Zurück">
</form>
<form name="Form" method="post" action="login.pl">
- <input type="hidden" name="path" value="<TMPL_VAR path ESCAPE=HTML>">
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
<input type="hidden" name="hashed_password" value="<TMPL_VAR password ESCAPE=HTML>">
<input type="hidden" name="unit_type" value="dimension">
<form name="Form" method="post" action="login.pl">
- <input type="hidden" name="path" value="<TMPL_VAR path ESCAPE=HTML>">
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
<input type="hidden" name="hashed_password" value="<TMPL_VAR password ESCAPE=HTML>">
<input type="hidden" name="unit_type" value="dimension">
<form name="Form" method="post" action="login.pl">
- <input type="hidden" name="path" value="<TMPL_VAR path ESCAPE=HTML>">
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
<input type="hidden" name="hashed_password" value="<TMPL_VAR password ESCAPE=HTML>">
<input type="hidden" name="unit_type" value="service">
<form name="Form" method="post" action="login.pl">
- <input type="hidden" name="path" value="<TMPL_VAR path ESCAPE=HTML>">
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
<input type="hidden" name="hashed_password" value="<TMPL_VAR password ESCAPE=HTML>">
<input type="hidden" name="unit_type" value="service">
<form name="Form" method="post" action="login.pl">
- <input type="hidden" name="path" value="<TMPL_VAR path ESCAPE=HTML>">
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
<input type="hidden" name="hashed_password" value="<TMPL_VAR password ESCAPE=HTML>">
<input type="hidden" name="unit_type" value="dimension">
<form name="Form" method="post" action="login.pl">
- <input type="hidden" name="path" value="<TMPL_VAR path ESCAPE=HTML>">
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
<input type="hidden" name="hashed_password" value="<TMPL_VAR password ESCAPE=HTML>">
<input type="hidden" name="unit_type" value="dimension">
--- /dev/null
+<p><b><translate>Error</translate>:</b> <TMPL_VAR message></p>
+
+<form>
+<input type="button" onclick="history.back()" value="<translate>Back</translate>">
+</form>
<form name="Form" method="post" action="login.pl">
- <input type="hidden" name="path" value="<TMPL_VAR path ESCAPE=HTML>">
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
<input type="hidden" name="hashed_password" value="<TMPL_VAR password ESCAPE=HTML>">
<input type="hidden" name="action" value="login">
<form name="Form" method="post" action="login.pl">
- <input type="hidden" name="path" value="<TMPL_VAR path ESCAPE=HTML>">
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
<input type="hidden" name="hashed_password" value="<TMPL_VAR password ESCAPE=HTML>">
<input type="hidden" name="action" value="login">
--- /dev/null
+<body>
+
+ <form action="<TMPL_VAR script ESCAPE=HTML>" method="post">
+
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+
+ <input type="hidden" name="SAVED_FORM" value="<TMPL_VAR SAVED_FORM ESCAPE=HTML>">
+
+ <table width="100%">
+ <tr>
+ <th class="listtop">Entwurf laden</th>
+ </tr>
+ <tr height="5"></tr>
+
+ <tr>
+ <td>
+ Die folgenden Entwürfe wurden gespeichert und können geladen werden.
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <th class="listheading"> </th>
+ <th class="listheading">Datum</th>
+ <th class="listheading">Beschreibung</th>
+ <th class="listheading">Bearbeiter</th>
+ </tr>
+
+ <TMPL_LOOP DRAFTS>
+ <tr class="listrow<TMPL_IF __odd__>1<TMPL_ELSE>0</TMPL_IF>">
+ <td><input type="checkbox" name="checked_<TMPL_VAR id>" value="1"></td>
+ <td><TMPL_VAR itime ESCAPE=HTML></td>
+ <td><a href="<TMPL_VAR script ESCAPE=URL>?login=<TMPL_VAR login ESCAPE=URL>&password=<TMPL_VAR password ESCAPE=URL>&action=load_draft&id=<TMPL_VAR id ESCAPE=URL>"><TMPL_VAR description ESCAPE=HTML></a></td>
+ <td><TMPL_VAR employee_name ESCAPE=HTML></td>
+ </tr>
+ </TMPL_LOOP>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <input type="hidden" name="action" value="draft_action_dispatcher">
+ <input type="submit" class="submit" name="draft_action" value="Überspringen">
+ <input type="submit" class="submit" name="draft_action" value="Entwürfe löschen">
+ </td>
+ </tr>
+ </table>
+
+ </form>
+</body>
+</html>
--- /dev/null
+<body>
+
+ <form action="<TMPL_VAR script ESCAPE=HTML>" method="post">
+
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+
+ <input type="hidden" name="SAVED_FORM" value="<TMPL_VAR SAVED_FORM ESCAPE=HTML>">
+
+ <table width="100%">
+ <tr>
+ <th class="listtop"><translate>Load draft</translate></th>
+ </tr>
+ <tr height="5"></tr>
+
+ <tr>
+ <td>
+ <translate>The following drafts have been saved and can be loaded.</translate>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <th class="listheading"> </th>
+ <th class="listheading"><translate>Date</translate></th>
+ <th class="listheading"><translate>Description</translate></th>
+ <th class="listheading"><translate>Employee</translate></th>
+ </tr>
+
+ <TMPL_LOOP DRAFTS>
+ <tr class="listrow<TMPL_IF __odd__>1<TMPL_ELSE>0</TMPL_IF>">
+ <td><input type="checkbox" name="checked_<TMPL_VAR id>" value="1"></td>
+ <td><TMPL_VAR itime ESCAPE=HTML></td>
+ <td><a href="<TMPL_VAR script ESCAPE=URL>?login=<TMPL_VAR login ESCAPE=URL>&password=<TMPL_VAR password ESCAPE=URL>&action=load_draft&id=<TMPL_VAR id ESCAPE=URL>"><TMPL_VAR description ESCAPE=HTML></a></td>
+ <td><TMPL_VAR employee_name ESCAPE=HTML></td>
+ </tr>
+ </TMPL_LOOP>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <input type="hidden" name="action" value="draft_action_dispatcher">
+ <input type="submit" class="submit" name="draft_action" value="<translate>Skip</translate>">
+ <input type="submit" class="submit" name="draft_action" value="<translate>Delete drafts</translate>">
+ </td>
+ </tr>
+ </table>
+
+ </form>
+</body>
+</html>
--- /dev/null
+<body>
+
+ <form action="<TMPL_VAR script ESCAPE=HTML>" method="post">
+
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+
+ <input type="hidden" name="SAVED_FORM" value="<TMPL_VAR SAVED_FORM ESCAPE=HTML>">
+
+ <table width="100%">
+ <tr>
+ <th class="listtop">Entwurf speichern</th>
+ </tr>
+ <tr height="5"></tr>
+
+ <tr>
+ <td>Geben Sie eine Beschreibung für diesen Entwurf ein.</td>
+ </tr>
+
+ <tr>
+ <td>
+ Beschreibung:
+ <input name="draft_description">
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <input type="submit" class="submit" name="action" value="Entwurf speichern">
+ </td>
+ </tr>
+ </table>
+
+ </form>
+</body>
+</html>
--- /dev/null
+<body>
+
+ <form action="<TMPL_VAR script ESCAPE=HTML>" method="post">
+
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+
+ <input type="hidden" name="SAVED_FORM" value="<TMPL_VAR SAVED_FORM ESCAPE=HTML>">
+
+ <table width="100%">
+ <tr>
+ <th class="listtop"><translate>Save draft</translate></th>
+ </tr>
+ <tr height="5"></tr>
+
+ <tr>
+ <td><translate>Enter a description for this new draft.</translate></td>
+ </tr>
+
+ <tr>
+ <td>
+ <translate>Description</translate>:
+ <input name="draft_description">
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <input type="submit" class="submit" name="action" value="<translate>Save draft</translate>">
+ </td>
+ </tr>
+ </table>
+
+ </form>
+</body>
+</html>
--- /dev/null
+<script type="text/javascript" src="js/common.js"></script>
+<script type="text/javascript">
+ <!--
+ function setup_controls() {
+ fokus();
+ setupDateFormat('<TMPL_VAR myconfig_dateformat>', 'Falsches Datumsformat!');
+ setupPoints('<TMPL_VAR myconfig_numberformat>', 'Falsches Format');
+ }
+ -->
+</script>
+
+<body onLoad="setup_controls();">
+
+ <div class="listtop"><TMPL_VAR title></div>
+
+ <form method="post" name="search" action="dn.pl">
+
+ <table>
+ <tr>
+ <th align="right">Kunde</th>
+ <td colspan="3">
+ <TMPL_IF SHOW_CUSTOMER_SELECTION>
+ <select name="customer">
+ <option></option>
+ <TMPL_LOOP all_customer><option><TMPL_VAR name ESCAPE=HTML>--<TMPL_VAR id ESCAPE=HTML></option></TMPL_LOOP>
+ </select>
+ <TMPL_ELSE>
+ <input name=customer size=35>
+ </TMPL_IF>
+ </td>
+ </tr>
+
+ <TMPL_IF SHOW_DUNNING_LEVEL_SELECTION>
+ <tr>
+ <th align="right">Nächste Mahnstufe</th>
+ <td colspan="3">
+ <select name="dunning_level">
+ <option></option>
+ <TMPL_LOOP DUNNING><option value="<TMPL_VAR id ESCAPE=HTML>"><TMPL_VAR dunning_description ESCAPE=HTML></option></TMPL_LOOP>
+ </select>
+ </td>
+ </tr>
+ </TMPL_IF>
+
+ <TMPL_IF SHOW_DEPARTMENT_SELECTION>
+ <tr>
+ <th align="right">Abteilung</th>
+ <td colspan="3">
+ <select name="department">
+ <option></option>
+ <TMPL_LOOP all_departments><option><TMPL_VAR description ESCAPE=HTML>--<TMPL_VAR id ESCAPE=HTML></option></TMPL_LOOP>
+ </select>
+ </td>
+ </tr>
+ </TMPL_IF>
+
+ <tr>
+ <th align="right" nowrap>Rechnungsnummer</th>
+ <td colspan="3"><input name="invnumber" size="20"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>Auftragsnummer</th>
+ <td colspan="3"><input name="ordnumber" size="20"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>Bemerkungen</th>
+ <td colspan="3"><input name="notes" size="40"></td>
+ </tr>
+
+ <tr><td colspan="2"><hr size="3" noshade></td></tr>
+
+ <tr>
+ <th align="right" nowrap>Mindestbetrag</th>
+ <td><input name="minamount" size="6"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>Rechnungen zusammenfassen</th>
+ <td><input type="checkbox" value="1" name="groupinvoices" checked></td>
+ </tr>
+ </table>
+
+ <input type="hidden" name="nextsub" value="show_invoices">
+
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+
+ <br>
+ <input class="submit" type="submit" name="action" value="Weiter">
+
+ </form>
+
+</body>
+
+</html>
--- /dev/null
+<script type="text/javascript" src="js/common.js"></script>
+<script type="text/javascript">
+ <!--
+ function setup_controls() {
+ fokus();
+ setupDateFormat('<TMPL_VAR myconfig_dateformat>', '<translate>Wrong date format!</translate>');
+ setupPoints('<TMPL_VAR myconfig_numberformat>', '<translate>wrongformat</translate>');
+ }
+ -->
+</script>
+
+<body onLoad="setup_controls();">
+
+ <div class="listtop"><TMPL_VAR title></div>
+
+ <form method="post" name="search" action="dn.pl">
+
+ <table>
+ <tr>
+ <th align="right"><translate>Customer</translate></th>
+ <td colspan="3">
+ <TMPL_IF SHOW_CUSTOMER_SELECTION>
+ <select name="customer">
+ <option></option>
+ <TMPL_LOOP all_customer><option><TMPL_VAR name ESCAPE=HTML>--<TMPL_VAR id ESCAPE=HTML></option></TMPL_LOOP>
+ </select>
+ <TMPL_ELSE>
+ <input name=customer size=35>
+ </TMPL_IF>
+ </td>
+ </tr>
+
+ <TMPL_IF SHOW_DUNNING_LEVEL_SELECTION>
+ <tr>
+ <th align="right"><translate>Next Dunning Level</translate></th>
+ <td colspan="3">
+ <select name="dunning_level">
+ <option></option>
+ <TMPL_LOOP DUNNING><option value="<TMPL_VAR id ESCAPE=HTML>"><TMPL_VAR dunning_description ESCAPE=HTML></option></TMPL_LOOP>
+ </select>
+ </td>
+ </tr>
+ </TMPL_IF>
+
+ <TMPL_IF SHOW_DEPARTMENT_SELECTION>
+ <tr>
+ <th align="right"><translate>Department</translate></th>
+ <td colspan="3">
+ <select name="department">
+ <option></option>
+ <TMPL_LOOP all_departments><option><TMPL_VAR description ESCAPE=HTML>--<TMPL_VAR id ESCAPE=HTML></option></TMPL_LOOP>
+ </select>
+ </td>
+ </tr>
+ </TMPL_IF>
+
+ <tr>
+ <th align="right" nowrap><translate>Invoice Number</translate></th>
+ <td colspan="3"><input name="invnumber" size="20"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap><translate>Order Number</translate></th>
+ <td colspan="3"><input name="ordnumber" size="20"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap><translate>Notes</translate></th>
+ <td colspan="3"><input name="notes" size="40"></td>
+ </tr>
+
+ <tr><td colspan="2"><hr size="3" noshade></td></tr>
+
+ <tr>
+ <th align="right" nowrap><translate>Minimum Amount</translate></th>
+ <td><input name="minamount" size="6"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap><translate>Group Invoices</translate></th>
+ <td><input type="checkbox" value="1" name="groupinvoices" checked></td>
+ </tr>
+ </table>
+
+ <input type="hidden" name="nextsub" value="show_invoices">
+
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+
+ <br>
+ <input class="submit" type="submit" name="action" value="<translate>Continue</translate>">
+
+ </form>
+
+</body>
+
+</html>
--- /dev/null
+[% USE HTML %]<body>
+ <script type="text/javascript" src="js/common.js"></script>
+ <script type="text/javascript" src="js/dunning.js"></script>
+
+ <div class="listtop" width="100%">[% title %]</div>
+
+ <form method="post" action="dn.pl" name="Form">
+ <table>
+ <tr height="5"></tr>
+
+ <tr>
+ <th class="listheading">Mahnlevel</th>
+ <th class="listheading">Mahnstufenbeschreibung</th>
+ <th class="listheading">Aktiviert?</th>
+ <th class="listheading">eMail-Versand?</th>
+<!-- <th class="listheading">Auto. Versand?</th> -->
+ <th class="listheading">Rechnung erstellen?</th>
+ <th class="listheading">Fristsetzung</th>
+ <th class="listheading">Fällikeitsdatum +Tage</th>
+ <th class="listheading">Gebühr</th>
+ <th class="listheading">Zinssatz</th>
+ <th class="listheading">Druckvorlage</th>
+ </tr>
+
+ [% SET odd = '1' %][% USE DUNNING_it = Iterator(DUNNING) %][% FOREACH row = DUNNING_it %]
+ <tr valign="top" class="listrow[% IF odd %]1[% SET odd = '0' %][% ELSE %]0[% SET odd = '1' %][% END %]">
+ <td>
+ <input type="hidden" name="dunning_level_[% DUNNING_it.count %]" value="[% DUNNING_it.count %]">
+ <input type="hidden" name="id_[% DUNNING_it.count %]" value="[% HTML.escape(row.id) %]">
+ [% DUNNING_it.count %]
+ </td>
+
+ <td><input name="dunning_description_[% DUNNING_it.count %]" value="[% HTML.escape(row.dunning_description) %]"></td>
+ <td><input type="checkbox" name="active_[% DUNNING_it.count %]" value="1" [% IF row.active %]checked[% END %]></td>
+
+ <td>
+ <input type="checkbox" name="email_[% DUNNING_it.count %]" value="1" [% IF row.email %]checked[% END %]>
+ <button type="button" onclick="set_email_window('email_subject_[% DUNNING_it.count %]', 'email_body_[% DUNNING_it.count %]', 'email_attachment_[% DUNNING_it.count %]')">
+ L</button>
+ <input type="hidden" name="email_body_[% DUNNING_it.count %]" value="[% HTML.escape(row.email_body) %]">
+ <input type="hidden" name="email_subject_[% DUNNING_it.count %]" value="[% HTML.escape(row.email_subject) %]">
+ <input type="hidden" name="email_attachment_[% DUNNING_it.count %]" value="[% HTML.escape(row.email_attachment) %]">
+ </td>
+
+<!-- <td><input type="checkbox" name="auto_[% DUNNING_it.count %]" value="1" [% IF row.auto %]checked[% END %]></td> -->
+ <td><input type="checkbox" name="create_invoices_for_fees_[% DUNNING_it.count %]" value="1" [% IF row.create_invoices_for_fees %]checked[% END %]></td>
+ <td><input name="payment_terms_[% DUNNING_it.count %]" size="3" value="[% HTML.escape(row.payment_terms) %]"></td>
+ <td><input name="terms_[% DUNNING_it.count %]" size="3" value="[% HTML.escape(row.terms) %]"></td>
+ <td><input name="fee_[% DUNNING_it.count %]" size="5" value="[% HTML.escape(row.fee) %]"></td>
+ <td><input name="interest_rate_[% DUNNING_it.count %]" size="4" value="[% HTML.escape(row.interest_rate) %]">%</td>
+ <td><input name="template_[% DUNNING_it.count %]" value="[% HTML.escape(row.template) %]"></td>
+ </tr>
+ [% IF DUNNING_it.last %][% SET rowcount = DUNNING_it.size + 1 %][% END %]
+ [% END %]
+
+ <tr valign="top" class="listrow[% IF odd %]1[% ELSE %]0[% END %]">
+ <td>
+ <input type="hidden" name="dunning_level_[% rowcount %]" value="[% rowcount %]">
+ <input type="hidden" name="id_[% rowcount %]">
+ [% rowcount %]
+ </td>
+
+ <td><input name="dunning_description_[% rowcount %]"></td>
+ <td><input type="checkbox" name="active_[% rowcount %]" value="1" checked></td>
+
+ <td>
+ <input type="checkbox" name="email_[% rowcount %]" value="1" checked>
+ <button type="button" onclick="set_email_window('email_subject_[% rowcount %]', 'email_body_[% rowcount %]', 'email_attachment_[% rowcount %]')">
+ L</button>
+ <input type="hidden" name="email_body_[% rowcount %]">
+ <input type="hidden" name="email_subject_[% rowcount %]">
+ <input type="hidden" name="email_attachment_[% rowcount %]">
+ </td>
+
+<!-- <td><input type="checkbox" name="auto_[% rowcount %]" value="1" checked></td> -->
+ <td><input type="checkbox" name="create_invoices_for_fees_[% rowcount %]" value="1" checked></td>
+ <td><input name="payment_terms_[% rowcount %]" size="3"></td>
+ <td><input name="terms_[% rowcount %]" size="3"></td>
+ <td><input name="fee_[% rowcount %]" size="5"></td>
+ <td><input name="interest_rate_[% rowcount %]" size="4">%</td>
+ <td><input name="template_[% rowcount %]"></td>
+ </tr>
+ </table>
+
+ <input type="hidden" name="rowcount" value="[% HTML.escape(rowcount) %]">
+
+ <hr size="3" noshade>
+
+ <p>Wenn das automatische Erstellen einer Rechnung über Mahngebühren und Zinsen für ein Mahnlevel aktiviert ist, so werden die folgenden Konten für die Rechnung benutzt.</p>
+
+ <table>
+ <tr>
+ <th align="right">Konto für Gebühren</th>
+ <td>
+ <select name="AR_amount_fee">
+ [% FOREACH row = SELECT_AR_AMOUNT %]<option value="[% HTML.escape(row.id) %]" [% IF row.AR_amount_fee_selected %]selected[% END %]>[% HTML.escape(row.accno) %]--[% HTML.escape(row.description) %]</option>
+ [% END %]
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right">Konto für Zinsen</th>
+ <td>
+ <select name="AR_amount_interest">
+ [% FOREACH row = SELECT_AR_AMOUNT %]<option value="[% HTML.escape(row.id) %]" [% IF row.AR_amount_interest_selected %]selected[% END %]>[% HTML.escape(row.accno) %]--[% HTML.escape(row.description) %]</option>
+ [% END %]
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right">Buchen auf</th>
+ <td>
+ <select name="AR">
+ [% FOREACH row = SELECT_AR %]<option value="[% HTML.escape(row.id) %]" [% IF row.AR_selected %]selected[% END %]>[% HTML.escape(row.accno) %]--[% HTML.escape(row.description) %]</option>
+ [% END %]
+ </select>
+ </td>
+ </tr>
+ </table>
+
+ <hr size="3" noshade>
+
+ <input type="hidden" name="callback" value="[% HTML.escape(callback) %]">
+
+ <input type="hidden" name="login" value="[% HTML.escape(login) %]">
+ <input type="hidden" name="password" value="[% HTML.escape(password) %]">
+
+ <input class="submit" type="submit" name="action" value="Speichern">
+
+ </form>
+</body>
+
+</html>
--- /dev/null
+[% USE HTML %]<body>
+ <script type="text/javascript" src="js/common.js"></script>
+ <script type="text/javascript" src="js/dunning.js"></script>
+
+ <div class="listtop" width="100%">[% title %]</div>
+
+ <form method="post" action="dn.pl" name="Form">
+ <table>
+ <tr height="5"></tr>
+
+ <tr>
+ <th class="listheading"><translate>Dunning Level</translate></th>
+ <th class="listheading"><translate>Dunning Description</translate></th>
+ <th class="listheading"><translate>Active?</translate></th>
+ <th class="listheading"><translate>eMail Send?</translate></th>
+<!-- <th class="listheading"><translate>Auto Send?</translate></th> -->
+ <th class="listheading"><translate>Create invoice?</translate></th>
+ <th class="listheading"><translate>Fristsetzung</translate></th>
+ <th class="listheading"><translate>Duedate +Days</translate></th>
+ <th class="listheading"><translate>Fee</translate></th>
+ <th class="listheading"><translate>Interest Rate</translate></th>
+ <th class="listheading"><translate>Template</translate></th>
+ </tr>
+
+ [% SET odd = '1' %][% USE DUNNING_it = Iterator(DUNNING) %][% FOREACH row = DUNNING_it %]
+ <tr valign="top" class="listrow[% IF odd %]1[% SET odd = '0' %][% ELSE %]0[% SET odd = '1' %][% END %]">
+ <td>
+ <input type="hidden" name="dunning_level_[% DUNNING_it.count %]" value="[% DUNNING_it.count %]">
+ <input type="hidden" name="id_[% DUNNING_it.count %]" value="[% HTML.escape(row.id) %]">
+ [% DUNNING_it.count %]
+ </td>
+
+ <td><input name="dunning_description_[% DUNNING_it.count %]" value="[% HTML.escape(row.dunning_description) %]"></td>
+ <td><input type="checkbox" name="active_[% DUNNING_it.count %]" value="1" [% IF row.active %]checked[% END %]></td>
+
+ <td>
+ <input type="checkbox" name="email_[% DUNNING_it.count %]" value="1" [% IF row.email %]checked[% END %]>
+ <button type="button" onclick="set_email_window('email_subject_[% DUNNING_it.count %]', 'email_body_[% DUNNING_it.count %]', 'email_attachment_[% DUNNING_it.count %]')">
+ <translate>L</translate></button>
+ <input type="hidden" name="email_body_[% DUNNING_it.count %]" value="[% HTML.escape(row.email_body) %]">
+ <input type="hidden" name="email_subject_[% DUNNING_it.count %]" value="[% HTML.escape(row.email_subject) %]">
+ <input type="hidden" name="email_attachment_[% DUNNING_it.count %]" value="[% HTML.escape(row.email_attachment) %]">
+ </td>
+
+<!-- <td><input type="checkbox" name="auto_[% DUNNING_it.count %]" value="1" [% IF row.auto %]checked[% END %]></td> -->
+ <td><input type="checkbox" name="create_invoices_for_fees_[% DUNNING_it.count %]" value="1" [% IF row.create_invoices_for_fees %]checked[% END %]></td>
+ <td><input name="payment_terms_[% DUNNING_it.count %]" size="3" value="[% HTML.escape(row.payment_terms) %]"></td>
+ <td><input name="terms_[% DUNNING_it.count %]" size="3" value="[% HTML.escape(row.terms) %]"></td>
+ <td><input name="fee_[% DUNNING_it.count %]" size="5" value="[% HTML.escape(row.fee) %]"></td>
+ <td><input name="interest_rate_[% DUNNING_it.count %]" size="4" value="[% HTML.escape(row.interest_rate) %]">%</td>
+ <td><input name="template_[% DUNNING_it.count %]" value="[% HTML.escape(row.template) %]"></td>
+ </tr>
+ [% IF DUNNING_it.last %][% SET rowcount = DUNNING_it.size + 1 %][% END %]
+ [% END %]
+
+ <tr valign="top" class="listrow[% IF odd %]1[% ELSE %]0[% END %]">
+ <td>
+ <input type="hidden" name="dunning_level_[% rowcount %]" value="[% rowcount %]">
+ <input type="hidden" name="id_[% rowcount %]">
+ [% rowcount %]
+ </td>
+
+ <td><input name="dunning_description_[% rowcount %]"></td>
+ <td><input type="checkbox" name="active_[% rowcount %]" value="1" checked></td>
+
+ <td>
+ <input type="checkbox" name="email_[% rowcount %]" value="1" checked>
+ <button type="button" onclick="set_email_window('email_subject_[% rowcount %]', 'email_body_[% rowcount %]', 'email_attachment_[% rowcount %]')">
+ <translate>L</translate></button>
+ <input type="hidden" name="email_body_[% rowcount %]">
+ <input type="hidden" name="email_subject_[% rowcount %]">
+ <input type="hidden" name="email_attachment_[% rowcount %]">
+ </td>
+
+<!-- <td><input type="checkbox" name="auto_[% rowcount %]" value="1" checked></td> -->
+ <td><input type="checkbox" name="create_invoices_for_fees_[% rowcount %]" value="1" checked></td>
+ <td><input name="payment_terms_[% rowcount %]" size="3"></td>
+ <td><input name="terms_[% rowcount %]" size="3"></td>
+ <td><input name="fee_[% rowcount %]" size="5"></td>
+ <td><input name="interest_rate_[% rowcount %]" size="4">%</td>
+ <td><input name="template_[% rowcount %]"></td>
+ </tr>
+ </table>
+
+ <input type="hidden" name="rowcount" value="[% HTML.escape(rowcount) %]">
+
+ <hr size="3" noshade>
+
+ <p><translate>If the automatic creation of invoices for fees and
+ interest is switched on for a dunning level then the following
+ accounts will be used for the invoice.</translate></p>
+
+ <table>
+ <tr>
+ <th align="right"><translate>Account for fees</translate></th>
+ <td>
+ <select name="AR_amount_fee">
+ [% FOREACH row = SELECT_AR_AMOUNT %]<option value="[% HTML.escape(row.id) %]" [% IF row.AR_amount_fee_selected %]selected[% END %]>[% HTML.escape(row.accno) %]--[% HTML.escape(row.description) %]</option>
+ [% END %]
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right"><translate>Account for interest</translate></th>
+ <td>
+ <select name="AR_amount_interest">
+ [% FOREACH row = SELECT_AR_AMOUNT %]<option value="[% HTML.escape(row.id) %]" [% IF row.AR_amount_interest_selected %]selected[% END %]>[% HTML.escape(row.accno) %]--[% HTML.escape(row.description) %]</option>
+ [% END %]
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right"><translate>Record in</translate></th>
+ <td>
+ <select name="AR">
+ [% FOREACH row = SELECT_AR %]<option value="[% HTML.escape(row.id) %]" [% IF row.AR_selected %]selected[% END %]>[% HTML.escape(row.accno) %]--[% HTML.escape(row.description) %]</option>
+ [% END %]
+ </select>
+ </td>
+ </tr>
+ </table>
+
+ <hr size="3" noshade>
+
+ <input type="hidden" name="callback" value="[% HTML.escape(callback) %]">
+
+ <input type="hidden" name="login" value="[% HTML.escape(login) %]">
+ <input type="hidden" name="password" value="[% HTML.escape(password) %]">
+
+ <input class="submit" type="submit" name="action" value="<translate>Save</translate>">
+
+ </form>
+</body>
+
+</html>
--- /dev/null
+<body onLoad="<TMPL_VAR onload>">
+
+ <script type="text/javascript" src="js/common.js"></script>
+
+ <form method="post" name="search" action="dn.pl">
+
+ <div class="listtop"><TMPL_VAR title></div>
+
+ <table width="100%">
+ <tr height="5"></tr>
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <th align="right">Kunde</th>
+ <td colspan="3">
+ <TMPL_IF SHOW_CUSTOMER_DDBOX>
+ <select name="customer_id">
+ <option value=""></option>
+ <TMPL_LOOP ALL_CUSTOMERS><option value="<TMPL_VAR id ESCAPE=HTML>"><TMPL_VAR name ESCAPE=HTML></option>
+ </TMPL_LOOP>
+ </select>
+ <TMPL_ELSE>
+ <input name="customer" size="35">
+ </TMPL_IF>
+ </td>
+ </tr>
+
+ <TMPL_IF SHOW_DUNNING_LEVELS>
+ <tr>
+ <th align="right" nowrap>Nächste Mahnstufe</th>
+ <td colspan="3">
+ <select name="dunning_level">
+ <option value=""></option>
+ <TMPL_LOOP DUNNING><option value="<TMPL_VAR id ESCAPE=HTML>"><TMPL_VAR dunning_description ESCAPE=HTML></option>
+ </TMPL_LOOP>
+ </select>
+ </td>
+ </tr>
+ </TMPL_IF>
+
+ <TMPL_IF SHOW_DEPARTMENT_DDBOX>
+ <tr>
+ <th align="right" nowrap>Abteilung</th>
+ <td colspan="3">
+ <select name="department_id">
+ <option value=""></option>
+ <TMPL_LOOP ALL_DEPARTMENTS><option value="<TMPL_VAR id ESCAPE=HTML>"><TMPL_VAR description ESCAPE=HTML></option>
+ </TMPL_LOOP>
+ </select>
+ </td>
+ </tr>
+ </TMPL_IF>
+
+ <tr>
+ <th align="right" nowrap>Rechnungsnummer</th>
+ <td colspan="3"><input name="invnumber" size="20"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>Auftragsnummer</th>
+ <td colspan="3"><input name="ordnumber" size="20"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>Bemerkungen</th>
+ <td colspan="3"><input name="notes" size="40"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>Rechnungen von</th>
+ <td>
+ <input name="transdatefrom" id="transdatefrom" size="11" title="<TMPL_VAR myconfig_dateformat" onBlur="check_right_date_format(this)">
+ <input type="button" name="transdatefrom" id="trigger1" value="?">
+ </td>
+ <th align="right" nowrap>An</th>
+ <td>
+ <input name="transdateto" id="transdateto" size="11" title="<TMPL_VAR myconfig_dateformat" onBlur="check_right_date_format(this)">
+ <input type="button" name="transdateto" id="trigger2" value="?">
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>Mahnungen von</th>
+ <td>
+ <input name="dunningfrom" id="dunningfrom" size="11" title="<TMPL_VAR myconfig_dateformat" onBlur="check_right_date_format(this)">
+ <input type="button" name="dunningfrom" id="trigger3" value="?">
+ </td>
+ <th align="right" nowrap>An</th>
+ <td>
+ <input name="dunningto" id="dunningto" size="11" title="<TMPL_VAR myconfig_dateformat" onBlur="check_right_date_format(this)">
+ <input type="button" name="dunningto" id="trigger4" value="?">
+ </td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+
+ <tr><td><hr size="3" noshade></td></tr>
+
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <th align="right" nowrap>Alte Mahnungen anzeigen</th>
+ <td><input type="checkbox" value="1" name="showold"></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+
+ <input type="hidden" name="nextsub" value="show_dunning">
+
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+
+ <br>
+
+ <input class="submit" type="submit" name="action" value="Weiter">
+
+ </form>
+
+ <script type="text/javascript">
+ <!--
+ Calendar.setup({ inputField : "transdatefrom", ifFormat :"<TMPL_VAR myconfig_jsc_dateformat>", align : "BR", button : "trigger1" });
+ Calendar.setup({ inputField : "transdateto", ifFormat :"<TMPL_VAR myconfig_jsc_dateformat>", align : "BR", button : "trigger2" });
+ Calendar.setup({ inputField : "dunningfrom", ifFormat :"<TMPL_VAR myconfig_jsc_dateformat>", align : "BR", button : "trigger3" });
+ Calendar.setup({ inputField : "dunningto", ifFormat :"<TMPL_VAR myconfig_jsc_dateformat>", align : "BR", button : "trigger4" });
+ -->
+ </script>
+
+</body>
+
+</html>
--- /dev/null
+<body onLoad="<TMPL_VAR onload>">
+
+ <script type="text/javascript" src="js/common.js"></script>
+
+ <form method="post" name="search" action="dn.pl">
+
+ <div class="listtop"><TMPL_VAR title></div>
+
+ <table width="100%">
+ <tr height="5"></tr>
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <th align="right"><translate>Customer</translate></th>
+ <td colspan="3">
+ <TMPL_IF SHOW_CUSTOMER_DDBOX>
+ <select name="customer_id">
+ <option value=""></option>
+ <TMPL_LOOP ALL_CUSTOMERS><option value="<TMPL_VAR id ESCAPE=HTML>"><TMPL_VAR name ESCAPE=HTML></option>
+ </TMPL_LOOP>
+ </select>
+ <TMPL_ELSE>
+ <input name="customer" size="35">
+ </TMPL_IF>
+ </td>
+ </tr>
+
+ <TMPL_IF SHOW_DUNNING_LEVELS>
+ <tr>
+ <th align="right" nowrap><translate>Next Dunning Level</translate></th>
+ <td colspan="3">
+ <select name="dunning_level">
+ <option value=""></option>
+ <TMPL_LOOP DUNNING><option value="<TMPL_VAR id ESCAPE=HTML>"><TMPL_VAR dunning_description ESCAPE=HTML></option>
+ </TMPL_LOOP>
+ </select>
+ </td>
+ </tr>
+ </TMPL_IF>
+
+ <TMPL_IF SHOW_DEPARTMENT_DDBOX>
+ <tr>
+ <th align="right" nowrap><translate>Department</translate></th>
+ <td colspan="3">
+ <select name="department_id">
+ <option value=""></option>
+ <TMPL_LOOP ALL_DEPARTMENTS><option value="<TMPL_VAR id ESCAPE=HTML>"><TMPL_VAR description ESCAPE=HTML></option>
+ </TMPL_LOOP>
+ </select>
+ </td>
+ </tr>
+ </TMPL_IF>
+
+ <tr>
+ <th align="right" nowrap><translate>Invoice Number</translate></th>
+ <td colspan="3"><input name="invnumber" size="20"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap><translate>Order Number</translate></th>
+ <td colspan="3"><input name="ordnumber" size="20"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap><translate>Notes</translate></th>
+ <td colspan="3"><input name="notes" size="40"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap><translate>Invdate from</translate></th>
+ <td>
+ <input name="transdatefrom" id="transdatefrom" size="11" title="<TMPL_VAR myconfig_dateformat" onBlur="check_right_date_format(this)">
+ <input type="button" name="transdatefrom" id="trigger1" value="?">
+ </td>
+ <th align="right" nowrap><translate>To</translate></th>
+ <td>
+ <input name="transdateto" id="transdateto" size="11" title="<TMPL_VAR myconfig_dateformat" onBlur="check_right_date_format(this)">
+ <input type="button" name="transdateto" id="trigger2" value="?">
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap><translate>Dunning Date from</translate></th>
+ <td>
+ <input name="dunningfrom" id="dunningfrom" size="11" title="<TMPL_VAR myconfig_dateformat" onBlur="check_right_date_format(this)">
+ <input type="button" name="dunningfrom" id="trigger3" value="?">
+ </td>
+ <th align="right" nowrap><translate>To</translate></th>
+ <td>
+ <input name="dunningto" id="dunningto" size="11" title="<TMPL_VAR myconfig_dateformat" onBlur="check_right_date_format(this)">
+ <input type="button" name="dunningto" id="trigger4" value="?">
+ </td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+
+ <tr><td><hr size="3" noshade></td></tr>
+
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <th align="right" nowrap><translate>Show old dunnings</translate></th>
+ <td><input type="checkbox" value="1" name="showold"></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+
+ <input type="hidden" name="nextsub" value="show_dunning">
+
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+
+ <br>
+
+ <input class="submit" type="submit" name="action" value="<translate>Continue</translate>">
+
+ </form>
+
+ <script type="text/javascript">
+ <!--
+ Calendar.setup({ inputField : "transdatefrom", ifFormat :"<TMPL_VAR myconfig_jsc_dateformat>", align : "BR", button : "trigger1" });
+ Calendar.setup({ inputField : "transdateto", ifFormat :"<TMPL_VAR myconfig_jsc_dateformat>", align : "BR", button : "trigger2" });
+ Calendar.setup({ inputField : "dunningfrom", ifFormat :"<TMPL_VAR myconfig_jsc_dateformat>", align : "BR", button : "trigger3" });
+ Calendar.setup({ inputField : "dunningto", ifFormat :"<TMPL_VAR myconfig_jsc_dateformat>", align : "BR", button : "trigger4" });
+ -->
+ </script>
+
+</body>
+
+</html>
<body <TMPL_IF NAME=onload>onload="<TMPL_VAR NAME=onload>"</TMPL_IF>>
+ <script type="text/javascript">
+ <!--
+ function email_updated() {
+ window.opener.document.getElementsByName(document.Form.input_subject.value)[0].value = document.getElementsByName("email_subject")[0].value;
+ window.opener.document.getElementsByName(document.Form.input_body.value)[0].value = document.getElementsByName("email_body")[0].value;
+ window.opener.document.getElementsByName(document.Form.input_attachment.value)[0].value = document.getElementsByName("email_attachment")[0].value; self.close();
+ }
+ -->
+ </script>
+
<form name="Form">
- <input type="hidden" name="input_subject" value="<TMPL_VAR NAME=input_subject ESCAPE=HTML>">
- <input type="hidden" name="input_body" value="<TMPL_VAR NAME=input_body ESCAPE=HTML>">
- <input type="hidden" name="input_attachment" value="<TMPL_VAR NAME=input_attachment ESCAPE=HTML>">
+ <input type="hidden" name="input_subject" value="<TMPL_VAR input_subject ESCAPE=HTML>">
+ <input type="hidden" name="input_body" value="<TMPL_VAR input_body ESCAPE=HTML>">
+ <input type="hidden" name="input_attachment" value="<TMPL_VAR input_attachment ESCAPE=HTML>">
+
+ <div class="listtop" width="100%"><TMPL_VAR title></div>
<table width="100%">
<tr>
- <th colspan=2 class="listtop"><TMPL_VAR NAME=title></th>
+ <td valign="top">Betreff:</td>
+ <td valign="top"><input id="email_subject" name="email_subject" size="40" value="<TMPL_VAR email_subject ESCAPE=HTML>"></td>
</tr>
+
<tr>
- <td>Betreff:</td>
- <td><input id="email_subject" name="email_subject" value="<TMPL_VAR NAME=email_subject ESCAPE=HTML>">
- </td>
+ <td valign="top">Text:</td>
+ <td valign="top"><textarea id="email_body" name="email_body" rows="20" cols="70" wrap="soft"><TMPL_VAR email_body ESCAPE=HTML></textarea></td>
</tr>
- <tr>
- <td>Text:</td>
- <td>
-<textarea id="email_body" name="email_body" rows=20 cols=70 wrap=soft><TMPL_VAR NAME=email_body ESCAPE=HTML></textarea>
- </td>
- </tr>
<tr>
- <td>PDF anhängen</td>
- <td><input id="email_attachment" type=checkbox name="email_attachment" value=1 "<TMPL_VAR NAME=email_attachment ESCAPE=HTML>">
- </td>
- </tr>
+ <td valign="top">PDF anhängen</td>
+ <td valign="top"><input id="email_attachment" type="checkbox" name="email_attachment" value="1" <TMPL_IF email_attachment>checked</TMPL_IF>></td>
+ </tr>
</table>
- <button type="button" onclick="email_updated()">Übernehmen</button></td>
- </form>
- <script type="text/javascript">
- <!--
- function email_updated() {
- window.opener.document.getElementsByName(document.Form.input_subject.value)[0].value = document.getElementsByName("email_subject")[0].value;
- window.opener.document.getElementsByName(document.Form.input_body.value)[0].value = document.getElementsByName("email_body")[0].value;
- window.opener.document.getElementsByName(document.Form.input_attachment.value)[0].value = document.getElementsByName("email_attachment")[0].value; self.close();
- }
- </script>
+ <button type="button" onclick="email_updated()">Speichern und schließen</button>
+ </form>
</body>
</html>
<body <TMPL_IF NAME=onload>onload="<TMPL_VAR NAME=onload>"</TMPL_IF>>
+ <script type="text/javascript">
+ <!--
+ function email_updated() {
+ window.opener.document.getElementsByName(document.Form.input_subject.value)[0].value = document.getElementsByName("email_subject")[0].value;
+ window.opener.document.getElementsByName(document.Form.input_body.value)[0].value = document.getElementsByName("email_body")[0].value;
+ window.opener.document.getElementsByName(document.Form.input_attachment.value)[0].value = document.getElementsByName("email_attachment")[0].value; self.close();
+ }
+ -->
+ </script>
+
<form name="Form">
- <input type="hidden" name="input_subject" value="<TMPL_VAR NAME=input_subject ESCAPE=HTML>">
- <input type="hidden" name="input_body" value="<TMPL_VAR NAME=input_body ESCAPE=HTML>">
- <input type="hidden" name="input_attachment" value="<TMPL_VAR NAME=input_attachment ESCAPE=HTML>">
+ <input type="hidden" name="input_subject" value="<TMPL_VAR input_subject ESCAPE=HTML>">
+ <input type="hidden" name="input_body" value="<TMPL_VAR input_body ESCAPE=HTML>">
+ <input type="hidden" name="input_attachment" value="<TMPL_VAR input_attachment ESCAPE=HTML>">
+
+ <div class="listtop" width="100%"><TMPL_VAR title></div>
<table width="100%">
<tr>
- <th colspan=2 class="listtop"><TMPL_VAR NAME=title></th>
+ <td valign="top"><translate>Subject:</translate></td>
+ <td valign="top"><input id="email_subject" name="email_subject" size="40" value="<TMPL_VAR email_subject ESCAPE=HTML>"></td>
</tr>
+
<tr>
- <td><translate>Subject:</translate></td>
- <td><input id="email_subject" name="email_subject" value="<TMPL_VAR NAME=email_subject ESCAPE=HTML>">
- </td>
+ <td valign="top"><translate>Body:</translate></td>
+ <td valign="top"><textarea id="email_body" name="email_body" rows="20" cols="70" wrap="soft"><TMPL_VAR email_body ESCAPE=HTML></textarea></td>
</tr>
- <tr>
- <td><translate>Body:</translate></td>
- <td>
-<textarea id="email_body" name="email_body" rows=20 cols=70 wrap=soft><TMPL_VAR NAME=email_body ESCAPE=HTML></textarea>
- </td>
- </tr>
<tr>
- <td><translate>Attach PDF:</translate></td>
- <td><input id="email_attachment" type=checkbox name="email_attachment" value=1 "<TMPL_VAR NAME=email_attachment ESCAPE=HTML>">
- </td>
- </tr>
+ <td valign="top"><translate>Attach PDF:</translate></td>
+ <td valign="top"><input id="email_attachment" type="checkbox" name="email_attachment" value="1" <TMPL_IF email_attachment>checked</TMPL_IF>></td>
+ </tr>
</table>
- <button type="button" onclick="email_updated()"><translate>Close</translate></button></td>
- </form>
- <script type="text/javascript">
- <!--
- function email_updated() {
- window.opener.document.getElementsByName(document.Form.input_subject.value)[0].value = document.getElementsByName("email_subject")[0].value;
- window.opener.document.getElementsByName(document.Form.input_body.value)[0].value = document.getElementsByName("email_body")[0].value;
- window.opener.document.getElementsByName(document.Form.input_attachment.value)[0].value = document.getElementsByName("email_attachment")[0].value; self.close();
- }
- </script>
+ <button type="button" onclick="email_updated()"><translate>Save and close</translate></button>
+ </form>
</body>
</html>
--- /dev/null
+ <input type="hidden" name="rowcount" value="<TMPL_VAR rowcount>">
+
+ <p><TMPL_VAR PRINT_OPTIONS></p>
+
+ <p>
+ Mahnungen<br>
+ <input type="hidden" name="print_nextsub" value="print_multiple">
+ <input type="submit" class="submit" name="action" value="Drucken">
+ </p>
+
+ </form>
--- /dev/null
+ <input type="hidden" name="rowcount" value="<TMPL_VAR rowcount>">
+
+ <p><TMPL_VAR PRINT_OPTIONS></p>
+
+ <p>
+ <translate>Dunnings</translate><br>
+ <input type="hidden" name="print_nextsub" value="print_multiple">
+ <input type="submit" class="submit" name="action" value="<translate>Print</translate>">
+ </p>
+
+ </form>
--- /dev/null
+ <script type="text/javascript" src="js/common.js"></script>
+ <script type="text/javascript" src="js/dunning.js"></script>
+
+ <form method="post" action="dn.pl">
+
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+
--- /dev/null
+ <script type="text/javascript" src="js/common.js"></script>
+ <script type="text/javascript" src="js/dunning.js"></script>
+
+ <form method="post" action="dn.pl">
+
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+
--- /dev/null
+<body>
+ <script type="text/javascript" src="js/checkbox_utils.js"></script>
+ <script type="text/javascript" src="js/common.js"></script>
+ <script type="text/javascript" src="js/dunning.js"></script>
+
+ <div class="listtop" width="100%"><TMPL_VAR title></div>
+
+ <p>Die Spalten "Zahlbar bis", "Kumulierte Gebühren" und "Zinsen" zeigen Daten der letzten für diese Rechnung erzeugten Mahnung.</p>
+
+ <form name="Form" method="post" action="dn.pl">
+
+ <table width="100%">
+ <th class="listheading" colspan="2">Aktuelles / Nächstes Mahnlevel</th>
+
+ <th class="listheading">
+ <input type="checkbox" name="selectall_active" id="selectall_active" onclick="checkbox_check_all('selectall_active', 'active_', 1, <TMPL_VAR rowcount>);">
+ <label for="selectall_active">Aktiviert?</label>
+ </th>
+
+ <th class="listheading">
+ <input type="checkbox" name="selectall_email" id="selectall_email" onclick="checkbox_check_all('selectall_email', 'email_', 1, <TMPL_VAR rowcount>);">
+ <label for="selectall_email">eMail?</label>
+ </th>
+
+ <th class="listheading">Kundenname</th>
+ <th class="listheading">Rg. Nr.</th>
+ <th class="listheading">Rechnungsdatum</th>
+ <th class="listheading">Rg. Fälligkeit</th>
+ <th class="listheading">Betrag</th>
+ <th class="listheading">Zahlbar bis</th>
+ <th class="listheading">Kumulierte Gebühren</th>
+ <th class="listheading">Zinsen</th>
+
+ <!-- Ausgabe der einzelnen Zeilen -->
+
+ <TMPL_LOOP DUNNINGS>
+ <tr class="listrow<TMPL_IF __odd__>1<TMPL_ELSE>0</TMPL_IF>">
+
+ <td>
+ <input type="hidden" name="inv_id_<TMPL_VAR __counter__>" size="2" value="<TMPL_VAR id ESCAPE=HTML>">
+ <input type="hidden" name="customer_id_<TMPL_VAR __counter__>" size="2" value="<TMPL_VAR customer_id ESCAPE=HTML>">
+ <TMPL_IF dunning_level><TMPL_VAR dunning_level ESCAPE=HTML><TMPL_ELSE> </TMPL_IF>
+ </td>
+
+ <td>
+ <select name="next_dunning_config_id_<TMPL_VAR __counter__>">
+ <TMPL_LOOP DUNNING_CONFIG><option value="<TMPL_VAR id ESCAPE=HTML>" <TMPL_IF SELECTED>selected</TMPL_IF>><TMPL_VAR dunning_description ESCAPE=HTML></option></TMPL_LOOP>
+ </select>
+ </td>
+
+ <td><input type="checkbox" name="active_<TMPL_VAR __counter__>" value="1" <TMPL_IF active>checked</TMPL_IF>></td>
+ <td><input type="checkbox" name="email_<TMPL_VAR __counter__>" value="1" <TMPL_IF email>checked</TMPL_IF>></td>
+ <td><input type="hidden" name="customername_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR customername ESCAPE=HTML>"><TMPL_VAR customername ESCAPE=HTML></td>
+ <td><input type="hidden" name="invnumber_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR invnumber ESCAPE=HTML>"><TMPL_VAR invnumber ESCAPE=HTML></td>
+ <td><input type="hidden" name="invdate_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR transdate ESCAPE=HTML>"><TMPL_VAR transdate ESCAPE=HTML></td>
+ <td><input type="hidden" name="inv_duedate_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR duedate ESCAPE=HTML>"><TMPL_VAR duedate ESCAPE=HTML></td>
+ <td align="right"><input type="hidden" name="amount_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR amount ESCAPE=HTML>"><TMPL_VAR amount ESCAPE=HTML></td>
+ <td><TMPL_VAR next_duedate ESCAPE=HTML></td>
+ <td align="right"><input type="hidden" name="fee_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR fee ESCAPE=HTML>"><TMPL_VAR fee ESCAPE=HTML></td>
+ <td align="right"><input type="hidden" name="interest_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR interest ESCAPE=HTML>"><TMPL_VAR interest ESCAPE=HTML></td>
+ </tr>
+ </TMPL_LOOP>
+ </table>
+
+ <hr size=3 noshade>
+
+ <TMPL_VAR PRINT_OPTIONS>
+
+ <br>
+
+ <input name="rowcount" type="hidden" value="<TMPL_VAR rowcount ESCAPE=HTML>">
+ <input name="groupinvoices" type="hidden" value="<TMPL_VAR groupinvoices ESCAPE=HTML>">
+
+ <input name="callback" type="hidden" value="<TMPL_VAR callback ESCAPE=HTML>">
+ <input name="nextsub" type="hidden" value="save_dunning">
+
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+ <input type="hidden" name="action" value="Weiter">
+
+ <input type="submit" name="dummy" value="Weiter"
+ <TMPL_UNLESS DEBUG_DUNNING>onclick="this.disabled=true; this.value='Der Mahnprozess ist gestartet.'; document.Form.submit()"</TMPL_UNLESS>>
+
+ </form>
+</body>
+</html>
--- /dev/null
+<body>
+ <script type="text/javascript" src="js/checkbox_utils.js"></script>
+ <script type="text/javascript" src="js/common.js"></script>
+ <script type="text/javascript" src="js/dunning.js"></script>
+
+ <div class="listtop" width="100%"><TMPL_VAR title></div>
+
+ <p><translate>The columns "Dunning Duedate", "Total
+ Fees" and "Interest" show data for the previous
+ dunning created for this invoice.</translate></p>
+
+ <form name="Form" method="post" action="dn.pl">
+
+ <table width="100%">
+ <th class="listheading" colspan="2"><translate>Current / Next Level</translate></th>
+
+ <th class="listheading">
+ <input type="checkbox" name="selectall_active" id="selectall_active" onclick="checkbox_check_all('selectall_active', 'active_', 1, <TMPL_VAR rowcount>);">
+ <label for="selectall_active"><translate>Active?</translate></label>
+ </th>
+
+ <th class="listheading">
+ <input type="checkbox" name="selectall_email" id="selectall_email" onclick="checkbox_check_all('selectall_email', 'email_', 1, <TMPL_VAR rowcount>);">
+ <label for="selectall_email"><translate>eMail?</translate></label>
+ </th>
+
+ <th class="listheading"><translate>Customername</translate></th>
+ <th class="listheading"><translate>Invno.</translate></th>
+ <th class="listheading"><translate>Invdate</translate></th>
+ <th class="listheading"><translate>Inv. Duedate</translate></th>
+ <th class="listheading"><translate>Amount</translate></th>
+ <th class="listheading"><translate>Dunning Duedate</translate></th>
+ <th class="listheading"><translate>Total Fees</translate></th>
+ <th class="listheading"><translate>Interest</translate></th>
+
+ <!-- Ausgabe der einzelnen Zeilen -->
+
+ <TMPL_LOOP DUNNINGS>
+ <tr class="listrow<TMPL_IF __odd__>1<TMPL_ELSE>0</TMPL_IF>">
+
+ <td>
+ <input type="hidden" name="inv_id_<TMPL_VAR __counter__>" size="2" value="<TMPL_VAR id ESCAPE=HTML>">
+ <input type="hidden" name="customer_id_<TMPL_VAR __counter__>" size="2" value="<TMPL_VAR customer_id ESCAPE=HTML>">
+ <TMPL_IF dunning_level><TMPL_VAR dunning_level ESCAPE=HTML><TMPL_ELSE> </TMPL_IF>
+ </td>
+
+ <td>
+ <select name="next_dunning_config_id_<TMPL_VAR __counter__>">
+ <TMPL_LOOP DUNNING_CONFIG><option value="<TMPL_VAR id ESCAPE=HTML>" <TMPL_IF SELECTED>selected</TMPL_IF>><TMPL_VAR dunning_description ESCAPE=HTML></option></TMPL_LOOP>
+ </select>
+ </td>
+
+ <td><input type="checkbox" name="active_<TMPL_VAR __counter__>" value="1" <TMPL_IF active>checked</TMPL_IF>></td>
+ <td><input type="checkbox" name="email_<TMPL_VAR __counter__>" value="1" <TMPL_IF email>checked</TMPL_IF>></td>
+ <td><input type="hidden" name="customername_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR customername ESCAPE=HTML>"><TMPL_VAR customername ESCAPE=HTML></td>
+ <td><input type="hidden" name="invnumber_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR invnumber ESCAPE=HTML>"><TMPL_VAR invnumber ESCAPE=HTML></td>
+ <td><input type="hidden" name="invdate_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR transdate ESCAPE=HTML>"><TMPL_VAR transdate ESCAPE=HTML></td>
+ <td><input type="hidden" name="inv_duedate_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR duedate ESCAPE=HTML>"><TMPL_VAR duedate ESCAPE=HTML></td>
+ <td align="right"><input type="hidden" name="amount_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR amount ESCAPE=HTML>"><TMPL_VAR amount ESCAPE=HTML></td>
+ <td><TMPL_VAR next_duedate ESCAPE=HTML></td>
+ <td align="right"><input type="hidden" name="fee_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR fee ESCAPE=HTML>"><TMPL_VAR fee ESCAPE=HTML></td>
+ <td align="right"><input type="hidden" name="interest_<TMPL_VAR __counter__>" size="6" value="<TMPL_VAR interest ESCAPE=HTML>"><TMPL_VAR interest ESCAPE=HTML></td>
+ </tr>
+ </TMPL_LOOP>
+ </table>
+
+ <hr size=3 noshade>
+
+ <TMPL_VAR PRINT_OPTIONS>
+
+ <br>
+
+ <input name="rowcount" type="hidden" value="<TMPL_VAR rowcount ESCAPE=HTML>">
+ <input name="groupinvoices" type="hidden" value="<TMPL_VAR groupinvoices ESCAPE=HTML>">
+
+ <input name="callback" type="hidden" value="<TMPL_VAR callback ESCAPE=HTML>">
+ <input name="nextsub" type="hidden" value="save_dunning">
+
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+ <input type="hidden" name="action" value="<translate>Continue</translate>">
+
+ <input type="submit" name="dummy" value="<translate>Continue</translate>"
+ <TMPL_UNLESS DEBUG_DUNNING>onclick="this.disabled=true; this.value='<translate>The dunning process started</translate>'; document.Form.submit()"</TMPL_UNLESS>>
+
+ </form>
+</body>
+</html>
--- /dev/null
+<body onload="fokus()">
+
+<form name="Form" method="post" action="<TMPL_VAR script>">
+
+<table width="100%">
+ <tr class="listtop">
+
+ <th class="listtop"><TMPL_VAR title></th>
+ </tr>
+ <tr height="5"></tr>
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <th align="right" nowrap>An</th>
+
+ <td><input name="email" size="30" value="<TMPL_VAR email>"></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap>Cc</th>
+ <td><input name="cc" size="30" value="<TMPL_VAR cc>"></td>
+ </tr>
+<TMPL_IF SHOW_BCC>
+ <tr>
+ <th align="right" nowrap>Bcc</th>
+ <td><input name="bcc" size="30" value="<TMPL_VAR bcc>"></td>
+ </tr></TMPL_IF>
+ <tr>
+ <th align="right" nowrap>Betreff</th>
+
+ <td><input name="subject" size="30" value="<TMPL_VAR subject>"></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap>Name des Anhangs</th>
+ <td><input name="attachment_filename" size="30" value="<TMPL_VAR a_filename>"></td>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <th align="left" nowrap>Nachricht</th>
+ </tr>
+ <tr>
+ <td><textarea name="message" rows="15" cols="60" wrap="soft"><TMPL_VAR message></textarea></td>
+
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+
+<TMPL_VAR _print_options_>
+<TMPL_LOOP HIDDEN><input type="hidden" name="<TMPL_VAR name>" value="<TMPL_VAR value ESCAPE=HTML>"></TMPL_LOOP>
+
+ </td>
+ </tr>
+
+ <tr>
+ <td><hr size="3" noshade></td>
+ </tr>
+</table>
+
+<input type="hidden" name="nextsub" value="send_email">
+
+<br>
+<input name="action" class="submit" type="submit" value="Weiter">
+</form>
+
+</body>
+</html>
--- /dev/null
+<body onload="fokus()">
+
+<form name="Form" method="post" action="<TMPL_VAR script>">
+
+<table width="100%">
+ <tr class="listtop">
+
+ <th class="listtop"><TMPL_VAR title></th>
+ </tr>
+ <tr height="5"></tr>
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <th align="right" nowrap><translate>To</translate></th>
+
+ <td><input name="email" size="30" value="<TMPL_VAR email>"></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap><translate>Cc</translate></th>
+ <td><input name="cc" size="30" value="<TMPL_VAR cc>"></td>
+ </tr>
+<TMPL_IF SHOW_BCC>
+ <tr>
+ <th align="right" nowrap><translate>Bcc</translate></th>
+ <td><input name="bcc" size="30" value="<TMPL_VAR bcc>"></td>
+ </tr></TMPL_IF>
+ <tr>
+ <th align="right" nowrap><translate>Subject</translate></th>
+
+ <td><input name="subject" size="30" value="<TMPL_VAR subject>"></td>
+ </tr>
+ <tr>
+ <th align="right" nowrap><translate>Attachment name</translate></th>
+ <td><input name="attachment_filename" size="30" value="<TMPL_VAR a_filename>"></td>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <th align="left" nowrap><translate>Message</translate></th>
+ </tr>
+ <tr>
+ <td><textarea name="message" rows="15" cols="60" wrap="soft"><TMPL_VAR message></textarea></td>
+
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+
+<TMPL_VAR _print_options_>
+<TMPL_LOOP HIDDEN><input type="hidden" name="<TMPL_VAR name>" value="<TMPL_VAR value ESCAPE=HTML>"></TMPL_LOOP>
+
+ </td>
+ </tr>
+
+ <tr>
+ <td><hr size="3" noshade></td>
+ </tr>
+</table>
+
+<input type="hidden" name="nextsub" value="send_email">
+
+<br>
+<input name="action" class="submit" type="submit" value="<translate>Continue</translate>">
+</form>
+
+</body>
+</html>
--- /dev/null
+<table width=100% cellspacing=0 cellpadding=0>
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <td>
+ <TMPL_LOOP SELECTS><TMPL_IF show>
+ <select name="<TMPL_VAR sname>"><TMPL_LOOP DATA>
+ <option value="<TMPL_VAR value>" <TMPL_VAR selected>><TMPL_VAR oname></option></TMPL_LOOP></select>
+ </TMPL_IF></TMPL_LOOP>
+ </td>
+ <TMPL_IF display_copies>
+ <td>Kopien <input name=copies size=2 value=<TMPL_VAR copies>></td>
+ </TMPL_IF>
+ <TMPL_IF display_groupitems>
+ <td>Waren gruppieren</td>
+ <td><input name=groupitems type=checkbox class=checkbox <TMPL_VAR groupitems_checked>></td>
+ </TMPL_IF>
+ <TMPL_IF display_remove_draft>
+ <td>Entwurf löschen</td>
+ <td><input name=remove_draft type=checkbox class=checkbox <TMPL_VAR remove_draft_checked>></td>
+ </TMPL_IF>
+ </tr>
+ </table>
+ </td>
+ <td align=right>
+ <table><tr><th><TMPL_VAR status_msg></th></tr></table>
+ </td>
+ </tr>
+</table>
+
--- /dev/null
+<table width=100% cellspacing=0 cellpadding=0>
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <td>
+ <TMPL_LOOP SELECTS><TMPL_IF show>
+ <select name="<TMPL_VAR sname>"><TMPL_LOOP DATA>
+ <option value="<TMPL_VAR value>" <TMPL_VAR selected>><TMPL_VAR oname></option></TMPL_LOOP></select>
+ </TMPL_IF></TMPL_LOOP>
+ </td>
+ <TMPL_IF display_copies>
+ <td><translate>Copies</translate> <input name=copies size=2 value=<TMPL_VAR copies>></td>
+ </TMPL_IF>
+ <TMPL_IF display_groupitems>
+ <td><translate>Group Items</translate></td>
+ <td><input name=groupitems type=checkbox class=checkbox <TMPL_VAR groupitems_checked>></td>
+ </TMPL_IF>
+ <TMPL_IF display_remove_draft>
+ <td><translate>Remove Draft</translate></td>
+ <td><input name=remove_draft type=checkbox class=checkbox <TMPL_VAR remove_draft_checked>></td>
+ </TMPL_IF>
+ </tr>
+ </table>
+ </td>
+ <td align=right>
+ <table><tr><th><TMPL_VAR status_msg></th></tr></table>
+ </td>
+ </tr>
+</table>
+
<tr>
<td>
-<textarea id="longdescription" name="longdescription" rows=4 cols=30 wrap=soft><TMPL_VAR NAME=longdescription ESCAPE=HTML></textarea>
+<textarea id="longdescription" name="longdescription" rows="15" cols="45" wrap="soft"><TMPL_VAR NAME=longdescription ESCAPE=HTML></textarea>
</td>
</tr>
<tr>
<td>
-<textarea id="longdescription" name="longdescription" rows=4 cols=30 wrap=soft><TMPL_VAR NAME=longdescription ESCAPE=HTML></textarea>
+<textarea id="longdescription" name="longdescription" rows="15" cols="45" wrap="soft"><TMPL_VAR NAME=longdescription ESCAPE=HTML></textarea>
</td>
</tr>
--- /dev/null
+<form method="post" action="gl.pl">
+
+ <input name="callback" type="hidden" value="<TMPL_VAR callback ESCAPE=HTML>">
+
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+
+ <input class="submit" type="submit" name="action" value="Dialogbuchung">
+ <input class="submit" type="submit" name="action" value="Debitorenbuchung">
+ <input class="submit" type="submit" name="action" value="Kreditorenbuchung">
+ <input class="submit" type="submit" name="action" value="Rechnung">
+ <input class="submit" type="submit" name="action" value="Einkaufsrechnung">
+
+</form>
--- /dev/null
+<form method="post" action="gl.pl">
+
+ <input name="callback" type="hidden" value="<TMPL_VAR callback ESCAPE=HTML>">
+
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+
+ <input class="submit" type="submit" name="action" value="<translate>GL Transaction</translate>">
+ <input class="submit" type="submit" name="action" value="<translate>AR Transaction</translate>">
+ <input class="submit" type="submit" name="action" value="<translate>AP Transaction</translate>">
+ <input class="submit" type="submit" name="action" value="<translate>Sales Invoice</translate>">
+ <input class="submit" type="submit" name="action" value="<translate>Vendor Invoice</translate>">
+
+</form>
--- /dev/null
+[% USE HTML %]<form method="post" action="ic.pl">
+
+ <input name="callback" type="hidden" value="[% HTML.escape(callback) %]">
+
+ <input type="hidden" name="item" value="[% HTML.escape(searchitems) %]">
+
+ <input type="hidden" name="login" value="[% HTML.escape(login) %]">
+ <input type="hidden" name="password" value="[% HTML.escape(password) %]">
+
+ [% SWITCH searchitems %]
+ [% CASE 'part' %]Neue Ware
+ [% CASE 'service' %]Neue Dienstleistung
+ [% CASE 'assembly' %]Neues Erzeugnis
+ [% END %]
+ <br>
+ <input class="submit" type="submit" name="action" value="Erfassen">
+
+</form>
--- /dev/null
+[% USE HTML %]<form method="post" action="ic.pl">
+
+ <input name="callback" type="hidden" value="[% HTML.escape(callback) %]">
+
+ <input type="hidden" name="item" value="[% HTML.escape(searchitems) %]">
+
+ <input type="hidden" name="login" value="[% HTML.escape(login) %]">
+ <input type="hidden" name="password" value="[% HTML.escape(password) %]">
+
+ [% SWITCH searchitems %]
+ [% CASE 'part' %]<translate>New part</translate>
+ [% CASE 'service' %]<translate>New service</translate>
+ [% CASE 'assembly' %]<translate>New assembly</translate>
+ [% END %]
+ <br>
+ <input class="submit" type="submit" name="action" value="<translate>Add</translate>">
+
+</form>
--- /dev/null
+<body style="padding:0px; margin:0px;">
+
+ <script type="text/javascript">
+<!--
+function clockon() {
+ var now = new Date();
+ var h = now.getHours();
+ var m = now.getMinutes();
+ document.getElementById('clock_id').innerHTML = (h<10?'0'+h:h)+":"+(m<10?'0'+m:m);
+ var timer=setTimeout("clockon()", 10000);
+}
+window.onload=clockon
+//-->
+ </script>
+
+ <table border="0" width="100%" background="image/bg_titel.gif" cellpadding="0" cellspacing="0">
+ <tr>
+ <td style="color:white; font-family:verdana,arial,sans-serif; font-size: 12px;">
+
+ [<a href="menuv3.pl?action=display&login=<TMPL_VAR login ESCAPE=URL>&password=<TMPL_VAR password ESCAPE=URL>" target="_blank">neues Fenster</a>]
+
+ [<a href="JavaScript:top.main_window.print()">drucken</a>]
+ </td>
+ <td align="right" style="vertical-align:middle; color:white; font-family:verdana,arial,sans-serif; font-size: 12px;" nowrap>
+ [Benutzer: <TMPL_VAR login ESCAPE=HTML> -
+ <a href="login.pl?action=logout&login=<TMPL_VAR login ESCAPE=URL>&password=<TMPL_VAR password ESCAPE=URL>" target="_top">abmelden</a>]
+ <TMPL_VAR date> <span id='clock_id' style='position:relative'></span>
+ </td>
+ </tr>
+ </table>
+
+
+ <div id="menu">
+
+ <TMPL_VAR menu>
+
+ </div>
+
+ <div style="clear: both;"></div>
+
+ <iframe id="win1" src="login.pl?action=company_logo&login=<TMPL_VAR login ESCAPE=URL>&password=<TMPL_VAR password ESCAPE=URL>" width="100%" height="94%" name="main_window" style="position: absolute; border: 0px; z-index: 99; ">
+ <p>Ihr Browser kann leider keine eingebetteten Frames anzeigen. Bitte wählen Sie ein anderes Menü in der Benutzerkonfiguration im Administrationsmenü aus.</p>
+ </iframe>
+</body>
+</html>
--- /dev/null
+<body style="padding:0px; margin:0px;">
+
+ <script type="text/javascript">
+<!--
+function clockon() {
+ var now = new Date();
+ var h = now.getHours();
+ var m = now.getMinutes();
+ document.getElementById('clock_id').innerHTML = (h<10?'0'+h:h)+":"+(m<10?'0'+m:m);
+ var timer=setTimeout("clockon()", 10000);
+}
+window.onload=clockon
+//-->
+ </script>
+
+ <table border="0" width="100%" background="image/bg_titel.gif" cellpadding="0" cellspacing="0">
+ <tr>
+ <td style="color:white; font-family:verdana,arial,sans-serif; font-size: 12px;">
+
+ [<a href="menuv3.pl?action=display&login=<TMPL_VAR login ESCAPE=URL>&password=<TMPL_VAR password ESCAPE=URL>" target="_blank"><translate>new Window</translate></a>]
+
+ [<a href="JavaScript:top.main_window.print()"><translate>print</translate></a>]
+ </td>
+ <td align="right" style="vertical-align:middle; color:white; font-family:verdana,arial,sans-serif; font-size: 12px;" nowrap>
+ [<translate>User</translate>: <TMPL_VAR login ESCAPE=HTML> -
+ <a href="login.pl?action=logout&login=<TMPL_VAR login ESCAPE=URL>&password=<TMPL_VAR password ESCAPE=URL>" target="_top"><translate>logout</translate></a>]
+ <TMPL_VAR date> <span id='clock_id' style='position:relative'></span>
+ </td>
+ </tr>
+ </table>
+
+
+ <div id="menu">
+
+ <TMPL_VAR menu>
+
+ </div>
+
+ <div style="clear: both;"></div>
+
+ <iframe id="win1" src="login.pl?action=company_logo&login=<TMPL_VAR login ESCAPE=URL>&password=<TMPL_VAR password ESCAPE=URL>" width="100%" height="94%" name="main_window" style="position: absolute; border: 0px; z-index: 99; ">
+ <p><translate>MSG_BROWSER_DOES_NOT_SUPPORT_IFRAMES</translate></p>
+ </iframe>
+</body>
+</html>
--- /dev/null
+<body>
+
+ <div class="listtop" width="100%">Lieferadresse übernehmen</div>
+
+ <p>Sie haben die folgende Lieferadresse eingegeben oder ausgewählt:</p>
+
+ <p>
+ <table>
+ <tr>
+ <th align="right" valign="top">Name:</th>
+ <td valign="top"><TMPL_VAR CFDD_shiptoname ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top">Abteilung:</th>
+ <td valign="top"><TMPL_VAR CFDD_shiptodepartment_1 ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top"> </th>
+ <td valign="top"><TMPL_VAR CFDD_shiptodepartment_2 ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top">Straße:</th>
+ <td valign="top"><TMPL_VAR CFDD_shiptostreet ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top">PLZ:</th>
+ <td valign="top"><TMPL_VAR CFDD_shiptozipcode ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top">Stadt:</th>
+ <td valign="top"><TMPL_VAR CFDD_shiptocity ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top">Land:</th>
+ <td valign="top"><TMPL_VAR CFDD_shiptocountry ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top">Kontakt:</th>
+ <td valign="top"><TMPL_VAR CFDD_shiptocontact ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top">Telefon:</th>
+ <td valign="top"><TMPL_VAR CFDD_shiptophone ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top">Fax:</th>
+ <td valign="top"><TMPL_VAR CFDD_shiptofax ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top">eMail:</th>
+ <td valign="top"><TMPL_VAR CFDD_shiptoemail ESCAPE=HTML></td>
+ </tr>
+ </table>
+ </p>
+
+ Wollen Sie diese Lieferadresse in den neuen Lieferantenauftrag übernehmen, damit der Händler die Waren direkt an Ihren Kunden liefern kann?
+ </p>
+
+ <form method="post" action="oe.pl">
+
+ <p>
+ <input type="submit" name="action" value="Ja">
+ <input type="submit" name="action" value="Nein">
+ </p>
+
+ <input type="hidden" name="yes_nextsub" value="check_for_direct_delivery_yes">
+ <input type="hidden" name="no_nextsub" value="check_for_direct_delivery_no">
+
+ <TMPL_LOOP VARIABLES>
+ <input type="hidden" name="<TMPL_VAR key ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>"></TMPL_LOOP>
+
+ </form>
+
+</body>
+</html>
--- /dev/null
+<body>
+
+ <div class="listtop" width="100%"><translate>Carry over shipping address</translate></div>
+
+ <p><translate>You have entered or selected the following shipping address for this customer:</translate></p>
+
+ <p>
+ <table>
+ <tr>
+ <th align="right" valign="top"><translate>Name</translate>:</th>
+ <td valign="top"><TMPL_VAR CFDD_shiptoname ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top"><translate>Department</translate>:</th>
+ <td valign="top"><TMPL_VAR CFDD_shiptodepartment_1 ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top"> </th>
+ <td valign="top"><TMPL_VAR CFDD_shiptodepartment_2 ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top"><translate>Street</translate>:</th>
+ <td valign="top"><TMPL_VAR CFDD_shiptostreet ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top"><translate>Zipcode</translate>:</th>
+ <td valign="top"><TMPL_VAR CFDD_shiptozipcode ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top"><translate>City</translate>:</th>
+ <td valign="top"><TMPL_VAR CFDD_shiptocity ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top"><translate>Country</translate>:</th>
+ <td valign="top"><TMPL_VAR CFDD_shiptocountry ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top"><translate>Contact</translate>:</th>
+ <td valign="top"><TMPL_VAR CFDD_shiptocontact ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top"><translate>Phone</translate>:</th>
+ <td valign="top"><TMPL_VAR CFDD_shiptophone ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top"><translate>Fax</translate>:</th>
+ <td valign="top"><TMPL_VAR CFDD_shiptofax ESCAPE=HTML></td>
+ </tr>
+
+ <tr>
+ <th align="right" valign="top"><translate>E-mail</translate>:</th>
+ <td valign="top"><TMPL_VAR CFDD_shiptoemail ESCAPE=HTML></td>
+ </tr>
+ </table>
+ </p>
+
+ <translate>Do you want to carry this shipping address over to the new purchase order so that the vendor can deliver the goods directly to your customer?</translate>
+ </p>
+
+ <form method="post" action="oe.pl">
+
+ <p>
+ <input type="submit" name="action" value="<translate>Yes</translate>">
+ <input type="submit" name="action" value="<translate>No</translate>">
+ </p>
+
+ <input type="hidden" name="yes_nextsub" value="check_for_direct_delivery_yes">
+ <input type="hidden" name="no_nextsub" value="check_for_direct_delivery_no">
+
+ <TMPL_LOOP VARIABLES>
+ <input type="hidden" name="<TMPL_VAR key ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>"></TMPL_LOOP>
+
+ </form>
+
+</body>
+</html>
--- /dev/null
+<TMPL_IF SHOW_CONTINUE_BUTTON>
+ Neuer Auftrag<br>
+ <input class="submit" type="submit" name="action" value="Weiter">
+</TMPL_IF>
+ <input type="hidden" name="nextsub" value="edit">
+ <input type="hidden" name="type" value="<TMPL_VAR type ESCAPE=HTML>">
+ <input type="hidden" name="vc" value="<TMPL_VAR vc ESCAPE=HTML>">
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+ <input type="hidden" name="callback" value="<TMPL_VAR callback ESCAPE=HTML>">
+ <input type="hidden" name="rowcount" value="<TMPL_VAR rowcount ESCAPE=HTML>">
+</form>
--- /dev/null
+<TMPL_IF SHOW_CONTINUE_BUTTON>
+ <translate>New sales order</translate><br>
+ <input class="submit" type="submit" name="action" value="<translate>Continue</translate>">
+</TMPL_IF>
+ <input type="hidden" name="nextsub" value="edit">
+ <input type="hidden" name="type" value="<TMPL_VAR type ESCAPE=HTML>">
+ <input type="hidden" name="vc" value="<TMPL_VAR vc ESCAPE=HTML>">
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+ <input type="hidden" name="callback" value="<TMPL_VAR callback ESCAPE=HTML>">
+ <input type="hidden" name="rowcount" value="<TMPL_VAR rowcount ESCAPE=HTML>">
+</form>
--- /dev/null
+<form method="post" action="oe.pl">
--- /dev/null
+<form method="post" action="oe.pl">
--- /dev/null
+<body>
+
+ <script type="text/javascript">
+ <!--
+ function submit_report_generator_form(nextsub) {
+ document.report_generator_form.report_generator_dispatch_to.value = nextsub;
+ document.report_generator_form.submit();
+ }
+
+ -->
+ </script>
+
+ <div class="listheading" width="100%"><TMPL_VAR title ESCAPE=HTML></div>
+
+ <form action="<TMPL_VAR script ESCAPE=HTML>" method="post" name="report_generator_form">
+
+ <TMPL_LOOP HIDDEN><input type="hidden" name="<TMPL_VAR key ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>">
+ </TMPL_LOOP>
+
+ <input type="hidden" name="report_generator_csv_options_set" value="1">
+ <input type="hidden" name="report_generator_dispatch_to" value="">
+ <input type="hidden" name="action" value="report_generator_dispatcher">
+
+ <table>
+ <tr>
+ <td align="right">Anführungszeichen</td>
+ <td>
+ <select name="report_generator_csv_options_quote_char" style="width: 300px">
+ <option value=""" selected>"</option>
+ <option value="'">'</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right">Escape-Zeichen</td>
+ <td>
+ <select name="report_generator_csv_options_escape_char" style="width: 300px">
+ <option value="QUOTE_CHAR" selected>Wie Anführungszeichen</option>
+ <option value=""">"</option>
+ <option value="'">'</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right">Feldtrennzeichen</td>
+ <td>
+ <select name="report_generator_csv_options_sep_char" style="width: 300px">
+ <option value=";" selected>;</option>
+ <option value=",">,</option>
+ <option value=":">:</option>
+ <option value="TAB">TAB (Das Tabulator-Symbol)</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right">Zeilenumbrüche</td>
+ <td>
+ <select name="report_generator_csv_options_eol_style" style="width: 300px">
+ <option value="DOS">DOS/Windows (CR/LF)</option>
+ <option value="Unix" selected>Unix (LF)</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top">Optionen:</td>
+ <td valign="top">
+ <input type="checkbox" name="report_generator_csv_options_headers" value="1" checked>
+ Spaltenüberschriften erzeugen
+ </td>
+ </tr>
+
+ </table>
+
+ <p>
+ <button type="button" class="submit" onclick="submit_report_generator_form('report_generator_export_as_csv')">Als CSV exportieren</button>
+ <button type="button" class="submit" onclick="submit_report_generator_form('report_generator_back')">Zurück</button>
+ </p>
+
+ </form>
+</body>
+</html>
--- /dev/null
+<body>
+
+ <script type="text/javascript">
+ <!--
+ function submit_report_generator_form(nextsub) {
+ document.report_generator_form.report_generator_dispatch_to.value = nextsub;
+ document.report_generator_form.submit();
+ }
+
+ -->
+ </script>
+
+ <div class="listheading" width="100%"><TMPL_VAR title ESCAPE=HTML></div>
+
+ <form action="<TMPL_VAR script ESCAPE=HTML>" method="post" name="report_generator_form">
+
+ <TMPL_LOOP HIDDEN><input type="hidden" name="<TMPL_VAR key ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>">
+ </TMPL_LOOP>
+
+ <input type="hidden" name="report_generator_csv_options_set" value="1">
+ <input type="hidden" name="report_generator_dispatch_to" value="">
+ <input type="hidden" name="action" value="report_generator_dispatcher">
+
+ <table>
+ <tr>
+ <td align="right"><translate>Quote chararacter</translate></td>
+ <td>
+ <select name="report_generator_csv_options_quote_char" style="width: 300px">
+ <option value=""" selected>"</option>
+ <option value="'">'</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Escape character</translate></td>
+ <td>
+ <select name="report_generator_csv_options_escape_char" style="width: 300px">
+ <option value="QUOTE_CHAR" selected><translate>Same as the quote character</translate></option>
+ <option value=""">"</option>
+ <option value="'">'</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Separator chararacter</translate></td>
+ <td>
+ <select name="report_generator_csv_options_sep_char" style="width: 300px">
+ <option value=";" selected>;</option>
+ <option value=",">,</option>
+ <option value=":">:</option>
+ <option value="TAB">TAB (<translate>The tabulator character</translate>)</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Line endings</translate></td>
+ <td>
+ <select name="report_generator_csv_options_eol_style" style="width: 300px">
+ <option value="DOS">DOS/Windows (CR/LF)</option>
+ <option value="Unix" selected>Unix (LF)</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><translate>Options</translate>:</td>
+ <td valign="top">
+ <input type="checkbox" name="report_generator_csv_options_headers" value="1" checked>
+ <translate>Include column headings</translate>
+ </td>
+ </tr>
+
+ </table>
+
+ <p>
+ <button type="button" class="submit" onclick="submit_report_generator_form('report_generator_export_as_csv')"><translate>Export as CSV</translate></button>
+ <button type="button" class="submit" onclick="submit_report_generator_form('report_generator_back')"><translate>Back</translate></button>
+ </p>
+
+ </form>
+</body>
+</html>
--- /dev/null
+[% USE HTML %]<body>
+
+ <script type="text/javascript">
+ <!--
+ function submit_report_generator_form(nextsub) {
+ document.report_generator_form.report_generator_dispatch_to.value = nextsub;
+ document.report_generator_form.submit();
+ }
+
+ -->
+ </script>
+
+ [% IF MESSAGE %]
+ <p>[% MESSAGE %]</p>
+ [% END %]
+
+ <div class="listtop" width="100%">[% TITLE %]</div>
+
+ [% IF TOP_INFO_TEXT %]
+ <p>[% TOP_INFO_TEXT %]</p>
+ [% END %]
+
+ [% RAW_TOP_INFO_TEXT %]
+
+ [% IF DATA_PRESENT %]
+ <p>
+ <table width="100%">
+ <tr>
+ [% FOREACH col = COLUMN_HEADERS %]
+ <th class="listheading">[% IF col.link %]<a href="[% col.link %]">[% END %][% HTML.escape(col.text) %][% IF col.link %][% IF col.show_sort_indicator %]<img border="0" src="image/[% IF col.sort_indicator_direction %]down[% ELSE %]up[% END %].png">[% END %]</a>[% ELSE %][% IF col.show_sort_indicator %]<img src="image/[% IF col.sort_indicator_direction %]down[% ELSE %]up[% END %].png">[% END %][% END %]</th>
+ [% END %]
+ </tr>
+
+ [% FOREACH row = ROWS %]
+ [% IF row.IS_CONTROL %]
+ [% IF row.IS_SEPARATOR %]<tr><td colspan="[% row.NUM_COLUMNS %]"><hr size="3" noshade></td></tr>[% END %][% IF row.IS_COLSPAN_DATA %]<tr><td colspan="[% row.NUM_COLUMNS %]">[% row.data %]</td></tr>[% END %]
+ [% ELSE %]
+ <tr class="listrow[% row.outer_idx_odd %]">
+ [% FOREACH col = row.COLUMNS %]<td[% IF col.align %] align="[% col.align %]"[% END %][% IF col.valign %] valign="[% col.valign %]"[% END %][% IF col.class %] class="[% col.class %]"[% END %]>[% IF col.raw_data %][% col.raw_data %][% END %][% USE iterator(col.CELL_ROWS) %][% FOREACH cell_row = iterator %][% IF cell_row.data %][% IF cell_row.link %]<a href="[% cell_row.link %]">[% END %][% cell_row.data %][% IF cell_row.link %]</a>[% END %][% END %][% UNLESS iterator.last %]<br>[% END %][% END %]</td>
+ [% END %]
+ </tr>
+ [% END %]
+ [% END %]
+
+ <tr><td colspan="[% NUM_COLUMNS %]"><hr size="3" noshade></td></tr>
+
+ </table>
+ </p>
+ [% ELSE %]
+ <p>Es wurden keine Daten gefunden.</p>
+ [% END %]
+
+ [% RAW_BOTTOM_INFO_TEXT %]
+
+ [% IF BOTTOM_INFO_TEXT %]
+ <p>[% BOTTOM_INFO_TEXT %]</p>
+ [% END %]
+
+ [% IF SHOW_EXPORT_BUTTONS %]
+ <form action="[% HTML.escape(script) %]" name="report_generator_form" method="post">
+ <input type="hidden" name="login" value="[% HTML.escape(login) %]">
+ <input type="hidden" name="password" value="[% HTML.escape(password) %]">
+
+ [% FOREACH var = EXPORT_VARIABLES %]<input type="hidden" name="report_generator_hidden_[% var.key %]" value="[% HTML.escape(var.value) %]">
+ [% END %]
+
+ <input type="hidden" name="report_generator_nextsub" value="[% HTML.escape(EXPORT_NEXTSUB) %]">
+ <input type="hidden" name="report_generator_variable_list" value="[% HTML.escape(EXPORT_VARIABLE_LIST) %]">
+ <input type="hidden" name="report_generator_dispatch_to" value="">
+ <input type="hidden" name="action" value="report_generator_dispatcher">
+
+ <p>
+ Listenexport<br>
+ [% IF ALLOW_PDF_EXPORT %]<button type="button" class="submit" onclick="submit_report_generator_form('report_generator_export_as_pdf')">Als PDF exportieren</button>[% END %]
+ [% IF ALLOW_CSV_EXPORT %]<button type="button" class="submit" onclick="submit_report_generator_form('report_generator_export_as_csv')">Als CSV exportieren</button>[% END %]
+ </p>
+ </form>
+ [% END %]
+
+</body>
--- /dev/null
+[% USE HTML %]<body>
+
+ <script type="text/javascript">
+ <!--
+ function submit_report_generator_form(nextsub) {
+ document.report_generator_form.report_generator_dispatch_to.value = nextsub;
+ document.report_generator_form.submit();
+ }
+
+ -->
+ </script>
+
+ [% IF MESSAGE %]
+ <p>[% MESSAGE %]</p>
+ [% END %]
+
+ <div class="listtop" width="100%">[% TITLE %]</div>
+
+ [% IF TOP_INFO_TEXT %]
+ <p>[% TOP_INFO_TEXT %]</p>
+ [% END %]
+
+ [% RAW_TOP_INFO_TEXT %]
+
+ [% IF DATA_PRESENT %]
+ <p>
+ <table width="100%">
+ <tr>
+ [% FOREACH col = COLUMN_HEADERS %]
+ <th class="listheading">[% IF col.link %]<a href="[% col.link %]">[% END %][% HTML.escape(col.text) %][% IF col.link %][% IF col.show_sort_indicator %]<img border="0" src="image/[% IF col.sort_indicator_direction %]down[% ELSE %]up[% END %].png">[% END %]</a>[% ELSE %][% IF col.show_sort_indicator %]<img src="image/[% IF col.sort_indicator_direction %]down[% ELSE %]up[% END %].png">[% END %][% END %]</th>
+ [% END %]
+ </tr>
+
+ [% FOREACH row = ROWS %]
+ [% IF row.IS_CONTROL %]
+ [% IF row.IS_SEPARATOR %]<tr><td colspan="[% row.NUM_COLUMNS %]"><hr size="3" noshade></td></tr>[% END %][% IF row.IS_COLSPAN_DATA %]<tr><td colspan="[% row.NUM_COLUMNS %]">[% row.data %]</td></tr>[% END %]
+ [% ELSE %]
+ <tr class="listrow[% row.outer_idx_odd %]">
+ [% FOREACH col = row.COLUMNS %]<td[% IF col.align %] align="[% col.align %]"[% END %][% IF col.valign %] valign="[% col.valign %]"[% END %][% IF col.class %] class="[% col.class %]"[% END %]>[% IF col.raw_data %][% col.raw_data %][% END %][% USE iterator(col.CELL_ROWS) %][% FOREACH cell_row = iterator %][% IF cell_row.data %][% IF cell_row.link %]<a href="[% cell_row.link %]">[% END %][% cell_row.data %][% IF cell_row.link %]</a>[% END %][% END %][% UNLESS iterator.last %]<br>[% END %][% END %]</td>
+ [% END %]
+ </tr>
+ [% END %]
+ [% END %]
+
+ <tr><td colspan="[% NUM_COLUMNS %]"><hr size="3" noshade></td></tr>
+
+ </table>
+ </p>
+ [% ELSE %]
+ <p><translate>No data was found.</translate></p>
+ [% END %]
+
+ [% RAW_BOTTOM_INFO_TEXT %]
+
+ [% IF BOTTOM_INFO_TEXT %]
+ <p>[% BOTTOM_INFO_TEXT %]</p>
+ [% END %]
+
+ [% IF SHOW_EXPORT_BUTTONS %]
+ <form action="[% HTML.escape(script) %]" name="report_generator_form" method="post">
+ <input type="hidden" name="login" value="[% HTML.escape(login) %]">
+ <input type="hidden" name="password" value="[% HTML.escape(password) %]">
+
+ [% FOREACH var = EXPORT_VARIABLES %]<input type="hidden" name="report_generator_hidden_[% var.key %]" value="[% HTML.escape(var.value) %]">
+ [% END %]
+
+ <input type="hidden" name="report_generator_nextsub" value="[% HTML.escape(EXPORT_NEXTSUB) %]">
+ <input type="hidden" name="report_generator_variable_list" value="[% HTML.escape(EXPORT_VARIABLE_LIST) %]">
+ <input type="hidden" name="report_generator_dispatch_to" value="">
+ <input type="hidden" name="action" value="report_generator_dispatcher">
+
+ <p>
+ Listenexport<br>
+ [% IF ALLOW_PDF_EXPORT %]<button type="button" class="submit" onclick="submit_report_generator_form('report_generator_export_as_pdf')">Als PDF exportieren</button>[% END %]
+ [% IF ALLOW_CSV_EXPORT %]<button type="button" class="submit" onclick="submit_report_generator_form('report_generator_export_as_csv')">Als CSV exportieren</button>[% END %]
+ </p>
+ </form>
+ [% END %]
+
+</body>
--- /dev/null
+<body>
+
+ <script type="text/javascript">
+ <!--
+ function submit_report_generator_form(nextsub) {
+ document.report_generator_form.report_generator_dispatch_to.value = nextsub;
+ document.report_generator_form.submit();
+ }
+
+ -->
+ </script>
+
+ <div class="listheading" width="100%"><TMPL_VAR title ESCAPE=HTML></div>
+
+ <form action="<TMPL_VAR script ESCAPE=HTML>" method="post" name="report_generator_form">
+
+ <TMPL_LOOP HIDDEN><input type="hidden" name="<TMPL_VAR key ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>">
+ </TMPL_LOOP>
+
+ <input type="hidden" name="report_generator_pdf_options_set" value="1">
+ <input type="hidden" name="report_generator_dispatch_to" value="">
+ <input type="hidden" name="action" value="report_generator_dispatcher">
+
+ <table>
+ <tr>
+ <td align="right">Seitenformat</td>
+ <td>
+ <select name="report_generator_pdf_options_paper_size">
+ <option value="A3">A3</option>
+ <option value="A4" selected>A4</option>
+ <option value="letter">Letter</option>
+ <option value="legal">Legal</option>
+ </select>
+ <select name="report_generator_pdf_options_orientation">
+ <option value="portrait">Hochformat</option>
+ <option value="landscape" selected>Querformat</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right">Schriftgröße</td>
+ <td><input name="report_generator_pdf_options_font_size" size="4" value="10">pt</td>
+ </tr>
+
+ <tr>
+ <td align="right">Seitenränder:</td>
+ </tr>
+
+ <tr>
+ <td align="right">Oben</td>
+ <td><input name="report_generator_pdf_options_margin_top" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
+ </tr>
+
+ <tr>
+ <td align="right">Links</td>
+ <td><input name="report_generator_pdf_options_margin_left" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
+ </tr>
+
+ <tr>
+ <td align="right">Unten</td>
+ <td><input name="report_generator_pdf_options_margin_bottom" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
+ </tr>
+
+ <tr>
+ <td align="right">Rechts</td>
+ <td><input name="report_generator_pdf_options_margin_right" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top">Optionen:</td>
+ <td valign="top">
+ <input type="checkbox" name="report_generator_pdf_options_number" value="1" checked>
+ Seiten nummerieren
+ <TMPL_IF SHOW_PRINTERS>
+ <br>
+ <input type="checkbox" name="report_generator_pdf_options_print" value="1">
+ Liste ausdrucken
+ </TMPL_IF>
+ </td>
+ </tr>
+
+ <TMPL_IF SHOW_PRINTERS>
+ <tr>
+ <td align="right">Drucker</td>
+ <td>
+ <select name="report_generator_pdf_options_printer_id">
+ <TMPL_LOOP ALL_PRINTERS><option value="<TMPL_VAR id ESCAPE=HTML>"<TMPL_IF selected> selected</TMPL_IF>><TMPL_VAR printer_description ESCAPE=HTML></option></TMPL_LOOP>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right">Kopien</td>
+ <td><input name="report_generator_pdf_options_copies" size="4" value="<TMPL_VAR copies ESCAPE=HTML>"></td>
+ </tr>
+ </TMPL_IF>
+ </table>
+
+ <p>
+ <button type="button" class="submit" onclick="submit_report_generator_form('report_generator_export_as_pdf')">Als PDF exportieren</button>
+ <button type="button" class="submit" onclick="submit_report_generator_form('report_generator_back')">Zurück</button>
+ </p>
+
+ </form>
+</body>
+</html>
--- /dev/null
+<body>
+
+ <script type="text/javascript">
+ <!--
+ function submit_report_generator_form(nextsub) {
+ document.report_generator_form.report_generator_dispatch_to.value = nextsub;
+ document.report_generator_form.submit();
+ }
+
+ -->
+ </script>
+
+ <div class="listheading" width="100%"><TMPL_VAR title ESCAPE=HTML></div>
+
+ <form action="<TMPL_VAR script ESCAPE=HTML>" method="post" name="report_generator_form">
+
+ <TMPL_LOOP HIDDEN><input type="hidden" name="<TMPL_VAR key ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>">
+ </TMPL_LOOP>
+
+ <input type="hidden" name="report_generator_pdf_options_set" value="1">
+ <input type="hidden" name="report_generator_dispatch_to" value="">
+ <input type="hidden" name="action" value="report_generator_dispatcher">
+
+ <table>
+ <tr>
+ <td align="right"><translate>Orientation</translate></td>
+ <td>
+ <select name="report_generator_pdf_options_paper_size">
+ <option value="A3">A3</option>
+ <option value="A4" selected>A4</option>
+ <option value="letter">Letter</option>
+ <option value="legal">Legal</option>
+ </select>
+ <select name="report_generator_pdf_options_orientation">
+ <option value="portrait"><translate>Portrait</translate></option>
+ <option value="landscape" selected><translate>Landscape</translate></option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Font size</translate></td>
+ <td><input name="report_generator_pdf_options_font_size" size="4" value="10">pt</td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Margins</translate>:</td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Top</translate></td>
+ <td><input name="report_generator_pdf_options_margin_top" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Left</translate></td>
+ <td><input name="report_generator_pdf_options_margin_left" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Bottom</translate></td>
+ <td><input name="report_generator_pdf_options_margin_bottom" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Right</translate></td>
+ <td><input name="report_generator_pdf_options_margin_right" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><translate>Options</translate>:</td>
+ <td valign="top">
+ <input type="checkbox" name="report_generator_pdf_options_number" value="1" checked>
+ <translate>Number pages</translate>
+ <TMPL_IF SHOW_PRINTERS>
+ <br>
+ <input type="checkbox" name="report_generator_pdf_options_print" value="1">
+ <translate>Print list</translate>
+ </TMPL_IF>
+ </td>
+ </tr>
+
+ <TMPL_IF SHOW_PRINTERS>
+ <tr>
+ <td align="right"><translate>Printer</translate></td>
+ <td>
+ <select name="report_generator_pdf_options_printer_id">
+ <TMPL_LOOP ALL_PRINTERS><option value="<TMPL_VAR id ESCAPE=HTML>"<TMPL_IF selected> selected</TMPL_IF>><TMPL_VAR printer_description ESCAPE=HTML></option></TMPL_LOOP>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Copies</translate></td>
+ <td><input name="report_generator_pdf_options_copies" size="4" value="<TMPL_VAR copies ESCAPE=HTML>"></td>
+ </tr>
+ </TMPL_IF>
+ </table>
+
+ <p>
+ <button type="button" class="submit" onclick="submit_report_generator_form('report_generator_export_as_pdf')"><translate>Export as PDF</translate></button>
+ <button type="button" class="submit" onclick="submit_report_generator_form('report_generator_back')"><translate>Back</translate></button>
+ </p>
+
+ </form>
+</body>
+</html>
--- /dev/null
+<html>
+ <body>
+
+ <div width="100%"><TMPL_VAR TITLE></div>
+
+ <TMPL_IF TOP_INFO_TEXT>
+ <p><TMPL_VAR TOP_INFO_TEXT></p>
+ </TMPL_IF>
+
+ <p>
+ <table width="100%">
+ <tr>
+ <TMPL_LOOP COLUMN_HEADERS>
+ <th><TMPL_IF link><a href="<TMPL_VAR link>"></TMPL_IF><TMPL_VAR text ESCAPE=HTML><TMPL_IF link></a></TMPL_IF></th>
+ </TMPL_LOOP>
+ </tr>
+
+ <TMPL_LOOP ROWS>
+ <tr>
+ <TMPL_LOOP COLUMNS><td<TMPL_IF align> align="<TMPL_VAR align>"</TMPL_IF><TMPL_IF valign> valign="<TMPL_VAR valign>"</TMPL_IF>><TMPL_LOOP CELL_ROWS><TMPL_IF data><TMPL_VAR data></TMPL_IF><TMPL_UNLESS __last__><br></TMPL_UNLESS></TMPL_LOOP></td></TMPL_LOOP>
+ </tr>
+ </TMPL_LOOP>
+
+ </table>
+ </p>
+
+ <TMPL_IF BOTTOM_INFO_TEXT>
+ <p><TMPL_VAR BOTTOM_INFO_TEXT></p>
+ </TMPL_IF>
+
+ </body>
+</html>
--- /dev/null
+<html>
+ <body>
+
+ <div width="100%"><TMPL_VAR TITLE></div>
+
+ <TMPL_IF TOP_INFO_TEXT>
+ <p><TMPL_VAR TOP_INFO_TEXT></p>
+ </TMPL_IF>
+
+ <p>
+ <table width="100%">
+ <tr>
+ <TMPL_LOOP COLUMN_HEADERS>
+ <th><TMPL_IF link><a href="<TMPL_VAR link>"></TMPL_IF><TMPL_VAR text ESCAPE=HTML><TMPL_IF link></a></TMPL_IF></th>
+ </TMPL_LOOP>
+ </tr>
+
+ <TMPL_LOOP ROWS>
+ <tr>
+ <TMPL_LOOP COLUMNS><td<TMPL_IF align> align="<TMPL_VAR align>"</TMPL_IF><TMPL_IF valign> valign="<TMPL_VAR valign>"</TMPL_IF>><TMPL_LOOP CELL_ROWS><TMPL_IF data><TMPL_VAR data></TMPL_IF><TMPL_UNLESS __last__><br></TMPL_UNLESS></TMPL_LOOP></td></TMPL_LOOP>
+ </tr>
+ </TMPL_LOOP>
+
+ </table>
+ </p>
+
+ <TMPL_IF BOTTOM_INFO_TEXT>
+ <p><TMPL_VAR BOTTOM_INFO_TEXT></p>
+ </TMPL_IF>
+
+ </body>
+</html>
--- /dev/null
+ <input type="hidden" name="rowcount" value="<TMPL_VAR row_idx ESCAPE=HTML>">
+
+ <TMPL_VAR PRINT_OPTIONS>
+
+ <input type="hidden" name="todate" value="<TMPL_VAR todate ESCAPE=HTML>">
+ <input type="hidden" name="title" value="<TMPL_VAR title ESCAPE=HTML>">
+ <input type="hidden" name="arap" value="<TMPL_VAR arap ESCAPE=HTML>">
+ <input type="hidden" name="ct" value="<TMPL_VAR ct ESCAPE=HTML>">
+ <input type="hidden" name="customer" value="<TMPL_VAR customer ESCAPE=HTML>">
+ <input type="hidden" name="vendor" value="<TMPL_VAR vendor ESCAPE=HTML>">
+ <input type="hidden" name="department" value="<TMPL_VAR department ESCAPE=HTML>">
+
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+
+ Sammelrechnung
+ <br>
+ <input class="submit" type="submit" name="action" value="Alle auswählen">
+ <input class="submit" type="submit" name="action" value="Drucken">
+ <input class="submit" type="submit" name="action" value="eMail">
+
+</form>
--- /dev/null
+ <input type="hidden" name="rowcount" value="<TMPL_VAR row_idx ESCAPE=HTML>">
+
+ <TMPL_VAR PRINT_OPTIONS>
+
+ <input type="hidden" name="todate" value="<TMPL_VAR todate ESCAPE=HTML>">
+ <input type="hidden" name="title" value="<TMPL_VAR title ESCAPE=HTML>">
+ <input type="hidden" name="arap" value="<TMPL_VAR arap ESCAPE=HTML>">
+ <input type="hidden" name="ct" value="<TMPL_VAR ct ESCAPE=HTML>">
+ <input type="hidden" name="customer" value="<TMPL_VAR customer ESCAPE=HTML>">
+ <input type="hidden" name="vendor" value="<TMPL_VAR vendor ESCAPE=HTML>">
+ <input type="hidden" name="department" value="<TMPL_VAR department ESCAPE=HTML>">
+
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+
+ <translate>Statement</translate>
+ <br>
+ <input class="submit" type="submit" name="action" value="<translate>Select all</translate>">
+ <input class="submit" type="submit" name="action" value="<translate>Print</translate>">
+ <input class="submit" type="submit" name="action" value="<translate>E-mail</translate>">
+
+</form>
--- /dev/null
+<form method="post" action="rp.pl">
--- /dev/null
+<form method="post" action="rp.pl">
--- /dev/null
+<!--This file is autogenerated,
+ Edit templates/webpages/ustva/config_step1_master.html
+ and run locale/<cc>/locales.pl -->
+
+<body>
+<form name="verzeichnis" method="post" action="<TMPL_VAR script ESCAPE=HTML>">
+<table width=100%>
+ <tr>
+ <th class="listtop">Finanzamt - Einstellungen</th>
+ </tr>
+ <tr>
+ <td>
+ <br />
+ <fieldset>
+ <legend><b>Angaben zum Finanzamt</b></legend>
+ <br />
+ <TMPL_VAR select_tax_office>
+ </fieldset>
+ <br />
+
+ <fieldset>
+ <legend><b>Versteuerungs Verfahren</b>
+ </legend>
+ <input name="method" id="accrual" class="radio" type="radio" value="accrual"
+ <TMPL_VAR checked_accrual>>
+ <label for="accrual">Bilanzierung (Soll-Versteuerung)</label>
+ <br>
+ <input name="method" id="cash" class="radio" type="radio" value="cash"
+ <TMPL_VAR checked_cash>>
+ <label for="cash">E/Ü-Rechnung (Ist-Versteuerung)</label>
+ </fieldset>
+ <br>
+ <fieldset>
+ <legend><b>Voranmeldungszeitraum</b>
+ </legend>
+
+
+ <input name=FA_voranmeld id=month class=radio type=radio value="month"
+ <TMPL_VAR checked_monthly>>
+ <label for="month">Monatliche Abgabe</label>
+ <br>
+ <input name="FA_voranmeld" id=quarter class=radio type=radio value="quarter"
+ <TMPL_VAR checked_quarterly>>
+ <label for="quarter">Vierteljährliche (quartalsweise) Abgabe</label>
+ <br>
+ <input name="FA_dauerfrist" id=FA_dauerfrist class=checkbox type=checkbox value="1"
+ <TMPL_VAR checked_dauerfristverlaengerung>>
+ <label for="">Dauerfristverlängerung</label>
+
+ </fieldset>
+ <br>
+ <fieldset>
+ <legend><b>Steuerberater/-in</b>
+ </legend>
+ <!-- <input name="FA_71" id=FA_71 class=checkbox type=checkbox value="X"
+ <TMPL_VAR checked_kz_71>>
+ <label for="FA_71">Verrechnung des Erstattungsbetrages erwünscht (Zeile 71)
+ . </label>
+ <br>
+ <br>-->
+ <table>
+ <tr>
+ <td>
+ Name
+ </td>
+ <td>
+ Straße
+ </td>
+ <td>
+ PLZ, Ort
+ </td>
+ <td>
+ Telefon
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input name="FA_steuerberater_name" id=steuerberater size=25
+ value="<TMPL_VAR FA_steuerberater_name ESCAPE=HTML>">
+ </td>
+ <td>
+ <input name="FA_steuerberater_street" id=steuerberater size=25
+ value="<TMPL_VAR FA_steuerberater_street ESCAPE=HTML>">
+ </td>
+ <td>
+ <input name="FA_steuerberater_city" id=steuerberater size=25
+ value="<TMPL_VAR FA_steuerberater_city ESCAPE=HTML>">
+ </td>
+ <td>
+ <input name="FA_steuerberater_tel" id=steuerberater size=25
+ value="<TMPL_VAR FA_steuerberater_tel ESCAPE=HTML>">
+ </tr>
+ </table>
+
+ </fieldset>
+
+ <br>
+ <br>
+ <hr>
+ <!--<input type=submit class=submit name=action value="
+ Debug">-->
+ <input type=submit class=submit name=action
+ value="weiter">
+ </td>
+ </tr>
+ </table>
+
+ <TMPL_LOOP hidden_variables>
+ <input type="hidden" name="<TMPL_VAR variable ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>">
+ </TMPL_LOOP>
+ </form>
+</body>
+
--- /dev/null
+<!--This file is autogenerated,
+ Edit templates/webpages/ustva/config_step1_master.html
+ and run locale/<cc>/locales.pl -->
+
+<body>
+<form name="verzeichnis" method="post" action="<TMPL_VAR script ESCAPE=HTML>">
+<table width=100%>
+ <tr>
+ <th class="listtop"><translate>Tax Office Preferences</translate></th>
+ </tr>
+ <tr>
+ <td>
+ <br />
+ <fieldset>
+ <legend><b><translate>Local Tax Office Preferences</translate></b></legend>
+ <br />
+ <TMPL_VAR select_tax_office>
+ </fieldset>
+ <br />
+
+ <fieldset>
+ <legend><b><translate>Taxation</translate></b>
+ </legend>
+ <input name="method" id="accrual" class="radio" type="radio" value="accrual"
+ <TMPL_VAR checked_accrual>>
+ <label for="accrual"><translate>accrual</translate></label>
+ <br>
+ <input name="method" id="cash" class="radio" type="radio" value="cash"
+ <TMPL_VAR checked_cash>>
+ <label for="cash"><translate>cash</translate></label>
+ </fieldset>
+ <br>
+ <fieldset>
+ <legend><b><translate>Tax Period</translate></b>
+ </legend>
+
+
+ <input name=FA_voranmeld id=month class=radio type=radio value="month"
+ <TMPL_VAR checked_monthly>>
+ <label for="month"><translate>month</translate></label>
+ <br>
+ <input name="FA_voranmeld" id=quarter class=radio type=radio value="quarter"
+ <TMPL_VAR checked_quarterly>>
+ <label for="quarter"><translate>quarter</translate></label>
+ <br>
+ <input name="FA_dauerfrist" id=FA_dauerfrist class=checkbox type=checkbox value="1"
+ <TMPL_VAR checked_dauerfristverlaengerung>>
+ <label for=""><translate>Extension Of Time</translate></label>
+
+ </fieldset>
+ <br>
+ <fieldset>
+ <legend><b><translate>Tax Consultant</translate></b>
+ </legend>
+ <!-- <input name="FA_71" id=FA_71 class=checkbox type=checkbox value="X"
+ <TMPL_VAR checked_kz_71>>
+ <label for="FA_71"><translate>Clearing Tax Received (No 71)</translate>
+ . </label>
+ <br>
+ <br>-->
+ <table>
+ <tr>
+ <td>
+ <translate>Name</translate>
+ </td>
+ <td>
+ <translate>Street</translate>
+ </td>
+ <td>
+ <translate>Zip, City</translate>
+ </td>
+ <td>
+ <translate>Telephone</translate>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input name="FA_steuerberater_name" id=steuerberater size=25
+ value="<TMPL_VAR FA_steuerberater_name ESCAPE=HTML>">
+ </td>
+ <td>
+ <input name="FA_steuerberater_street" id=steuerberater size=25
+ value="<TMPL_VAR FA_steuerberater_street ESCAPE=HTML>">
+ </td>
+ <td>
+ <input name="FA_steuerberater_city" id=steuerberater size=25
+ value="<TMPL_VAR FA_steuerberater_city ESCAPE=HTML>">
+ </td>
+ <td>
+ <input name="FA_steuerberater_tel" id=steuerberater size=25
+ value="<TMPL_VAR FA_steuerberater_tel ESCAPE=HTML>">
+ </tr>
+ </table>
+
+ </fieldset>
+
+ <br>
+ <br>
+ <hr>
+ <!--<input type=submit class=submit name=action value="
+ <translate>debug</translate>">-->
+ <input type=submit class=submit name=action
+ value="<translate>continue</translate>">
+ </td>
+ </tr>
+ </table>
+
+ <TMPL_LOOP hidden_variables>
+ <input type="hidden" name="<TMPL_VAR variable ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>">
+ </TMPL_LOOP>
+ </form>
+</body>
+
\ No newline at end of file
--- /dev/null
+<!--This file is autogenerated,
+ Edit templates/webpages/ustva/config_step2_master.html
+ and run locale/<cc>/locales.pl -->
+
+
+<body>
+ <form name="elsterform" method="post" action="<TMPL_VAR script>">
+ <table width="100%">
+ <tr>
+ <th colspan="2" class="listtop">
+ Finanzamt - Einstellungen</th>
+ </tr>
+ <tr>
+ <td colspan=2>
+ <br>
+ <!-- Start Finanzamtdaten -->
+ <br>
+ <fieldset>
+ <legend>
+ <font size="+1">Finanzamt
+ <TMPL_VAR FA_Name ESCAPE=HTML></font>
+ </legend>
+ <table width="100%" valign="top">
+ <tr>
+ <td valign="top">
+ <br>
+ <fieldset>
+ <legend>
+ <b>Adresse</b>
+ </legend>
+ <table width="100%">
+ <tr>
+ <td>
+ Finanzamt
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <input name="FA_Name" size="40" title="FA_Name"
+ value="<TMPL_VAR FA_Name ESCAPE=HTML>" <TMPL_VAR readonly>>
+ <td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <input name="FA_Strasse" size="40" title="FA_Strasse"
+ value="<TMPL_VAR FA_Strasse ESCAPE=HTML>" <TMPL_VAR readonly>>
+ </td width="100%">
+ </tr>
+ <tr>
+ <td width="116px">
+ <input name="FA_PLZ" size="10" title="FA_PLZ"
+ value="<TMPL_VAR FA_PLZ ESCAPE=HTML>" <TMPL_VAR readonly>>
+ </td>
+ <td>
+ <input name="FA_Ort" size="20" title="FA_Ort"
+ value="<TMPL_VAR FA_Ort ESCAPE=HTML>" <TMPL_VAR readonly>>
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+ <br>
+ <fieldset>
+ <legend>
+ <b>Kontakt</b>
+ </legend>
+ Telefon<br>
+ <input name="FA_Telefon" size="40" title="FA_Telefon"
+ value="<TMPL_VAR FA_Telefon ESCAPE=HTML>" <TMPL_VAR readonly>>
+ <br>
+ <br>
+ Fax<br>
+ <input name="FA_Fax" size="40" title="FA_Fax"
+ value="<TMPL_VAR FA_Fax ESCAPE=HTML>" <TMPL_VAR readonly>>
+ <br>
+ <br>
+ Internet<br>
+ <input name="FA_Email" size="40" title="FA_Email"
+ value="<TMPL_VAR FA_Email ESCAPE=HTML>" <TMPL_VAR readonly>>
+ <br>
+ <br>
+ <input name="FA_Internet" size="40" title="" title="FA_Internet"
+ value="<TMPL_VAR FA_Internet ESCAPE=HTML>" <TMPL_VAR readonly>>
+ <br>
+ </fieldset>
+ </td>
+ <td valign="top">
+ <br>
+ <fieldset>
+ <legend>
+ <b>Öffnungszeiten</b>
+ </legend>
+ <textarea name="FA_Oeffnungszeiten" rows="4" cols="40"
+ <TMPL_VAR readonly>><TMPL_VAR FA_Oeffnungszeiten ESCAPE=HTML></textarea>
+ </fieldset>
+ <br>
+ <fieldset>
+ <legend>
+ <b>Bankverbindung des Finanzamts</b>
+ <legend>
+ <table>
+ <tr>
+ <td width="40%">
+ Bank
+ <br>
+ <input name="FA_Bankbezeichnung_1" size="30"
+ value="<TMPL_VAR FA_Bankbezeichnung_1 ESCAPE=HTML>" <TMPL_VAR readonly>>
+ <br>
+ <br>
+ Kontonummer
+ <br>
+ <input name="FA_Kontonummer_1" size="15"
+ value="<TMPL_VAR FA_Kontonummer_1 ESCAPE=HTML>" <TMPL_VAR readonly>>
+ <br>
+ <br>
+ Bankleitzahl (BLZ)
+ <br>
+ <input name="FA_BLZ_1" size="15"
+ value="<TMPL_VAR FA_BLZ_1 ESCAPE=HTML>" <TMPL_VAR readonly>>
+ </td>
+ <td width="40%">
+ Bank
+ <br>
+ <input name="FA_Bankbezeichnung_oertlich" size="30"
+ value="<TMPL_VAR FA_Bankbezeichnung_oertlich ESCAPE=HTML>" <TMPL_VAR readonly>>
+ <br>
+ <br>
+ Kontonummer
+ <br>
+ <input name="FA_Kontonummer_2" size="15"
+ value="<TMPL_VAR FA_Kontonummer_2 ESCAPE=HTML>" <TMPL_VAR readonly>>
+ <br>
+ <br>
+ Bankleitzahl (BLZ)
+ <br>
+ <input name="FA_BLZ_2" size="15"
+ value="<TMPL_VAR FA_BLZ_2 ESCAPE=HTML>" <TMPL_VAR readonly>>
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+
+<!-- Stop Finanzamtdaten -->
+
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <br>
+ <fieldset>
+ <legend>
+ <font size="+1">Steuernummer</font>
+ </legend>
+ <br>
+ <TMPL_VAR input_steuernummer>
+ </H2><br>
+ </fieldset>
+ <br>
+ <br>
+ <hr>
+ </td>
+ </tr>
+ <tr>
+ <td align="left">
+
+ <TMPL_IF callback>
+ <input type="button" name="Verweis" value="Benutzereinstellungen"
+ onClick="self.location.href='<TMPL_VAR callback>">
+ <TMPL_ELSE>
+ <input type="submit" class="submit" name="action" value="zurück">
+ </TMPL_IF>
+
+ <TMPL_IF warnung>
+
+ <input type="hidden" name="nextsub" value="config_step2">
+ <input type="submit" class="submit" name="action"
+ value="weiter">
+
+ <input type="hidden" name="saved" value="Bitte Angaben überprüfen">
+
+ <TMPL_ELSE>
+
+ <input type="hidden" name="nextsub" value="save">
+ <input type="hidden" name="filename" value="finanzamt.ini">
+ <input type="submit" class="submit" name="action" value="Speichern">
+
+ </TMPL_IF>
+
+ </td>
+ <td align="right">
+ <H2 class="confirm"><TMPL_VAR saved></H2>
+ </td>
+ </tr>
+ </table>
+
+<TMPL_LOOP hidden_variables> <input type="hidden" name="<TMPL_VAR variable ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>">
+</TMPL_LOOP>
+
+
+ </form>
+</body>
+</html>
--- /dev/null
+<!--This file is autogenerated,
+ Edit templates/webpages/ustva/config_step2_master.html
+ and run locale/<cc>/locales.pl -->
+
+
+<body>
+ <form name="elsterform" method="post" action="<TMPL_VAR script>">
+ <table width="100%">
+ <tr>
+ <th colspan="2" class="listtop">
+ <translate>Tax Office Preferences</translate></th>
+ </tr>
+ <tr>
+ <td colspan=2>
+ <br>
+ <!-- Start Finanzamtdaten -->
+ <br>
+ <fieldset>
+ <legend>
+ <font size="+1"><translate>Tax Office</translate>
+ <TMPL_VAR FA_Name ESCAPE=HTML></font>
+ </legend>
+ <table width="100%" valign="top">
+ <tr>
+ <td valign="top">
+ <br>
+ <fieldset>
+ <legend>
+ <b><translate>Address</translate></b>
+ </legend>
+ <table width="100%">
+ <tr>
+ <td>
+ <translate>Tax Office</translate>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <input name="FA_Name" size="40" title="FA_Name"
+ value="<TMPL_VAR FA_Name ESCAPE=HTML>" <TMPL_VAR readonly>>
+ <td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <input name="FA_Strasse" size="40" title="FA_Strasse"
+ value="<TMPL_VAR FA_Strasse ESCAPE=HTML>" <TMPL_VAR readonly>>
+ </td width="100%">
+ </tr>
+ <tr>
+ <td width="116px">
+ <input name="FA_PLZ" size="10" title="FA_PLZ"
+ value="<TMPL_VAR FA_PLZ ESCAPE=HTML>" <TMPL_VAR readonly>>
+ </td>
+ <td>
+ <input name="FA_Ort" size="20" title="FA_Ort"
+ value="<TMPL_VAR FA_Ort ESCAPE=HTML>" <TMPL_VAR readonly>>
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+ <br>
+ <fieldset>
+ <legend>
+ <b><translate>Contact</translate></b>
+ </legend>
+ <translate>Telephone</translate><br>
+ <input name="FA_Telefon" size="40" title="FA_Telefon"
+ value="<TMPL_VAR FA_Telefon ESCAPE=HTML>" <TMPL_VAR readonly>>
+ <br>
+ <br>
+ <translate>Fax</translate><br>
+ <input name="FA_Fax" size="40" title="FA_Fax"
+ value="<TMPL_VAR FA_Fax ESCAPE=HTML>" <TMPL_VAR readonly>>
+ <br>
+ <br>
+ <translate>Internet</translate><br>
+ <input name="FA_Email" size="40" title="FA_Email"
+ value="<TMPL_VAR FA_Email ESCAPE=HTML>" <TMPL_VAR readonly>>
+ <br>
+ <br>
+ <input name="FA_Internet" size="40" title="" title="FA_Internet"
+ value="<TMPL_VAR FA_Internet ESCAPE=HTML>" <TMPL_VAR readonly>>
+ <br>
+ </fieldset>
+ </td>
+ <td valign="top">
+ <br>
+ <fieldset>
+ <legend>
+ <b><translate>Openings</translate></b>
+ </legend>
+ <textarea name="FA_Oeffnungszeiten" rows="4" cols="40"
+ <TMPL_VAR readonly>><TMPL_VAR FA_Oeffnungszeiten ESCAPE=HTML></textarea>
+ </fieldset>
+ <br>
+ <fieldset>
+ <legend>
+ <b><translate>Bank Connection Tax Office</translate></b>
+ <legend>
+ <table>
+ <tr>
+ <td width="40%">
+ <translate>Bank</translate>
+ <br>
+ <input name="FA_Bankbezeichnung_1" size="30"
+ value="<TMPL_VAR FA_Bankbezeichnung_1 ESCAPE=HTML>" <TMPL_VAR readonly>>
+ <br>
+ <br>
+ <translate>Account Nummer</translate>
+ <br>
+ <input name="FA_Kontonummer_1" size="15"
+ value="<TMPL_VAR FA_Kontonummer_1 ESCAPE=HTML>" <TMPL_VAR readonly>>
+ <br>
+ <br>
+ <translate>Bank Code (long)</translate>
+ <br>
+ <input name="FA_BLZ_1" size="15"
+ value="<TMPL_VAR FA_BLZ_1 ESCAPE=HTML>" <TMPL_VAR readonly>>
+ </td>
+ <td width="40%">
+ <translate>Bank</translate>
+ <br>
+ <input name="FA_Bankbezeichnung_oertlich" size="30"
+ value="<TMPL_VAR FA_Bankbezeichnung_oertlich ESCAPE=HTML>" <TMPL_VAR readonly>>
+ <br>
+ <br>
+ <translate>Account Nummer</translate>
+ <br>
+ <input name="FA_Kontonummer_2" size="15"
+ value="<TMPL_VAR FA_Kontonummer_2 ESCAPE=HTML>" <TMPL_VAR readonly>>
+ <br>
+ <br>
+ <translate>Bank Code (long)</translate>
+ <br>
+ <input name="FA_BLZ_2" size="15"
+ value="<TMPL_VAR FA_BLZ_2 ESCAPE=HTML>" <TMPL_VAR readonly>>
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+
+<!-- Stop Finanzamtdaten -->
+
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <br>
+ <fieldset>
+ <legend>
+ <font size="+1"><translate>Tax Number</translate></font>
+ </legend>
+ <br>
+ <TMPL_VAR input_steuernummer>
+ </H2><br>
+ </fieldset>
+ <br>
+ <br>
+ <hr>
+ </td>
+ </tr>
+ <tr>
+ <td align="left">
+
+ <TMPL_IF callback>
+ <input type="button" name="Verweis" value="<translate>User Config</translate>"
+ onClick="self.location.href='<TMPL_VAR callback>">
+ <TMPL_ELSE>
+ <input type="submit" class="submit" name="action" value="<translate>back</translate>">
+ </TMPL_IF>
+
+ <TMPL_IF warnung>
+
+ <input type="hidden" name="nextsub" value="config_step2">
+ <input type="submit" class="submit" name="action"
+ value="<translate>continue</translate>">
+
+ <input type="hidden" name="saved" value="<translate>Check
+ Details</translate>">
+
+ <TMPL_ELSE>
+
+ <input type="hidden" name="nextsub" value="save">
+ <input type="hidden" name="filename" value="finanzamt.ini">
+ <input type="submit" class="submit" name="action" value="<translate>Save</translate>">
+
+ </TMPL_IF>
+
+ </td>
+ <td align="right">
+ <H2 class="confirm"><TMPL_VAR saved></H2>
+ </td>
+ </tr>
+ </table>
+
+<TMPL_LOOP hidden_variables> <input type="hidden" name="<TMPL_VAR variable ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>">
+</TMPL_LOOP>
+
+
+ </form>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!--This file is autogenerated,
+ Edit templates/webpages/ustva/report_master.html
+ and run locale/<cc>/locales.pl -->
+
+ <body>
+ <form method="post" action="<TMPL_VAR script ESCAPE=HTML>">
+
+ <input type="hidden" name="title" value="<TMPL_VAR title ESCAPE=HTML>">
+
+ <table width="100%">
+ <tr>
+ <th class="listtop"><TMPL_VAR title ESCAPE=HTML></th>
+ </tr>
+ <tr height="5"></tr>
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <td width="50%" align="left" valign="top">
+ <fieldset>
+ <legend>
+ <b>Firma</b>
+ </legend>
+
+ <TMPL_VAR company_given>
+ <TMPL_VAR address_given>
+
+ <br />
+ <br />
+ Tel.:
+ <TMPL_VAR co_tel ESCAPE=HTML>
+ <br />
+ Fax.:
+ <TMPL_VAR co_fax ESCAPE=HTML>
+ <br />
+ <br />
+ <TMPL_VAR co_email ESCAPE=HTML>
+ <br />
+ <br />
+ Steuernummer:
+ <TMPL_VAR taxnumber_given>
+ <br />
+ ELSTER-Steuernummer:
+ <TMPL_VAR elstersteuernummer ESCAPE=HTML>
+ <br />
+ <br />
+
+ </fieldset>
+ <br />
+
+ <TMPL_IF FA_steuerberater_name>
+ <fieldset>
+ <legend>
+ <input checked="checked"
+ title = "Beraterdaten in UStVA übernehmen?"
+ name = "FA_steuerberater"
+ id = "steuerberater"
+ class = "checkbox"
+ type = "checkbox"
+ value = "1" >
+ <b>Steuerberater/-in</b>
+ </legend>
+
+ <TMPL_VAR FA_steuerberater_name ESCAPE=HTML><br />
+ <TMPL_VAR FA_steuerberater_street ESCAPE=HTML><br />
+ <TMPL_VAR FA_steuerberater_city ESCAPE=HTML><br />
+ Telefon <TMPL_VAR FA_steuerberater_tel ESCAPE=HTML><br />
+ </fieldset>
+ <br />
+ </TMPL_IF>
+
+ <fieldset>
+ <legend>
+ <b>Voranmeldungszeitraum</b>
+ </legend>
+ <TMPL_VAR select_year> <TMPL_VAR ustva_vorauswahl>
+ <TMPL_VAR checkbox_kz_10>
+ <br />
+ <TMPL_IF FA_voranmeld>
+ <br />
+ <TMPL_VAR period_local>
+ <TMPL_IF FA_dauerfrist>
+ mit Dauerfristverlängerung
+ </TMPL_IF>
+ <br />
+ </TMPL_IF>
+
+ <TMPL_IF method_local>
+ Verfahren: <TMPL_VAR method_local>
+ </TMPL_IF>
+ </fieldset>
+ </td>
+ <td width="50%" valign="top">
+
+<!-- TMPL_IF FA_Name -->
+
+ <fieldset>
+ <legend>
+ <b>Finanzamt</b>
+ </legend>
+ <h3><TMPL_VAR FA_Name ESCAPE=HTML></h3>
+
+ <TMPL_VAR FA_Strasse ESCAPE=HTML>
+ <br>
+ <TMPL_VAR FA_PLZ ESCAPE=HTML> <TMPL_VAR FA_Ort
+ ESCAPE=HTML>
+ <br>
+ <br>
+ Tel.:
+ <TMPL_VAR FA_Telefon ESCAPE=HTML>
+ <br>
+ Fax.:
+ <TMPL_VAR FA_Fax ESCAPE=HTML>
+ <br>
+ <br>
+ <!-- Mailto alles Maskieren! -->
+ <a href="mailto:<TMPL_VAR FA_Email ESCAPE=HTML>
+ ?subject="<TMPL_VAR steuernummer ESCAPE=HTML>:"
+ &bcc="<TMPL_VAR email ESCAPE=HTML>"
+ &body="Sehr%20geehrte%20Damen%20und%20Herren,
+ %0D%0A%0D%0A%0D%0AMit%20freundlichen%20Grüßen
+ %0D%0A%0D%0A<TMPL_VAR signature ESCAPE=HTML>"">
+ <TMPL_VAR FA_Email ESCAPE=HTML>
+ </a>
+ <br>
+ <a href="<TMPL_VAR FA_Internet>">
+ <TMPL_VAR FA_Internet ESCAPE=HTML>
+ </a>
+ <br>
+ <br>
+ Öffnungszeiten
+ <br>
+ <TMPL_VAR openings>
+ <br>
+ <br>
+ Bankverbindungen
+ <table>
+ <tr>
+
+ <TMPL_LOOP NAME="tax_office_banks">
+ <td width="40%">
+ <TMPL_VAR Bankbezeichnung ESCAPE=HTML>
+ <br>
+ Konto:
+ <TMPL_VAR Kontonummer ESCAPE=HTML>
+ <br>
+ BLZ:
+ <TMPL_VAR BLZ ESCAPE=HTML>
+ </td>
+ </TMPL_LOOP>
+
+ </tr>
+ </table>
+ <br>
+ </fieldset>
+
+ <br>
+
+ <fieldset>
+ <legend>
+ <b>Ausgabeformat</b>
+ </legend>
+ <TMPL_VAR select_options>
+ </fieldset>
+
+ <TMPL_ELSE>
+
+ <td width="50%" valign="bottom">
+ <fieldset>
+ <legend>
+ <b>Hinweise</b>
+ </legend>
+ <h2 class="confirm">
+ Die Ausgabefunktionen sind wegen unzureichender Voreinstellungen deaktiviert!
+ </h2>
+ <h3>Hilfe</h3>
+ <ul>
+ <li>Bitte fehlende USTVA Einstellungen ergänzen (Menüpunkt: System-> UStVA Einstellungen)</li>
+ </ul>
+ </fieldset>
+
+ </TMPL_IF>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td><hr size="3" noshade></td>
+ </tr>
+ </table>
+
+ <br>
+ <input type="hidden" name="address" value="<TMPL_VAR address>">
+ <input type="hidden" name="reporttype" value="custom">
+ <input type="hidden" name="co_street" value="<TMPL_VAR co_street>">
+ <input type="hidden" name="co_city" value="<TMPL_VAR co_city>">
+ <input type="hidden" name="login" value="<TMPL_VAR login>">
+ <input type="hidden" name="password" value="<TMPL_VAR password>">
+ <table width="100%">
+ <tr>
+ <td align="left">
+ <input type=hidden name=nextsub value=generate_ustva>
+ <input <TMPL_UNLESS FA_Name>disabled="disabled"</TMPL_UNLESS>
+ type=submit class=submit name=action value="Zeigen">
+ </td>
+ <td align="right">
+
+ </form>
+ <!--
+ <form action="doc/ustva.html" method="get">
+ <input type=submit class=submit name=action
+ value="Hilfe">
+ </form>
+ -->
+ </td>
+ </tr>
+ </table>
+</body>
+</html>
+
+
+
+
+
--- /dev/null
+<!--This file is autogenerated,
+ Edit templates/webpages/ustva/report_master.html
+ and run locale/<cc>/locales.pl -->
+
+ <body>
+ <form method="post" action="<TMPL_VAR script ESCAPE=HTML>">
+
+ <input type="hidden" name="title" value="<TMPL_VAR title ESCAPE=HTML>">
+
+ <table width="100%">
+ <tr>
+ <th class="listtop"><TMPL_VAR title ESCAPE=HTML></th>
+ </tr>
+ <tr height="5"></tr>
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <td width="50%" align="left" valign="top">
+ <fieldset>
+ <legend>
+ <b><translate>Company</translate></b>
+ </legend>
+
+ <TMPL_VAR company_given>
+ <TMPL_VAR address_given>
+
+ <br />
+ <br />
+ <translate>Tel</translate>.:
+ <TMPL_VAR co_tel ESCAPE=HTML>
+ <br />
+ <translate>Fax</translate>.:
+ <TMPL_VAR co_fax ESCAPE=HTML>
+ <br />
+ <br />
+ <TMPL_VAR co_email ESCAPE=HTML>
+ <br />
+ <br />
+ <translate>Tax Number</translate>:
+ <TMPL_VAR taxnumber_given>
+ <br />
+ <translate>ELSTER Tax Number</translate>:
+ <TMPL_VAR elstersteuernummer ESCAPE=HTML>
+ <br />
+ <br />
+
+ </fieldset>
+ <br />
+
+ <TMPL_IF FA_steuerberater_name>
+ <fieldset>
+ <legend>
+ <input checked="checked"
+ title = "<translate>Assume Tax Consultant Data in Tax Computation?</translate>"
+ name = "FA_steuerberater"
+ id = "steuerberater"
+ class = "checkbox"
+ type = "checkbox"
+ value = "1" >
+ <b><translate>Tax Consultant</translate></b>
+ </legend>
+
+ <TMPL_VAR FA_steuerberater_name ESCAPE=HTML><br />
+ <TMPL_VAR FA_steuerberater_street ESCAPE=HTML><br />
+ <TMPL_VAR FA_steuerberater_city ESCAPE=HTML><br />
+ <translate>Tel.</translate> <TMPL_VAR FA_steuerberater_tel ESCAPE=HTML><br />
+ </fieldset>
+ <br />
+ </TMPL_IF>
+
+ <fieldset>
+ <legend>
+ <b><translate>Tax Period</translate></b>
+ </legend>
+ <TMPL_VAR select_year> <TMPL_VAR ustva_vorauswahl>
+ <TMPL_VAR checkbox_kz_10>
+ <br />
+ <TMPL_IF FA_voranmeld>
+ <br />
+ <TMPL_VAR period_local>
+ <TMPL_IF FA_dauerfrist>
+ <translate>With Extension Of Time</translate>
+ </TMPL_IF>
+ <br />
+ </TMPL_IF>
+
+ <TMPL_IF method_local>
+ <translate>Method</translate>: <TMPL_VAR method_local>
+ </TMPL_IF>
+ </fieldset>
+ </td>
+ <td width="50%" valign="top">
+
+<!-- TMPL_IF FA_Name -->
+
+ <fieldset>
+ <legend>
+ <b><translate>Tax Office</translate></b>
+ </legend>
+ <h3><TMPL_VAR FA_Name ESCAPE=HTML></h3>
+
+ <TMPL_VAR FA_Strasse ESCAPE=HTML>
+ <br>
+ <TMPL_VAR FA_PLZ ESCAPE=HTML> <TMPL_VAR FA_Ort
+ ESCAPE=HTML>
+ <br>
+ <br>
+ <translate>Tel</translate>.:
+ <TMPL_VAR FA_Telefon ESCAPE=HTML>
+ <br>
+ <translate>Fax</translate>.:
+ <TMPL_VAR FA_Fax ESCAPE=HTML>
+ <br>
+ <br>
+ <!-- Mailto alles Maskieren! -->
+ <a href="mailto:<TMPL_VAR FA_Email ESCAPE=HTML>
+ ?subject="<TMPL_VAR steuernummer ESCAPE=HTML>:"
+ &bcc="<TMPL_VAR email ESCAPE=HTML>"
+ &body="Sehr%20geehrte%20Damen%20und%20Herren,
+ %0D%0A%0D%0A%0D%0AMit%20freundlichen%20Grüßen
+ %0D%0A%0D%0A<TMPL_VAR signature ESCAPE=HTML>"">
+ <TMPL_VAR FA_Email ESCAPE=HTML>
+ </a>
+ <br>
+ <a href="<TMPL_VAR FA_Internet>">
+ <TMPL_VAR FA_Internet ESCAPE=HTML>
+ </a>
+ <br>
+ <br>
+ <translate>Openings</translate>
+ <br>
+ <TMPL_VAR openings>
+ <br>
+ <br>
+ <translate>Bank Connections</translate>
+ <table>
+ <tr>
+
+ <TMPL_LOOP NAME="tax_office_banks">
+ <td width="40%">
+ <TMPL_VAR Bankbezeichnung ESCAPE=HTML>
+ <br>
+ <translate>Account</translate>:
+ <TMPL_VAR Kontonummer ESCAPE=HTML>
+ <br>
+ <translate>Bank Code</translate>:
+ <TMPL_VAR BLZ ESCAPE=HTML>
+ </td>
+ </TMPL_LOOP>
+
+ </tr>
+ </table>
+ <br>
+ </fieldset>
+
+ <br>
+
+ <fieldset>
+ <legend>
+ <b><translate>Outputformat</translate></b>
+ </legend>
+ <TMPL_VAR select_options>
+ </fieldset>
+
+ <TMPL_ELSE>
+
+ <td width="50%" valign="bottom">
+ <fieldset>
+ <legend>
+ <b><translate>Hints</translate></b>
+ </legend>
+ <h2 class="confirm">
+ <translate>Missing Preferences: Outputroutine
+ disabled</translate>
+ </h2>
+ <h3><translate>Help</translate></h3>
+ <ul>
+ <li><translate>Hint-Missing-Preferences</translate></li>
+ </ul>
+ </fieldset>
+
+ </TMPL_IF>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td><hr size="3" noshade></td>
+ </tr>
+ </table>
+
+ <br>
+ <input type="hidden" name="address" value="<TMPL_VAR address>">
+ <input type="hidden" name="reporttype" value="custom">
+ <input type="hidden" name="co_street" value="<TMPL_VAR co_street>">
+ <input type="hidden" name="co_city" value="<TMPL_VAR co_city>">
+ <input type="hidden" name="login" value="<TMPL_VAR login>">
+ <input type="hidden" name="password" value="<TMPL_VAR password>">
+ <table width="100%">
+ <tr>
+ <td align="left">
+ <input type=hidden name=nextsub value=generate_ustva>
+ <input <TMPL_UNLESS FA_Name>disabled="disabled"</TMPL_UNLESS>
+ type=submit class=submit name=action value="<translate>Show</translate>">
+ </td>
+ <td align="right">
+
+ </form>
+ <!--
+ <form action="doc/ustva.html" method="get">
+ <input type=submit class=submit name=action
+ value="<translate>Help</translate>">
+ </form>
+ -->
+ </td>
+ </tr>
+ </table>
+</body>
+</html>
+
+
+
+
+
</node>
<node oor:name="ServiceManager">
<prop oor:name="DataFilesChangedCheckValue" oor:type="xs:int">
- <value>-411764226</value>
+ <value>-1472371459</value>
</prop>
<node oor:name="HyphenatorList">
<prop oor:name="de-AT" oor:op="replace" oor:type="xs:string">
--- /dev/null
+am.pl
\ No newline at end of file