View | Details | Raw Unified | Return to bug 9505
Collapse All | Expand All

(-)a/acqui/invoices.pl (-54 / +40 lines)
Lines 33-43 use CGI; Link Here
33
use C4::Auth;
33
use C4::Auth;
34
use C4::Output;
34
use C4::Output;
35
35
36
use C4::Acquisition;
36
use C4::Acquisition qw/GetInvoices/;
37
use C4::Bookseller qw/GetBookSeller/;
37
use C4::Bookseller qw/GetBookSeller/;
38
use C4::Branch;
38
use C4::Branch qw/GetBranches/;
39
39
40
my $input = new CGI;
40
my $input = CGI->new;
41
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
41
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
42
    {
42
    {
43
        template_name   => 'acqui/invoices.tmpl',
43
        template_name   => 'acqui/invoices.tmpl',
Lines 63-75 my $publicationyear = $input->param('publicationyear'); Link Here
63
my $branch           = $input->param('branch');
63
my $branch           = $input->param('branch');
64
my $op               = $input->param('op');
64
my $op               = $input->param('op');
65
65
66
my @results_loop = ();
66
my $invoices = [];
67
if ( $op and $op eq "do_search" ) {
67
if ( $op and $op eq 'do_search' ) {
68
    my $shipmentdatefrom_iso = C4::Dates->new($shipmentdatefrom)->output("iso");
68
    my $shipmentdatefrom_iso = C4::Dates->new($shipmentdatefrom)->output('iso');
69
    my $shipmentdateto_iso   = C4::Dates->new($shipmentdateto)->output("iso");
69
    my $shipmentdateto_iso   = C4::Dates->new($shipmentdateto)->output('iso');
70
    my $billingdatefrom_iso  = C4::Dates->new($billingdatefrom)->output("iso");
70
    my $billingdatefrom_iso  = C4::Dates->new($billingdatefrom)->output('iso');
71
    my $billingdateto_iso    = C4::Dates->new($billingdateto)->output("iso");
71
    my $billingdateto_iso    = C4::Dates->new($billingdateto)->output('iso');
72
    my @invoices             = GetInvoices(
72
    @{$invoices} = GetInvoices(
73
        invoicenumber    => $invoicenumber,
73
        invoicenumber    => $invoicenumber,
74
        supplierid       => $supplierid,
74
        supplierid       => $supplierid,
75
        shipmentdatefrom => $shipmentdatefrom_iso,
75
        shipmentdatefrom => $shipmentdatefrom_iso,
Lines 83-125 if ( $op and $op eq "do_search" ) { Link Here
83
        publicationyear  => $publicationyear,
83
        publicationyear  => $publicationyear,
84
        branchcode       => $branch
84
        branchcode       => $branch
85
    );
85
    );
86
    foreach (@invoices) {
87
        my %row = (
88
            invoiceid       => $_->{invoiceid},
89
            billingdate     => $_->{billingdate},
90
            invoicenumber   => $_->{invoicenumber},
91
            suppliername    => $_->{suppliername},
92
            booksellerid      => $_->{booksellerid},
93
            receivedbiblios => $_->{receivedbiblios},
94
            receiveditems   => $_->{receiveditems},
95
            subscriptionid  => $_->{subscriptionid},
96
            closedate       => $_->{closedate},
97
        );
98
        push @results_loop, \%row;
99
    }
100
}
86
}
101
87
102
# Build suppliers list
88
# Build suppliers list
103
my @suppliers      = GetBookSeller(undef);
89
my @suppliers      = GetBookSeller(undef);
104
my @suppliers_loop = ();
90
my $suppliers_loop = [];
105
my $suppliername;
91
my $suppliername;
106
foreach (@suppliers) {
92
foreach (@suppliers) {
107
    my $selected = 0;
93
    my $selected = 0;
108
    if ( $supplierid && $supplierid == $_->{'id'} ) {
94
    if ($supplierid && $supplierid == $_->{id} ) {
109
        $selected     = 1;
95
        $selected = 1;
110
        $suppliername = $_->{'name'};
96
        $suppliername = $_->{name};
111
    }
97
    }
112
    my %row = (
98
    push @{$suppliers_loop},
113
        suppliername => $_->{'name'},
99
      {
114
        booksellerid   => $_->{'id'},
100
        suppliername => $_->{name},
101
        booksellerid   => $_->{id},
115
        selected     => $selected,
102
        selected     => $selected,
116
    );
103
      };
117
    push @suppliers_loop, \%row;
118
}
104
}
119
105
120
# Build branches list
106
# Build branches list
121
my $branches      = GetBranches();
107
my $branches      = GetBranches();
122
my @branches_loop = ();
108
my $branches_loop = [];
123
my $branchname;
109
my $branchname;
124
foreach ( sort keys %$branches ) {
110
foreach ( sort keys %$branches ) {
125
    my $selected = 0;
111
    my $selected = 0;
Lines 127-157 foreach ( sort keys %$branches ) { Link Here
127
        $selected   = 1;
113
        $selected   = 1;
128
        $branchname = $branches->{$_}->{'branchname'};
114
        $branchname = $branches->{$_}->{'branchname'};
129
    }
115
    }
130
    my %row = (
116
    push @{$branches_loop},
117
      {
131
        branchcode => $_,
118
        branchcode => $_,
132
        branchname => $branches->{$_}->{'branchname'},
119
        branchname => $branches->{$_}->{branchname},
133
        selected   => $selected,
120
        selected   => $selected,
134
    );
121
      };
135
    push @branches_loop, \%row;
136
}
122
}
137
123
138
$template->param(
124
$template->param(
139
    do_search => ( $op and $op eq "do_search" ) ? 1 : 0,
125
    do_search => ( $op and $op eq 'do_search' ) ? 1 : 0,
140
    results_loop             => \@results_loop,
126
    invoices => $invoices,
141
    invoicenumber            => $invoicenumber,
127
    invoicenumber   => $invoicenumber,
142
    booksellerid             => $supplierid,
128
    booksellerid    => $supplierid,
143
    suppliername             => $suppliername,
129
    suppliername    => $suppliername,
144
    billingdatefrom          => $billingdatefrom,
130
    billingdatefrom => $billingdatefrom,
145
    billingdateto            => $billingdateto,
131
    billingdateto   => $billingdateto,
146
    isbneanissn              => $isbneanissn,
132
    isbneanissn     => $isbneanissn,
147
    title                    => $title,
133
    title           => $title,
148
    author                   => $author,
134
    author          => $author,
149
    publisher                => $publisher,
135
    publisher       => $publisher,
150
    publicationyear          => $publicationyear,
136
    publicationyear => $publicationyear,
151
    branch                   => $branch,
137
    branch          => $branch,
152
    branchname               => $branchname,
138
    branchname      => $branchname,
153
    suppliers_loop           => \@suppliers_loop,
139
    suppliers_loop  => $suppliers_loop,
154
    branches_loop            => \@branches_loop,
140
    branches_loop   => $branches_loop,
155
);
141
);
156
142
157
output_html_with_http_headers $input, $cookie, $template->output;
143
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt (-17 / +16 lines)
Lines 41-47 $(document).ready(function() { Link Here
41
    <div class="yui-b">
41
    <div class="yui-b">
42
      <h1>Invoices</h1>
42
      <h1>Invoices</h1>
43
      [% IF ( do_search ) %]
43
      [% IF ( do_search ) %]
44
        [% IF ( results_loop ) %]
44
        [% IF invoices %]
45
          <table id="resultst">
45
          <table id="resultst">
46
            <thead>
46
            <thead>
47
              <tr>
47
              <tr>
Lines 55-84 $(document).ready(function() { Link Here
55
              </tr>
55
              </tr>
56
            </thead>
56
            </thead>
57
            <tbody>
57
            <tbody>
58
              [% FOREACH result IN results_loop %]
58
              [% FOREACH invoice IN invoices %]
59
                <tr>
59
                <tr>
60
                  <td><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% result.invoiceid %]">[% result.invoicenumber %]</a></td>
60
                  <td><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid %]">[% invoice.invoicenumber %]</a></td>
61
                  <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% result.booksellerid %]">[% result.suppliername %]</a></td>
61
                  <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% invoice.booksellerid %]">[% invoice.suppliername %]</a></td>
62
                  <td>
62
                  <td>
63
                    [% IF (result.billingdate) %]
63
                    [% IF invoice.billingdate %]
64
                      [% result.billingdate | $KohaDates %]
64
                      [% invoice.billingdate | $KohaDates %]
65
                    [% END %]
65
                    [% END %]
66
                  </td>
66
                  </td>
67
                  <td>[% result.receivedbiblios %]</td>
67
                  <td>[% invoice.receivedbiblios %]</td>
68
                  <td>[% result.receiveditems %]</td>
68
                  <td>[% invoice.receiveditems %]</td>
69
                  <td>
69
                  <td>
70
                    [% IF ( result.closedate ) %]
70
                    [% IF invoice.closedate %]
71
                      Closed on [% result.closedate | $KohaDates %]
71
                      Closed on [% invoice.closedate | $KohaDates %]
72
                    [% ELSE %]
72
                    [% ELSE %]
73
                      Open
73
                      Open
74
                    [% END %]
74
                    [% END %]
75
                  </td>
75
                  </td>
76
                  <td>
76
                  <td>
77
                    <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% result.invoiceid %]">Details</a> /
77
                    <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid %]">Details</a> /
