From c74a6a000992e77707669d840eb0c6892ecc6503 Mon Sep 17 00:00:00 2001 From: tipaul Date: Mon, 10 Feb 2003 13:38:44 +0000 Subject: [PATCH] templating normal acquisition before reordering acquisition and cataloguing. supplier now works with currencies table, not hardcoded currencies --- acqui/acqui-home.pl | 64 ++++ acqui/order.pl | 132 +++----- acqui/supplier.pl | 296 ++++-------------- .../default/en/acqui/acqui-home.tmpl | 118 +++++++ .../intranet-tmpl/default/en/acqui/order.tmpl | 46 +++ .../default/en/acqui/supplier.tmpl | 153 +++++++++ 6 files changed, 483 insertions(+), 326 deletions(-) create mode 100755 acqui/acqui-home.pl create mode 100644 koha-tmpl/intranet-tmpl/default/en/acqui/acqui-home.tmpl create mode 100644 koha-tmpl/intranet-tmpl/default/en/acqui/order.tmpl create mode 100644 koha-tmpl/intranet-tmpl/default/en/acqui/supplier.tmpl diff --git a/acqui/acqui-home.pl b/acqui/acqui-home.pl new file mode 100755 index 0000000000..53c99b2c58 --- /dev/null +++ b/acqui/acqui-home.pl @@ -0,0 +1,64 @@ +#!/usr/bin/perl + +use strict; +use CGI; +use C4::Auth; +use C4::Output; +use C4::Interface::CGI::Output; +use C4::Database; +use HTML::Template; +use C4::Catalogue; + +my $query = new CGI; +my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "acqui/acqui-home.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {acquisition => 1}, + debug => 1, + }); + +# budget +my ($count,@results)=bookfunds; +my $classlist=''; +my $total=0; +my $totspent=0; +my $totcomtd=0; +my $totavail=0; +my @loop_budget = (); +for (my $i=0;$i<$count;$i++){ + my ($spent,$comtd)=bookfundbreakdown($results[$i]->{'bookfundid'}); + my $avail=$results[$i]->{'budgetamount'}-($spent+$comtd); + my %line; + $line{bookfundname} = $results[$i]->{'bookfundname'}; + $line{budgetamount} = $results[$i]->{'budgetamount'}; + $line{spent} = sprintf ("%.2f", $spent); + $line{comtd} = sprintf ("%.2f",$comtd); + $line{avail} = sprintf ("%.2f",$avail); + push @loop_budget, \%line; + $total+=$results[$i]->{'budgetamount'}; + $totspent+=$spent; + $totcomtd+=$comtd; + $totavail+=$avail; +} +#currencies +my ($count,$rates)=getcurrencies(); +my @loop_currency = (); +for (my $i=0;$i<$count;$i++){ + my %line; + $line{currency} = $rates->[$i]->{'currency'}; + $line{rate} = $rates->[$i]->{'rate'}; + push @loop_currency, \%line; +} +$template->param(loggedinuser => $loggedinuser, + classlist => $classlist, + type => 'intranet', + loop_budget => \@loop_budget, + loop_currency => \@loop_currency, + total => sprintf("%.2f",$total), + totspent => sprintf("%.2f",$totspent), + totcomtd => sprintf("%.2f",$totcomtd), + totavail => sprintf("%.2f",$totavail)); + +output_html_with_http_headers $query, $cookie, $template->output; diff --git a/acqui/order.pl b/acqui/order.pl index 67669661c3..f077ced3f2 100755 --- a/acqui/order.pl +++ b/acqui/order.pl @@ -23,105 +23,63 @@ # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, # Suite 330, Boston, MA 02111-1307 USA +use strict; use C4::Catalogue; +use C4::Auth; use C4::Biblio; use C4::Output; use CGI; -use strict; +use C4::Interface::CGI::Output; +use C4::Database; +use HTML::Template; +use C4::Catalogue; -my $input=new CGI; -print $input->header(); -my $supplier=$input->param('supplier'); -print startpage; +my $query=new CGI; +my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "acqui/order.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {acquisition => 1}, + debug => 1, + }); -print startmenu('acquisitions'); +my $supplier=$query->param('supplier'); my ($count,@suppliers)=bookseller($supplier); -print <Supplier Search Results -
-Add New Supplier -
-
-You searched on supplier $supplier, $count results found

