Bugzilla – Attachment 22059 Details for
Bug 10412
The ability to update Acquisitions with credit notes, with the option to link to an existing invoice
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10412 - The ability to update Acquisitions with
0001-Bug-10412-The-ability-to-update-Acquisitions-with.patch (text/plain), 35.34 KB, created by
Amit Gupta
on 2013-10-18 15:03:27 UTC
(
hide
)
Description:
Bug 10412 - The ability to update Acquisitions with
Filename:
MIME Type:
Creator:
Amit Gupta
Created:
2013-10-18 15:03:27 UTC
Size:
35.34 KB
patch
obsolete
>From 59147395904191d58cdbc91a4338def564f14ed1 Mon Sep 17 00:00:00 2001 >From: Amit Gupta <amitddng135@gmail.com> >Date: Mon, 14 Oct 2013 09:52:26 +0530 >Subject: [PATCH 1/2] Bug 10412 - The ability to update Acquisitions with > >credit notes, with the option to link to an existing >invoice. > >To Test: >1) Create a basket. >2) Create some orders underbakset and close > the basket. >3) Receive the shipment give invoice number. >4) For entering creditnote against bookseller > click on invoices link on left hand side. >5) Search invoice number,title,author,isbn etc. >6) Click on Credit note link. >7) Enter credit amount, date, notes etc and > click on Save button. >8) You can edit and delete also. > >Signed-off-by: Amit Gupta <amitddng135@gmail.com> >--- > C4/Budgets.pm | 13 ++ > C4/Creditnote.pm | 148 ++++++++++++++++++++ > acqui/acqui-home.pl | 16 ++- > acqui/creditnote.pl | 121 ++++++++++++++++ > acqui/editcreditnote.pl | 104 ++++++++++++++ > admin/aqbudgets.pl | 15 +- > .../prog/en/modules/acqui/acqui-home.tt | 11 +- > .../prog/en/modules/acqui/creditnote.tt | 132 +++++++++++++++++ > .../prog/en/modules/acqui/editcreditnote.tt | 63 +++++++++ > .../prog/en/modules/acqui/invoices.tt | 2 + > .../prog/en/modules/admin/aqbudgets.tt | 3 + > 11 files changed, 617 insertions(+), 11 deletions(-) > create mode 100644 C4/Creditnote.pm > create mode 100755 acqui/creditnote.pl > create mode 100755 acqui/editcreditnote.pl > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/acqui/creditnote.tt > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/acqui/editcreditnote.tt > >diff --git a/C4/Budgets.pm b/C4/Budgets.pm >index a648773..c7c5494 100644 >--- a/C4/Budgets.pm >+++ b/C4/Budgets.pm >@@ -41,6 +41,7 @@ BEGIN { > &DelBudget > &GetBudgetSpent > &GetBudgetOrdered >+ &GetBudgetCredited > &GetBudgetName > &GetPeriodsCount > &GetChildBudgetsSpent >@@ -357,6 +358,18 @@ sub GetBudgetOrdered { > return $sum; > } > >+# ------------------------------------------------------------------- >+sub GetBudgetCredited { >+ my ($budget_id) = @_; >+ my $dbh = C4::Context->dbh; >+ my $sth = $dbh->prepare(qq| >+ SELECT SUM(amountcredit) AS sum FROM aqcreditnotes >+ WHERE budget_id = ? >+ |); >+ $sth->execute($budget_id); >+ return $sth->fetchrow_array; >+} >+ > =head2 GetBudgetName > > my $budget_name = &GetBudgetName($budget_id); >diff --git a/C4/Creditnote.pm b/C4/Creditnote.pm >new file mode 100644 >index 0000000..6d15463 >--- /dev/null >+++ b/C4/Creditnote.pm >@@ -0,0 +1,148 @@ >+package C4::Creditnote; >+ >+# This file is part of Koha. >+# >+# Copyright (C) 2013 Amit Gupta (amitddng135@gmail.com) >+# >+# Koha 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 3 of the License, or >+# (at your option) any later version. >+# >+# Koha 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 Koha; if not, see <http://www.gnu.org/licenses>.. >+ >+ >+use strict; >+use warnings; >+use C4::Context; >+ >+use vars qw($VERSION @ISA @EXPORT); >+ >+BEGIN { >+ # set the version for version checking >+ $VERSION = 3.07.00.049; >+ require Exporter; >+ @ISA = qw(Exporter); >+ @EXPORT = qw( >+ &AddCreditnote &ModCreditnote &Creditnote &ShowCreditnoteid >+ &DelCreditnote >+ >+ ); >+} >+ >+ >+=head3 AddCreditnote >+ >+Create a new creditnote and return its id. >+ >+=cut >+ >+sub AddCreditnote { >+ my ($booksellerid, $invoiceid, $vendorrefid, $amountcredit, $creditdate, $notes, $budget_id) = @_; >+ my $dbh = C4::Context->dbh; >+ my $query = qq| >+ INSERT INTO aqcreditnotes >+ (booksellerid, invoiceid, vendorrefid, amountcredit, creditdate, notes, budget_id) >+ VALUES (?,?,?,?,?,?,?) |; >+ >+ my $sth = $dbh->prepare($query); >+ $sth->execute( $booksellerid,$invoiceid,$vendorrefid,$amountcredit,$creditdate,$notes,$budget_id); >+} >+ >+=head3 ModCreditnote >+ >+Modify an creditnote, creditnote_id is mandatory. >+ >+Return undef if it fails. >+ >+=cut >+ >+sub ModCreditnote { >+ my ($vendorrefid,$amountcredit,$creditdate,$notes,$budget_id,$creditnote_id) = @_; >+ my $dbh = C4::Context->dbh; >+ my $query = qq| >+ UPDATE aqcreditnotes >+ SET vendorrefid = ?, amountcredit = ?, creditdate = ?, notes = ?, budget_id = ? >+ WHERE creditnote_id=? >+ |; >+ my $sth = $dbh->prepare($query); >+ $sth->execute($vendorrefid,$amountcredit,$creditdate,$notes,$budget_id,$creditnote_id); >+} >+ >+=head3 Creditnote >+ >+Show all results against booksellerid and invoiceid >+ >+=cut >+ >+sub Creditnote { >+ my ($booksellerid, $invoiceid) = @_; >+ my $dbh = C4::Context->dbh; >+ my $query = qq| >+ SELECT * FROM aqcreditnotes >+ WHERE booksellerid = ? AND invoiceid = ? >+ |; >+ my $sth = $dbh->prepare($query); >+ my @results; >+ $sth->execute($booksellerid, $invoiceid); >+ return $sth->fetchall_arrayref( {} ); >+} >+ >+=head3 ShowCreditnoteid >+ >+Show particular result against creditnote_id >+ >+=cut >+ >+sub ShowCreditnoteid { >+ my ($creditnote_id) = @_; >+ my $dbh = C4::Context->dbh; >+ my $query = " >+ SELECT * FROM aqcreditnotes >+ WHERE creditnote_id = ? >+ "; >+ my $sth=$dbh->prepare($query); >+ $sth->execute($creditnote_id); >+ return $sth->fetchrow_hashref; >+} >+ >+=head3 DelCreditnote >+ >+ &DelCreditnote($creditnote_id,$booksellerid,$invoiceid); >+ >+Deletes the creditnote that has creditnote_id field $creditnote_id in the aqcreditnotes table. >+ >+=over >+ >+=item C<$creditnote_id> is the primary key of the creditnote in the aqcreditnotes table. >+ >+=back >+ >+=cut >+ >+sub DelCreditnote { >+ my ($creditnote_id,$booksellerid,$invoiceid) = @_; >+ my $dbh = C4::Context->dbh; >+ my $query = qq| >+ DELETE FROM aqcreditnotes >+ WHERE creditnote_id = ? AND booksellerid = ? AND invoiceid = ? >+ |; >+ my $sth = $dbh->prepare($query); >+ $sth->execute($creditnote_id,$booksellerid,$invoiceid); >+ $sth->finish; >+} >+ >+1; >+__END__ >+ >+=head1 AUTHOR >+ >+Amit Gupta <amitddng135 AT gmail.com> >+ >+=cut >diff --git a/acqui/acqui-home.pl b/acqui/acqui-home.pl >index cd56831..71458f7 100755 >--- a/acqui/acqui-home.pl >+++ b/acqui/acqui-home.pl >@@ -85,11 +85,13 @@ my $totspent = 0; > my $totordered = 0; > my $totcomtd = 0; > my $totavail = 0; >+my $totcredit = 0; > > my $total_active = 0; > my $totspent_active = 0; > my $totordered_active = 0; > my $totavail_active = 0; >+my $totavail_credit = 0; > > my @budget_loop; > foreach my $budget ( @{$budget_arr} ) { >@@ -113,29 +115,35 @@ foreach my $budget ( @{$budget_arr} ) { > > $budget->{'budget_ordered'} = GetBudgetOrdered( $budget->{'budget_id'} ); > $budget->{'budget_spent'} = GetBudgetSpent( $budget->{'budget_id'} ); >+ $budget->{'budget_credit'} = GetBudgetCredited( $budget->{'budget_id'} ); > if ( !defined $budget->{budget_spent} ) { > $budget->{budget_spent} = 0; > } > if ( !defined $budget->{budget_ordered} ) { > $budget->{budget_ordered} = 0; > } >+ if ( !defined $budget->{budget_credit} ) { >+ $budget->{budget_credit} = 0; >+ } > $budget->{'budget_avail'} = >- $budget->{'budget_amount'} - ( $budget->{'budget_spent'} + $budget->{'budget_ordered'} ); >+ ($budget->{'budget_amount'} + $budget->{'budget_credit'})- ( $budget->{'budget_spent'} + $budget->{'budget_ordered'} ); > > $total += $budget->{'budget_amount'}; > $totspent += $budget->{'budget_spent'}; > $totordered += $budget->{'budget_ordered'}; > $totavail += $budget->{'budget_avail'}; >+ $totcredit += $budget->{'budget_credit'}; > > if ($budget->{budget_period_active}){ > $total_active += $budget->{'budget_amount'}; > $totspent_active += $budget->{'budget_spent'}; > $totordered_active += $budget->{'budget_ordered'}; > $totavail_active += $budget->{'budget_avail'}; >+ $totavail_credit += $budget->{'budget_credit'}; > } > >- for my $field (qw( budget_amount budget_spent budget_ordered budget_avail ) ) { >- $budget->{"formatted_$field"} = $num_formatter->format_price( $budget->{$field} ); >+ for my $field (qw( budget_amount budget_spent budget_ordered budget_avail budget_credit ) ) { >+ $budget->{$field} = $num_formatter->format_price( $budget->{$field} ); > } > > push @budget_loop, $budget; >@@ -150,10 +158,12 @@ $template->param( > totordered => $num_formatter->format_price($totordered), > totcomtd => $num_formatter->format_price($totcomtd), > totavail => $num_formatter->format_price($totavail), >+ totcredit => $num_formatter->format_price($totcredit), > total_active => $num_formatter->format_price($total_active), > totspent_active => $num_formatter->format_price($totspent_active), > totordered_active => $num_formatter->format_price($totordered_active), > totavail_active => $num_formatter->format_price($totavail_active), >+ totavail_credit => $num_formatter->format_price($totavail_credit), > suggestions_count => $suggestions_count, > ); > >diff --git a/acqui/creditnote.pl b/acqui/creditnote.pl >new file mode 100755 >index 0000000..ee8046a >--- /dev/null >+++ b/acqui/creditnote.pl >@@ -0,0 +1,121 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Copyright (C) 2013 Amit Gupta (amitddng135@gmail.com) >+# >+# Koha 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 3 of the License, or >+# (at your option) any later version. >+# >+# Koha 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 Koha; if not, see <http://www.gnu.org/licenses>. >+ >+=head1 NAME >+ >+creditnote.pl >+ >+=head1 DESCRIPTION >+ >+creditnote details >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use CGI; >+use C4::Auth; >+use C4::Output; >+use C4::Acquisition; >+use C4::Bookseller qw/GetBookSellerFromId/; >+use C4::Creditnote; >+use C4::Budgets; >+use C4::Dates qw/format_date format_date_in_iso/; >+ >+my $input = new CGI; >+my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( >+ { >+ template_name => 'acqui/creditnote.tmpl', >+ query => $input, >+ type => 'intranet', >+ authnotrequired => 0, >+ flagsrequired => { 'acquisition' => '*' }, >+ debug => 1, >+ } >+); >+ >+my $invoiceid = $input->param('invoiceid'); >+my $booksellerid = $input->param('booksellerid'); >+my $vendorrefid = $input->param('vendorrefid'); >+my $amountcredit = $input->param('amountcredit'); >+my $budget_id = $input->param('budget_id') || 0; >+my $creditdate = C4::Dates->new($input->param('creditdate'))->output('iso'); >+my $notes = $input->param('notes'); >+my $creditnote_id = $input->param('creditnote_id'); >+my $op = $input->param('op'); >+ >+my $details = GetInvoiceDetails($invoiceid); >+my $bookseller = GetBookSellerFromId($booksellerid); >+ >+# build budget list >+my $budget_loop = []; >+my $budgets = GetBudgetHierarchy; >+foreach my $r (@{$budgets}) { >+ push @{$budget_loop}, { >+ b_id => $r->{budget_id}, >+ b_txt => $r->{budget_name}, >+ b_active => $r->{budget_period_active}, >+ b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0, >+ }; >+} >+ >+@{$budget_loop} = >+ sort { uc( $a->{b_txt}) cmp uc( $b->{b_txt}) } @{$budget_loop}; >+ >+my $script_name = "/cgi-bin/koha/acqui/creditnote.pl?booksellerid=$booksellerid&invoiceid=$invoiceid"; >+ >+my $results = Creditnote($booksellerid, $invoiceid); >+my @creditloop = (); >+foreach my $credit (@$results) { >+ my $budget_name = GetBudget($credit->{'budget_id'}); >+ push @creditloop, { >+ creditnote_id => $credit->{'creditnote_id'}, >+ vendorrefid => $credit->{'vendorrefid'}, >+ amountcredit => sprintf( "%.2f", $credit->{'amountcredit'}), >+ creditdate => format_date($credit->{'creditdate'}), >+ notes => $credit->{'notes'}, >+ budget => $budget_name->{'budget_name'}, >+ }; >+ } >+ >+ >+if ($op eq 'add'){ >+ AddCreditnote($booksellerid, $invoiceid, $vendorrefid, $amountcredit, $creditdate, $notes, $budget_id); >+ print $input->redirect($script_name); >+ exit; >+} >+ >+if ($op eq 'delete'){ >+ DelCreditnote($creditnote_id,$booksellerid,$invoiceid); >+ print $input->redirect($script_name); >+ exit; >+} >+ >+$template->param( >+ invoiceid => $invoiceid, >+ invoicenumber => $details->{'invoicenumber'}, >+ suppliername => $bookseller->{'name'}, >+ booksellerid => $booksellerid, >+ creditloop => \@creditloop, >+ budget_loop => $budget_loop, >+); >+ >+ >+output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/acqui/editcreditnote.pl b/acqui/editcreditnote.pl >new file mode 100755 >index 0000000..ad41afa >--- /dev/null >+++ b/acqui/editcreditnote.pl >@@ -0,0 +1,104 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Copyright (C) 2013 Amit Gupta (amitddng135@gmail.com) >+# >+# Koha 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 3 of the License, or >+# (at your option) any later version. >+# >+# Koha 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 Koha; if not, see <http://www.gnu.org/licenses>. >+ >+=head1 NAME >+ >+creditnote.pl >+ >+=head1 DESCRIPTION >+ >+creditnote details >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use CGI; >+use C4::Auth; >+use C4::Output; >+use C4::Acquisition; >+use C4::Bookseller qw/GetBookSellerFromId/; >+use C4::Creditnote; >+use C4::Budgets; >+use C4::Dates qw/format_date format_date_in_iso/; >+ >+my $input = new CGI; >+my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( >+ { >+ template_name => 'acqui/editcreditnote.tmpl', >+ query => $input, >+ type => 'intranet', >+ authnotrequired => 0, >+ flagsrequired => { 'acquisition' => '*' }, >+ debug => 1, >+ } >+); >+ >+my $invoiceid = $input->param('invoiceid'); >+my $booksellerid = $input->param('booksellerid'); >+my $creditnote_id = $input->param('creditnote_id'); >+my $vendorrefid = $input->param('vendorrefid'); >+my $amountcredit = $input->param('amountcredit'); >+my $budget_id = $input->param('budget_id'); >+my $creditdate = C4::Dates->new($input->param('creditdate'))->output('iso'); >+my $notes = $input->param('notes'); >+ >+my $op = $input->param('op'); >+ >+my $creditdetail = &ShowCreditnoteid($creditnote_id); >+my $details = GetInvoiceDetails($invoiceid); >+my $bookseller = GetBookSellerFromId($booksellerid); >+ >+# build budget list >+my $budget_loop = []; >+my $budgets = GetBudgetHierarchy; >+foreach my $r (@{$budgets}) { >+ push @{$budget_loop}, { >+ b_id => $r->{budget_id}, >+ b_txt => $r->{budget_name}, >+ b_active => $r->{budget_period_active}, >+ b_sel => ( $r->{budget_id} == $creditdetail->{'budget_id'} ) ? 1 : 0, >+ }; >+} >+ >+@{$budget_loop} = >+ sort { uc( $a->{b_txt}) cmp uc( $b->{b_txt}) } @{$budget_loop}; >+ >+if ($op eq 'edit'){ >+ ModCreditnote($vendorrefid, $amountcredit, $creditdate,$notes,$budget_id, $creditnote_id); >+ print $input->redirect("/cgi-bin/koha/acqui/creditnote.pl?booksellerid=$booksellerid&invoiceid=$invoiceid"); >+ exit; >+ } >+ >+$template->param( >+ invoiceid => $invoiceid, >+ invoicenumber => $details->{'invoicenumber'}, >+ suppliername => $bookseller->{'name'}, >+ booksellerid => $booksellerid, >+ creditnote_id => $creditnote_id, >+ amountcredit => sprintf("%.2f",$creditdetail->{'amountcredit'}), >+ creditdate => format_date($creditdetail->{'creditdate'}), >+ vendorrefid => $creditdetail->{'vendorrefid'}, >+ notes => $creditdetail->{'notes'}, >+ budget_loop => $budget_loop, >+); >+ >+ >+output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/admin/aqbudgets.pl b/admin/aqbudgets.pl >index f7dcc75..1c539a7 100755 >--- a/admin/aqbudgets.pl >+++ b/admin/aqbudgets.pl >@@ -276,14 +276,14 @@ if ($op eq 'add_form') { > my $toggle = 0; > my @loop; > my $period_total = 0; >- my ( $period_alloc_total, $base_spent_total ); >+ my ( $period_alloc_total, $base_spent_total, $base_credit_total); > > #This Looks WEIRD to me : should budgets be filtered in such a way ppl who donot own it would not see the amount spent on the budget by others ? > > foreach my $budget (@budgets) { > #Level and sublevels total spent > $budget->{'total_levels_spent'} = GetChildBudgetsSpent($budget->{"budget_id"}); >- >+ $budget->{'budget_credit'} = GetBudgetCredited($budget->{"budget_id"}); > # PERMISSIONS > unless(CanUserModifyBudget($borrowernumber, $budget, $staffflags)) { > $budget->{'budget_lock'} = 1; >@@ -303,7 +303,8 @@ if ($op eq 'add_form') { > # adds to total - only if budget is a 'top-level' budget > $period_alloc_total += $budget->{'budget_amount_total'} if $budget->{'depth'} == 0; > $base_spent_total += $budget->{'budget_spent'}; >- $budget->{'budget_remaining'} = $budget->{'budget_amount'} - $budget->{'total_levels_spent'}; >+ $base_credit_total += $budget->{'budget_credit'}; >+ $budget->{'budget_remaining'} = ($budget->{'budget_amount'} + $budget->{'budget_credit'}) - $budget->{'total_levels_spent'}; > > # if amount == 0 dont display... > delete $budget->{'budget_unalloc_sublevel'} >@@ -312,12 +313,13 @@ if ($op eq 'add_form') { > > $budget->{'remaining_pos'} = 1 if $budget->{'budget_remaining'} > 0; > $budget->{'remaining_neg'} = 1 if $budget->{'budget_remaining'} < 0; >- for (grep {/total_levels_spent|budget_spent|budget_amount|budget_remaining|budget_unalloc/} keys %$budget){ >+ for (grep {/total_levels_spent|budget_spent|budget_amount|budget_remaining|budget_unalloc|budget_credit/} keys %$budget){ > $budget->{$_} = $num->format_price( $budget->{$_} ) if defined($budget->{$_}) > } > > # Value of budget_spent equals 0 instead of undefined value > $budget->{"budget_spent"} = $num->format_price(0) unless defined($budget->{"budget_spent"}); >+ $budget->{"budget_credit"} = $num->format_price(0) unless defined($budget->{"budget_credit"}); > > my $borrower = &GetMember( borrowernumber=>$budget->{budget_owner_id} ); > $budget->{"budget_owner_name"} = $borrower->{'firstname'} . ' ' . $borrower->{'surname'}; >@@ -356,12 +358,17 @@ if ($op eq 'add_form') { > $base_spent_total = $num->format_price($base_spent_total); > } > >+ if ($base_credit_total) { >+ $base_credit_total = $num->format_price($base_credit_total); >+ } >+ > $template->param( > else => 1, > budget => \@loop, > budget_period_total => $budget_period_total, > period_alloc_total => $period_alloc_total, > base_spent_total => $base_spent_total, >+ base_credit_total => $base_credit_total, > branchloop => \@branchloop2, > ); > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt >index 4fabffe..f035c63 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt >@@ -118,6 +118,7 @@ $(document).ready(function() { > <th>Amount</th> > <th>Ordered</th> > <th>Spent</th> >+ <th>Credited</th> > <th>Avail</th> > </tr> > </thead> >@@ -131,6 +132,7 @@ $(document).ready(function() { > <th class="data"><span class="bu_active">[% total %]</span><span class="bu_inactive" >[% total_active %]</span></th> > <th class="data"><span class="bu_active">[% totordered %]</span><span class="bu_inactive" >[% totordered_active %]</span></th> > <th class="data"><span class="bu_active">[% totspent %]</span><span class="bu_inactive" >[% totspent_active %]</span></th> >+ <th class="data"><span class="bu_active">[% totavail_credit %]</span><span class="bu_inactive" >[% totavail_credit %]</span></th> > <th class="data"><span class="bu_active">[% totavail %]</span><span class="bu_inactive" >[% totavail_active %]</span></th> > </tr> > </tfoot> >@@ -154,10 +156,11 @@ $(document).ready(function() { > [% END %] > </td> > <td>[% loop_budge.budget_branchname %]</td> >- <td class="data"><span title="[% loop_budge.budget_amount %]">[% loop_budge.formatted_budget_amount %]</span></td> >- <td class="data"><span title="[% loop_budge.budget_ordered %]"><a href="ordered.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.formatted_budget_ordered %]</a></span></td> >- <td class="data"><span title="[% loop_budge.budget_spent %]"><a href="spent.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.formatted_budget_spent %]</span></a></td> >- <td class="data"><span title="[% loop_budge.budget_avail %]">[% loop_budge.formatted_budget_avail %]</td> >+ <td class="data">[% loop_budge.budget_amount %]</td> >+ <td class="data"><a href="ordered.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.budget_ordered %]</a></td> >+ <td class="data"><a href="spent.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.budget_spent %]</a></td> >+ <td class="data">[% loop_budge.budget_credit %]</td> >+ <td class="data">[% loop_budge.budget_avail %]</td> > </tr> > [% ELSE %] > <tr class="b_inactive"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/creditnote.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/creditnote.tt >new file mode 100644 >index 0000000..e28804b >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/creditnote.tt >@@ -0,0 +1,132 @@ >+[% USE KohaDates %] >+ >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Acquisitions › Invoice</title> >+[% INCLUDE 'doc-head-close.inc' %] >+[% INCLUDE 'calendar.inc' %] >+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> >+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script> >+[% INCLUDE 'datatables-strings.inc' %] >+<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script> >+<script type="text/javascript"> >+//<![CDATA[ >+ function Check(f) { >+ if ((f.amountcredit.value.length == 0) && (f.budget_id.value.length == 0)) { >+ alert("Budget and amount is missing"); >+ return false; >+ } else if (f.amountcredit.value.length == 0) { >+ alert("Amount is missing"); >+ return false; >+ } else if (f.budget_id.value.length == 0) { >+ alert("Budget is missing"); >+ return false; >+ } else{ >+ document.Aform.submit(); >+ } >+ } >+ $(document).ready(function() { >+ $("#table_credit").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false }, >+ ], >+ "aaSorting": [[ 1, "asc" ]], >+ "iDisplayLength": 10, >+ "aLengthMenu": [[2, 20, 50, 100, -1], [10, 20, 50, 100, "All"]], >+ })); >+ }); >+//]]> >+</script> >+</head> >+ >+<body> >+[% INCLUDE 'header.inc' %] >+[% INCLUDE 'acquisitions-search.inc' %] >+ >+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › <a href="/cgi-bin/koha/acqui/invoices.pl">Invoices</a> › <a href="/cgi-bin/koha/acqui/creditnote.pl?booksellerid=[% booksellerid %]&invoiceid=[% invoiceid %]">Credit note</a></div> >+ >+ >+<div id="doc3" class="yui-t2"> >+ >+<div id="bd"> >+ <div id="yui-main"> >+ <div class="yui-b"> >+ [% IF ( modified ) %] >+ <div class="dialog message"> >+ <p>Invoice has been modified</p> >+ </div> >+ [% END %] >+ <h1>Invoice: [% invoicenumber %]</h1> >+ <p>Vendor: <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% suppliername %]</a></p> >+ <form action="/cgi-bin/koha/acqui/creditnote.pl" name="Aform" method="post"> >+ <input type="hidden" name="op" value="add" /> >+ <input type="hidden" id="booksellerid" name="booksellerid" value="[% booksellerid %]"/> >+ <input type="hidden" id="invoiceid" name="invoiceid" value="[% invoiceid %]"/> >+ <fieldset class="rows"> >+ <ol> >+ <li><label for="invoicenumber">Invoicenumber:</label>[% invoicenumber %]</li> >+ <li><label for="suppliername">Vendorname:</label>[% suppliername %]</li> >+ <li><label for="vendorrefid">Vendor ref. id:</label> >+ <input type="text" size="30" id="vendorrefid" name="vendorrefid" value="[% vendorrefid %]" /></li> >+ <li><label class="required" for="budget_id">Fund: </label> >+ <select id="budget_id" onchange="fetchSortDropbox(this.form)" size="1" name="budget_id"> >+ <option value="">Select a budget</option> >+ [% FOREACH budget_loo IN budget_loop %] >+ [% IF ( budget_loo.b_sel ) %] >+ <option value="[% budget_loo.b_id %]" selected="selected">[% budget_loo.b_txt %]</option> >+ [% ELSE %] >+ [% IF ( budget_loo.b_active ) %]<option value="[% budget_loo.b_id %]">[% budget_loo.b_txt %]</option> >+ [% ELSE %]<option value="[% budget_loo.b_id %]" class="b_inactive">[% budget_loo.b_txt %]</option> >+ [% END %] >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ <li><label for="amountcredit">Amount credit:</label> >+ <input type="text" size="10" id="amountcredit" name="amountcredit" value="[% amountcredit %]" /></li> >+ <li><label for="creditdate">Date:</label> >+ <input type="text" size="10" id="creditdate" name="creditdate" value="[% creditdate | $KohaDates %]" readonly="readonly" class="datepicker" /></li> >+ <li><label for="notes">Notes: </label><textarea id = "notes" name="notes" width="40" rows="8" >[% notes %]</textarea></li> >+ <input type="hidden" name="op" value="mod" /> >+ <input type="hidden" name="invoiceid" value="[% invoiceid %]" /> >+ </fieldset> >+ <fieldset class="action"> >+ <input type="submit" value="Save" onclick="Check(this.form); return false;"/> >+ </fieldset> >+ </form> >+ <h2>Credit details</h2> >+ [% IF creditloop.size %] >+ <table id="table_credit"> >+ <thead> >+ <tr> >+ <th>Vendor reference id</th> >+ <th>Amount credit</th> >+ <th>Credit date</th> >+ <th>Budget</th> >+ <th>Notes</th> >+ <th></th> >+ <th></th> >+ </tr> >+ </thead> >+ [% FOREACH credit IN creditloop %] >+ <tr> >+ <td>[% credit.vendorrefid %]</td> >+ <td>[% credit.amountcredit %]</td> >+ <td>[% credit.creditdate %]</td> >+ <td>[% credit.budget %]</td> >+ <td>[% credit.notes %]</td> >+ <td><a href="/cgi-bin/koha/acqui/editcreditnote.pl?creditnote_id=[% credit.creditnote_id %]&booksellerid=[% booksellerid %]&invoiceid=[% invoiceid %]">Edit</a></td> >+ <td><a href="/cgi-bin/koha/acqui/creditnote.pl?op=delete&creditnote_id=[% credit.creditnote_id %]&booksellerid=[% booksellerid %]&invoiceid=[% invoiceid %]">Delete</a></td> >+ </tr> >+ </thead> >+ [% END %] >+ </table> >+ [% ELSE %] >+ <div class="dialog message"><p>No credit details yet</p></div> >+ [% END %] >+ </div> >+ </div> >+ <div class="yui-b"> >+ [% INCLUDE 'acquisitions-menu.inc' %] >+ </div> >+</div> >+[% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/editcreditnote.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/editcreditnote.tt >new file mode 100644 >index 0000000..23ae385 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/editcreditnote.tt >@@ -0,0 +1,63 @@ >+[% USE KohaDates %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Acquisitions › Creditnote</title> >+[% INCLUDE 'doc-head-close.inc' %] >+[% INCLUDE 'calendar.inc' %] >+</head> >+ >+<body> >+[% INCLUDE 'header.inc' %] >+[% INCLUDE 'acquisitions-search.inc' %] >+ >+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › <a href="/cgi-bin/koha/acqui/invoices.pl">Invoices</a> › <a href="/cgi-bin/koha/acqui/editcreditnote.pl?creditnote_id=[% creditnote_id %]&booksellerid=[% booksellerid %]&invoiceid=[% invoiceid %]">Modify credit note</a></div> >+ >+<div id="doc3" class="yui-t2"> >+ >+<div id="bd"> >+ <div id="yui-main"> >+ <div class="yui-b"> >+ <h1>Invoice: [% invoicenumber %]</h1> >+ <p>Vendor: <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% suppliername %]</a></p> >+ <form action="/cgi-bin/koha/acqui/editcreditnote.pl" name="Aform" method="post"> >+ <input type="hidden" name="op" value="edit" /> >+ <input type="hidden" id="booksellerid" name="booksellerid" value="[% booksellerid %]"/> >+ <input type="hidden" id="invoiceid" name="invoiceid" value="[% invoiceid %]"/> >+ <input type="hidden" id="creditnote_id" name="creditnote_id" value="[% creditnote_id %]"/> >+ <fieldset class="rows"> >+ <ol> >+ <li><label for="invoicenumber">Invoicenumber:</label>[% invoicenumber %]</li> >+ <li><label for="suppliername">Vendorname:</label>[% suppliername %]</li> >+ <li><label for="vendorrefid">Vendor ref. id:</label> >+ <input type="text" size="30" id="vendorrefid" name="vendorrefid" value="[% vendorrefid %]" /></li> >+ <li><label class="required" for="budget_id">Fund: </label> >+ <select id="budget_id" onchange="fetchSortDropbox(this.form)" size="1" name="budget_id"> >+ <option value="">Select a budget</option> >+ [% FOREACH budget_loo IN budget_loop %] >+ [% IF ( budget_loo.b_sel ) %] >+ <option value="[% budget_loo.b_id %]" selected="selected">[% budget_loo.b_txt %]</option> >+ [% ELSE %] >+ [% IF ( budget_loo.b_active ) %]<option value="[% budget_loo.b_id %]">[% budget_loo.b_txt %]</option> >+ [% ELSE %]<option value="[% budget_loo.b_id %]" class="b_inactive">[% budget_loo.b_txt %]</option> >+ [% END %] >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ <li><label for="amountcredit">Amount credit:</label> >+ <input type="text" size="10" id="amountcredit" name="amountcredit" value="[% amountcredit %]" /></li> >+ <li><label for="creditdate">Date:</label> >+ <input type="text" size="10" id="creditdate" name="creditdate" value="[% creditdate | $KohaDates %]" readonly="readonly" class="datepicker" /></li> >+ <li><label for="notes">Notes: </label><textarea id = "notes" name="notes" width="40" rows="8" >[% notes %]</textarea></li> >+ <input type="hidden" name="invoiceid" value="[% invoiceid %]" /> >+ </fieldset> >+ <fieldset class="action"> >+ <input type="submit" value="Save"/> >+ </fieldset> >+ </form> >+ </div> >+ </div> >+ <div class="yui-b"> >+ [% INCLUDE 'acquisitions-menu.inc' %] >+ </div> >+</div> >+[% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt >index 965fec5..866d457 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt >@@ -45,6 +45,7 @@ $(document).ready(function() { > <th>Billing date</th> > <th>Received biblios</th> > <th>Received items</th> >+ <th>Creditnote</th> > <th>Status</th> > <th> </th> > </tr> >@@ -63,6 +64,7 @@ $(document).ready(function() { > </td> > <td>[% invoice.receivedbiblios %]</td> > <td>[% invoice.receiveditems %]</td> >+ <td><a href="/cgi-bin/koha/acqui/creditnote.pl?booksellerid=[% invoice.booksellerid %]&invoiceid=[% invoice.invoiceid %]">Credit note</td> > <td> > [% IF invoice.closedate %] > Closed on [% invoice.closedate | $KohaDates %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt >index 0c62416..67f0fdd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt >@@ -247,6 +247,7 @@ var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") > <th>Base-level<br />allocated</th> > <th>Base-level<br />spent</th> > <th>Total sublevels<br />spent</th> >+ <th>Base-level<br />credited</th> > <th>Base-level<br />remaining</th> > <th class="tooltipcontent"> </th> > <th>Actions</th> >@@ -259,6 +260,7 @@ var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") > <th nowrap="nowrap" class="data"> [% base_alloc_total %]</th> > <th class="data">[% base_spent_total %]</th> > <th class="data">[% base_spent_total %]</th> >+ <th class="data">[% base_credit_total %]</th> > <th class="data">[% base_remaining_total %]</th> > <th class="tooltipcontent"></th> > <th></th> >@@ -278,6 +280,7 @@ var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") > <td class="data">[% budge.budget_amount %] </td> > <td class="data">[% budge.budget_spent %] </td> > <td class="data">[% budge.total_levels_spent %]</td> >+ <td class="data">[% budge.budget_credit %]</td> > [% IF ( budge.remaining_pos ) %] > <td class="data" style="color: green;"> > [% ELSIF ( budge.remaining_neg ) %] >-- >1.7.9.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10412
:
18809
|
18810
|
22059
|
22060
|
22538
|
22539