summaryrefslogtreecommitdiff
path: root/FS/bin/freeside-count-active-customers
diff options
context:
space:
mode:
authorivan <ivan>2002-10-04 12:30:19 +0000
committerivan <ivan>2002-10-04 12:30:19 +0000
commit2f742fce69ed1d168f95478f36a5e70b381d64a9 (patch)
treec0859fe849b06a318ce68ef8d0bc4c5e7522a51e /FS/bin/freeside-count-active-customers
parenta47374ae5aba9530e999f630ca5a21eb758cc0b5 (diff)
adding
Diffstat (limited to 'FS/bin/freeside-count-active-customers')
-rwxr-xr-xFS/bin/freeside-count-active-customers17
1 files changed, 17 insertions, 0 deletions
diff --git a/FS/bin/freeside-count-active-customers b/FS/bin/freeside-count-active-customers
new file mode 100755
index 0000000..759085a
--- /dev/null
+++ b/FS/bin/freeside-count-active-customers
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+domain=$1
+
+echo "\t
+select count(*) from cust_main where
+ 0 < ( SELECT COUNT(*) FROM cust_pkg
+ WHERE cust_pkg.custnum = cust_main.custnum
+ AND ( cust_pkg.cancel IS NULL
+ OR cust_pkg.cancel = 0
+ )
+ )
+ OR 0 = ( SELECT COUNT(*) FROM cust_pkg
+ WHERE cust_pkg.custnum = cust_main.custnum
+ );
+" | psql -U freeside -q $domain | head -1
+