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

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 ?>
0024 <style>
0025     .cell-default {
0026         line-height: 4em;
0027         vertical-align: middle;
0028     }
0029     .row-total {
0030         border-top: #1595ee solid thin;
0031         padding-top: 1em;
0032         padding-bottom: 1em;
0033         line-height: 30px;
0034         margin-left: 0px;
0035         margin-right: 0px;
0036     }
0037     
0038     .popover {
0039         min-width:350px;
0040     }
0041     
0042     .popover-title { 
0043         text-transform: none;
0044         font-size: 11pt;
0045     }
0046     
0047     .popover-content { 
0048         text-transform: none;
0049         font-size: 11pt;
0050     }
0051 </style>
0052 <ul class="nav nav-tabs margin-bottom-10">
0053 <?php
0054     
0055 $isCurrentMonth = false;
0056 $modelDownload = new Default_Model_StatDownload();
0057 $yearmonth = null;
0058 
0059 if(isset($this->yearmonth)) {
0060     $yearmonth = $this->yearmonth;
0061 }
0062 
0063 $section_id = null;
0064 /*
0065 if(isset($this->section_id)) {
0066     $section_id = $this->section_id;
0067 }
0068 */
0069 ?>
0070 
0071 <div class="tab-content">
0072 <?php
0073 $helperUserRole = new Backend_View_Helper_UserRole();
0074 $userRoleName = $helperUserRole->userRole();
0075 
0076 $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl();
0077 $helpImage = new Default_View_Helper_Image();
0078 $css_active = ' in active';
0079 $has_paypal = false;
0080 $currency = new Zend_Currency('en_US');
0081 
0082 $currentDate = date("Ym",time());
0083 $printCurrentMonth = new DateTime($currentDate.'01');
0084 
0085 $printMonth = new DateTime($yearmonth.'01');
0086 $printDate = $printMonth->format('M Y');
0087 
0088 if(null != $section_id) {
0089     $allDownloads = $modelDownload->getUserAffiliatesForMonthAndSection($this->member->member_id, $yearmonth, $section_id);
0090 } else {
0091     $allDownloads = $modelDownload->getUserAffiliatesForMonth($this->member->member_id, $yearmonth);
0092 }
0093 
0094 $countDownloadsOverall = count($allDownloads);
0095 
0096 if ($countDownloadsOverall > 0) {
0097     $firstProduct = $allDownloads[0];
0098     if ($firstProduct) {
0099         $printMonth = new DateTime($firstProduct['yearmonth'].'01');
0100         $printCurrentMonth = new DateTime($currentDate.'01');
0101         
0102         if($printMonth == $printCurrentMonth) {
0103             $isCurrentMonth = true;
0104         } else {
0105             $isCurrentMonth = false;
0106         }
0107         $sum_total_month = 0;
0108         $sum_total_text = '';
0109         ?>
0110     
0111         <div class="container-fluid margin-bottom-12" style="padding-left: 0; padding-right: 0;">
0112             <div class="row">
0113                 <div class="col-md-2 text-left text-uppercase nowrap" style="white-space: nowrap; min-width: 140px;max-width: 180px; "><strong>Affiliate</strong></div>
0114                 <div class="col-md-2 text-right text-uppercase nowrap" style="white-space: nowrap;min-width: 140px;max-width: 180px; "><strong>Donation</strong></div>
0115                 <div class="col-md-2 text-right text-uppercase nowrap" style="white-space: nowrap;min-width: 140px;max-width: 180px; "><strong>Percent</strong></div>
0116                 <div class="col-md-2 text-right text-uppercase nowrap" style="white-space: nowrap;min-width: 140px;max-width: 180px; "><strong>Sum Payout</strong></div>
0117             </div>
0118         </div>
0119     
0120         <div class="tab-pane fade <?=$css_active?>" id="<?=$firstProduct['yearmonth']?>">
0121             <?php
0122             $css_active = '';
0123 
0124             foreach ($allDownloads as $product) { 
0125                 ?>
0126                 <div class="row margin-bottom-12"  style="padding-left: 0; padding-right: 0; margin-bottom: 10px;">
0127                     <div class="col-md-2 text-left cell-default" style="min-width: 140px;max-width: 180px;">
0128                         <a href="<?= $this->buildMemberUrl($product['supporter_username']) ?>">
0129                             <span style="line-height: 3em;"><?= $product['supporter_username']; ?></span>
0130                         </a>
0131                     </div>
0132                     <div class="col-md-2 text-right cell-default" style="min-width: 140px;max-width: 180px;">
0133                         <span><?php print($currency->toCurrency($product['sum_donations'])); ?></span>
0134                     </div>
0135                     <div class="col-md-2 text-right cell-default" style="min-width: 140px;max-width: 180px;">
0136                         <span><?= $product['affiliate_percent'] ?></span>
0137                     </div>
0138                     <div class="col-md-2 text-right cell-default" style="min-width: 140px;max-width: 180px;">
0139                         <span><?php print($currency->toCurrency($product['sum_donations']*$product['affiliate_percent'])); ?></span>
0140                     </div>
0141                 </div>
0142                 <?php
0143                 $sum_total_text = 'Summaries:';
0144                 $sum_total_month += $product['sum_donations']*$product['affiliate_percent'];
0145             }
0146 
0147             ?>
0148             <div class='row row-total'>
0149                 <div class='col-md-2 text-right' style="min-width: 140px;max-width: 180px;"></div>
0150                 <div class='col-md-2 text-right' style="min-width: 140px;max-width: 180px;"><?=$sum_total_text?></div>
0151                 <div class='col-md-2 text-right' style="min-width: 140px;max-width: 180px;"><strong></strong></div>
0152                 <div class='col-md-2 text-right' style="min-width: 140px;max-width: 180px;"><strong><?php print($currency->toCurrency($sum_total_month)); ?></strong></div>
0153             </div>
0154             
0155             
0156             
0157             <?php 
0158 
0159 
0160             $currentDate = date("Ym",time());
0161             $viewDate = $firstProduct['yearmonth']."";
0162 ?>
0163             
0164         </div>
0165 <?php
0166     }
0167 } else {
0168     
0169     echo '<div class="tab-pane fade in active" id="'.$printDate.'">';
0170     echo '    <div style="text-align: center;" class="row margin-bottom-12"><div class="col-md-8 cell-default">No Data</div></div>';
0171     echo '    <div class="row row-total">';
0172     echo '        <div class="col-md-1 text-right" style="min-width: 150px;"></div><div class="col-md-4 text-right"></div><div class="col-md-3 text-right" style="min-width: 570px;">Possible payout for this month (<span style="font-size: smaller;">*</span>):</div><div class="col-md-1 text-right" style="min-width: 190px;"><strong>$0.00</strong></div>';
0173     echo '    </div>';
0174     echo '</div>';
0175 }
0176     
0177     
0178 ?>
0179 
0180 </div>    
0181     
0182 
0183 
0184 <?php $this->inlineScript()->appendScript(
0185     '    $(document).ready(function(){
0186             $(\'[data-toggle="popover"]\').popover();
0187         });
0188     ');