78
                    [% IF ( result.closedate ) %]
78
                    [% IF invoice.closedate %]
79
                      <a href="invoice.pl?op=reopen&amp;invoiceid=[% result.invoiceid %]&amp;referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% supplier %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]">Reopen</a>
79
                      <a href="invoice.pl?op=reopen&amp;invoiceid=[% invoice.invoiceid %]&amp;referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% booksellerid %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]">Reopen</a>
80
                    [% ELSE %]
80
                    [% ELSE %]
81
                      <a href="invoice.pl?op=close&amp;invoiceid=[% result.invoiceid %]&amp;referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% supplier %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]">Close</a>
81
                      <a href="invoice.pl?op=close&amp;invoiceid=[% invoice.invoiceid %]&amp;referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% booksellerid %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]">Close</a>
82
                    [% END %]
82
                    [% END %]
83
                  </td>
83
                  </td>
84
                </tr>
84
                </tr>
Lines 92-98 $(document).ready(function() { Link Here
92
              [% IF ( invoicenumber ) %]
92
              [% IF ( invoicenumber ) %]
93
                <li>Invoice no.: [% invoicenumber %]</li>
93
                <li>Invoice no.: [% invoicenumber %]</li>
94
              [% END %]
94
              [% END %]
95
              [% IF ( supplier ) %]
95
              [% IF booksellerid %]
96
                <li>Vendor: [% suppliername %]</li>
96
                <li>Vendor: [% suppliername %]</li>
97
              [% END %]
97
              [% END %]
98
              [% IF ( billingdatefrom ) %]
98
              [% IF ( billingdatefrom ) %]
Lines 131-137 $(document).ready(function() { Link Here
131
              [% END %]
131
              [% END %]
132
            </ul>
132
            </ul>
133
          </p>
133
          </p>
134
        [% END %]<!-- results_loop -->
134
        [% END %]<!-- invoices -->
135
      [% ELSE %]
135
      [% ELSE %]
136
        <p>Use the search form on the left to find invoices.</p>
136
        <p>Use the search form on the left to find invoices.</p>
137
      [% END %]<!-- do_search -->
137
      [% END %]<!-- do_search -->
138
- 

Return to bug 9505