v1
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 24 Aug 2006 18:28:44 +0000 (18:28 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 24 Aug 2006 18:28:44 +0000 (18:28 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5659 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/admin/cash_reports.js [new file with mode: 0644]
Open-ILS/xul/staff_client/server/admin/cash_reports.xhtml [new file with mode: 0644]

diff --git a/Open-ILS/xul/staff_client/server/admin/cash_reports.js b/Open-ILS/xul/staff_client/server/admin/cash_reports.js
new file mode 100644 (file)
index 0000000..d06e8c5
--- /dev/null
@@ -0,0 +1,119 @@
+var FETCH_DESK_PAYMENTS = 'open-ils.circ:open-ils.circ.money.org_unit.desk_payments';
+var FETCH_USER_PAYMENTS = 'open-ils.circ:open-ils.circ.money.org_unit.user_payments';
+
+var myPerms = [ 'VIEW_TRANSACTIONS' ];
+var crBaseOrg;
+
+function crInit() {
+       fetchUser();
+       $('user').appendChild(text(USER.usrname()));
+
+       setTimeout( 
+               function() { 
+                       fetchHighestPermOrgs( SESSION, USER.id(), myPerms );
+                       crSetCals();
+                       crBuildOrgs();
+                       crDrawRange();
+               }, 
+               20 
+       );
+}
+
+function crSetCals() {
+
+       Calendar.setup({
+               inputField  : "cr_start",
+               ifFormat    : "%Y-%m-%d",
+               button      : "cr_start_trigger",
+               align       : "Tl",           
+               singleClick : true
+       });
+
+       Calendar.setup({
+               inputField  : "cr_end",
+               ifFormat    : "%Y-%m-%d",
+               button      : "cr_end_trigger",
+               align       : "Tl",           
+               singleClick : true
+       });
+
+       var d = new Date();
+       var y = d.getYear()+1900;
+       var m = ((d.getMonth()+1)+'').replace(/^(\d)$/,'0$1');
+       var da = (d.getDate()+'').replace(/^(\d)$/,'0$1');
+
+       var dat = y+'-'+m+'-'+da;
+       $('cr_start').value = dat;
+       $('cr_end').value = dat;
+}
+
+
+function crCurrentOrg() {
+       var selector = $('cr_orgs');
+       return getSelectorVal(selector);
+}
+
+function crBuildOrgs() {
+
+       var org = findOrgUnit(PERMS['VIEW_TRANSACTIONS']);
+
+       if(!org) {
+               $('cr_orgs').disabled = true;
+               return;
+       }
+
+       org = findOrgUnit(org);
+       var type = findOrgType(org.ou_type()) ;
+
+       var selector = $('cr_orgs');
+       buildOrgSel(selector, org, type.depth());
+
+       for( var i = 0; i < selector.options.length; i++ ) {
+               var opt = selector.options[i];
+               if( !isTrue(findOrgType( findOrgUnit(opt.value).ou_type() ).can_have_users()) )
+                       opt.disabled = true;
+       }
+
+       selector.onchange = crDrawRange;
+
+       crBaseOrg = org;
+
+       var gotoOrg = USER.ws_ou();
+       if( ! setSelector( selector, gotoOrg ) ) {
+               gotoOrg = USER.home_ou();
+               setSelector( selector, gotoOrg );
+       }
+
+       return gotoOrg;
+}
+
+function crDrawRange() {
+       var org = crCurrentOrg();
+
+       removeChildren($('cr_desk_payments'));
+       removeChildren($('cr_user_payments'));
+
+       var req = new Request( FETCH_DESK_PAYMENTS, SESSION, 
+               org, $('cr_start').value, $('cr_end').value );
+       req.callback(
+               function(r) {
+                       drawFMObjectTable( { dest : 'cr_desk_payments', obj : r.getResultObject() });
+                       sortables_init();
+               }
+       );
+       req.send();
+
+       var req = new Request( FETCH_USER_PAYMENTS, SESSION, 
+               org, $('cr_start').value, $('cr_end').value );
+       req.callback(
+               function(r) {
+                       drawFMObjectTable( { dest : 'cr_user_payments', obj : r.getResultObject() });
+                       sortables_init();
+               }
+       );
+       req.send();
+}
+
+
+
+
diff --git a/Open-ILS/xul/staff_client/server/admin/cash_reports.xhtml b/Open-ILS/xul/staff_client/server/admin/cash_reports.xhtml
new file mode 100644 (file)
index 0000000..483b62b
--- /dev/null
@@ -0,0 +1,89 @@
+<?xml version='1.0'?>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude">
+
+       <head>
+               <title>Evergreen: Cash Reports</title>
+               <script language='javascript' src='/opac/common/js/utils.js'> </script>
+               <script language='javascript' src='/opac/common/js//config.js'> </script>
+               <script language='javascript' src='/opac/common/js/CGI.js'> </script>
+               <script language='javascript' src='/opac/common/js/Cookie.js'> </script>
+       
+               <script language='javascript' src='/opac/common/js/JSON.js'> </script>
+               <script language='javascript' src='/opac/common/js/fmall.js'> </script>
+               <script language='javascript' src='/opac/common/js/fmgen.js'> </script>
+               <script language='javascript' src='/opac/common/js/Cookies.js'> </script>
+               <script language='javascript' src='/opac/common/js/opac_utils.js'> </script>
+               <script language='javascript' src='/opac/common/js/OrgTree.js'> </script>
+               <script language='javascript' src='/opac/common/js/org_utils.js'> </script>
+               <script language='javascript' src='/opac/common/js/init.js'> </script>
+               <script language='javascript' src='/opac/common/js/RemoteRequest.js'> </script>
+               <script language='javascript' src='adminlib.js'> </script>
+               <script language='javascript' src='cash_reports.js'> </script>
+
+               <script language='javascript' src='/opac/common/js/sorttable.js'> </script>
+
+               <script language='javascript' src='/opac/common/js/fm_table.js'> </script>
+               <script language='javascript' src='/opac/common/js/fm_table_conf.js'> </script>
+
+               <link rel="stylesheet" type="text/css" media="all" 
+                       href="/opac/common/js/jscalendar/calendar-brown.css" title="win2k-cold-1" />
+               <script type="text/javascript" src="/opac/common/js/jscalendar/calendar.js"></script>
+               <script type="text/javascript" src="/opac/common/js/jscalendar/lang/calendar-en.js"></script>
+               <script type="text/javascript" src="/opac/common/js/jscalendar/calendar-setup.js"></script>
+
+
+               <link type='text/css' rel='stylesheet' href='admin.css' />
+               <link type='text/css' rel='stylesheet' href="/opac/common/css/fm_table.css"/>
+       </head>
+
+       <body onload='crInit();'>
+
+               <div class='welcome_box'>
+                       <span>Welcome </span><b><span id='user'/></b>
+               </div>
+
+               <center>
+
+                       <span style='padding-left: 15px;'>Start Date:</span>
+                       <input type='text' id='cr_start' size='10' maxlength='10'> </input>
+                       <button style='padding: 0px;' id='cr_start_trigger'>
+                               <img src="/opac/common/js/jscalendar/img.gif" 
+                                       style="cursor: pointer; border: 1px solid red; padding: 0px; margin: -3px;" 
+                                       title="Date selector"
+                                       onmouseover="this.style.background='red';" 
+                                       onmouseout="this.style.background=''" />
+                       </button>
+
+                       <span style='padding-left: 15px;'>End Date:</span>
+                       <input type='text' id='cr_end' size='10' maxlength='10'> </input>
+                       <button style='padding: 0px;' id='cr_end_trigger'>
+                               <img src="/opac/common/js/jscalendar/img.gif" 
+                                       style="cursor: pointer; border: 1px solid red; padding: 0px; margin: -3px;" 
+                                       title="Date selector"
+                                       onmouseover="this.style.background='red';" 
+                                       onmouseout="this.style.background=''" />
+                       </button>
+
+                       <div class='pad' style='padding-left: 10px; font-size: 8pt;'>(YYYY-MM-DD)</div>
+
+                       <div>View reports for :  <select id='cr_orgs' style='width:auto;'/></div>
+                       <div><button onclick='crDrawRange();'>Go!</button></div>
+
+
+                       <div id='cr_desk_payments_div'>
+                               <h2>Desk Payments</h2>
+                               <div id='cr_desk_payments'/>
+                       </div>
+                       
+                       <br/><hr/><br/>
+
+                       <div id='cr_user_payments_div'>
+                               <h2>User Payments</h2>
+                               <div id='cr_user_payments'/>
+                       </div>
+
+               </center>
+       </body>
+</html>
+
+