Exemple #1
0
 function getTemplateData($id)
 {
     global $_LABELS;
     global $_CONF;
     $fields = sprintf("\t\r\n  \t\t\t\tu.*,\r\n\t\t\t\tCONCAT(uc.first,' ',uc.last) AS creator, \r\n\t\t\t\tDATE_FORMAT(u.creator_date,'%s') AS f_creator_date, \r\n\t\t\t\tCONCAT(ue.first,' ',ue.last) AS editor, \r\n\t\t\t\tDATE_FORMAT(u.editor_date,'%s') AS f_editor_date, \r\n\t\t\t\tCONCAT(us.first,' ',us.last) AS super, \r\n\t\t\t\tDATE_FORMAT(u.birthdate,'%s') AS f_birthdate, \r\n\t\t\t\tz.zone", $_CONF['date_format_mysql'], $_CONF['date_format_mysql'], $_CONF['date_format_mysql']);
     $tables = "tblUsers AS u, tblUsers AS us, tblUsers AS uc, tblUsers AS ue";
     $left = "tblZones AS z";
     $on = "u.zone_id = z.id";
     $param = sprintf("u.id = '%s' AND u.super_id = us.id AND u.creator_id = uc.id AND u.editor_id = ue.id", $id);
     $data = current(SQL::select_leftjoin($tables, $fields, $left, $on, $param));
     $data['super'] = WEBPAGE::hotlink('BS.SCR.viewUser', 'id', $data['super_id'], $data['super']);
     $data['name'] = sprintf("%s %s %s", $data['first'], $data['middle'], $data['last']);
     $data['status'] = $_LABELS[sprintf('tblUsers.active.%s', $data['active'])];
     $data['zone'] = WEBPAGE::hotlink('BS.SCR.viewZone', 'id', $data['zone_id'], $data['zone']);
     $data['membership'] = self::getMembership($data['access_code']);
     $data['img_path'] = sprintf(WEBPAGE::_IMG_USER, $data['username']);
     if ($_CONF[auto_photo] && !file_exists($data['img_path'])) {
         $img_remote_path = sprintf("http://web.jce.do/consultas/FOTOS/%s/%s/%s/%s.jpg", substr($data['code'], 0, 3), substr($data['code'], 4, 2), substr($data['code'], 6, 2), $data['code']);
         if (!($fp_remote = @fopen($img_remote_path, "r"))) {
             $data['img_path'] = './img/unknown.png';
         } else {
             $data['img_path'] = $img_remote_path;
         }
         /*
           		if ($fp_remote=fopen($img_remote_path, "r")) {
         			$fp_local = fopen($img_path,"w");
         			$image = fread($fp_remote,102400);
         			fwrite($fp_local,$image,102400);
             		fclose($fp_remote);
             		fclose($fp_local);
         			}
         */
     }
     $c = 0;
     $data['buttondata'][$c][id] = "BS.SCR.addUser";
     $data['buttondata'][$c][href] = "index.php?scr_name=BS.SCR.addUser&id=" . $id;
     $data['buttondata'][$c][alt] = $_LABELS['edit'];
     $data['buttondata'][$c][onClick] = "";
     $data['buttondata'][$c][ico] = "edit";
     if ($data['active']) {
         $c++;
         $data['buttondata'][$c][id] = "BS.SCR.suspendUser";
         $data['buttondata'][$c][href] = "index.php?scr_name=BS.SCR.suspendUser&id=" . $id;
         $data['buttondata'][$c][alt] = $_LABELS['deactivate'];
         $data['buttondata'][$c][onClick] = "";
         $data['buttondata'][$c][ico] = "user_rem";
     }
     return $data;
 }
