my $totcomtd = 0;
my $totavail = 0;
my @loop_budget = ();
-for ( my $i = 0 ; $i < $count ; $i++ ) {
-
- if ( $toggle eq 0 ) {
- $toggle = 1;
- }
- else {
- $toggle = 0;
- }
- 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{bookfundid} = $results[$i]->{'bookfundid'};
- $line{sdate} = $results[$i]->{'startdate'};
- $line{edate} = $results[$i]->{'enddate'};
- $line{aqbudgetid} = $results[$i]->{'aqbudgetid'};
- $line{spent} = sprintf( "%.2f", $spent );
- $line{comtd} = sprintf( "%.2f", $comtd );
- $line{avail} = sprintf( "%.2f", $avail );
- $line{'toggle'} = $toggle;
- push @loop_budget, \%line;
- $total += $results[$i]->{'budgetamount'};
- $totspent += $spent;
- $totcomtd += $comtd;
- $totavail += $avail;
+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
author => $author,
name => $name,
from_placed_on =>$from_placed_on,
- to_placed_on =>$to_placed_on
+ to_placed_on =>$to_placed_on,
+ intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
);
output_html_with_http_headers $input, $cookie, $template->output;
-default => $supplierid,
-labels => \%supplierlist,
-size => 1,
+ -tabindex=>'',
-multiple => 0 );
$template->param(Supplier=>$supplierlist{$supplierid}) if ($supplierid);
);
push @branchloop, \%row;
}
+my $CGIbranch=CGI::scrolling_list( -name => 'branch',
+ -values => \@select_branches,
+ -labels => \%select_branches,
+ -size => 1,
+ -tabindex=>'',
+ -multiple => 0 );
my ($count, @lateorders) = getlateorders($delay,$supplierid,$branch);
my $total;
CGIsupplier => $CGIsupplier,
lateorders => \@lateorders,
total=>$total,
+ intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
);
output_html_with_http_headers $query, $cookie, $template->output;
my $input=new CGI;
my $supplierid=$input->param('supplierid');
my ($count,@booksellers)=bookseller($supplierid);
-my $invoice=$input->param('invoice');
+my $invoice=$input->param('code') || '';
my $freight=$input->param('freight');
my $gst=$input->param('gst');
-my $date=localtime(time);
+my $date=$input->param('datereceived');
+my $code=$input->param('code');
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "acqui/recieve.tmpl",
debug => 1,
});
-my @results;
-($count,@results)=invoice($invoice);
-if ($invoice eq ''){
- ($count,@results)=getallorders($supplierid);
-}
+my ($countlines,@parcelitems)=getparcelinformation($supplierid,$invoice,$date);
my $totalprice=0;
my $totalfreight=0;
my $totalquantity=0;
my $total;
my $tototal;
my $toggle;
+my @loop_received = ();
+for (my $i=0;$i<$countlines;$i++){
+ $total=($parcelitems[$i]->{'unitprice'} + $parcelitems[$i]->{'freight'}) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre)
+ $parcelitems[$i]->{'unitprice'}+=0;
+ my %line;
+ if ($toggle==0){
+ $line{color}='#EEEEEE';
+ $toggle=1;
+ } else {
+ $line{color}='white';
+ $toggle=0;
+ }
+ $line{basketno} = $parcelitems[$i]->{'basketno'};
+ $line{isbn} = $parcelitems[$i]->{'isbn'};
+ $line{ordernumber} = $parcelitems[$i]->{'ordernumber'};
+ $line{biblionumber} = $parcelitems[$i]->{'biblionumber'};
+ $line{invoice} = $invoice;
+ $line{gst} = $gst;
+ $line{title} = $parcelitems[$i]->{'title'};
+ $line{author} = $parcelitems[$i]->{'author'};
+ $line{unitprice} = $parcelitems[$i]->{'unitprice'};
+ $line{ecost} = $parcelitems[$i]->{'ecost'};
+ $line{quantityrecieved} = $parcelitems[$i]->{'quantityreceived'};
+ $line{quantity} = $parcelitems[$i]->{'quantity'};
+ $line{total} = $total;
+ $line{supplierid} = $supplierid;
+ push @loop_received, \%line;
+ $totalprice+=$parcelitems[$i]->{'unitprice'};
+ $totalfreight+=$parcelitems[$i]->{'freight'};
+ $totalquantity+=$parcelitems[$i]->{'quantityreceived'};
+ $tototal+=$total;
+}
+my ($countpendings,@pendingorders)=getallorders($supplierid);
my @loop_orders = ();
-for (my$i=0;$i<$count;$i++){
- $total=($results[$i]->{'unitprice'} + $results[$i]->{'freight'}) * $results[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre)
- $results[$i]->{'unitprice'}+=0;
+for (my $i=0;$i<$countpendings;$i++){
my %line;
if ($toggle==0){
$line{color}='#EEEEEE';
$line{color}='white';
$toggle=0;
}
- $line{basketno} = $results[$i]->{'basketno'};
- $line{isbn} = $results[$i]->{'isbn'};
- $line{ordernumber} = $results[$i]->{'ordernumber'};
- $line{biblionumber} = $results[$i]->{'biblionumber'};
+ $line{basketno} = $pendingorders[$i]->{'basketno'};
+ $line{isbn} = $pendingorders[$i]->{'isbn'};
+ $line{ordernumber} = $pendingorders[$i]->{'ordernumber'};
+ $line{biblionumber} = $pendingorders[$i]->{'biblionumber'};
$line{invoice} = $invoice;
$line{gst} = $gst;
- $line{title} = ($results[$i]->{'truetitle'}?$results[$i]->{'truetitle'}:$results[$i]->{'suggestedtitle'});
- $line{author} = $results[$i]->{'author'};
- $line{unitprice} = $results[$i]->{'unitprice'};
- $line{quantityrecieved} = $results[$i]->{'quantityreceived'};
+ $line{title} = $pendingorders[$i]->{'title'};
+ $line{author} = $pendingorders[$i]->{'author'};
+ $line{unitprice} = $pendingorders[$i]->{'unitprice'};
+ $line{ecost} = $pendingorders[$i]->{'ecost'};
+ $line{quantityrecieved} = $pendingorders[$i]->{'quantityreceived'};
+ $line{quantity} = $pendingorders[$i]->{'quantity'};
$line{total} = $total;
$line{supplierid} = $supplierid;
push @loop_orders, \%line;
- $totalprice+=$results[$i]->{'unitprice'};
- $totalfreight+=$results[$i]->{'freight'};
- $totalquantity+=$results[$i]->{'quantityreceived'};
- $tototal+=$total;
}
$totalfreight=$freight;
gst => $gst,
freight => $freight,
invoice => $invoice,
- count => $count,
+ countreceived => $countlines,
+ loop_received => \@loop_received,
+ countpending => $countpendings,
loop_orders => \@loop_orders,
totalprice => $totalprice,
totalfreight => $totalfreight,
tototal => $tototal,
gst => $gst,
grandtot => $tototal+$gst,
+ intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
);
output_html_with_http_headers $input, $cookie, $template->output;
use C4::Output;
use C4::Interface::CGI::Output;
use C4::Database;
+use C4::Date;
use HTML::Template;
use C4::Acquisition;
my $input=new CGI;
my $supplierid=$input->param('supplierid');
+my $order=$input->param('orderby') || "datereceived desc";
+my $startfrom=$input->param('startfrom');
+my $code=$input->param('filter');
+my $datefrom=$input->param('datefrom');
+my $dateto=$input->param('dateto');
+my $resultsperpage = $input->param('resultsperpage');
+
my ($count,@booksellers)=bookseller($supplierid);
my ($template, $loggedinuser, $cookie)
debug => 1,
});
+
+$resultsperpage = 20 unless ($resultsperpage);
+my ($count,@results)=getparcels($supplierid, $order, $code,$datefrom,$dateto);
+
+# multi page display gestion
+$startfrom=0 unless ($startfrom);
+if ($count>$resultsperpage){
+ my $displaynext=0;
+ my $displayprev=$startfrom;
+ if(($count - ($startfrom+$resultsperpage)) > 0 ) {
+ $displaynext = 1;
+ }
+
+ my @numbers = ();
+ if ($count>$resultsperpage) {
+ for (my $i=1; $i<$count/$resultsperpage+1; $i++) {
+ if ($i<16) {
+ my $highlight=0;
+ ($startfrom/$resultsperpage==($i-1)) && ($highlight=1);
+ push @numbers, { number => $i,
+ highlight => $highlight ,
+# searchdata=> "test",
+ startfrom => ($i-1)*$resultsperpage};
+ }
+ }
+ }
+
+ my $from = $startfrom*$resultsperpage+1;
+ my $to;
+
+ if($count < (($startfrom+1)*$resultsperpage))
+ {
+ $to = $count;
+ } else {
+ $to = (($startfrom+1)*$resultsperpage);
+ }
+ $template->param(numbers=>\@numbers,
+ displaynext=>$displaynext,
+ displayprev=>$displayprev,
+ nextstartfrom=>(($startfrom+$resultsperpage<$count)?$startfrom+$resultsperpage:$count),
+ prevstartfrom=>(($startfrom-$resultsperpage>0)?$startfrom-$resultsperpage:0)
+ );
+}
+my @loopres;
+
+my $hilighted=0;
+for (my $i=$startfrom;$i<=($startfrom+$resultsperpage-1<$count-1?$startfrom+$resultsperpage-1:$count-1);$i++){
+### startfrom: $startfrom
+### resultsperpage: $resultsperpage
+### count: $count
+### code: $results[$i]->{booksellerinvoicenumber}
+### datereceived: $results[$i]->{datereceived}
+
+ my %cell;
+ $cell{number}=$i+1;
+ $cell{code}=$results[$i]->{booksellerinvoicenumber};
+ $cell{nullcode}=$results[$i]->{booksellerinvoicenumber} eq "NULL";
+ $cell{emptycode}=$results[$i]->{booksellerinvoicenumber} eq '';
+ $cell{raw_datereceived}=$results[$i]->{datereceived};
+ $cell{datereceived}=format_date($results[$i]->{datereceived});
+ $cell{bibcount}=$results[$i]->{biblio};
+ $cell{reccount}=$results[$i]->{itemsreceived};
+ $cell{itemcount}=$results[$i]->{itemsexpected};
+ $cell{hilighted} = $hilighted%2;
+ $hilighted++;
+ push @loopres, \%cell;
+}
+$template->param(searchresults=>\@loopres, count=>$count) if ($count);
+$template->param(orderby=>$order, filter=>$code, datefrom=>$datefrom,dateto=>$dateto, resultsperpage=>$resultsperpage);
$template->param(
name => $booksellers[0]->{'name'},
supplierid => $supplierid,
+ intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
);
output_html_with_http_headers $input, $cookie, $template->output;
}
$template->param(loop_suppliers => \@loop_suppliers,
supplier => $supplier,
- count => $count);
+ count => $count,
+ intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
+ );
output_html_with_http_headers $query, $cookie, $template->output;
use C4::Auth; # get_template_and_user
use C4::Interface::CGI::Output;
use C4::Suggestions;
+use C4::Biblio;
+use C4::SearchMarc;
my $input = new CGI;
my $publicationyear = $input->param('publicationyear');
my $place = $input->param('place');
my $isbn = $input->param('isbn');
+my $duplicateNumber = $input->param('duplicateNumber');
+my $suggestionid = $input->param('suggestionid');
+
my $status = 'ACCEPTED';
my $suggestedbyme = -1; # search ALL suggestors
my $op = $input->param('op');
flagsrequired => {acquisition => 1},
});
+if ($op eq 'connectDuplicate') {
+ connectSuggestionAndBiblio($suggestionid,$duplicateNumber);
+}
my $suggestions_loop= &searchsuggestion($borrowernumber,$author,$title,$publishercode,$status,$suggestedbyme);
+foreach (@$suggestions_loop) {
+ unless ($_->{biblionumber}) {
+ my (@tags, @and_or, @excluding, @operator, @value, $offset,$length);
+ # search on biblio.title
+ if ($_->{title}) {
+ my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,"biblio.title","");
+ push @tags, "'".$tag.$subfield."'";
+ push @and_or, "and";
+ push @excluding, "";
+ push @operator, "contains";
+ push @value, $_->{title};
+ }
+ if ($_->{author}) {
+ my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,"biblio.author","");
+ push @tags, "'".$tag.$subfield."'";
+ push @and_or, "and";
+ push @excluding, "";
+ push @operator, "contains";
+ push @value, $_->{author};
+ }
+ # ... and on publicationyear.
+ if ($_->{publicationyear}) {
+ my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,"biblioitems.publicationyear","");
+ push @tags, "'".$tag.$subfield."'";
+ push @and_or, "and";
+ push @excluding, "";
+ push @operator, "=";
+ push @value, $_->{publicationyear};
+ }
+ # ... and on publisher.
+ if ($_->{publishercode}) {
+ my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,"biblioitems.publishercode","");
+ push @tags, "'".$tag.$subfield."'";
+ push @and_or, "and";
+ push @excluding, "";
+ push @operator, "=";
+ push @value, $_->{publishercode};
+ }
+
+ my ($finalresult,$nbresult) = C4::SearchMarc::catalogsearch($dbh,\@tags,\@and_or,\@excluding,\@operator,\@value,0,10);
+ # there is at least 1 result => return the 1st one
+ if ($nbresult) {
+ # warn "$nbresult => ".@$finalresult[0]->{biblionumber},@$finalresult[0]->{bibid},@$finalresult[0]->{title};
+# warn "DUPLICATE ==>".@$finalresult[0]->{biblionumber},@$finalresult[0]->{bibid},@$finalresult[0]->{title};
+ $_->{duplicateBiblionumber} = @$finalresult[0]->{biblionumber};
+ }
+ }
+}
$template->param(suggestions_loop => $suggestions_loop,
title => $title,
author => $author,
basketno => $basketno,
supplierid => $supplierid,
"op_$op" => 1,
+ intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
);
output_html_with_http_headers $input, $cookie, $template->output;
my $query=new CGI;
my $id=$query->param('supplierid');
+my $op=$query->param('op');
+
my ($count,@booksellers)=bookseller($id);
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "acqui/supplier.tmpl",
contfax => $booksellers[0]->{'contfax'},
contemail => $booksellers[0]->{'contemail'},
contnotes => $booksellers[0]->{'contnotes'},
+ notes => $booksellers[0]->{'notes'},
active => $booksellers[0]->{'active'},
specialty => $booksellers[0]->{'specialty'},
gstreg => $booksellers[0]->{'gstreg'},
listincgst => $booksellers[0]->{'listincgst'},
invoiceincgst => $booksellers[0]->{'invoiceincgst'},
discount => $booksellers[0]->{'discount'},
- loop_pricescurrency => \@loop_pricescurrency,
- loop_invoicecurrency => \@loop_invoicecurrency,);
-
+ invoiceprice=>$booksellers[0]->{'invoiceprice'},
+ listprice=>$booksellers[0]->{'listprice'},
+ intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
+ );
+}else{
+ 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 => "<option selected value=\"$currencies->[$i]->{'currency'}\">$currencies->[$i]->{'currency'}</option>" };
+ } else {
+ push @loop_pricescurrency, { currency => "<option value=\"$currencies->[$i]->{'currency'}\">$currencies->[$i]->{'currency'}</option>"};
+ }
+ if ($booksellers[0]->{'invoiceprice'} eq $currencies->[$i]->{'currency'}) {
+ push @loop_invoicecurrency, { currency => "<option selected value=\"$currencies->[$i]->{'currency'}\">$currencies->[$i]->{'currency'}</option>"};
+ } else {
+ push @loop_invoicecurrency, { currency => "<option value=\"$currencies->[$i]->{'currency'}\">$currencies->[$i]->{'currency'}</option>"};
+ }
+ }
+ $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'},
+ notes => $booksellers[0]->{'notes'},
+ contnotes => $booksellers[0]->{'contnotes'},
+ active => $booksellers[0]->{'active'},
+ specialty => $booksellers[0]->{'specialty'},
+ gstreg => $booksellers[0]->{'gstreg'},
+ listincgst => $booksellers[0]->{'listincgst'},
+ invoiceincgst => $booksellers[0]->{'invoiceincgst'},
+ discount => $booksellers[0]->{'discount'},
+ loop_pricescurrency => \@loop_pricescurrency,
+ loop_invoicecurrency => \@loop_invoicecurrency,
+ intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
+ enter=>1,
+ );
+}
output_html_with_http_headers $query, $cookie, $template->output;
$data{'contaltphone'}=$input->param('contact_phone_2');
$data{'contfax'}=$input->param('contact_fax');
$data{'contemail'}=$input->param('company_email');
-$data{'contnotes'}=$input->param('notes');
+$data{'contnotes'}=$input->param('contact_notes');
+warn "".$data{'contnotes'};
+$data{'notes'}=$input->param('notes');
$data{'active'}=$input->param('status');
$data{'specialty'}=$input->param('publishers_imprints');
$data{'listprice'}=$input->param('list_currency');