File indexing completed on 2025-05-04 05:29:02

0001 <?php 
0002 /**
0003  *  ocs-webserver
0004  *
0005  *  Copyright 2016 by pling GmbH.
0006  *
0007  *    This file is part of ocs-webserver.
0008  *
0009  *    This program is free software: you can redistribute it and/or modify
0010  *    it under the terms of the GNU Affero General Public License as
0011  *    published by the Free Software Foundation, either version 3 of the
0012  *    License, or (at your option) any later version.
0013  *
0014  *    This program is distributed in the hope that it will be useful,
0015  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017  *    GNU Affero General Public License for more details.
0018  *
0019  *    You should have received a copy of the GNU Affero General Public License
0020  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021  **/
0022 ?>
0023 <div class="messages">
0024     <?php foreach (Zend_Controller_Action_HelperBroker::getStaticHelper('flashMessenger')
0025                        ->getCurrentMessages() as $message) : ?>
0026         <p><?php echo $this->escape($message); ?></p>
0027     <?php endforeach; ?>
0028 </div>
0029 <?php
0030 $lastMonth = date("Ym", strtotime("first day of previous month"));
0031 ?>
0032 
0033 <div class="filtering">
0034     <form>
0035         Month: 
0036             <select name="filter_yearmonth" id="filter_yearmonth">
0037                 <option value="201704" <?php if($lastMonth == '201704') echo 'selected=1'; ?> >2017 Apr</option>
0038                 <option value="201705" <?php if($lastMonth == '201705') echo 'selected=1'; ?> >2017 May</option>
0039                 <option value="201706" <?php if($lastMonth == '201706') echo 'selected=1'; ?> >2017 Jun</option>
0040                 <option value="201707" <?php if($lastMonth == '201707') echo 'selected=1'; ?> >2017 Jul</option>
0041                 <option value="201708" <?php if($lastMonth == '201708') echo 'selected=1'; ?> >2017 Aug</option>
0042                 <option value="201709" <?php if($lastMonth == '201709') echo 'selected=1'; ?> >2017 Sep</option>
0043                 <option value="201710" <?php if($lastMonth == '201710') echo 'selected=1'; ?> >2017 Oct</option>
0044                 <option value="201711" <?php if($lastMonth == '201711') echo 'selected=1'; ?> >2017 Nov</option>
0045                 <option value="201712" <?php if($lastMonth == '201712') echo 'selected=1'; ?> >2017 Dect</option>
0046                 
0047                 <option value="201801" <?php if($lastMonth == '201801') echo 'selected=1'; ?> >2018 Jan</option>
0048                 <option value="201802" <?php if($lastMonth == '201802') echo 'selected=1'; ?> >2018 Feb</option>
0049                 <option value="201803" <?php if($lastMonth == '201803') echo 'selected=1'; ?> >2018 Mar</option>
0050                 <option value="201804" <?php if($lastMonth == '201804') echo 'selected=1'; ?> >2018 Apr</option>
0051                 <option value="201805" <?php if($lastMonth == '201805') echo 'selected=1'; ?> >2018 May</option>
0052                 <option value="201806" <?php if($lastMonth == '201806') echo 'selected=1'; ?> >2018 Jun</option>
0053                 <option value="201807" <?php if($lastMonth == '201807') echo 'selected=1'; ?> >2018 Jul</option>
0054                 <option value="201808" <?php if($lastMonth == '201808') echo 'selected=1'; ?> >2018 Aug</option>
0055                 <option value="201809" <?php if($lastMonth == '201809') echo 'selected=1'; ?> >2018 Sep</option>
0056                 <option value="201810" <?php if($lastMonth == '201810') echo 'selected=1'; ?> >2018 Oct</option>
0057                 <option value="201811" <?php if($lastMonth == '201811') echo 'selected=1'; ?> >2018 Nov</option>
0058                 <option value="201812" <?php if($lastMonth == '201812') echo 'selected=1'; ?> >2018 Dect</option>
0059 
0060                 <option value="201901" <?php if($lastMonth == '201901') echo 'selected=1'; ?> >2019 Jan</option>
0061                 <option value="201902" <?php if($lastMonth == '201902') echo 'selected=1'; ?> >2019 Feb</option>
0062                 <option value="201903" <?php if($lastMonth == '201903') echo 'selected=1'; ?> >2019 Mar</option>
0063                 <option value="201904" <?php if($lastMonth == '201904') echo 'selected=1'; ?> >2019 Apr</option>
0064                 <option value="201905" <?php if($lastMonth == '201905') echo 'selected=1'; ?> >2019 May</option>
0065                 <option value="201906" <?php if($lastMonth == '201906') echo 'selected=1'; ?> >2019 Jun</option>
0066                 <option value="201907" <?php if($lastMonth == '201907') echo 'selected=1'; ?> >2019 Jul</option>
0067                 <option value="201908" <?php if($lastMonth == '201908') echo 'selected=1'; ?> >2019 Aug</option>
0068                 <option value="201909" <?php if($lastMonth == '201909') echo 'selected=1'; ?> >2019 Sep</option>
0069                 <option value="201910" <?php if($lastMonth == '201910') echo 'selected=1'; ?> >2019 Oct</option>
0070                 <option value="201911" <?php if($lastMonth == '201911') echo 'selected=1'; ?> >2019 Nov</option>
0071                 <option value="201912" <?php if($lastMonth == '201912') echo 'selected=1'; ?> >2019 Dect</option>
0072                 
0073                 <option value="202001" <?php if($lastMonth == '202001') echo 'selected=1'; ?> >2020 Jan</option>
0074                 <option value="202002" <?php if($lastMonth == '202002') echo 'selected=1'; ?> >2020 Feb</option>
0075                 <option value="202003" <?php if($lastMonth == '202003') echo 'selected=1'; ?> >2020 Mar</option>
0076                 <option value="202004" <?php if($lastMonth == '202004') echo 'selected=1'; ?> >2020 Apr</option>
0077                 <option value="202005" <?php if($lastMonth == '202005') echo 'selected=1'; ?> >2020 May</option>
0078                 <option value="202006" <?php if($lastMonth == '202006') echo 'selected=1'; ?> >2020 Jun</option>
0079                 <option value="202007" <?php if($lastMonth == '202007') echo 'selected=1'; ?> >2020 Jul</option>
0080                 <option value="202008" <?php if($lastMonth == '202008') echo 'selected=1'; ?> >2020 Aug</option>
0081                 <option value="202009" <?php if($lastMonth == '202009') echo 'selected=1'; ?> >2020 Sep</option>
0082                 <option value="202010" <?php if($lastMonth == '202010') echo 'selected=1'; ?> >2020 Oct</option>
0083                 <option value="202011" <?php if($lastMonth == '202011') echo 'selected=1'; ?> >2020 Nov</option>
0084                 <option value="202012" <?php if($lastMonth == '202012') echo 'selected=1'; ?> >2020 Dect</option>
0085                 
0086             </select>
0087             
0088         Status:
0089 
0090             <select name="filter_status" id="filter_status">
0091             <option value=""></option>
0092           <?php 
0093             $optionString = "'':'',";
0094               $payoutStatusModel = new Default_Model_DbTable_PayoutStatus();
0095               $list = $payoutStatusModel->getStatiForSelectList();
0096               foreach ($list as $key => $value) {
0097                 $optionString= "<option value=".$key.">".$key." - ".$value."</option>";
0098                 echo $optionString;
0099               }
0100           ?>
0101         
0102           </select>
0103         
0104         Member Id: <input type="text" name="filter_member_id" id="filter_member_id"/>
0105         PayPal-Mail: <input type="text" name="filter_paypal_mail" id="filter_paypal_mail"/>
0106         e-mail: <input type="text" name="filter_mail" id="filter_mail"/>
0107         <button type="submit" id="LoadRecordsButton"><?= $this->translate('Load records'); ?></button>
0108         <button type="reset" id="RemoveFilterButton"><?= $this->translate('Remove filter'); ?></button>
0109     </form>
0110 </div>
0111 <div id="TableContainer"></div>
0112 <script type="text/javascript">
0113     $(document).ready(function () {
0114         $('#TableContainer').jtable({
0115             jqueryuiTheme: true,
0116             paging: true,
0117             sorting: true,
0118             defaultSorting: 'amount asc',
0119             title: 'Table of member payouts',
0120             toolbar: {
0121                 items: [{
0122                     Tooltip: 'Click here to export this table to excel',
0123                     //icon: '/images/paginate.gif',
0124                     text: 'Export to Excel',
0125                     click: function () {
0126                       url = '/backend/memberpayout/export?filter_status=';
0127                       url += $('#filter_status').val();
0128                       url += '&filter_yearmonth=';
0129                       url += $('#filter_yearmonth').val();
0130                       url += '&filter_member_id=';
0131                       url += $('#filter_member_id').val();
0132                       url += '&filter_paypal_mail=';
0133                       url += $('#filter_paypal_mail').val();
0134                       url += '&filter_mail=';
0135                       url += $('#filter_mail').val();
0136                       window.location = url;
0137                         e.preventDefault();
0138                     }
0139                 }]
0140             },
0141             actions: {
0142                 listAction: '/backend/memberpayout/list',
0143                 //createAction: '/backend/memberpayout/create',
0144                 updateAction: '/backend/memberpayout/update',
0145                 //deleteAction: '/backend/memberpayout/delete'
0146             },
0147             fields: {
0148                 id: {
0149                     title: 'Id',
0150                     key: true,
0151                     create: false,
0152                     edit: false,
0153                     list: false
0154                 },
0155                 yearmonth: {
0156                     title: 'YearMonth',
0157                     list: true,
0158                     create: false,
0159                     edit: false
0160                 },
0161                 member_id: {
0162                     title: 'Member Id',
0163                     list: true,
0164                     edit: false,
0165                     create: false
0166                 },
0167                 mail: {
0168                     title: 'Mail',
0169                     list: true,
0170                     edit: false,
0171                     create: false
0172                 },
0173                 paypal_mail: {
0174                     title: 'PayPal Mail',
0175                     list: true,
0176                     edit: false,
0177                     create: false
0178                 },
0179                 num_downloads: {
0180                     title: '#DL',
0181                     list: true,
0182                     edit: false,
0183                     create: false
0184                 },
0185                 amount: {
0186                     title: 'Amount',
0187                     list: true,
0188                     edit: false,
0189                     create: false
0190                 },
0191                 payment_transaction_id: {
0192                     title: 'Paypal Transaction Id',
0193                     list: true,
0194                     edit: true,
0195                     create: true
0196                 },
0197                 payment_status: {
0198                     title: 'Paypal Status',
0199                     list: false,
0200                     edit: false,
0201                     create: false
0202                 },
0203                 status: {
0204                     title: 'Our Payment Status',
0205                     <?php 
0206                         $optionString = "'':'',";
0207                         $payoutStatusModel = new Default_Model_DbTable_PayoutStatus();
0208                         $list = $payoutStatusModel->getStatiForSelectList();
0209                         foreach ($list as $key => $value) {
0210                             $optionString.= "'".$key."':'".$key." - ".$value."',";
0211                         }
0212                         echo "options: {" . $optionString . "},";
0213                     ?>
0214                     
0215                     list: true,
0216                     edit: true
0217                 },
0218             },
0219             recordsLoaded: function (event, data) {
0220                 
0221                 for (var i in data.records) {
0222                     $('#TableContainer').find(".jtable tbody tr:eq(" + i + ")").css("cssText", "background-color:" + data.records[i].color + " !important; color:white !important;");
0223                 }
0224                 
0225                 /*
0226                 for (var i in data.records) {
0227                     
0228                     if (data.records[i].status > 0 && data.records[i].status < 99) {
0229                         $('#TableContainer').find(".jtable tbody tr:eq(" + i + ")").css("cssText", "background-color:#31708f; !important; color:white !important;");
0230                     } else
0231                     if (data.records[i].status == 100) {
0232                         $('#TableContainer').find(".jtable tbody tr:eq(" + i + ")").css("cssText", "background-color:#3c763d; !important; color:white !important;");
0233                     } else
0234                     if (data.records[i].status > 900 && data.records[i].status < 930) {
0235                         $('#TableContainer').find(".jtable tbody tr:eq(" + i + ")").css("cssText", "background-color:#bd8614; !important; color:black !important;");
0236                     } else
0237                     if (data.records[i].status == 900) {
0238                         $('#TableContainer').find(".jtable tbody tr:eq(" + i + ")").css("cssText", "background-color:#0f2573; !important; color:white !important;");
0239                     } else
0240                     if (data.records[i].status >= 930) {
0241                         $('#TableContainer').find(".jtable tbody tr:eq(" + i + ")").css("cssText", "background-color:#a94442; !important; color:white !important;");
0242                     }
0243                 }
0244                 */
0245             },
0246             recordUpdated: function (event, data) {
0247                 if (data.record) {
0248                     $('#TableContainer').jtable('load', {
0249                       filter_status: $('#filter_status').val(),
0250                         filter_yearmonth: $('#filter_yearmonth').val(),
0251                         filter_member_id: $('#filter_member_id').val(),
0252                         filter_paypal_mail: $('#filter_paypal_mail').val(),
0253                         filter_mail: $('#filter_mail').val()
0254                     });
0255                 }
0256                 
0257             },
0258             rowUpdated: function (event, data) {
0259                 /*
0260                 if (data.record) {
0261                     $('#TableContainer').jtable('load', {
0262                       filter_status: $('#filter_status').val(),
0263                         filter_yearmonth: $('#filter_yearmonth').val(),
0264                         filter_member_id: $('#filter_member_id').val(),
0265                         filter_paypal_mail: $('#filter_paypal_mail').val(),
0266                         filter_mail: $('#filter_mail').val()
0267                     });
0268                 }
0269                 */
0270             }
0271         });
0272 
0273         //Re-load records when user click 'load records' button.
0274         $('#LoadRecordsButton').click(function (e) {
0275             e.preventDefault();
0276             $('#TableContainer').jtable('load', {
0277               filter_status: $('#filter_status').val(),
0278                 filter_yearmonth: $('#filter_yearmonth').val(),
0279                 filter_member_id: $('#filter_member_id').val(),
0280                 filter_paypal_mail: $('#filter_paypal_mail').val(),
0281                 filter_mail: $('#filter_mail').val()
0282             });
0283         });
0284 
0285         //Re-load records when user click 'remove filter' button.
0286         $('#RemoveFilterButton').click(function (e) {
0287             e.preventDefault();
0288             $('#TableContainer').jtable('load', {
0289               filter_status: null,
0290                 filter_yearmonth: null,
0291                 filter_member_id: null,
0292                 filter_paypal_mail: null,
0293                 filter_mail: null
0294             });
0295         });
0296 
0297         $('#TableContainer').jtable('load');
0298         
0299         
0300     });
0301 </script>