Exemple #2
0
 function BORROWER($bt, $bid)
 {
     switch ($bt) {
         case 'B':
             $borrower = new SOCIETY($bid);
             $members = $borrower->getMembers();
             break;
         case 'G':
             $borrower = new SOCIETY($bid);
             $members[$bid] = $borrower->data['name'];
             break;
         case 'I':
             $borrower = new CLIENT($bid);
             $members[$bid] = $borrower->data['name'];
             break;
         default:
             WEBPAGE::redirect('index.php?logout=1');
             break;
     }
     $this->data = $borrower->data;
     $this->data['members'] = $members;
 }
    $c++;
}
foreach ($ldata as $key => $val) {
    WEBPAGE::$dbh->query(sprintf("insert into tblLoansOnDelinquency values ('null','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')", $val['loan_id'], $val['date'], $val['hits'], $val['delay'], $val['pmt'], $val['penalties'], $val['interest'], $val['fees'], $val['insurances'], $val['principal']));
}
//require 'index.cron.transactionsUpdate.inc';
//actualiza tblTCredits y fija pagos del dia anterior en tblPayments
//WEBPAGE::$dbh->query("insert into tblTCredits (code,date,branch_id,program_id,amount,principal,fees,insurances,interest,penalties) select CONCAT('C',p.date+0,LPAD(l.zone_id,3,'0'),LPAD(l.program_id,3,'0')) as transaction,p.date,l.zone_id,l.program_id,sum(p.pmt),sum(p.principal),sum(p.fees),sum(p.insurances),sum(p.interest),sum(p.penalties) from tblPayments as p, tblLoans as l where p.transaction_id = '0' and l.id = p.loan_id group by transaction");
WEBPAGE::$dbh->query("insert into tblTCredits (code,date,branch_id,program_id,fund_id,amount,principal,fees,insurances,interest,penalties) select CONCAT('C',p.date+0,LPAD(l.zone_id,3,'0'),LPAD(l.program_id,3,'0'),LPAD(flmp.fund_id,3,'0')) as transaction, p.date, l.zone_id, l.program_id, flmp.fund_id, sum(p.pmt),sum(p.principal),sum(p.fees),sum(p.insurances),sum(p.interest),sum(p.penalties) from tblPayments as p, tblLoans as l, tblFundsLoansMasterPct flmp, tblLoansMasterDetails lmd where lmd.loan_id = l.id and flmp.master_id = lmd.master_id and p.transaction_id = '0' and l.id = p.loan_id group by transaction");
WEBPAGE::$dbh->query("update tblPayments as p, tblLoans as l, tblFundsLoansMasterPct flmp, tblLoansMasterDetails lmd  set p.transaction_id = CONCAT('C',p.date+0,LPAD(l.zone_id,3,'0'),LPAD(l.program_id,3,'0'),LPAD(flmp.fund_id,3,'0')) where p.transaction_id = 0 and l.id = p.loan_id and lmd.loan_id = l.id and flmp.master_id = lmd.master_id");
//tblTDebits se actualiza desde LN.SCR.doCheckRelease.inc
WEBPAGE::$dbh->query("delete from tblLoansCurrentDataBackup");
WEBPAGE::$dbh->query("insert into tblLoansCurrentDataBackup select * from tblLoansCurrentData");
//Automatic loan write off
if ($_CONF['auto_write_off']) {
    $lod_id = WEBPAGE::$dbh->getAll(sprintf("select max(lod.id) id,lcd.loan_id,lcd.balance_kp,lcd.balance_kaf,lcd.balance_kat,lcd.cn_date from tblLoansOnDelinquency lod, tblLoansCurrentData lcd where lcd.loan_id = lod.loan_id and lcd.cn_delay > '%s' group by lod.loan_id", $_CONF['auto_write_off_margin']));
    foreach ($lod_id as $key => $val) {
        $lod_info = current(WEBPAGE::$dbh->getAll(sprintf("select lod.interest,lod.penalties from tblLoansOnDelinquency lod where lod.id = '%s'", $val['id'])));
        $amount = $val['balance_kp'] + $val['balance_kaf'] + $val['balance_kat'] + $lod_info['interest'] + $lod_info['penalties'];
        WEBPAGE::$dbh->query(sprintf("insert into tblLoanWriteOff (id,loan_id,amount,principal,insurance,fees,interest,penalties,date,user_id) values ('Null','%s','%s','%s','%s','%s','%s','%s','%s','%s')", $val['loan_id'], $amount, $val['balance_kp'], $val['balance_kaf'], $val['balance_kat'], $lod_info['interest'], $lod_info['penalties'], $val['cn_date'], '1'));
        WEBPAGE::$dbh->query(sprintf("delete from tblLoansCurrentData where loan_id = %s", $val['loan_id']));
        WEBPAGE::$dbh->query(sprintf("insert into tblLoanStatusHistory (id,loan_id,p_status,status,date,user_id,memo) values ('Null','%s','G','LI','%s','1','%s')", $val['loan_id'], $val['cn_date'], $_LABELS['loanWriteOff']));
        WEBPAGE::$dbh->query(sprintf("update tblLoans set status = 'LI', editor_id = '1', editor_date = '%s' where id = '%s'", $val['cn_date'], $val['loan_id']));
    }
}
// Pone sistema en el modo anterior.
WEBPAGE::$dbh->query(sprintf("insert into tblDataLog values ('null','%s',CURTIME(),'normal','index.cron.php','','')", $p_date));
if ($_CONF['auto_cron'] != '1') {
    WEBPAGE::redirect('index.cron.php');
    exit;
}
// // Number of Children
$head = array('fact' => "Esperanza International - Dominican Republic - PMR", 'value' => "  ");
$ldata = array();
$row = 0;
foreach ($data as $header => $parameter) {
    $ldata[$row][$header . '_label'] = sprintf('<table><tr><td><h1>%s</h1></td></tr></table>', str_replace('_', '  ', $header));
    $ldata[$row][$header . '_html'] = "&nbsp;&nbsp;";
    $row++;
    foreach ($parameter as $label => $value) {
        $ldata[$row][$label . '_label'] = str_replace('_', ' ', $label);
        if ($value == "-") {
            $ldata[$row][$label] = "-";
        } elseif (is_float($value)) {
            $ldata[$row][$label] = number_format($value, 2, '.', ',');
        } else {
            $ldata[$row][$label] = number_format($value, 2, '.', ',');
        }
        $row++;
    }
}
$_html .= count($data) ? WEBPAGE::printchart($ldata, $head) : $_LABELS['noData'];
print $_html;
/*
Accounting data
================
*/
?>
<p>* Monetary values in dominican pesos (DOP) unless otherwise specified</p>
</body>
</html>             
    $group_bde_ratio = WEBPAGE::$dbh->getAll(sprintf("SELECT  u.id,concat(u.first,' ',u.last) as asesor,(sum(cp.group_b)/ sum(cp.group_bg)) as group_bde_ratio,cp.date\r\nFROM    tblClientPortfolio cp,\r\n        tblUsers u\r\nWHERE   u.id      = cp.advisor_id\r\n    AND cp.date ='%s'\r\n    GROUP BY u.id;", $end_date));
    $_html = "<h1>Ratio Grupo/BDE [{$start_date} --- {$end_date}]</h1>";
    $_html .= count($group_bde_ratio) ? WEBPAGE::printchart($group_bde_ratio, array_keys($group_bde_ratio[0])) : $_LABELS['noData'];
    print $_html;
}
if ($_GET['report'] == "11") {
    $client_portfolio = WEBPAGE::$dbh->getAll(sprintf("SELECT  u.id,concat(u.first,' ',u.last) as asesor,sum(cp.clients) as cartera_clientes,cp.date\r\nFROM    tblClientPortfolio cp,\r\n        tblUsers u\r\nWHERE   u.id      = cp.advisor_id\r\n    AND cp.date ='%s'\r\n    GROUP BY u.id ORDER BY cartera_clientes DESC;", $end_date));
    $_html = "<h1>Cartera Clientes [{$start_date} --- {$end_date}]</h1>";
    $_html .= count($client_portfolio) ? WEBPAGE::printchart($client_portfolio, array_keys($client_portfolio[0])) : $_LABELS['noData'];
    print $_html;
}
// Assessing active loans within the date range
if ($_GET['report'] == "07") {
    $women_percent = WEBPAGE::$dbh->getAll(sprintf("select u.id,cp.date,u.id,concat(u.first,' ',u.last) as asesor,sum(cp.female) as female,sum(cp.clients) as clients,\r\nround((sum(cp.female)/sum(cp.clients))*100,2) as female_percent\r\n from tblClientPortfolio cp,tblUsers u where\r\n u.id = cp.advisor_id and\r\n cp.date='%s' group by u.id order by female desc;", $end_date));
    $_html .= "<h1>% de Mujeres [{$start_date} --- {$end_date}]</h1>";
    $_html .= count($women_percent) ? WEBPAGE::printchart($women_percent, array_keys($women_percent[0])) : $_LABELS['noData'];
    print $_html;
}
// print "<pre>";
// // foreach ($loan_summary as $key=>$value) {
// // foreach ($value as $key_inner=>$value_inner) {
// // print "$key_inner => $value_inner" . "\n";
// // }
// // }
// print count($loan_summary);
// print "</pre>";
// trace(array_keys($women_percent[0]));
// $output.="<table>";
// $output.="<tr>";
//
// foreach (array_keys($women_percent[0]) as $key1=>$value1) {
<?php