- - - - - -printend -; my $colour='#ffffcc'; my $toggle=0; +my @loop_suppliers; for (my $i=0; $i<$count; $i++) { - if ($toggle==0){ - $colour='#ffffcc'; - $toggle=1; - } else { - $colour='white'; - $toggle=0; - } - my ($ordcount,$orders)=getorders($suppliers[$i]->{'id'}); -# print $ordcount; - if ($orders->[0]->{'basketno'}>0) { - print < - - - - - - -printend -; - } else { - print < - - - - - - -printend -; - } - for (my $i2=1;$i2<$ordcount;$i2++){ - if ($orders->[$i2]->{'basketno'}>=1) { - print < - - - - - - -printend -; + my ($ordcount,$orders)=getorders($suppliers[$i]->{'id'}); + my %line; + if ($toggle==0){ + $line{color}='#ffffcc'; + $toggle=1; } else { - print < - - - - - - -printend -; + $line{color}='white'; + $toggle=0; } - } + $line{id} =$suppliers[$i]->{'id'}; + $line{name} = $suppliers[$i]->{'name'}; + $line{total} = $orders->[0]->{'count(*)'}; + $line{authorisedby} = $orders->[0]->{'authorisedby'}; + $line{entrydate} = $orders->[0]->{'entrydate'}; + my @loop_basket; + for (my $i2=0;$i2<$ordcount;$i2++){ + my %inner_line; + warn "bask : ".$orders->[$i2]->{'basketno'}; + $inner_line{basketno} =$orders->[$i2]->{'basketno'}; + $inner_line{total} =$orders->[$i2]->{'count(*)'}; + $inner_line{authorisedby} = $orders->[$i2]->{'authorisedby'}; + $inner_line{entrydate} = $orders->[$i2]->{'entrydate'}; + push @loop_basket, \%inner_line; + } + $line{loop_basket} = \@loop_basket; + push @loop_suppliers, \%line; } +$template->param(loop_suppliers => \@loop_suppliers, + supplier => $supplier, + count => $count); -print < - - -printend -; - -print endmenu('acquisitions'); - -print endpage; +output_html_with_http_headers $query, $cookie, $template->output; diff --git a/acqui/supplier.pl b/acqui/supplier.pl index cb3ff66425..b6b88dad22 100755 --- a/acqui/supplier.pl +++ b/acqui/supplier.pl @@ -23,250 +23,68 @@ # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, # Suite 330, Boston, MA 02111-1307 USA +use C4::Auth; use C4::Catalogue; use C4::Biblio; use C4::Output; use CGI; +use C4::Interface::CGI::Output; +use C4::Database; +use HTML::Template; +use C4::Catalogue; use strict; -my $input=new CGI; -print $input->header(); -my $id=$input->param('id'); +my $query=new CGI; +my $id=$query->param('id'); my ($count,@booksellers)=bookseller($id); -print startpage; - -print startmenu('acquisitions'); - -print < - - -Update: $booksellers[0]->{'name'} -

-

-
 COMPANYBASKETSITEMSSTAFFDATE
New Basket - Receive Order$suppliers[$i]->{'name'}HLT-$orders->[0]->{'basketno'}$orders->[0]->{'count(*)'}$orders->[0]->{'authorisedby'}$orders->[0]->{'entrydate'}
New Basket - Receive Order$suppliers[$i]->{'name'} $orders->[0]->{'count(*)'}$orders->[0]->{'authorisedby'}$orders->[0]->{'entrydate'}
    HLT-$orders->[$i2]->{'basketno'}$orders->[$i2]->{'count(*)'}$orders->[$i2]->{'authorisedby'}   $orders->[$i2]->{'entrydate'}
     $orders->[$i2]->{'count(*)'}$orders->[$i2]->{'authorisedby'}   $orders->[$i2]->{'entrydate'}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
COMPANY DETAILS
Company Name -
Postal Address
Physical Address -
Phone -
Fax -
Website -
CONTACT DETAILS
Contact Name -
Position -
Phone -
Alternative Phone -
Fax -
E-mail -
Notes -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CURRENT STATUS
Supplier is{'active'}==1){ - print " checked "; -} -print ">Active -{'active'}==0){ - print " checked "; -} -print <Inactive -
ORDERING INFORMATION
Publishers and Imprints -
List Prices are -
Invoice Prices are -
GST Registered{'gstreg'}==1){ - print " checked"; -} -print ">Yes -{'gstreg'}==0){ - print " checked"; -} -print <No -
List Item Price Includes GST{'listincgst'}==1){ - print " checked"; -} -print ">Yes -{'listincgst'}==0){ - print " checked"; -} -print <No -
Invoice Item Price Includes GST{'invoiceincgst'}==1){ - print " checked"; -} -print ">Yes -{'invoiceincgst'}==0){ - print " checked"; -} -print <No -
Discount{'discount'}> % -
- - -

