log in." unless $remote; return "You don't have access to see this." unless LJ::remote_has_priv($remote, "moneyview") || LJ::remote_has_priv($remote, "shipping"); my $ret; unless (LJ::did_post()) { $ret .= "
"; $ret .= "All labels past date: "; $ret .= "

(be sure to set printer margins to 0.5\" at top and left, with no header or footer.)

"; $ret .= "
"; return $ret; } my $dbh = LJ::get_db_writer(); my $sth; my %country; LJ::load_codes($dbh, { "country" => \%country }); $sth = $dbh->prepare("SELECT payid, dateready FROM shipping ". "WHERE dateready > ? AND status='needs' ". "ORDER BY dateready"); $sth->execute($POST{'date'}); my @ship; push @ship, $_ while $_ = $sth->fetchrow_hashref; my $ct; foreach my $sh (@ship) { $ct++; my $cartobj = $dbh->selectrow_hashref("SELECT * FROM payments WHERE payid=?", undef, $sh->{'payid'}); next unless $cartobj; # load all the cart my $cart = "$cartobj->{'payid'}-$cartobj->{'anum'}"; $cartobj = LJ::Pay::load_cart($cart); next unless $cartobj; if ($ct == 1) { $ret .= "
"; } else { $ret .= "
"; } $ret .= "

Order \#$cart

"; $ret .= "
$sh->{'dateready'}
"; $ret .= "

Enclosed are the items you ordered. If you have any questions, email accounts\@livejournal.com and reference the order number above.

"; LJ::Pay::render_cart($cartobj, \$ret, { shipping_labels => 1 }); $ret .= "

$cart

"; $ret .= "
" . LJ::Pay::postal_address_html() . "
\n"; $ret .= "
"; my %payvar; my $sth = $dbh->prepare("SELECT pkey, pval FROM payvars WHERE payid=? AND pkey LIKE 'ship%'"); $sth->execute($cartobj->{'payid'}); while (my ($k, $v)= $sth->fetchrow_array) { $payvar{$k} = $v; } my $ctry = uc($payvar{'ship_country'}); # Canadian shipping labels need to be printed in all caps, ugh if ($ctry eq 'CA') { $payvar{$_} = uc($payvar{$_}) foreach grep { $_ =~ /^ship_/ } keys %payvar; $country{'CA'} = uc($country{'CA'}); } $ret .= "$payvar{'ship_name'}
"; $ret .= "$payvar{'ship_addr1'}
"; $ret .= "$payvar{'ship_addr2'}
" if $payvar{'ship_addr2'}; $ret .= "$payvar{'ship_city'}, $payvar{'ship_state'} $payvar{'ship_zip'}
"; if ($ctry ne "US") { $ret .= $country{$ctry}; } $ret .= "
"; $ret .= "
[$cart]
"; $ret .= "
"; # end page } $ret .= "no orders found past $POST{'date'}" unless $ct; return $ret; } _code?>