// client portfolio graph
// called by RP.SCR.performancePlotter
error_reporting(E_ERROR);
require_once 'class/webpage.php';
require_once 'class/sql.php';
require_once 'PEAR.php';
require_once 'class/graph.php';
WEBPAGE::START();
$_LABELS = WEBPAGE::getCacheData(sprintf(WEBPAGE::_APP_LABELS_FILE, $_GET['lang']));
$_CONF = WEBPAGE::getCacheData(sprintf(WEBPAGE::_APP_CONF_FILE, $_GET['lang']));
if ($_GET['mode'] == 'total') {
    $_GET['mode'] = 1;
    $_GET['1'] = 1;
}
switch ($_GET['cycle']) {
    case 'DAY':
        $xrange = WEBPAGE::$dbh->getAll(sprintf('select 1000*YEAR(c.date)+DAYOFYEAR(c.date) as date from tblCalendar as c where c.date >= "%s" and c.date <= "%s" group by date', $_GET['dateFrom'], $_GET['dateTo']));
        $mrow = WEBPAGE::$dbh->getAll(sprintf('select 1000*YEAR(cp.date)+DAYOFYEAR(cp.date) as date, sum(cp.clients) as clients, sum(cp.female) as female, sum(cp.male) as male, sum(cp.client_i) as client_i, sum(cp.client_b) as client_b from tblClientPortfolio as cp where 1000*YEAR(cp.date)+DAYOFYEAR(cp.date) >= "%s" and 1000*YEAR(cp.date)+DAYOFYEAR(cp.date) <= "%s" and %s = %s group by date', $xrange[0]['date'], $xrange[count($xrange) - 1]['date'], $_GET['mode'], $_GET[$_GET['mode']]));
        $xmin = $_GET['dateFrom'];
        $xmax = $_GET['dateTo'];
        break;
    case 'WEEK':
        $xrange = WEBPAGE::$dbh->getAll(sprintf('select 1000*YEAR(c.date)+WEEK(c.date,"%s") as date from tblCalendar as c where c.date >= "%s" and c.date <= "%s" group by date', $_GET['dateFrom'], $_GET['dateFrom'], $_GET['dateTo']));
        $mrow = WEBPAGE::$dbh->getAll(sprintf('select 1000*YEAR(cp.date)+WEEK(cp.date,"%s") as date, sum(cp.clients)/7 as clients, sum(cp.female)/7 as female, sum(cp.male)/7 as male, sum(cp.client_i)/7 as client_i, sum(cp.client_b)/7 as client_b from tblClientPortfolio as cp where 1000*YEAR(cp.date)+WEEK(cp.date,"%s") >= "%s" and 1000*YEAR(cp.date)+WEEK(cp.date,"%s") <= "%s" and %s = %s group by date', $_GET['dateFrom'], $_GET['dateFrom'], $xrange[0]['date'], $_GET['dateFrom'], $xrange[count($xrange) - 1]['date'], $_GET['mode'], $_GET[$_GET['mode']]));
        $xmin = sprintf('%s/%s', $xrange[0]['date'] - 1000 * floor($xrange[0]['date'] / 1000), floor($xrange[0]['date'] / 1000));
        $xmax = sprintf('%s/%s', $xrange[count($xrange) - 1]['date'] - 1000 * floor($xrange[count($xrange) - 1]['date'] / 1000), floor($xrange[count($xrange) - 1]['date'] / 1000));
        break;
    case 'MONTH':
        $xrange = WEBPAGE::$dbh->getAll(sprintf('select 1000*YEAR(c.date)+MONTH(c.date) as date from tblCalendar as c where c.date >= "%s" and c.date <= "%s" group by date', $_GET['dateFrom'], $_GET['dateTo']));
<?php

error_reporting(E_ERROR);
require_once 'class/webpage.php';
require_once 'class/sql.php';
require_once 'PEAR.php';
require_once 'class/graph.php';
WEBPAGE::START();
$_LABELS = WEBPAGE::getCacheData(sprintf(WEBPAGE::_APP_LABELS_FILE, $_GET['lang']));
$mrow = WEBPAGE::$dbh->getAll('select c.gender, zp.short_name as branch, count(c.id) as hits from tblClients as c, tblZones as z, tblZones as zp 
    							where c.zone_id > 0 and z.id = c.zone_id and zp.id = z.parent_id group by c.gender, zp.id');
foreach ($mrow as $key => $val) {
    $data[$_LABELS[sprintf('tblClients.gender.%s', $val['gender'])]]['TOTAL'] += $val['hits'];
    $data[$_LABELS[sprintf('tblClients.gender.%s', $val['gender'])]][$val['branch']] = $val['hits'];
}
$graph = new Graph('', $_LABELS['tblUsers.zone_id'], '%', $data);
Graph::printStdCols($graph);
Exemple #8
0
    $auth->logout();
    loginFunction();
    exit;
}
// blocks session hacking on shared hosting with multiple emms installations
if (WEBPAGE::$url != $_SESSION['_authsession']['data']['url']) {
    $message = 'loggedOut';
    $auth->logout();
    loginFunction();
    exit;
}
// to be here you need to provide valid username/password
// or have a valid session open
WEBPAGE::LOAD_SESSION();
$_LABELS = WEBPAGE::getCacheData(sprintf(WEBPAGE::_APP_LABELS_FILE, WEBPAGE::$lang));
$_CONF = WEBPAGE::getCacheData(sprintf(WEBPAGE::_APP_CONF_FILE, WEBPAGE::$lang));
// request logout
if (!empty($_REQUEST['logout'])) {
    $message = 'loggedOut';
    $auth->logout();
    loginFunction();
    exit;
}
// check run mode
switch (WEBPAGE::$runMode) {
    case WEBPAGE::_RUN_MODE_NORMAL:
        break;
    case WEBPAGE::_RUN_MODE_OUTDATED:
        require 'includes/index.update.inc';
        exit;
    default:
 function loadBorrowerData()
 {
     switch ($this->data['borrower_type']) {
         case 'B':
             //      require_once 'class/society.php';
             $this->data['borrower'] = new SOCIETY($this->data['borrower_id']);
             break;
         case 'G':
             //      require_once 'class/society.php';
             $this->data['borrower'] = new SOCIETY($this->data['borrower_id']);
             break;
         case 'I':
             //      require_once 'class/client.php';
             $this->data['borrower'] = new CLIENT($this->data['borrower_id']);
             break;
         default:
             WEBPAGE::redirect('index.php?logout=1');
             exit;
     }
 }
    WEBPAGE::$lang = $_GET['lang'];
} else {
    WEBPAGE::$lang = 'esp';
}
$_LABELS = WEBPAGE::getCacheData(sprintf(WEBPAGE::_APP_LABELS_FILE, WEBPAGE::$lang));
$_CONF = WEBPAGE::getCacheData(sprintf(WEBPAGE::_APP_CONF_FILE, WEBPAGE::$lang));
$data = WEBPAGE::$dbh->getAll(sprintf("select\r\n    lmd.master_id,\r\n    l.xp_cancel_date,\r\n    l.xp_num_pmt,\r\n    lt.payment_frequency,\r\n    lcd.xp_pmt_date,\r\n    lcd.loan_id,\r\n    lcd.xp_pmt,\r\n    lcd.cn_delay,\r\n    lcd.cn_penalties,\r\n    lm.program_id, prg.program,\r\n    lm.zone_id, z.short_name,\r\n    concat(c.first,' ',c.last) cliente,\r\n    c.code govID,\r\n    s.name grupo,\r\n    u.username,\r\n    count(p.id)+1 cuota,\r\n    fa.p_pmt_receipt_flag_a pmt_receipt_flag_a,\r\n    fb.p_pmt_receipt_flag_b pmt_receipt_flag_b\r\nfrom\r\n    (\r\n    tblLoansCurrentData lcd,\r\n    tblLoansMasterDetails lmd,\r\n    tblLoansMaster lm,\r\n    tblLoans l,\r\n    tblLoanTypes lt,\r\n    tblClients c,\r\n    tblPrograms prg,\r\n    tblZones z,\r\n    tblUsers u\r\n    )\r\nleft join\r\n    tblSocieties s on s.id = c.society_id\r\nleft join\r\n    tblPayments p on p.loan_id = lcd.loan_id and p.special = 0\r\nleft join\r\n    (select fap.loan_id p_loan_id, count(far.flag_a) p_pmt_receipt_flag_a FROM tblPayments fap, tblReceipts far, tblLinkReceiptsPayments falrp, tblLoansCurrentData falcd where falcd.loan_id = fap.loan_id and falcd.xp_pmt_date <= date_add(now(), interval 7 day) and far.flag_a = '1' and falrp.payment_id = fap.id and falrp.receipt_id = far.id group by fap.loan_id) fa on fa.p_loan_id = lcd.loan_id\r\nleft join\r\n    (select fbp.loan_id p_loan_id, count(fbr.flag_b) p_pmt_receipt_flag_b FROM tblPayments fbp, tblReceipts fbr, tblLinkReceiptsPayments fblrp, tblLoansCurrentData fblcd where fblcd.loan_id = fbp.loan_id and fblcd.xp_pmt_date <= date_add(now(), interval 7 day) and fbr.flag_b = '1' and fblrp.payment_id = fbp.id and fblrp.receipt_id = fbr.id group by fbp.loan_id) fb on fb.p_loan_id = lcd.loan_id\r\nwhere\r\n        lcd.xp_pmt_date <= date_add(now(), interval 1 month)\r\n    and lmd.loan_id = lcd.loan_id\r\n    and lm.id = lmd.master_id\r\n    and l.id = lcd.loan_id\r\n    and lt.id = l.loan_type_id\r\n    and c.id = l.client_id\r\n    and prg.id = lm.program_id\r\n    and z.id = lm.zone_id\r\n    and u.id = l.advisor_id\r\ngroup by\r\n    lcd.loan_id\r\norder by\r\n    lcd.loan_id"));
$head = array('id' => 'ID', 'client' => 'Cliente', 'num_pmt' => 'No cuota', 'xp_num_pmt' => 'Total de cuotas', 'payment_frequency' => 'Frec. Pagos', 'xp_pmt_date' => 'Fecha pago', 'xp_cancel_date' => 'Fecha vencimiento', 'xp_pmt' => 'Monto cuota', 'cn_penalties' => 'Punitorios', 'pmt_receipt_flag_a' => $_CONF['pmt_receipt_flag_a'] ? $_CONF['pmt_receipt_flag_a'] : '-', 'pmt_receipt_flag_b' => $_CONF['pmt_receipt_flag_b'] ? $_CONF['pmt_receipt_flag_b'] : '-', 'username' => 'Asesor', 'program' => 'Programa', 'branch' => 'Sucursal', 'print' => 'Imprimir');
foreach ($data as $key => $val) {
    $master[$val['master_id']]['id'] = $val['master_id'];
    $master[$val['master_id']]['client'] = $counter[$val['master_id']] ? $val['grupo'] : $val['cliente'] . ' : ' . $val['govID'];
    //  $master[$val['master_id']]['client']           = $val['grupo'] ? $val['grupo'] : $val['cliente'];
    $master[$val['master_id']]['num_pmt'] = $val['cuota'];
    $master[$val['master_id']]['xp_num_pmt'] = $val['xp_num_pmt'];
    $master[$val['master_id']]['payment_frequency'] = $val['payment_frequency'];
    $master[$val['master_id']]['xp_pmt_date'] = $val['xp_pmt_date'];
    $master[$val['master_id']]['xp_cancel_date'] = $val['xp_cancel_date'];
    $master[$val['master_id']]['xp_pmt'] += $val['xp_pmt'];
    $master[$val['master_id']]['cn_penalties'] += $val['cn_penalties'];
    $master[$val['master_id']]['pmt_receipt_flag_a'] = $_CONF['pmt_receipt_flag_a'] ? $val['pmt_receipt_flag_a'] ? $val['pmt_receipt_flag_a'] : 0 : '-';
    $master[$val['master_id']]['pmt_receipt_flag_b'] = $_CONF['pmt_receipt_flag_b'] ? $val['pmt_receipt_flag_b'] ? $val['pmt_receipt_flag_b'] : 0 : '-';
    $master[$val['master_id']]['username'] = $val['username'];
    $master[$val['master_id']]['program'] = $val['program'];
    $master[$val['master_id']]['branch'] = $val['short_name'];
    $master[$val['master_id']]['print'] = sprintf('<a href="index.receipt.php?advisor=%s&client=%s&xp_pmt_date=%s&num_pmt=%s&xp_num_pmt=%s&xp_pmt=%s">Imprimir</a>', $master[$val['master_id']]['username'], $master[$val['master_id']]['client'], $master[$val['master_id']]['xp_pmt_date'], $master[$val['master_id']]['num_pmt'], $master[$val['master_id']]['xp_num_pmt'], $master[$val['master_id']]['xp_pmt']);
    $counter[$val['master_id']]++;
}
$tpl = new HTML_Template_ITX('.');
$tpl->loadTemplateFile('index.compactCS.tpl');
$tpl->setVariable('chart', count($master) ? WEBPAGE::printchart($master, $head) : $_LABELS['noData']);
$tpl->show();
Exemple #11
0
 function CalNumOfPMT()
 {
     switch ($this->data['payment_frequency']) {
         case "W":
             return floor($this->data['installment'] / 7);
         case "BW":
             return floor($this->data['installment'] / 14);
         case "M":
             return floor($this->data['installment'] / 30);
         case "Q":
             return floor($this->data['installment'] / 90);
         case "SA":
             return floor($this->data['installment'] / 180);
         case "A":
             return floor($this->data['installment'] / 360);
         default:
             WEBPAGE::redirect('index.php?scr_name=BS.SCR.message&ico=err&msg=err');
     }
 }
<?php

error_reporting(E_ERROR);
require_once 'class/webpage.php';
require_once 'class/sql.php';
require_once 'PEAR.php';
require_once 'class/graph.php';
WEBPAGE::START();
$top = 5;
$mrow1 = WEBPAGE::$dbh->getAll("SELECT bt.type, count( b.id ) AS hits, pz.short_name AS zone\r\n\t\t\t\t\t\t\t\tFROM tblBusiness AS b, tblBusinessTypes AS bt, tblZones AS z, tblClients AS c, tblZones AS pz\r\n\t\t\t\t\t\t\t\tWHERE bt.id = b.type_id\r\n\t\t\t\t\t\t\t\tAND FIND_IN_SET( c.id, b.client_list )\r\n\t\t\t\t\t\t\t\tAND z.id = c.zone_id\r\n\t\t\t\t\t\t\t\tAND pz.id = z.parent_id\r\n\t\t\t\t\t\t\t\tGROUP BY bt.id, pz.id");
$mrow1 = is_array($mrow1) ? $mrow1 : array();
$data1['TOTAL'] = array();
foreach ($mrow1 as $i => $row) {
    $data1[$row['zone']][$row['type']] = $row['hits'];
    $data1['TOTAL'][$row['type']] += $row['hits'];
}
$types['OTROS'] = '';
foreach ($data1 as $z => $row) {
    arsort($row);
    $c = $top;
    foreach ($row as $t => $h) {
        if ($c > 0) {
            $data2[$z][$t] = $h;
            $zones[$z] = '';
            $types[$t] = '';
        } else {
            $data2[$z]['OTROS'] += $h;
        }
        $c--;
    }
}
Exemple #13
0
 function getTemplateData($id)
 {
     global $_LABELS;
     global $_CONF;
     $client = new CLIENT($id);
     $data = $client->data;
     $data['society_code'] = sprintf("%s.%s.%s", str_pad($data['zone_id'], 3, '0', STR_PAD_LEFT), $data['category'], str_pad($data['society_id'], 5, '0', STR_PAD_LEFT));
     $data['society_code'] = WEBPAGE::hotlink('BS.SCR.viewSociety', 'id', $data['society_id'], $data['society_code']);
     $zone = CLIENT::zones();
     $data['zone'] = $zone[$data['zone_id']];
     $data['advisor'] = current(SQL::getAssoc('tblUsers', 'id,CONCAT(first," ",last)', sprintf("id = '%s'", $data['advisor_id'])));
     $data['advisor'] = WEBPAGE::hotlink('BS.SCR.viewUser', 'id', $data['advisor_id'], $data['advisor']);
     $cstatus = CLIENT::cstatus();
     $data['cstatus'] = $cstatus[$data['cstatus']];
     $education = CLIENT::education();
     $data['education'] = $education[$data['education']];
     /**
       $data['img_path']		  = sprintf(WEBPAGE::_IMG_CLIENT,$data['code']);
     
       if (($_CONF[auto_photo])&&(!(file_exists($data['img_path'])))) {
         $img_remote_path = sprintf("http://web.jce.do/consultas/FOTOS/%s/%s/%s/%s.jpg",substr($data['code'],0,3),substr($data['code'],4,2),substr($data['code'],6,2),$data['code']);
     
     	if (!($fp_remote=@fopen($img_remote_path, "r"))) {
     	  $data['img_path']	= './img/unknown.png';
     	  } else {
           $data['img_path'] = $img_remote_path;
       	  }
         }
     */
     $c = 0;
     if ($data['advisor_id']) {
         $data['buttondata'][$c]['id'] = "BS.SCR.addClient";
         $data['buttondata'][$c]['href'] = "index.php?scr_name=BS.SCR.addClient&id=" . $id;
         $data['buttondata'][$c]['alt'] = $_LABELS['edit'];
         $data['buttondata'][$c]['onClick'] = "";
         $data['buttondata'][$c]['ico'] = "edit";
         $c++;
         $data['buttondata'][$c]['id'] = "LN.SCR.browseLoans";
         $data['buttondata'][$c]['href'] = "index.php?scr_name=LN.SCR.browseLoans&loan_code=." . str_pad($id, 6, 0, STR_PAD_LEFT);
         $data['buttondata'][$c]['alt'] = $_LABELS['LN.SCR.browseLoans'];
         $data['buttondata'][$c]['onClick'] = "";
         $data['buttondata'][$c]['ico'] = "money_history";
         $c++;
         $data['buttondata'][$c]['id'] = "BS.SCR.moveClient";
         $data['buttondata'][$c]['href'] = "index.php?scr_name=BS.SCR.moveClient&ref=BS.SCR.editClient&id=" . $id;
         $data['buttondata'][$c]['alt'] = $_LABELS['moveClient'];
         $data['buttondata'][$c]['onClick'] = "";
         $data['buttondata'][$c]['ico'] = "client_move";
         $c++;
         $data['buttondata'][$c]['id'] = "BS.SCR.deactivateClient";
         $data['buttondata'][$c]['href'] = "index.php?scr_name=BS.SCR.deactivateClient&ref=BS.SCR.editClient&id=" . $id;
         $data['buttondata'][$c]['alt'] = $_LABELS['deactivate'];
         $data['buttondata'][$c]['onClick'] = "";
         $data['buttondata'][$c]['ico'] = "client_rem";
         $c++;
         $data['buttondata'][$c]['id'] = "BS.SCR.addBusiness";
         $data['buttondata'][$c]['href'] = "index.php?scr_name=BS.SCR.addBusiness&owner_id=" . $id;
         $data['buttondata'][$c]['alt'] = $_LABELS['addBusiness'];
         $data['buttondata'][$c]['onClick'] = "";
         $data['buttondata'][$c]['ico'] = "business_add";
         $c++;
         $data['buttondata'][$c]['id'] = "SV.SCR.applySurveyStepB";
         $data['buttondata'][$c]['href'] = "index.php?scr_name=SV.SCR.browseSurveys&ref=SV.SCR.applySurveyStepA&client_id=" . $id;
         $data['buttondata'][$c]['alt'] = $_LABELS['applySurvey'];
         $data['buttondata'][$c]['onClick'] = "";
         $data['buttondata'][$c]['ico'] = "survey_apply";
         $c++;
         $data['buttondata'][$c]['id'] = "SV.SCR.viewGraph";
         $data['buttondata'][$c]['href'] = "index.php?scr_name=SV.SCR.browseSurveys&stats_client_id=" . $id;
         $data['buttondata'][$c]['alt'] = $_LABELS['SV.SCR.viewGraph'];
         $data['buttondata'][$c]['onClick'] = "";
         $data['buttondata'][$c]['ico'] = "survey_results";
         $c++;
     } else {
         $data['buttondata'][$c]['id'] = "BS.SCR.addClient";
         $data['buttondata'][$c]['href'] = "index.php?scr_name=BS.SCR.addClient&ref=BS.SCR.editClient&activate=1&id=" . $id;
         $data['buttondata'][$c]['alt'] = $_LABELS['activate'];
         $data['buttondata'][$c]['onClick'] = "";
         $data['buttondata'][$c]['ico'] = "client_add";
         $c++;
     }
     $data['buttondata'][$c]['id'] = "BS.SCR.viewClientIOM";
     $data['buttondata'][$c]['href'] = 'javascript:openWin("index.popup.php?scr_name=BS.SCR.viewClientIOM&ref=BS.SCR.viewClient&id=' . $id . '","ClientIOM","menubar=no,scrollbars=no,resizable=no,width=700,height=320")';
     $data['buttondata'][$c]['alt'] = $_LABELS['movements'];
     $data['buttondata'][$c]['onClick'] = "";
     $data['buttondata'][$c]['ico'] = "client_history";
     $c++;
     return $data;
 }
Exemple #14
0
 static function getCurrentPath()
 {
     global $_LOCATION;
     global $_CONF;
     self::$referrer = self::$referrer ? self::$referrer : $_CONF['ref'][self::$scr_name];
     for ($i = 0; $i < count($_SESSION['OrderedMenu']); $i++) {
         if ($_SESSION['OrderedMenu'][$i]['link'] == self::$referrer) {
             $_LOCATION[0]['id'] = $_SESSION['OrderedMenu'][$i]['id'];
             $_LOCATION[0]['parent_id'] = $_SESSION['OrderedMenu'][$i]['parent_id'];
             $_LOCATION[0]['link'] = $_SESSION['OrderedMenu'][$i]['link'];
             $_LOCATION[0]['label'] = $_SESSION['OrderedMenu'][$i][self::$lang];
             break;
         }
     }
     while (!$stop) {
         $n = count($_LOCATION);
         $_LOCATION = self::getPARENT($_LOCATION[$n - 1]['parent_id']);
         if ($_LOCATION[$n]['parent_id'] == $_LOCATION[$n]['id']) {
             $stop = true;
         }
     }
     for ($i = $n; $i >= 0; $i--) {
         $path[] = $_LOCATION[$i]['label'];
     }
     return $path;
 }