-EOP -; - - -print endmenu('acquisitions'); +my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "acqui/supplier.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {acquisition => 1}, + debug => 1, + }); +#build array for currencies +my ($count, $currencies) = &getcurrencies(); +my @loop_pricescurrency; +my @loop_invoicecurrency; +for (my $i=0;$i<$count;$i++) { + if ($booksellers[0]->{'listprice'} eq $currencies->[$i]->{'currency'}) { + push @loop_pricescurrency, { currency => "" }; + } else { + push @loop_pricescurrency, { currency => ""}; + } + if ($booksellers[0]->{'invoiceprice'} eq $currencies->[$i]->{'currency'}) { + push @loop_invoicecurrency, { currency => ""}; + } else { + push @loop_invoicecurrency, { currency => ""}; + } +} +$template->param(id => $id, + name => $booksellers[0]->{'name'}, + postal =>$booksellers[0]->{'postal'}, + address1 => $booksellers[0]->{'address1'}, + address2 => $booksellers[0]->{'address2'}, + address3 => $booksellers[0]->{'address3'}, + address4 => $booksellers[0]->{'address4'}, + phone =>$booksellers[0]->{'phone'}, + fax => $booksellers[0]->{'fax'}, + url => $booksellers[0]->{'url'}, + contact => $booksellers[0]->{'contact'}, + contpos => $booksellers[0]->{'contpos'}, + contphone => $booksellers[0]->{'contphone'}, + contaltphone => $booksellers[0]->{'contaltphone'}, + contfax => $booksellers[0]->{'contfax'}, + contemail => $booksellers[0]->{'contemail'}, + contnotes => $booksellers[0]->{'contnotes'}, + active => $booksellers[0]->{'active'}, + specialty => $booksellers[0]->{'specialty'}, + gstreg => $booksellers[0]->{'gstreg'}, + listinggst => $booksellers[0]->{'listincgst'}, + invoiceincgst => $booksellers[0]->{'invoiceincgst'}, + discount => $booksellers[0]->{'discount'}, + loop_pricescurrency => \@loop_pricescurrency, + loop_invoicecurrency => \@loop_invoicecurrency,); -print endpage; +output_html_with_http_headers $query, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/default/en/acqui/acqui-home.tmpl b/koha-tmpl/intranet-tmpl/default/en/acqui/acqui-home.tmpl new file mode 100644 index 0000000000..cc164a9953 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/default/en/acqui/acqui-home.tmpl @@ -0,0 +1,118 @@ + + +Acquisitions
+ + + + + + + + + +
+ START, RECEIVE, MODIFY ANY ORDER +
Supplier ID or Name +
+ +
+
+ + + + + + + + + + +
+ RECEIVE OR MODIFY PERIODICAL ORDER +
Title Search +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + +
EXCHANGE RATES
+ + + " value=> +
+ + + + + + + + + + + + + +
BUDGETS AND BOOKFUNDS
+ + + + + + + + + + + + + + + + + + + + + + + + +
BudgetsTotalSpentComtdAvail
Total

+ Use your reload button [ctrl + r] to get the most recent figures. + Committed figures are approximate only, as exchange rates will affect the amount actually paid. +
+ +
+ + + + +
+ HELP
+ Ordering:

To start an acquisition, whether an order, local purchase or donation first search on the supplier, you will be asked to check their details, and enter your name which will set up a "shopping basket" for you. (Why is this you might ask... well because we want to know that it's really you ordering things - not just your computer).

+

To order an item you need to establish whether a biblio already exists for it, and either add an item, or set up a new biblio then add the item.

+

To start a new shopping basket with a new supplier return to this page and just start a new supplier search.

+

To close off a shopping basket click on "view shopping baskets" or search above, and the click on "confirm basket".

+
+ + diff --git a/koha-tmpl/intranet-tmpl/default/en/acqui/order.tmpl b/koha-tmpl/intranet-tmpl/default/en/acqui/order.tmpl new file mode 100644 index 0000000000..7b62af3f88 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/default/en/acqui/order.tmpl @@ -0,0 +1,46 @@ + +Supplier Search Results +
+Add New Supplier +
+
+You searched on supplier , results found

+ + + + + + + + + > + + + + +
 Company + + + + + + + +
BasketItemsStaffDate
+
+ ">New Basket + ">Receive Order + "> + + + + + + + + + +
">
+
+

+ diff --git a/koha-tmpl/intranet-tmpl/default/en/acqui/supplier.tmpl b/koha-tmpl/intranet-tmpl/default/en/acqui/supplier.tmpl new file mode 100644 index 0000000000..90db94ac24 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/default/en/acqui/supplier.tmpl @@ -0,0 +1,153 @@ + + +
+ +> +Update: +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
COMPANY DETAILS
Company Name"> +
Postal Address
Physical Address +
Phone"> +
Fax"> +
Website"> +
CONTACT DETAILS
Contact Name"> +
Position"> +
Phone"> +
Alternative Phone"> +
Fax"> +
E-mail"> +
Notes +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CURRENT STATUS
Supplier ischecked>Active + checked>Inactive
ORDERING INFORMATION
Publishers and Imprints +
List Prices are + +
Invoice Prices are + +
GST Registered + checked>Yes + checked>No +
List Item Price Includes GST + checked>Yes + checked>No +
Invoice Item Price Includes GST + checked>Yes + checked>No +
Discount> % +
+ + +
+ + + -- 2.39.5