Exemple #1
0
 function web_CashCashtypeDefaultForm()
 {
     $defCashType = zb_StorageGet('DEF_CT');
     if (empty($defCashType)) {
         $defCashType = 'NOP';
     }
     $allCashTypes = zb_CashGetAllCashTypes();
     $inputs = wf_Selector('setdefaultcashtype', $allCashTypes, __('Current default cashtype for manual input'), $defCashType, true);
     $inputs .= wf_Submit(__('Set as default cash type'));
     $result = wf_Form('', 'POST', $inputs, 'glamour');
     return $result;
 }
Exemple #2
0
 function web_PaymentSearch($markers)
 {
     if (wf_CheckPost(array('searchtable'))) {
         if ($_POST['searchtable'] == 'payments') {
             $table = 'payments';
         }
         if ($_POST['searchtable'] == 'corrections') {
             $table = 'paymentscorr';
         }
     } else {
         $table = 'payments';
     }
     $query = "SELECT * from `" . $table . "`";
     $query .= $markers;
     $altercfg = rcms_parse_ini_file(CONFIG_PATH . "alter.ini");
     $csvdata = '';
     $allpayments = simple_queryall($query);
     if ($altercfg['FINREP_CONTRACT']) {
         $allcontracts = zb_UserGetAllContracts();
         $allcontracts = array_flip($allcontracts);
     }
     if ($altercfg['FINREP_TARIFF']) {
         $alltariffs = zb_TariffsGetAllUsers();
     }
     $allrealnames = zb_UserGetAllRealnames();
     $alladdress = zb_AddressGetFulladdresslist();
     $alltypes = zb_CashGetAllCashTypes();
     $allservicenames = zb_VservicesGetAllNamesLabeled();
     $allpaysyspercents = zb_PaySysPercentGetAll();
     $totalsumm = 0;
     $paysyssumm = 0;
     $profitsumm = 0;
     $totalcount = 0;
     $cells = wf_TableCell(__('ID'));
     $cells .= wf_TableCell(__('Date'));
     $cells .= wf_TableCell(__('Cash'));
     $cells .= wf_TableCell(__('PS%'));
     $cells .= wf_TableCell(__('Profit'));
     $cells .= wf_TableCell(__('Login'));
     if ($altercfg['FINREP_CONTRACT']) {
         $cells .= wf_TableCell(__('Contract'));
     }
     $cells .= wf_TableCell(__('Full address'));
     $cells .= wf_TableCell(__('Real Name'));
     if ($altercfg['FINREP_TARIFF']) {
         $cells .= wf_TableCell(__('Tariff'));
     }
     $cells .= wf_TableCell(__('Payment type'));
     $cells .= wf_TableCell(__('Notes'));
     $cells .= wf_TableCell(__('Admin'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($allpayments)) {
         if ($altercfg['FINREP_TARIFF']) {
             $csvTariffColumn = ';' . __('Tariff');
         } else {
             $csvTariffColumn = '';
         }
         $csvdata .= __('ID') . ';' . __('Date') . ';' . __('Cash') . ';' . __('PS%') . ';' . __('Profit') . ';' . __('Login') . ';' . __('Full address') . ';' . __('Real Name') . $csvTariffColumn . ';' . __('Payment type') . ';' . __('Notes') . ';' . __('Admin') . "\n";
         foreach ($allpayments as $io => $each) {
             $cells = wf_TableCell($each['id']);
             $cells .= wf_TableCell($each['date']);
             $cells .= wf_TableCell($each['summ']);
             //detecting paymentsystem and calc percent
             if (isset($allpaysyspercents[$each['note']])) {
                 $currPc = $allpaysyspercents[$each['note']]['percent'];
                 $rawSumm = $each['summ'];
                 $paySysPc = $rawSumm / 100 * $currPc;
                 $ourProfit = $rawSumm - $paySysPc;
             } else {
                 $paySysPc = 0;
                 $ourProfit = $each['summ'];
             }
             $cells .= wf_TableCell($paySysPc);
             $cells .= wf_TableCell($ourProfit);
             $cells .= wf_TableCell(wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . $each['login'], false, ''));
             if ($altercfg['FINREP_CONTRACT']) {
                 $cells .= wf_TableCell(@$allcontracts[$each['login']]);
             }
             @($paymentRealname = $allrealnames[$each['login']]);
             @($paymentCashType = __($alltypes[$each['cashtypeid']]));
             @($paymentAddress = $alladdress[$each['login']]);
             $cells .= wf_TableCell($paymentAddress);
             $cells .= wf_TableCell($paymentRealname);
             if ($altercfg['FINREP_TARIFF']) {
                 @($userTariff = $alltariffs[$each['login']]);
                 $cells .= wf_TableCell($userTariff);
                 $csvTariff = ';' . $userTariff;
             } else {
                 $csvTariff = '';
             }
             $cells .= wf_TableCell($paymentCashType);
             //payment notes translation
             if ($altercfg['TRANSLATE_PAYMENTS_NOTES']) {
                 $paynote = zb_TranslatePaymentNote($each['note'], $allservicenames);
             } else {
                 $paynote = $each['note'];
             }
             $cells .= wf_TableCell($paynote);
             $cells .= wf_TableCell($each['admin']);
             $rows .= wf_TableRow($cells, 'row3');
             //calculating totals
             if ($each['summ'] > 0) {
                 $totalsumm = $totalsumm + $each['summ'];
                 $totalcount++;
             }
             if ($paySysPc > 0) {
                 $paysyssumm = $paysyssumm + $paySysPc;
             }
             if ($ourProfit > 0) {
                 $profitsumm = $profitsumm + $ourProfit;
             }
             $csvSumm = str_replace('.', ',', $each['summ']);
             $csvdata .= $each['id'] . ';' . $each['date'] . ';' . $csvSumm . ';' . $paySysPc . ';' . $ourProfit . ';' . $each['login'] . ';' . $paymentAddress . ';' . $paymentRealname . $csvTariff . ';' . $paymentCashType . ';' . $paynote . ';' . $each['admin'] . "\n";
         }
     }
     //saving report for future download
     if (!empty($csvdata)) {
         $csvSaveName = 'exports/payfind_' . zb_rand_string(8) . '.csv';
         $csvSaveNameEnc = base64_encode($csvSaveName);
         $csvdata = iconv('utf-8', 'windows-1251', $csvdata);
         file_put_contents($csvSaveName, $csvdata);
         $csvDownloadLink = wf_Link('?module=payfind&downloadcsv=' . $csvSaveNameEnc, wf_img('skins/excel.gif', __('Export')), false);
     } else {
         $csvDownloadLink = '';
     }
     $result = wf_TableBody($rows, '100%', '0', 'sortable');
     //additional total counters
     $result .= wf_tag('div', false, 'glamour') . __('Count') . ': ' . $totalcount . wf_tag('div', true);
     $result .= wf_tag('div', false, 'glamour') . __('Total payments') . ': ' . $totalsumm . wf_tag('div', true);
     $result .= wf_tag('div', false, 'glamour') . __('Payment systems %') . ': ' . $paysyssumm . wf_tag('div', true);
     $result .= wf_tag('div', false, 'glamour') . __('Our final profit') . ': ' . $profitsumm . wf_tag('div', true);
     $result .= wf_CleanDiv();
     show_window(__('Payments found') . ' ' . $csvDownloadLink, $result);
 }
