summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorivan <ivan>2003-07-11 15:23:33 +0000
committerivan <ivan>2003-07-11 15:23:33 +0000
commit3d7644882ebf59fcac7230a408d06e7c4e1bb34b (patch)
tree958f73541e6220b2e316be76d9b8439a882b4fbe /httemplate
parentc9ab1234bd0ab76260c7a967b0c0d3d55a03c735 (diff)
payments report for inventivemedia / hpnx
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/index.html6
-rwxr-xr-xhttemplate/search/cust_pay.cgi71
-rwxr-xr-xhttemplate/search/cust_pkg.cgi2
-rw-r--r--httemplate/search/report_cust_pay.html24
4 files changed, 89 insertions, 14 deletions
diff --git a/httemplate/index.html b/httemplate/index.html
index e5bd11806..7354b1c00 100644
--- a/httemplate/index.html
+++ b/httemplate/index.html
@@ -67,7 +67,8 @@
<LI>120 day open invoices (<A HREF="search/cust_bill.cgi?OPEN120_invnum">by invoice number</A>) (<A HREF="search/cust_bill.cgi?OPEN120_date">by date</A>) (<A HREF="search/cust_bill.cgi?OPEN120_custnum">by customer number</A>)
<LI>all invoices (<A HREF="search/cust_bill.cgi?invnum">by invoice number</A>) (<A HREF="search/cust_bill.cgi?date">by date</A>) (<A HREF="search/cust_bill.cgi?custnum">by customer number</A>)
</UL>
- Financial reports
+ <A HREF="search/report_cust_pay.html">Payments</A>
+ <BR><BR>Financial reports
<UL>
<LI> <A HREF="search/report_receivables.cgi">current receivables</A>
<LI> <A HREF="search/report_tax.html">tax reports</A>
@@ -134,7 +135,8 @@
<LI>120 day open invoices (<A HREF="search/cust_bill.cgi?OPEN120_invnum">by invoice number</A>) (<A HREF="search/cust_bill.cgi?OPEN120_date">by date</A>) (<A HREF="search/cust_bill.cgi?OPEN120_custnum">by customer number</A>)
<LI>all invoices (<A HREF="search/cust_bill.cgi?invnum">by invoice number</A>) (<A HREF="search/cust_bill.cgi?date">by date</A>) (<A HREF="search/cust_bill.cgi?custnum">by customer number</A>)
</UL>
- Financial reports
+ <A HREF="search/report_cust_pay.html">Payments</A>
+ <BR><BR>Financial reports
<UL>
<LI> <A HREF="search/report_receivables.cgi">current receivables</A>
<LI> <A HREF="search/report_tax.html">tax reports</A>
diff --git a/httemplate/search/cust_pay.cgi b/httemplate/search/cust_pay.cgi
index b5bdf8296..d601617f9 100755
--- a/httemplate/search/cust_pay.cgi
+++ b/httemplate/search/cust_pay.cgi
@@ -1,12 +1,46 @@
<%
-$cgi->param('payinfo') =~ /^\s*(\d+)\s*$/ or die "illegal payinfo";
-my $payinfo = $1;
-$cgi->param('payby') =~ /^(\w+)$/ or die "illegal payby";
-my $payby = $1;
-my @cust_pay = qsearch('cust_pay', { 'payinfo' => $payinfo,
+my $sortby;
+my @cust_pay;
+if ( $cgi->param('magic') && $cgi->param('magic') eq '_date' ) {
+
+ my %search;
+ if ( $cgi->param('payby') ) {
+ $cgi->param('payby') =~ /^(CARD|CHEK|BILL)$/
+ or die "illegal payby ". $cgi->param('payby');
+ $search{'payby'} = $1;
+ }
+
+ #false laziness with cust_pkg.cgi
+ my $range = '';
+ if ( $cgi->param('beginning')
+ && $cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/ ) {
+ my $beginning = str2time($1);
+ $range = " WHERE _date >= $beginning ";
+ }
+ if ( $cgi->param('ending')
+ && $cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/ ) {
+ my $ending = str2time($1) + 86400;
+ $range .= ( $range ? ' AND ' : ' WHERE ' ). " _date <= $ending ";
+ }
+
+ @cust_pay = qsearch('cust_pay', \%search, '', " $range" );
+
+ $sortby = \*date_sort;
+
+} else {
+
+ $cgi->param('payinfo') =~ /^\s*(\d+)\s*$/ or die "illegal payinfo";
+ my $payinfo = $1;
+
+ $cgi->param('payby') =~ /^(\w+)$/ or die "illegal payby";
+ my $payby = $1;
+
+ @cust_pay = qsearch('cust_pay', { 'payinfo' => $payinfo,
'payby' => $payby } );
-my $sortby = \*date_sort;
+ $sortby = \*date_sort;
+
+}
if (0) {
#if ( scalar(@cust_pay) == 1 ) {
@@ -16,7 +50,7 @@ if (0) {
%>
<!-- mason kludge -->
<%
- idiot("Check # not found.");
+ idiot("Payment not found.");
#exit;
} else {
my $total = scalar(@cust_pay);
@@ -24,9 +58,9 @@ if (0) {
%>
<!-- mason kludge -->
<%
- print header("Check # Search Results", menubar(
+ print header("Payment Search Results", menubar(
'Main Menu', popurl(2)
- )), "$total matching check$s found<BR>", &table(), <<END;
+ )), "$total matching payment$s found<BR>", &table(), <<END;
<TR>
<TH></TH>
<TH>Amount</TH>
@@ -40,23 +74,36 @@ END
foreach my $cust_pay (
sort $sortby grep(!$saw{$_->paynum}++, @cust_pay)
) {
- my($paynum, $custnum, $payinfo, $amount, $date ) = (
+ my($paynum, $custnum, $payby, $payinfo, $amount, $date ) = (
$cust_pay->paynum,
$cust_pay->custnum,
+ $cust_pay->payby,
$cust_pay->payinfo,
sprintf("%.2f", $cust_pay->paid),
$cust_pay->_date,
);
- my $pdate = time2str("%b %d %Y", $date);
+ my $pdate = time2str("%b&nbsp;%d&nbsp;%Y", $date);
my $rowspan = 1;
my $view = popurl(2). "view/cust_main.cgi?". $custnum.
"#". $payby. $payinfo;
+ my $payment_info;
+ if ( $payby eq 'CARD' ) {
+ $payment_info = 'Card&nbsp;#'. 'x'x(length($payinfo)-4).
+ substr($payinfo,(length($payinfo)-4));
+ } elsif ( $payby eq 'CHEK' ) {
+ $payment_info = "E-check&nbsp;acct#$payinfo";
+ } elsif ( $payby eq 'BILL' ) {
+ $payment_info = "Check&nbsp;#$payinfo";
+ } else {
+ $payment_info = "$payby&nbsp;$payinfo";
+ }
+
print <<END;
<TR>
- <TD ROWSPAN=$rowspan><A HREF="$view"><FONT SIZE=-1>$payinfo</FONT></A></TD>
+ <TD ROWSPAN=$rowspan><A HREF="$view"><FONT SIZE=-1>$payment_info</FONT></A></TD>
<TD ROWSPAN=$rowspan ALIGN="right"><A HREF="$view"><FONT SIZE=-1>\$$amount</FONT></A></TD>
<TD ROWSPAN=$rowspan><A HREF="$view"><FONT SIZE=-1>$pdate</FONT></A></TD>
END
diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi
index 12179eaca..603b5654c 100755
--- a/httemplate/search/cust_pkg.cgi
+++ b/httemplate/search/cust_pkg.cgi
@@ -19,6 +19,8 @@ my @cust_pkg;
if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) {
$sortby=\*bill_sort;
+
+ #false laziness with cust_pay.cgi
my $range = '';
if ( $cgi->param('beginning')
&& $cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/ ) {
diff --git a/httemplate/search/report_cust_pay.html b/httemplate/search/report_cust_pay.html
new file mode 100644
index 000000000..93053e1ee
--- /dev/null
+++ b/httemplate/search/report_cust_pay.html
@@ -0,0 +1,24 @@
+<HTML>
+ <HEAD>
+ <TITLE>Payment report criteria</TITLE>
+ </HEAD>
+ <BODY>
+ <CENTER>
+ <H1>Payment report criteria</H1>
+ </CENTER>
+ <HR>
+ <FORM ACTION="cust_pay.cgi" METHOD="post">
+ <INPUT TYPE="hidden" NAME="magic" VALUE="_date">
+ Return <SELECT NAME="payby">
+ <OPTION VALUE="">all</OPTION>
+ <OPTION VALUE="CARD">credit card</OPTION>
+ <OPTION VALUE="CHEK">electronic check (ACH)</OPTION>
+ <OPTION VALUE="BILL">check/cash</OPTION>
+ </SELECT> payments for period<BR>
+ from <INPUT TYPE="text" NAME="beginning"> <i>m/d/y</i>
+ to <INPUT TYPE="text" NAME="ending"> <i>m/d/y</i>
+ <P><INPUT TYPE="submit" VALUE="Get Report">
+ </FORM>
+ <HR>
+ </BODY>
+</HTML>