Exemple #3
0
 $group_controls .= wf_Link('?module=corporate&userlink=' . $userlink . '&control=tariff', 'Tariff', false, 'ubButton');
 $group_controls .= wf_Link('?module=corporate&userlink=' . $userlink . '&control=credit', 'Credit', false, 'ubButton');
 show_window(__('Group operations'), $group_controls);
 show_window(__('Linked users'), web_UserArrayShower($childusers));
 //show parent user profile by default
 if (!isset($_GET['control'])) {
     $profileObj = new UserProfile($parent_login);
     $default_profile = $profileObj->render();
     show_window(__('User profile'), $default_profile);
 } else {
     //show controls
     if ($_GET['control'] == 'cash') {
         //group cash operations
         $allchildusers = cu_GetAllChildUsers($userlink);
         //cash add form construct
         $cashtypes = zb_CashGetAllCashTypes();
         $cashinputs = wf_TextInput('newcash', 'New cash', '', true, 5);
         $cashinputs .= web_CashTypeSelector() . ' ' . __('Cash type');
         $cashinputs .= '<br>';
         $cashinputs .= wf_RadioInput('operation', 'Add cash', 'add', false, true);
         $cashinputs .= wf_RadioInput('operation', 'Correct saldo', 'correct', false, false);
         $cashinputs .= wf_RadioInput('operation', 'Mock payment', 'mock', false, false);
         $cashinputs .= wf_RadioInput('operation', 'Set cash', 'set', true, false);
         $cashinputs .= wf_TextInput('newpaymentnote', 'Payment note', '', true, 35);
         $cashinputs .= '<br>';
         $cashinputs .= wf_Submit('Add cash');
         $cashform = wf_Form('', 'POST', $cashinputs, 'glamour');
         show_window(__('Add cash'), $cashform);
         show_window('', web_UserControls($parent_login));
         //if someone adds cash
         if (wf_CheckPost(array('newcash'))) {
Exemple #4
0
function catv_PaymentsShow($query)
{
    $alter_conf = rcms_parse_ini_file(CONFIG_PATH . 'alter.ini');
    $alladrs = catv_GetFullAddressList();
    $allrealnames = catv_GetAllRealnames();
    $alltypes = zb_CashGetAllCashTypes();
    $allapayments = simple_queryall($query);
    $total = 0;
    $result = '<table width="100%" border="0" class="sortable">';
    $result .= '
                <tr class="row1">
                <td>' . __('ID') . '</td>
                <td>' . __('IDENC') . '</td>
                <td>' . __('Date') . '</td>
                <td>' . __('Cash') . '</td>
                <td>' . __('User') . '</td>
                <td>' . __('Full address') . '</td>                    
                <td>' . __('Notes') . '</td>
                <td>' . __('Admin') . '</td>
                </tr>
                ';
    if (!empty($allapayments)) {
        foreach ($allapayments as $io => $eachpayment) {
            if ($alter_conf['TRANSLATE_PAYMENTS_NOTES']) {
                if ($eachpayment['notes'] == '') {
                    $eachpayment['notes'] = __('CaTV');
                }
                $eachpayment['notes'] = zb_TranslatePaymentNote($eachpayment['notes'], array());
            }
            $result .= '
                <tr class="row3">
                <td>' . $eachpayment['id'] . '</td>
                <td>' . zb_NumEncode($eachpayment['id']) . '</td>
                <td>' . $eachpayment['date'] . '</td>
                <td>' . $eachpayment['summ'] . '</td>
                <td> <a href="?module=catv_profile&userid=' . $eachpayment['userid'] . '">' . web_profile_icon() . '</a> ' . @$allrealnames[$eachpayment['userid']] . '</td>                    
                <td>' . @$alladrs[$eachpayment['userid']] . '</td>                    
                <td>' . $eachpayment['notes'] . '</td>
                <td>' . $eachpayment['admin'] . '</td>
                </tr>
                ';
            if ($eachpayment['summ'] > 0) {
                $total = $total + $eachpayment['summ'];
            }
        }
    }
    $result .= '</table>';
    $result .= '<strong>' . __('Total') . ': ' . $total . '</strong>';
    return $result;
}
Exemple #5
0
/**
 * Renders NDS users payments list
 * 
 * @param string $query
 * @return string
 */
function web_NdsPaymentsShow($query)
{
    $alter_conf = rcms_parse_ini_file(CONFIG_PATH . 'alter.ini');
    $alladrs = zb_AddressGetFulladdresslist();
    $alltypes = zb_CashGetAllCashTypes();
    $allapayments = simple_queryall($query);
    $ndstax = $alter_conf['NDS_TAX_PERCENT'];
    $allndsusers = zb_NdsGetAllUsers();
    $ndspercent = zb_NdsGetPercent();
    $allservicenames = zb_VservicesGetAllNamesLabeled();
    $total = 0;
    $ndstotal = 0;
    $tablecells = wf_TableCell(__('ID'));
    $tablecells .= wf_TableCell(__('IDENC'));
    $tablecells .= wf_TableCell(__('Date'));
    $tablecells .= wf_TableCell(__('Cash'));
    $tablecells .= wf_TableCell(__('NDS'));
    $tablecells .= wf_TableCell(__('Without NDS'));
    $tablecells .= wf_TableCell(__('Login'));
    $tablecells .= wf_TableCell(__('Full address'));
    $tablecells .= wf_TableCell(__('Cash type'));
    $tablecells .= wf_TableCell(__('Notes'));
    $tablecells .= wf_TableCell(__('Admin'));
    $tablerows = wf_TableRow($tablecells, 'row1');
    if (!empty($allapayments)) {
        foreach ($allapayments as $io => $eachpayment) {
            if (zb_NdsCheckUser($eachpayment['login'], $allndsusers)) {
                if ($alter_conf['TRANSLATE_PAYMENTS_NOTES']) {
                    if ($eachpayment['note'] == '') {
                        $eachpayment['note'] = __('Internet');
                    }
                    if (isset($allservicenames[$eachpayment['note']])) {
                        $eachpayment['note'] = $allservicenames[$eachpayment['note']];
                    }
                    if (ispos($eachpayment['note'], 'CARD:')) {
                        $cardnum = explode(':', $eachpayment['note']);
                        $eachpayment['note'] = __('Card') . " " . $cardnum[1];
                    }
                    if (ispos($eachpayment['note'], 'SCFEE')) {
                        $eachpayment['note'] = __('Credit fee');
                    }
                    if (ispos($eachpayment['note'], 'TCHANGE:')) {
                        $tariff = explode(':', $eachpayment['note']);
                        $eachpayment['note'] = __('Tariff change') . " " . $tariff[1];
                    }
                    if (ispos($eachpayment['note'], 'BANKSTA:')) {
                        $banksta = explode(':', $eachpayment['note']);
                        $eachpayment['note'] = __('Bank statement') . " " . $banksta[1];
                    }
                }
                $tablecells = wf_TableCell($eachpayment['id']);
                $tablecells .= wf_TableCell(zb_NumEncode($eachpayment['id']));
                $tablecells .= wf_TableCell($eachpayment['date']);
                $tablecells .= wf_TableCell($eachpayment['summ']);
                $paynds = zb_NdsCalc($eachpayment['summ'], $ndspercent);
                $tablecells .= wf_TableCell($paynds);
                $tablecells .= wf_TableCell($eachpayment['summ'] - $paynds);
                $profilelink = wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . $eachpayment['login'], false);
                $tablecells .= wf_TableCell($profilelink);
                $tablecells .= wf_TableCell(@$alladrs[$eachpayment['login']]);
                $tablecells .= wf_TableCell(@__($alltypes[$eachpayment['cashtypeid']]));
                $tablecells .= wf_TableCell($eachpayment['note']);
                $tablecells .= wf_TableCell($eachpayment['admin']);
                $tablerows .= wf_TableRow($tablecells, 'row3');
                if ($eachpayment['summ'] > 0) {
                    $total = $total + $eachpayment['summ'];
                    $ndstotal = $ndstotal + $paynds;
                }
            }
        }
    }
    $tablecells = wf_TableCell('');
    $tablecells .= wf_TableCell('');
    $tablecells .= wf_TableCell('');
    $tablecells .= wf_TableCell($total);
    $tablecells .= wf_TableCell($ndstotal);
    $tablecells .= wf_TableCell($total - $ndstotal);
    $tablecells .= wf_TableCell('');
    $tablecells .= wf_TableCell('');
    $tablecells .= wf_TableCell('');
    $tablecells .= wf_TableCell('');
    $tablecells .= wf_TableCell('');
    $tablerows .= wf_TableRow($tablecells, 'row2');
    $result = wf_TableBody($tablerows, '100%', '0', 'sortable');
    $result .= '' . __('Total') . ': <strong>' . $total . '</strong> ' . __('ELVs for all payments of') . ': <strong>' . $ndstotal . '</strong>';
    return $result;
}
Exemple #6
0
 /**
  * Get all cash types and load it into $this->allCashTypes
  * 
  * @return void
  */
 protected function LoadCashTypes()
 {
     $this->allCashTypes = zb_CashGetAllCashTypes();
 }
/**
 * Renders payments extracted from database with some query
 * 
 * @param string $query
 * @return string
 */
function web_PaymentsShow($query)
{
    $alter_conf = rcms_parse_ini_file(CONFIG_PATH . 'alter.ini');
    $alladrs = zb_AddressGetFulladdresslist();
    $allrealnames = zb_UserGetAllRealnames();
    $alltypes = zb_CashGetAllCashTypes();
    $allapayments = simple_queryall($query);
    $allservicenames = zb_VservicesGetAllNamesLabeled();
    //getting full contract list
    if ($alter_conf['FINREP_CONTRACT']) {
        $allcontracts = zb_UserGetAllContracts();
        $allcontracts = array_flip($allcontracts);
    }
    //getting all users tariffs
    if ($alter_conf['FINREP_TARIFF']) {
        $alltariffs = zb_TariffsGetAllUsers();
    }
    $total = 0;
    $totalPaycount = 0;
    $cells = wf_TableCell(__('ID'));
    $cells .= wf_TableCell(__('IDENC'));
    $cells .= wf_TableCell(__('Date'));
    $cells .= wf_TableCell(__('Cash'));
    //optional contract display
    if ($alter_conf['FINREP_CONTRACT']) {
        $cells .= wf_TableCell(__('Contract'));
    }
    $cells .= wf_TableCell(__('Login'));
    $cells .= wf_TableCell(__('Full address'));
    $cells .= wf_TableCell(__('Real Name'));
    //optional tariff display
    if ($alter_conf['FINREP_TARIFF']) {
        $cells .= wf_TableCell(__('Tariff'));
    }
    $cells .= wf_TableCell(__('Cash type'));
    $cells .= wf_TableCell(__('Notes'));
    $cells .= wf_TableCell(__('Admin'));
    $rows = wf_TableRow($cells, 'row1');
    if (!empty($allapayments)) {
        foreach ($allapayments as $io => $eachpayment) {
            if ($alter_conf['TRANSLATE_PAYMENTS_NOTES']) {
                $eachpayment['note'] = zb_TranslatePaymentNote($eachpayment['note'], $allservicenames);
            }
            $cells = wf_TableCell($eachpayment['id']);
            $cells .= wf_TableCell(zb_NumEncode($eachpayment['id']));
            $cells .= wf_TableCell($eachpayment['date']);
            $cells .= wf_TableCell($eachpayment['summ']);
            //optional contract display
            if ($alter_conf['FINREP_CONTRACT']) {
                $cells .= wf_TableCell(@$allcontracts[$eachpayment['login']]);
            }
            $cells .= wf_TableCell(wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . $eachpayment['login'], false, ''));
            $cells .= wf_TableCell(@$alladrs[$eachpayment['login']]);
            $cells .= wf_TableCell(@$allrealnames[$eachpayment['login']]);
            //optional tariff display
            if ($alter_conf['FINREP_TARIFF']) {
                $cells .= wf_TableCell(@$alltariffs[$eachpayment['login']]);
            }
            $cells .= wf_TableCell(@__($alltypes[$eachpayment['cashtypeid']]));
            $cells .= wf_TableCell($eachpayment['note']);
            $cells .= wf_TableCell($eachpayment['admin']);
            $rows .= wf_TableRow($cells, 'row3');
            if ($eachpayment['summ'] > 0) {
                $total = $total + $eachpayment['summ'];
                $totalPaycount++;
            }
        }
    }
    $result = wf_TableBody($rows, '100%', '0', 'sortable');
    $result .= wf_tag('strong') . __('Cash') . ': ' . $total . wf_tag('strong', true) . wf_tag('br');
    $result .= wf_tag('strong') . __('Count') . ': ' . $totalPaycount . wf_tag('strong', true);
    return $result;
}