예제 #1
0
 public function pdftransactionAction()
 {
     //rupees right alignment
     function position($amt, $posValue)
     {
         $len = strlen($amt);
         $pos = $posValue - 35 - $len * 4;
         return $pos;
     }
     $fromDate = $this->_request->getParam('date');
     $branchid = $this->_request->getParam('office');
     $this->view->field1 = $fromDate;
     $this->view->branchid = $branchid;
     //         $fromDate = $this->_request->getParam('field1');
     //         $this->view->field1 = $fromDate;
     //date format instance
     $dateconvertor = new App_Model_dateConvertor();
     $cfromDate = $dateconvertor->mysqlformat($fromDate);
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     //Path
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = $word[1];
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizontal
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 9);
     $page->drawText("Cash Scroll", 270, 780);
     $page->drawText("Cash Scroll", 270, 780);
     //set the font
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $y1 = 745;
     $page->drawText("Credit", 50, $y1);
     $page->drawText("Debit", 310, $y1);
     $y1 = 745;
     $y2 = 740;
     $page->drawText("As of From " . $fromDate, 465, $y1);
     //For Top Header
     $text = array("", "SL No.", "Particulars", "Amount", "Total", "Particulars", "Opening Cash", "Closing Cash");
     $this->view->savings = 10;
     $page->drawText("Date : " . date('d-m-Y'), 500, 800);
     //date('Y-m-d')
     //         $page->drawText("Date : ".date('d-m-Y'),500, 800);
     $page->drawText($text[0], 240, 780);
     $page->drawText($text[0], 240, 780);
     $x1 = 60;
     $x2 = 120;
     $x3 = 310;
     $x4 = 315;
     $x5 = 390;
     $x6 = 570;
     $page->drawLine(50, 740, 550, 740);
     $page->drawLine(50, 720, 550, 720);
     $page->drawText($text[1], $x1, 725);
     $page->drawText($text[2], $x2, 725);
     $page->drawText($text[3], 250, 725);
     $page->drawText($text[1], $x4, 725);
     $page->drawText($text[5], $x5, 725);
     $page->drawText($text[3], 510, 725);
     $y1 = 710;
     $y2 = 710;
     $transaction = new Cashscroll_Model_Cashscroll();
     $this->view->savings = 10;
     $this->view->savingsCredit = $transaction->totalSavingsCredit($cfromDate, $branchid);
     $this->view->savingsDebit = $transaction->totalSavingsDebit($cfromDate, $branchid);
     //Credit and Debit
     $savingsCredit = $transaction->totalSavingsCredit($cfromDate, $branchid);
     $savingsDebit = $transaction->totalSavingsDebit($cfromDate, $branchid);
     // Opening Cash
     $openingBalance = 0;
     $osc = $transaction->openingBalance($cfromDate, $branchid);
     foreach ($osc as $osc1) {
         $openingBalance = $osc1->openingBalance;
     }
     $this->view->openingBalance = $openingBalance;
     $amountCredit = "0";
     $amountDebit = "0";
     $i = 0;
     $j = 0;
     foreach ($savingsCredit as $savingsCredit) {
         $i++;
         $page->drawText($i, $x1, $y1);
         $page->drawText($savingsCredit->account_number, $x2, $y1);
         //             $page->drawText($savingsCredit->amount_to_bank,$x3, $y1);
         $pos = position(sprintf("%4.2f", $savingsCredit->amount_to_bank), $x3);
         $page->drawText(sprintf("%4.2f", $savingsCredit->amount_to_bank), $pos + 2, $y1);
         $amountCredit = $amountCredit + $savingsCredit->amount_to_bank;
         $y1 = $y1 - 15;
     }
     foreach ($savingsDebit as $savingsDebit) {
         $j++;
         $page->drawText($j, $x4, $y2);
         $page->drawText($savingsDebit->account_number, $x5, $y2);
         //             $page->drawText($savingsDebit->amount_from_bank,$x6, $y2);
         $pos = position(sprintf("%4.2f", $savingsDebit->amount_from_bank), $x6);
         $page->drawText(sprintf("%4.2f", $savingsDebit->amount_from_bank), $pos + 2, $y2);
         $amountDebit = $amountDebit + $savingsDebit->amount_from_bank;
         $y2 = $y2 - 15;
     }
     $page->drawLine(50, $y1, 550, $y1);
     //opening balnce
     $page->drawText($text[6], $x1, $y1 - 10);
     //         $page->drawText(sprintf("%4.2f", $openingBalance), $x3, $y1 -10);
     $pos = position(sprintf("%4.2f", $openingBalance), $x3);
     $page->drawText(sprintf("%4.2f", $openingBalance), $pos + 2, $y1 - 10);
     //closing Balance
     $page->drawText($text[7], $x4, $y1 - 10);
     //         $page->drawText(sprintf("%4.2f", ( $sum = ($amountCredit + $openingBalance) - $amountDebit)), $x6, $y1 -10);
     $pos = position(sprintf("%4.2f", $sum = $amountCredit + $openingBalance - $amountDebit), $x6);
     $page->drawText(sprintf("%4.2f", $sum = $amountCredit + $openingBalance - $amountDebit), $pos + 2, $y1 - 10);
     $page->drawLine(50, $y1 = $y1 - 20, 550, $y1);
     $page->drawLine(50, $y1 - 20, 550, $y1 - 20);
     $page->drawText($text[4], $x1, $y1 - 15);
     $page->drawText($text[4], $x1, $y1 - 15);
     $pos = position(sprintf("%4.2f", $amountCredit + $openingBalance), $x3);
     $page->drawText(sprintf("%4.2f", $amountCredit + $openingBalance), $pos + 2, $y1 - 15);
     //         $page->drawText(sprintf("%4.2f", ($amountCredit + $openingBalance)), $x3, $y1 -15);
     //         $page->drawText(sprintf("%4.2f", ($amountCredit + $openingBalance)), $x3, $y1 -15);
     $page->drawText($text[4], $x4, $y1 - 15);
     $page->drawText($text[4], $x4, $y1 - 15);
     //         $page->drawText(sprintf("%4.2f", $amountDebit + $sum), $x6, $y1 -15);
     //         $page->drawText(sprintf("%4.2f", $amountDebit + $sum), $x6, $y1 -15);
     $pos = position(sprintf("%4.2f", $amountDebit + $sum), $x6);
     $page->drawText(sprintf("%4.2f", $amountDebit + $sum), $pos + 2, $y1 - 15);
     // Virtual table
     $page->setLineWidth(1)->drawLine(50, $y1 - 20, 50, 740);
     //Table left vertical
     $page->setLineWidth(1)->drawLine(300, $y1 - 20, 300, 740);
     //Table center vertical
     $page->setLineWidth(1)->drawLine(550, $y1 - 20, 550, 740);
     //table rigth vertical
     //$page->drawText("ಭಾವನಾ. ಕೆ. ಎಸ್ ",$x6 + 30, $y1 -15, 'UTF-8');
     $pdfData = $pdf->render();
     $pdf->save('/var/www/' . $projname . '/reports/cashscroll.pdf');
     $path = '/var/www/' . $projname . '/reports/cashscroll.pdf';
     chmod($path, 0777);
 }
				<?php 
    }
    ?>
					<p style="margin-top:10px;">
						<a href="<?php 
    echo url('user/i/' . $value['id']);
    ?>
"><?php 
    echo $value['firstname'];
    ?>
</a>
						<br/><?php 
    echo $value['nickname'];
    ?>
 ( <?php 
    echo position($value['role_id']);
    ?>
 )
						<br/>
				<?php 
    if (role_check(1)) {
        ?>
					<?php 
        if ($value['active'] === '1') {
            ?>
						<span class="label label-success">ยืนยันแล้ว</span>
					<?php 
        } else {
            ?>
						<span class="label label-danger">ยังไม่ได้ยืนยัน</span>
					<?php 
예제 #3
0
 /**
  * 解析标签list
  */
 protected function _listdata($param)
 {
     $_param = explode(' ', $param);
     $param = array();
     foreach ($_param as $p) {
         $mark = strpos($p, '=');
         if ($p && $mark !== false) {
             $var = substr($p, 0, $mark);
             $val = substr($p, $mark + 1);
             if (isset($var) && $var) {
                 $param[$var] = $val;
             }
         }
     }
     $system = $fields = $_fields = $not = $in = $or = $between = $like = array();
     $dbcache = isset($param['cache']) ? (int) $param['cache'] : 0;
     unset($param['cache']);
     if (is_array($param)) {
         foreach ($param as $key => $val) {
             //参数归类
             if (in_array($key, array('return', 'more', 'page', 'urlrule', 'num', 'join', 'on', 'order', 'table', 'pagesize', 'pagerule', 'action', 'tag', 'extend', 'site', 'form', 'fields'))) {
                 $system[$key] = $val;
             } else {
                 if (substr($key, 0, 3) == 'NOT') {
                     $key = substr($key, 3);
                     $not[] = $key;
                 } elseif (substr($key, 0, 2) == 'OR') {
                     $key = substr($key, 2);
                     $or[] = $key;
                 } elseif (substr($key, 0, 2) == 'IN') {
                     $key = substr($key, 2);
                     $in[] = $key;
                 } elseif (substr($key, 0, 2) == 'BW') {
                     $key = substr($key, 2);
                     $between[] = $key;
                 } elseif (substr($key, 0, 4) == 'LIKE') {
                     $key = substr($key, 4);
                     $like[] = $key;
                 }
                 $fields[$key] = $val;
                 $_fields[] = $key;
             }
         }
     }
     $where = '';
     //设置站点id
     $system['site'] = !isset($system['site']) || empty($system['site']) ? App::get_site_id() : $system['site'];
     //Action判断
     if (isset($system['action']) && $system['action'] == 'position') {
         //推荐位
         $data = position($system['site'], $fields['id'], isset($fields['catid']) ? $fields['catid'] : 0, isset($system['num']) ? $system['num'] : 0);
         if ($data) {
             $db = Controller::model('content');
             foreach ($data as $i => $t) {
                 if ($t['contentid']) {
                     $row = $db->db->where('id', $t['contentid'])->get('content_' . $system['site'])->row_array();
                     $data[$i] = $t + $row;
                 }
             }
         }
         if (isset($system['return']) && $system['return'] && $system['return'] != 't') {
             return array('return_' . $system['return'] => $data, 'total_' . $system['return'] => count($data));
         }
         return array('return' => $data, 'total' => count($data));
     } elseif (isset($system['action']) && $system['action'] == 'keywords') {
         //搜索关键字
         $search = Controller::model('search');
         $num = $system['num'] ? (int) $system['num'] : 5;
         if (isset($system['order']) && $system['order']) {
             $order = null;
             $orders = explode(',', $system['order']);
             foreach ($orders as $t) {
                 list($_field, $_order) = explode('_', $t);
                 if (in_array($_field, array('id', 'keywords', 'addtime', 'total'))) {
                     $_orderby = isset($_order) && strtoupper($_order) == 'ASC' ? 'ASC' : 'DESC';
                     $order .= '`' . $_field . '` ' . $_orderby . ',';
                 }
             }
             if (substr($order, -1) == ',') {
                 $order = substr($order, 0, -1);
             }
         } else {
             $order = '`total` DESC';
         }
         $data = $search->execute('select distinct keywords as title from ' . $search->prefix . 'search order by ' . $order . ' limit ' . $num, true, $dbcache);
         if (isset($system['return']) && $system['return'] && $system['return'] != 't') {
             return array('return_' . $system['return'] => $data, 'total_' . $system['return'] => count($data));
         }
         return array('return' => $data, 'total' => count($data));
     } elseif (isset($system['action']) && $system['action'] == 'sql') {
         //
     } elseif (isset($system['action']) && $system['action'] == 'relation') {
         if (isset($system['tag']) && $system['tag']) {
             //按关键字搜索
             if (isset($fields['id']) && $fields['id']) {
                 $where .= '`id`<>' . (int) $fields['id'];
             }
             $tags = @explode(',', $system['tag']);
             $kwhere = $k = NULL;
             foreach ($tags as $tag) {
                 if ($tag) {
                     if (empty($k)) {
                         $kwhere .= '`title` like "%' . $tag . '%"';
                     } else {
                         $kwhere .= ' OR `title` like "%' . $tag . '%"';
                     }
                     $k = 1;
                 }
             }
             if ($kwhere) {
                 $where .= ' AND (' . $kwhere . ')';
             }
             unset($k, $tags, $tag, $kwhere, $system['table'], $fields['id']);
         } else {
             //手动设置的相关文章
             $data = $this->relation($fields['id'], $system['num']);
             if (isset($system['return']) && $system['return'] && $system['return'] != 't') {
                 return array('return_' . $system['return'] => $data, 'total_' . $system['return'] => count($data));
             }
             return array('return' => $data, 'total' => count($data));
         }
     } elseif (isset($system['action']) && $system['action'] == 'field') {
         //字段信息
         $mods = get_model_data();
         $mod = $mods[$fields['modelid']];
         $data = array();
         if ($mod['fields']) {
             foreach ($mod['fields']['data'] as $t) {
                 if ($fields['name'] == $t['field']) {
                     //加载字段配置文件
                     App::auto_load('fields');
                     $data_fields = '';
                     $data_fields .= '<tr id="fine_' . $t['field'] . '">';
                     $data_fields .= '<th>' . (isset($t['not_null']) && $t['not_null'] ? '<font color="red">*</font> ' : '') . $t['name'] . ':</th>';
                     $data_fields .= '<td>';
                     $func = 'content_' . $t['formtype'];
                     //防止出错,把字段内容转换成数组格式
                     $content = array($fields['value']);
                     $content = var_export($content, true);
                     $field_config = var_export($t, true);
                     if (function_exists($func)) {
                         eval("\$data_fields .= " . $func . "(" . $t['field'] . ", " . $content . ", " . $field_config . ");");
                     }
                     $data_fields .= $t['tips'] ? '<div class="onShow">' . $t['tips'] . '</div>' : '';
                     $data_fields .= '<span id="ck_' . $t['field'] . '"></span>';
                     $data_fields .= '</td>';
                     $data_fields .= '</tr>';
                     $data[0]['form'] = $data_fields;
                     if ($t['setting']) {
                         $c = string2array($t['setting']);
                         if ($c['content']) {
                             $select = explode(PHP_EOL, $c['content']);
                             $vdata = array();
                             foreach ($select as $i => $c) {
                                 list($n, $v) = explode('|', $c);
                                 $vdata[trim($n)] = $v === null ? trim($n) : trim($v);
                             }
                             $data[0]['data'] = $vdata;
                         }
                     }
                 }
             }
         }
         if (isset($system['return']) && $system['return'] && $system['return'] != 't') {
             return array('return_' . $system['return'] => $data);
         }
         return array('return' => $data);
     }
     //主表判断
     if (isset($system['table']) && $system['table']) {
         $table = $system['table'];
     } elseif (isset($system['form']) && $system['form']) {
         $table = 'form_' . $system['site'] . '_' . $system['form'];
     } else {
         $table = 'content';
     }
     //加载Model实例
     if (strpos($table, '.') !== false) {
         list($plugin, $table) = explode('.', $table);
         $db = App::plugin_model($plugin, $table);
     } else {
         $db = Controller::model('content');
         if (strpos($table, 'content') === 0) {
             $table .= '_' . $system['site'];
         }
     }
     $table = $db->prefix . $table;
     $db->table_name = $table;
     $table_join = $table_data = $table_fields = $table_join_fields = $table_data_fields = $arrchilds = null;
     $_table_fields = $db->get_table_fields();
     $table_fields = array_intersect($_fields, $_table_fields);
     //status判断
     if (in_array('status', $_table_fields)) {
         $where .= ($where ? ' AND ' : ' ') . ' `' . $table . '`.`status`=1';
     }
     if (isset($fields['catid']) && $fields['catid']) {
         //栏目信息
         $cats = get_category_data($system['site']);
         $cat = $cats[$fields['catid']];
     }
     if (isset($system['join']) && $system['join'] && $system['on']) {
         //JOIN联合查询
         $table_join = $system['join'];
         //加载Model实例
         if (strpos($table_join, '.') !== false) {
             list($plugin, $table_join) = explode('.', $table_join);
             $db_join = App::plugin_model($plugin, $table_join);
         } else {
             $db_join = Controller::model($table_join);
         }
         $_table_join_fields = $db_join->get_table_fields();
         $table_join_fields = array_intersect($_fields, $_table_join_fields);
         foreach ($table_join_fields as $k => $c) {
             if (in_array($c, $table_fields)) {
                 unset($table_join_fields[$k]);
             }
         }
         $table_join = $db->prefix . $table_join;
     }
     if (isset($system['more']) && $system['more']) {
         //附表
         $model = null;
         if ($table == $db->prefix . 'content_' . $system['site']) {
             $models = get_model_data('content', $system['site']);
             if (isset($fields['catid']) && $fields['catid'] && isset($cat) && $cat) {
                 $model = $models[$cat['modelid']];
             } elseif (isset($fields['modelid']) && $fields['modelid']) {
                 $model = $models[$fields['modelid']];
             }
         } elseif ($table == $db->prefix . 'member' && isset($fields['modelid']) && $fields['modelid']) {
             $cache = new cache_file();
             $models = $cache->get('model_member');
             $model = $models[$fields['modelid']];
         }
         if ($model) {
             $table_data = $model['tablename'];
             $db_data = Controller::model($table_data);
             $_table_data_fields = $db_data->get_table_fields();
             $table_data_fields = array_intersect($_fields, $_table_data_fields);
             foreach ($table_data_fields as $k => $c) {
                 if (in_array($c, $table_fields)) {
                     unset($table_data_fields[$k]);
                 }
             }
             $table_data = $db->prefix . $table_data;
         }
     }
     //WHERE整合
     $fieldsAll = array($table => $table_fields, $table_join => $table_join_fields, $table_data => $table_data_fields);
     foreach ($fieldsAll as $_table => $t) {
         if (is_array($t)) {
             foreach ($t as $f) {
                 if ($fields[$f] == '') {
                     continue;
                 }
                 $and_or = in_array($f, $or) ? 'OR' : 'AND';
                 //栏目条件根据子栏目来做为条件
                 if ($f == 'catid' && isset($fields['catid']) && $fields['catid']) {
                     if (isset($cat) && $cat && $cat['child']) {
                         $arrchilds = $cat['arrchilds'];
                         $not_in = in_array($f, $not) ? 'NOT IN' : 'IN';
                         $where .= ' ' . $and_or . ' `' . $_table . '`.`catid` ' . $not_in . ' (' . $arrchilds . ')';
                     } elseif (strpos($fields['catid'], ',') !== false) {
                         $not_in = in_array($f, $not) ? 'NOT IN' : 'IN';
                         $where .= ' ' . $and_or . ' `' . $_table . '`.`catid` ' . $not_in . ' (' . $fields['catid'] . ')';
                     } else {
                         $not_in = in_array($f, $not) ? '<>' : '=';
                         $where .= ' ' . $and_or . ' `' . $_table . '`.`catid`' . $not_in . $fields['catid'];
                     }
                 } elseif ($f == 'thumb' && isset($fields['thumb']) && is_numeric($fields['thumb'])) {
                     $where .= $fields['thumb'] ? ' ' . $and_or . ' `' . $_table . '`.`thumb`<>""' : ' ' . $and_or . ' `' . $_table . '`.`thumb`=""';
                 } else {
                     $not_in = in_array($f, $in) ? 'IN' : '';
                     $not_in = in_array($f, $not) ? 'NOT IN' : $not_in;
                     if (in_array($f, $between)) {
                         if (strpos($fields[$f], '_') !== false) {
                             list($v1, $v2) = explode('_', $fields[$f]);
                             $v1 = is_numeric($v1) ? $v1 : '"' . addslashes($v1) . '"';
                             $v2 = is_numeric($v2) ? $v2 : '"' . addslashes($v2) . '"';
                             $where .= ' ' . $and_or . ' `' . $_table . '`.`' . $f . '` BETWEEN ' . $v1 . ' AND ' . $v2;
                         } elseif (strpos($fields[$f], ',') !== false) {
                             list($v1, $v2) = explode(',', $fields[$f]);
                             $v1 = is_numeric($v1) ? $v1 : '"' . addslashes($v1) . '"';
                             $v2 = is_numeric($v2) ? $v2 : '"' . addslashes($v2) . '"';
                             $where .= ' ' . $and_or . ' `' . $_table . '`.`' . $f . '` BETWEEN ' . $v1 . ' AND ' . $v2;
                         } else {
                             continue;
                         }
                     } elseif ($not_in) {
                         $where .= ' ' . $and_or . ' `' . $_table . '`.`' . $f . '` ' . $not_in . ' (' . $fields[$f] . ')';
                     } elseif (in_array($f, $like)) {
                         $value = addslashes($fields[$f]);
                         $where .= ' ' . $and_or . ' `' . $_table . '`.`' . $f . '` LIKE "' . $value . '"';
                     } else {
                         $value = is_numeric($fields[$f]) ? $fields[$f] : '"' . addslashes($fields[$f]) . '"';
                         $where .= ' ' . $and_or . ' `' . $_table . '`.`' . $f . '`=' . $value . '';
                     }
                 }
             }
         }
     }
     if ($where) {
         if (substr($where, 0, 4) == ' AND') {
             $where = ' WHERE' . substr($where, 4);
         } elseif (substr($where, 0, 3) == ' OR') {
             $where = ' WHERE' . substr($where, 3);
         } else {
             $where = ' WHERE' . $where;
         }
         //对WHERE延展
         if (isset($system['extend']) && substr($system['extend'], 0, 6) == 'WHERE.') {
             $where .= ' ' . str_replace('-', ' ', substr($system['extend'], 6));
             unset($system['extend']);
         }
     }
     //延展list
     $extend = '';
     if (isset($system['extend']) && $system['extend']) {
         $extend = ' ' . str_replace('-', ' ', $system['extend']);
     }
     //FROM整合
     $from = 'FROM ' . $table;
     if ($table_data) {
         $from .= ' LEFT JOIN ' . $table_data . ' ON `' . $table . '`.`' . $db->get_primary_key() . '`=`' . $table_data . '`.`' . $db_data->get_primary_key() . '`';
     }
     if ($table_join && $system['on']) {
         $_join_name = null;
         if (in_array($system['on'], $_table_fields)) {
             $_join_name = $table;
         } elseif (isset($_table_data_fields) && in_array($system['on'], $_table_data_fields)) {
             $_join_name = $table_data;
         }
         if ($_join_name) {
             $from .= ' LEFT JOIN ' . $table_join . ' ON `' . $table_join . '`.`' . $db_join->get_primary_key() . '`=`' . $_join_name . '`.`' . $system['on'] . '`';
         }
     }
     //ORDER排序
     $order = '';
     if (isset($system['order']) && $system['order']) {
         if (strtoupper($system['order']) == 'RAND()') {
             $order .= ' ORDER BY RAND()';
         } else {
             $orders = explode(',', $system['order']);
             foreach ($orders as $t) {
                 list($_field, $_order) = explode('_', $t);
                 $_name = null;
                 if (in_array($_field, $_table_fields)) {
                     $_name = $table;
                 } elseif (isset($_table_data_fields) && in_array($_field, $_table_data_fields)) {
                     $_name = $table_data;
                 } elseif (isset($_table_join_fields) && in_array($_field, $_table_join_fields)) {
                     $_name = $table_join;
                 }
                 $_orderby = isset($_order) && strtoupper($_order) == 'ASC' ? 'ASC' : 'DESC';
                 if ($_name) {
                     $order .= ' `' . $_name . '`.`' . $_field . '` ' . $_orderby . ',';
                 }
             }
             if (substr($order, -1) == ',') {
                 $order = ' ORDER BY' . substr($order, 0, -1);
             }
         }
     }
     //limit与分页
     $limit = '';
     if (isset($system['num']) && $system['num']) {
         $limit = ' LIMIT ' . $system['num'];
     } elseif (isset($system['page'])) {
         $pageurl = '';
         $system['page'] = (int) $system['page'] ? (int) $system['page'] : 1;
         if ($system['urlrule']) {
             $pageurl = str_replace(array('_page_', '[page]'), '{page}', $system['urlrule']);
             $pagesize = $system['pagesize'] ? $system['pagesize'] : (isset($cat['pagesize']) ? $cat['pagesize'] : 10);
         } elseif ($cat) {
             $pageurl = getCaturl($cat, '{page}');
             $pagesize = $system['pagesize'] ? $system['pagesize'] : $cat['pagesize'];
         } else {
             $pagesize = $system['pagesize'] ? $system['pagesize'] : 10;
             $pageurl = '{page}';
         }
         $sql = 'SELECT count(*) AS total ' . $from . ' ' . $where;
         $count = $db->execute($sql, false, $dbcache);
         $total = $count['total'];
         $pagelist = Controller::instance('pagelist');
         $pagelist->loadconfig($system['pagerule'] ? $system['pagerule'] : 'pagerule');
         $start_id = $pagesize * ($system['page'] - 1);
         $limit = ' LIMIT ' . $start_id . ',' . $pagesize;
         $pagelist = $pagelist->total($total)->url($pageurl)->num($pagesize)->page($system['page'])->output();
     }
     //查询字段筛选
     if (isset($system['fields']) && $system['fields']) {
         $fields_array = explode(',', $system['fields']);
         //字段参数转为数组
         $select_array = array();
         foreach ($fields_array as $t) {
             //遍历字段参数数组,筛选无用字段、字段附加表前缀
             if (in_array($t, $_table_fields)) {
                 //主表字段
                 $select_array[] = '`' . $table . '`.`' . $t . '`';
             } elseif (isset($_table_data_fields) && in_array($t, $_table_data_fields)) {
                 //附表字段
                 $select_array[] = '`' . $table_data . '`.`' . $t . '`';
             } elseif (isset($_table_join_fields) && in_array($t, $_table_join_fields)) {
                 //联合表字段
                 $select_array[] = '`' . $table_join . '`.`' . $t . '`';
             }
         }
         $select_field = empty($select_array) ? ' * ' : ' ' . implode(',', $select_array) . ' ';
         //组合成sql查询格式
         unset($select_array, $fields_array);
     } else {
         $select_field = ' * ';
     }
     //查询结果
     $sql = 'SELECT' . $select_field . $from . $where . $order . $limit . $extend;
     $data = $db->execute($sql, true, $dbcache);
     //释放变量
     unset($_param, $param, $par, $p, $fields, $_fields, $not, $in, $or, $between, $dbcache, $like);
     unset($table, $db, $table_join, $table_data, $table_fields, $table_join_fields, $table_data_fields, $arrchilds, $_table_fields);
     unset($fieldsAll, $_table_data_fields, $cache, $db_join, $cats, $cat, $models, $model, $db_data, $where, $order, $from);
     if (isset($system['return']) && $system['return'] && $system['return'] != 't') {
         return array('sql_' . $system['return'] => $sql, 'total_' . $system['return'] => isset($total) ? $total : count($data), 'return_' . $system['return'] => $data, 'pagelist_' . $system['return'] => $pagelist);
     }
     return array('pagelist' => $pagelist, 'return' => $data, 'sql' => $sql, 'total' => isset($total) ? $total : count($data));
 }
//0;
$start_col = $ui_start_index_2d['col'];
//0;
$goal_row = $ui_goal_index_2d['row'];
//4;
$goal_col = $ui_goal_index_2d['col'];
//5;
$max_row = $ui_num_row - 1;
$max_col = $ui_num_col - 1;
$b_find_path = runAstar($grid_1, $start_row, $start_col, $goal_row, $goal_col, $max_row, $max_col);
$start_node = $grid_1->nodes[$start_row][$start_col];
$goal_node = $grid_1->nodes[$goal_row][$goal_col];
$last_node = null;
$raw_path = array();
if ($b_find_path) {
    $raw_path = findReversePath($start_node, $goal_node, $last_node);
    $raw_path = array_reverse($raw_path);
}
$path = array();
foreach ($raw_path as $node) {
    $row = $node->row;
    $col = $node->col;
    $path[] = position($row, $col);
}
//$path = [position(0, 0),
// position(0, 1),
//    position(1, 1)];
$output = array('path' => $path);
//$post_data = json_encode(array('like_votes' => $audio_file['like_votes'], 'dislike_votes' => $audio_file['dislike_votes']));
$post_data = json_encode($output);
echo $post_data;
예제 #5
0
    /* vypis pouzite abecedy - standardne znaky a-z */
    //echo "Abeceda: ", $alphabet . "<br/><br/>";
    $result = "";
    $result_numbers = "";
    for ($i = 0; $i < strlen($input); $i++) {
        /* projedeme cely retezec */
        if ($encode) {
            /* kodujeme */
            $new_position = encode($input[$i], $cipher[$i], $alphabet);
            /* ziskame novou pozici */
        } else {
            /* dekodujeme */
            $new_position = decode($input[$i], $cipher[$i], $alphabet);
            /* ziskame novou pozici */
        }
        $char = position($new_position, $alphabet);
        /* pozice noveho znaku */
        $result .= $char;
        $result_numbers .= $new_position . " ";
        /* pro zajimavost si ukladam i cisla, jak to bylo v augustove verzi */
    }
    if (!$encode) {
        /* pokud dekodujeme, musime zase nahradit znaky z abecedy */
        $result = reverseReplaceChars($result, $inputChars);
    }
    /* vypíšeme si výsledek */
    //print_r($result);
}
?>
        <header>
            <h1>Augustova šifra</h1>
예제 #6
0
파일: karte.php 프로젝트: o-wars/o-wars
	<tr>
		<th align="center" colspan="25">
			<b>Karte Sektor ' . ($map['end'] / 500 - 1) . ':</b> (stand: ' . date('H:i') . ' update: %update%' . ')
		</th>
	</tr>';
    //date('H:i',(date('U')+14400)).
    $select = "SELECT * FROM `clans` WHERE `userid` = '" . $_SESSION['user']['omni'] . "' LIMIT 1;";
    $result = mysql_query($select);
    $myclan = mysql_fetch_array($result);
    if ($myclan == 0) {
        $myclan = 'keiner';
    }
    do {
        $map['start']++;
        $col++;
        $to_position = position($map['start']);
        $own_pos = $own_position['x'] + ($own_position['y'] + $own_position['z'] * 20);
        $to_pos = $to_position['x'] + ($to_position['y'] + $to_position['z'] * 20);
        if ($own_position['x'] > $to_position['x']) {
            $entfernung = $own_position['x'] - $to_position['x'];
        } else {
            $entfernung = $to_position['x'] - $own_position['x'];
        }
        if ($own_position['y'] + $own_position['z'] * 20 > $to_position['y'] + $to_position['z'] * 20) {
            $entfernung += $own_position['y'] + $own_position['z'] * 20 - ($to_position['y'] + $to_position['z'] * 20);
        } else {
            $entfernung += $to_position['y'] + $to_position['z'] * 20 - ($own_position['y'] + $own_position['z'] * 20);
        }
        $select = "SELECT * FROM `user` WHERE 1 AND `omni` =" . $map['start'] . ";";
        $result = mysql_query($select);
        $row = mysql_fetch_array($result);
예제 #7
0
	<li><span style="font-weight: bold">Selected Clients:</span> Hostirian, Systematic Revenue, Venture Draft, St. Louis Arch Angels.</li>
	</ul>', "");
position("Washington University Student Investment Fund", "St. Louis, MO", "Communication Chair", "1/10-6/12", '
	<ul>
	<li>Managed the investment of over $100,000 of the university endowment via qualitative, multiples, and DCF analysis, resulting in  growth exceeding S&P 500 Midcap Index on invested funds.</li>
	<li>Competed nationally in investment competitions, and was a Finalist in the Spring 2011 <a href="http://miiuic.org/" target="_BLANK">Michigan Interactive Investments Competition</a>.</li>
	<li><span style="font-style:italic;">Previous Positions:</span> Technology Portfolio Manager (2010), Webmaster (2010-2011), Healthcare Analyst (2010).</li>
	</ul>', "http://wusif.org");
position("Washington University in St. Louis Department of Computer Science", "St. Louis, MO", "Teaching Assistant, Introduction to Computing Tools: MATLAB", "1/11-6/11", "", "");
position("Washington University School of Medicine in St. Louis", "St. Louis, MO", "Research Assistant, Dr. Jennifer Lodge Laboratory", "9/09-1/12", '
	<ul>
	<li>Studied pathogenic fungus <a href="http://en.wikipedia.org/wiki/Cryptococcus_neoformans" target="_BLANK"><span style="font-style:italic;">Cryptococcus neoformans</span></a> with in vitro, in vivo, and computational techniques.</li>
	<li>Selected Project Experience:
		<ul>
			<li>Bioinformatics – Designed, developed, and implemented a scalable <span style="font-style:italic;">C. neoformans</span> Strain Database for collaborative use in the scientific community. </li>
			<li>Gene research – Studied stress sensors involved with nitrositive stress.</li>
			<li>Animal testing – Analyzed strain virulence with <span style="font-style"italic;">in vitro</span> studies in mice.</li>
		<ul>

			
	</li>
	</ul>', "");
?>
    
    
      </section>
      
      <section id="technical">
            <div class="row">

      <div class="page-header">
예제 #8
0
</a>
<?php 
} elseif (front::get('case') == 'mailsubscription') {
    ?>
<a href="#" title="<?php 
    echo lang(mailsubscription);
    ?>
"><?php 
    echo lang(mailsubscription);
    ?>
</a>
                <?php 
} else {
    ?>
            	<?php 
    foreach (position($catid) as $t) {
        ?>
<a title="<?php 
        echo $t['name'];
        ?>
" href="<?php 
        echo $t['url'];
        ?>
"><?php 
        echo $t['name'];
        ?>
</a>
<?php 
    }
    ?>
                <?php 
예제 #9
0
 function pdftransactionAction()
 {
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     // Image
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = '';
     for ($i = 0; $i < count($word); $i++) {
         if ($i > 0 && $i < count($word) - 1) {
             $projname .= '/' . $word[$i];
         }
     }
     // Image
     $image_name = "/var/www" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizontal
     //set the font
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
     $text = array($this->view->translate("Deposit Summary"), $this->view->translate("Product"), $this->view->translate('Deposit summary'), $this->view->translate("No. of Savings"), $this->view->translate("Total Savings Amount"));
     function position($amt)
     {
         $len = strlen($amt);
         $pos = 490 - $len * 4;
         return $pos;
     }
     $xx = 50;
     $xy = 550;
     $x1 = 60;
     $x2 = 190;
     $x3 = 330;
     $x4 = 420;
     $page->drawText($text[0], 260, 750);
     $y1 = 725;
     if ($this->_request->getParam('field1')) {
         $officename = new Depositsummary_Model_Depositsummary();
         $OffName = $officename->officeNamefetch($this->_request->getParam('field1'));
         foreach ($OffName as $OffName) {
         }
         $this->view->officeName = $OffName['name'];
         $page->drawText($this->view->translate("Branch Name : "), $x1, $y1);
         $page->drawText($OffName['name'], $x2, $y1);
         $y1 -= 20;
     }
     //point to draw Side line
     $startlinepoint = $y1;
     $page->drawLine($xx, $y1, $xy, $y1);
     $y1 -= 20;
     $page->drawText($text[1], $x1, $y1);
     $page->drawText($text[2], $x2, $y1);
     $page->drawText($text[3], $x3, $y1);
     $page->drawText($text[4], $x4, $y1);
     $y1 -= 5;
     $page->drawLine($xx, $y1, $xy, $y1);
     $y1 -= 20;
     $this->view->depositAmount = 0;
     $this->view->withdrawlAmount = 0;
     $this->view->totalAmount = 0;
     $this->view->deposit = 0;
     $this->view->withdrawl = 0;
     $this->view->sum = 0;
     if ($this->_request->getParam('field1')) {
         $office_id = $this->_request->getParam('field1');
         $this->view->office_id = $office_id;
         $savingsummary = new Depositsummary_Model_Depositsummary();
         $result = $savingsummary->fetchSavingsDetails($office_id);
         $this->view->result = $result;
         $depositAmount = 0;
         $deposit = 0;
         $withdrawlAmount = 0;
         $withdrawl = 0;
         $totalamount = 0;
         $sum = 0;
         foreach ($result as $result) {
             $page->drawText($result['productname'], $x1, $y1);
             $page->drawText($result['prodoffername'], $x2, $y1);
             $page->drawText($result['countvalue'], $x3, $y1);
             $y1 -= 15;
             $accountBalanc = $savingsummary->accountBalanceDetails($office_id);
             $this->view->accountBalanc = $accountBalanc;
             foreach ($accountBalanc as $accountBalanc) {
                 if ($result['id'] == $accountBalanc['offerprodid']) {
                     if ($accountBalanc['transactiontype_id'] == 1) {
                         $depositAmount = $depositAmount + $accountBalanc['amount_to_bank'];
                         $deposit = $deposit + $accountBalanc['amount_to_bank'];
                     }
                     if ($accountBalanc['transactiontype_id'] == 2) {
                         $withdrawlAmount = $withdrawlAmount + $accountBalanc['amount_from_bank'];
                         $withdrawl = $withdrawl + $accountBalanc['amount_from_bank'];
                     }
                     $totalamount = $depositAmount - $withdrawlAmount;
                     $sum = $deposit - $withdrawl;
                 }
             }
             if ($totalamount) {
                 $pos = position(sprintf("%4.2f", $totalamount));
                 $page->drawText(sprintf("%4.2f", $totalamount), $pos, $y1);
                 $y1 -= 18;
                 $totalamount = 0;
                 $withdrawlAmount = 0;
                 $depositAmount = 0;
             } else {
                 echo "***";
             }
         }
         $page->drawLine($xx, $y1, $xy, $y1);
         $y1 -= 18;
         $page->drawText("Total", $x3, $y1);
         $pos = position(sprintf("%4.2f", $sum));
         $page->drawText(sprintf("%4.2f", $sum), $pos, $y1);
         $y1 -= 10;
         $page->drawLine($xx, $y1, $xy, $y1);
         $page->drawLine($xx, $y1, $xx, $startlinepoint);
         //1st vertical line
         $page->drawLine($x2 - 8, $y1, $x2 - 8, $startlinepoint);
         //1st vertical line
         $page->drawLine($x3 - 10, $y1, $x3 - 10, $startlinepoint);
         //1st vertical line
         $page->drawLine($x4 - 10, $y1, $x4 - 10, $startlinepoint);
         //1st vertical line
         $page->drawLine($xy, $y1, $xy, $startlinepoint);
         //1st vertical line
         //echo "<pre>";print_r($accountBalanc);echo "<pre>";
         if (!$result && !$accountBalanc) {
             echo "<font color='RED' size = '3'>No Savings Account</font>";
         }
     } else {
         // $office_id = $this->_request->getParam('field1');
         $savingsummary = new Depositsummary_Model_Depositsummary();
         $result = $savingsummary->SavingsDetails();
         $this->view->result = $result;
         $accountBalanc = $savingsummary->accountBalance();
         $this->view->accountBalanc = $accountBalanc;
         $depositAmount = 0;
         $deposit = 0;
         $withdrawlAmount = 0;
         $withdrawl = 0;
         $totalamount = 0;
         $sum = 0;
         foreach ($result as $result) {
             $page->drawText($result['productname'], $x1, $y1);
             $page->drawText($result['prodoffername'], $x2, $y1);
             $page->drawText($result['countvalue'], $x3, $y1);
             $accountBalanc = $savingsummary->accountBalance();
             $this->view->accountBalanc = $accountBalanc;
             foreach ($accountBalanc as $accountBalanc) {
                 if ($result['id'] == $accountBalanc['offerprodid']) {
                     if ($accountBalanc['transactiontype_id'] == 1) {
                         $depositAmount = $depositAmount + $accountBalanc['amount_to_bank'];
                         $deposit = $deposit + $accountBalanc['amount_to_bank'];
                     }
                     if ($accountBalanc['transactiontype_id'] == 2) {
                         $withdrawlAmount = $withdrawlAmount + $accountBalanc['amount_from_bank'];
                         $withdrawl = $withdrawl + $accountBalanc['amount_from_bank'];
                     }
                     $totalamount = $depositAmount - $withdrawlAmount;
                     $sum = $deposit - $withdrawl;
                 }
             }
             if ($totalamount) {
                 $pos = position(sprintf("%4.2f", $totalamount));
                 $page->drawText(sprintf("%4.2f", $totalamount), $pos, $y1);
                 $y1 -= 18;
                 $totalamount = 0;
                 $withdrawlAmount = 0;
                 $depositAmount = 0;
             } else {
                 echo "***";
             }
         }
         $page->drawLine($xx, $y1, $xy, $y1);
         $y1 = 18;
         $page->drawText("Total", $x3, $y1);
         $pos = position(sprintf("%4.2f", $sum));
         $page->drawText(sprintf("%4.2f", $sum), $pos, $y1);
         $y1 = 15;
         $page->drawLine($xx, $y1, $xy, $y1);
         $page->drawLine($xx, $y1, $xx, $startlinepoint);
         //1st vertical line
         $page->drawLine($x2 - 8, $y1, $x2 - 8, $startlinepoint);
         //1st vertical line
         $page->drawLine($x3 - 10, $y1, $x3 - 10, $startlinepoint);
         //1st vertical line
         $page->drawLine($x4 - 10, $y1, $x4 - 10, $startlinepoint);
         //1st vertical line
         $page->drawLine($xy, $y1, $xy, $startlinepoint);
         //1st vertical line
         if (!$result && !$accountBalanc) {
             echo "<font color='RED' size = '3'>No Savings Account</font>";
         }
     }
     //          $y1-=15;
     $pdfData = $pdf->render();
     $pdf->save('/var/www' . $projname . '/reports/depositsummaryreport.pdf');
     $path = '/var/www' . $projname . '/reports/depositsummaryreport.pdf';
     chmod($path, 0777);
     $this->_redirect('depositsummary/index');
 }
예제 #10
0
 function pdftransactionAction()
 {
     $pdf = new Zend_Pdf();
     //create a new page
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = '';
     for ($i = 0; $i < count($word); $i++) {
         if ($i > 0 && $i < count($word) - 1) {
             $projname .= '/' . $word[$i];
         }
     }
     // Image
     $image_name = "/var/www" . $app . "/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizontal
     //set the font
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 12);
     echo $title = $this->_request->getParam('pagetitle');
     $len = strlen($title);
     $pos = 550 - $len * 7;
     $page->drawText($title, $pos, 760);
     $z1 = 50;
     $z2 = 550;
     $y1 = 740;
     $y2 = 740;
     $x = array(60, 92, 180, 240, 340, 400, 460);
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
     //Amount Formatting
     function position($spaceFlag, $amt)
     {
         if ($spaceFlag == 0) {
             $len = strlen($amt);
             $pos = 300 - $len * 5;
             return $pos;
         }
         if ($spaceFlag == 1) {
             $len = strlen($amt);
             $pos = 230 - $len * 5;
             return $pos;
         }
     }
     function position1($spaceFlag1, $amt)
     {
         if ($spaceFlag1 == 0) {
             $len = strlen($amt);
             $pos = 370 - $len * 5;
             return $pos;
         }
         if ($spaceFlag1 == 1) {
             $len = strlen($amt);
             $pos = 300 - $len * 5;
             return $pos;
         }
     }
     function balPosi($spaceFlag, $amt)
     {
         if ($spaceFlag == 0) {
             $len = strlen($amt);
             $pos = 450 - $len * 5;
             return $pos;
         }
         if ($spaceFlag == 1) {
             $len = strlen($amt);
             $pos = 370 - $len * 5;
             return $pos;
         }
     }
     echo $accountnumber = $this->view->accno = $this->_request->getParam('accno');
     echo $fromdate = $this->view->fromdate = $this->_request->getParam('fromdate');
     echo $todate = $this->view->todate = $this->_request->getParam('todate');
     $transaction = new Savingsledger_Model_Savingsledger();
     if ($accountnumber != '') {
         $accountDetails = $transaction->getAccountDetails($accountnumber);
         $balance = $transaction->balance($accountnumber);
         foreach ($accountDetails as $arraytran2) {
             $page->drawText("Name  ", 50, $y1);
             $page->drawText(": " . $arraytran2['membername'], 120, $y1);
             $y1 -= 15;
             $page->drawText("ID  ", 50, $y1);
             $page->drawText(": " . $arraytran2['membercode'], 120, $y1);
             $y1 -= 15;
             $page->drawText("Office name ", 50, $y1);
             $page->drawText(": " . $arraytran2['office_name'], 120, $y1);
             $y1 -= 15;
             $page->drawText("Product name ", 300, $y2);
             $page->drawText(": " . $arraytran2['offername'], 390, $y2);
             $y2 -= 15;
             $page->drawText("Account no.  ", 300, $y2);
             $page->drawText(": " . $arraytran2['account_number'], 390, $y2);
             $y2 -= 15;
             //$account_number = $arraytran2->account_number;
             foreach ($balance as $balanc) {
                 $page->drawText("Balance  ", 300, $y2);
                 $page->drawText(": " . $balanc['bal'], 390, $y2);
                 $y2 -= 15;
             }
         }
     }
     $startlinepoint = $y1;
     $page->drawLine($z1, $y1, $z2, $y1);
     $text = array("V No.", "A/c number", "Tran date", "Credit(Rs)", "Debit(Rs)", "Balance(Rs)", "Description", "Total(Rs)");
     $y1 -= 15;
     $i = 0;
     $j = 0;
     $page->drawText($text[$i], $x[$j], $y1);
     $j += 1;
     $i += 1;
     $acFlag = 0;
     if ($accountnumber == '') {
         $page->drawText($text[$i], $x[$j], $y1);
         $j += 1;
         $i += 1;
         $acFlag = 1;
     } else {
         $i += 1;
     }
     $page->drawText($text[$i], $x[$j], $y1);
     $j += 1;
     $i += 1;
     $page->drawText($text[$i], $x[$j] + 10, $y1);
     $j += 1;
     $i += 1;
     if ($acFlag == 1) {
         $page->drawText($text[$i], $x[$j], $y1);
         $j += 1;
         $i += 1;
     }
     if ($acFlag == 0) {
         $page->drawText($text[$i], $x[$j] + 20, $y1);
         $j += 1;
         $i += 1;
     }
     $page->drawText($text[$i], $x[$j], $y1);
     $j += 1;
     $i += 1;
     $page->drawText($text[$i], $x[$j], $y1);
     $y1 -= 10;
     $page->drawLine($z1, $y1, $z2, $y1);
     $y1 -= 15;
     $transactionDetails = $transaction->fetchTransactionDetails($accountnumber, $fromdate, $todate);
     foreach ($transactionDetails as $transactionDetails1) {
         if ($y1 > 30) {
             $i = 0;
             $j = 0;
             $page->drawText($transactionDetails1->Transactionid, $x[$j], $y1);
             $j += 1;
             $i += 1;
             if ($accountnumber == '') {
                 $page->drawText($transactionDetails1->account_number, $x[$j], $y1);
                 $j += 1;
                 $spaceFlag = 0;
                 $spaceFlag1 = 0;
             } else {
                 $spaceFlag = 1;
                 $spaceFlag1 = 1;
             }
             $page->drawText($transactionDetails1->transaction_date, $x[$j], $y1);
             $j += 1;
             $i += 1;
             //Position for Amount Formatting.......
             if ($transactionDetails1->transactiontype_id == 1) {
                 $pos = position($spaceFlag, sprintf("%4.2f", $transactionDetails1->amount_to_bank));
                 $page->drawText($transactionDetails1->amount_to_bank, $pos, $y1);
                 $j += 1;
                 $i += 1;
                 if ($spaceFlag == 0) {
                     $page->drawText("------", $x[$j], $y1);
                 } else {
                     $page->drawText("------", $x[$j] + 30, $y1);
                 }
                 $j += 1;
                 $i += 1;
             }
             if ($transactionDetails1->transactiontype_id == 2) {
                 $page->drawText("------", $x[$j] + 30, $y1);
                 $j += 1;
                 $i += 1;
                 $pos1 = position1($spaceFlag1, sprintf("%4.2f", $transactionDetails1->amount_from_bank));
                 $page->drawText($transactionDetails1->amount_from_bank, $pos1, $y1);
                 $j += 1;
                 $i += 1;
             }
             $pos = balPosi($spaceFlag, sprintf("%4.2f", $transactionDetails1->balance));
             $page->drawText(sprintf("%4.2f", $transactionDetails1->balance), $pos, $y1);
             $j += 1;
             $i += 1;
             // 			$page->drawText($transactionDetails1->balance,$x[$j], $y1);$j+=1;$i+=1;
             $page->drawText($transactionDetails1->description, $x[$j], $y1);
             $y1 -= 15;
         } else {
             $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
             $pdf->pages[] = $page;
             $app = $this->view->baseUrl();
             $word = explode('/', $app);
             $projname = $word[1];
             // Image
             $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
             $image = Zend_Pdf_Image::imageWithPath($image_name);
             $page->drawImage($image, 30, 770, 130, 820);
             $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
             //bottom horizontal
             $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
             //left vertical
             $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
             //right vertical
             $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
             //top horizontal
             //set the font
             $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
             $z1 = 50;
             $z2 = 550;
             $y1 = 740;
             $y2 = 740;
             $x = array(60, 92, 180, 240, 340, 400, 460);
             $i = 0;
             $j = 0;
             $page->drawText($transactionDetails1->Transactionid, $x[$j], $y1);
             $j += 1;
             $i += 1;
             if ($accountnumber == '') {
                 $page->drawText($transactionDetails1->account_number, $x[$j], $y1);
                 $j += 1;
                 $spaceFlag = 0;
                 $spaceFlag1 = 0;
             } else {
                 $spaceFlag = 1;
                 $spaceFlag1 = 1;
             }
             $page->drawText($transactionDetails1->transaction_date, $x[$j], $y1);
             $j += 1;
             $i += 1;
             //Position for Amount Formatting.......
             if ($transactionDetails1->transactiontype_id == 1) {
                 $pos = position($spaceFlag, sprintf("%4.2f", $transactionDetails1->amount_to_bank));
                 $page->drawText($transactionDetails1->amount_to_bank, $pos, $y1);
                 $j += 1;
                 $i += 1;
                 if ($spaceFlag == 0) {
                     $page->drawText("------", $x[$j], $y1);
                 } else {
                     $page->drawText("------", $x[$j] + 30, $y1);
                 }
                 $j += 1;
                 $i += 1;
             }
             if ($transactionDetails1->transactiontype_id == 2) {
                 $page->drawText("------", $x[$j] + 30, $y1);
                 $j += 1;
                 $i += 1;
                 $pos1 = position1($spaceFlag1, sprintf("%4.2f", $transactionDetails1->amount_from_bank));
                 $page->drawText($transactionDetails1->amount_from_bank, $pos1, $y1);
                 $j += 1;
                 $i += 1;
             }
             $pos = balPosi($spaceFlag, sprintf("%4.2f", $transactionDetails1->balance));
             $page->drawText(sprintf("%4.2f", $transactionDetails1->balance), $pos, $y1);
             $j += 1;
             $i += 1;
             // 			$page->drawText($transactionDetails1->balance,$x[$j], $y1);$j+=1;$i+=1;
             $page->drawText($transactionDetails1->description, $x[$j], $y1);
             $y1 -= 15;
         }
     }
     $creditTotal = 0;
     $debitTotal = 0;
     foreach ($transactionDetails as $calc) {
         if ($calc['transactiontype_id'] == 1) {
             $creditTotal += $calc['amount_to_bank'];
         } else {
             $debitTotal += $calc['amount_from_bank'];
         }
     }
     if ($spaceFlag == 0) {
         $page->drawText($text[7], $x[2], $y1);
     }
     if ($spaceFlag == 1) {
         $page->drawText($text[7], $x[1], $y1);
     }
     $pos = position($spaceFlag, sprintf("%4.2f", $creditTotal));
     $page->drawText(sprintf("%4.2f", $creditTotal), $pos, $y1);
     // 			$page->drawText($creditTotal,$x[3], $y1);
     $pos1 = position1($spaceFlag1, sprintf("%4.2f", $debitTotal));
     $page->drawText(sprintf("%4.2f", $debitTotal), $pos1, $y1);
     $y1 -= 15;
     // 			$page->drawText($debitTotal,$x[4], $y1);$y1-=15;
     $page->drawLine($z1, $y1, $z2, $y1);
     $page->drawLine($z1, $y1, $z1, $startlinepoint);
     $page->drawLine($z2, $y1, $z2, $startlinepoint);
     $pdfData = $pdf->render();
     $pdf->save('/var/www/' . $projname . '/reports/savingsledger.pdf');
     $path = '/var/www/' . $projname . '/reports/savingsledger.pdf';
     chmod($path, 0777);
     $this->_redirect('/savingsledger/index/viewtransaction/acc/' . $accountnumber . '/datefrom/' . $fromdate . '/dateto/' . $todate);
 }
예제 #11
0
 public function pdfmeetingAction()
 {
     //rupees right alignment
     function position($amt, $posValue)
     {
         $len = strlen($amt);
         $pos = $posValue - 35 - $len * 4;
         return $pos;
     }
     //view details on pdf page
     $meeting_id = $this->_request->getParam('meeting_name');
     $meetingno = $this->_request->getParam('meetingno');
     $this->view->field1 = $meetingno;
     $this->view->branchid = $meeting_id;
     //for meeting details
     $meetingbook = new Meetingbookreport_Model_Meetingbook();
     // 	$this->view->fetchgroupid=$groupid1=$meetingbook->fetchgroupid($meeting_id);
     // 	$groupid= $groupid1[0]['group_id'];
     $this->view->meeting = $ff = $meetingbook->fetchmeeting($meeting_id);
     //echo '<pre>';print_r($ff);
     //fetch member details
     $this->view->members = $aa = $meetingbook->fetchMembers($meeting_id);
     //echo '<pre>';print_r($aa);
     //fetch attendance details
     $this->view->attendance = $meetingbook->fetchattendance($meeting_id, $meetingno);
     //fetch loan officer
     $loanofficer = $meetingbook->fetchloanofficer($meeting_id);
     if ($loanofficer) {
         $this->view->loanofficer = $loanofficer[0]['loanofficer'];
     }
     //$cfromDate = $dateconvertor->mysqlformat($fromDate);
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     //Path
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = $word[1];
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizontal
     //set the font
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $text = array();
     $this->view->savings = 10;
     $page->drawText("Date : " . date('d/m/Y'), 500, 800);
     //date('Y-m-d')
     $page->drawText("Meeting Book", 270, 770);
     $page->drawText("Meeting Book", 270, 770);
     $x1 = 50;
     $x2 = 320;
     $y1 = 725;
     $y2 = 710;
     $page->drawText("Meeting Information", $x1, $y1);
     $page->drawText("Meeting Information", $x1, $y1);
     //fetching meeting details
     if ($this->view->meeting) {
         $count = count($this->view->meeting);
         foreach ($this->view->meeting as $meeting) {
         }
         $page->drawText("Group name: " . $meeting['groupname'], $x1, $y1 = $y1 - 20);
         $page->drawText("Week Day: " . $meeting['weekday'], $x2, $y1);
         $page->drawText("Group head: " . $meeting['grouphead_name'], $x1, $y1 = $y1 - 15);
         $page->drawText("Time: " . $meeting['time'], $x2, $y1);
         $page->drawText("Number of members: " . $count, $x1, $y1 = $y1 - 15);
         $page->drawText("Place: " . $meeting['place'], $x2, $y1);
         $page->drawText("Loan Officer: " . $this->view->loanofficer, $x1, $y1 = $y1 - 15);
     }
     //         $this->view->savings = 10;
     $y1 = $y1 - 30;
     $page->drawText("Attendance Information", $x1, $y1);
     $page->drawText("Attendance Information", $x1, $y1);
     //fetching attendance details
     foreach ($this->view->attendance as $attendance) {
     }
     $page->drawText("Meeting name: " . $attendance['meetingname'], $x1, $y1 = $y1 - 20);
     $page->drawText("Held on: " . $this->view->dateconvertor->phpnormalformat($attendance['meeting_date']), $x2, $y1);
     $page->drawText("Meeting Number: " . $attendance['week_no'], $x1, $y1 = $y1 - 15);
     $page->drawText("Time: " . $attendance['time'], $x2, $y1);
     $y1 = $y1 - 30;
     $page->drawText("Member Details", $x1, $y1);
     $page->drawText("Member Details", $x1, $y1);
     $y1 = $y1 - 15;
     $page->drawLine(50, $y1, 550, $y1);
     //table top line
     $y3 = $y1;
     // assign for left and right lines
     $y1 = $y1 - 15;
     $page->drawText("Sl", 55, $y1);
     $page->drawText("Members", 70, $y1);
     $page->drawText("UID", 180, $y1);
     $page->drawText("Attn.", 240, $y1);
     $page->drawText("Late", 265, $y1);
     $page->drawText("Absent", 290, $y1);
     $page->drawText("Balance", 340, $y1);
     $page->drawText("Pay", 395, $y1);
     $page->drawText("Outstanding", 420, $y1);
     $page->drawText("Due", 480, $y1);
     $page->drawText("Total", 525, $y1);
     // $page->drawLine(50, $y1 = $y1 - 20, 550, $y1); //dynamic bottom line - member details table
     $page->drawLine(50, $y1 - 10, 550, $y1 = $y1 - 10);
     $no = 1;
     $Topay = 0;
     $currentbalance1 = 0;
     $currentbalance2 = 0;
     $currentbalance3 = 0;
     $loandue1 = 0;
     $loandue2 = 0;
     $currentpay = 0;
     $totallatefee = 0;
     $totalabsentfee = 0;
     $total1 = 0;
     $total = 0;
     $currentbalance = new Meetingbookreport_Model_Meetingbook();
     $x3 = 315;
     $x4 = 345;
     $x5 = 400;
     $x6 = 445;
     $x7 = 495;
     $x8 = 530;
     $x9 = 575;
     foreach ($this->view->members as $members) {
         $memberid = $members['memberid'];
         $total = 0;
         $y1 = $y1 - 15;
         $page->drawText($no, 55, $y1);
         $page->drawText($members['membername'], 70, $y1);
         $page->drawText($members['uid'], 180, $y1);
         //$members['uid']
         $memberabsent = $currentbalance->memberabsent($memberid, $attendance['id']);
         $memberlate = $currentbalance->memberlate($memberid, $attendance['id']);
         if ($memberabsent) {
             $absente = 'A';
         } else {
             if ($memberlate) {
                 $absente = 'L';
             } else {
                 $absente = 'P';
             }
         }
         $page->drawText($absente, 245, $y1);
         if ($memberlate) {
             $totallatefee += $latefee = $members['penalty_latecoming'];
             $pos = position(sprintf("%4.2f", $latefee), $x3);
             $page->drawText(sprintf("%4.2f", $latefee), $pos + 2, $y1);
         } else {
             $latefee = 0;
             $pos = position(sprintf("%4.2f", ''), $x3);
             $page->drawText(sprintf("%4.2f", ''), $pos + 2, $y1);
         }
         if ($memberabsent) {
             $totalabsentfee += $absentfee = $members['penalty_notcoming'];
             $pos = position(sprintf("%4.2f", $absentfee), $x4);
             $page->drawText(sprintf("%4.2f", $absentfee), $pos + 2, $y1);
         } else {
             $absentfee = 0;
             $pos = position(sprintf("%4.2f", ''), $x4);
             $page->drawText(sprintf("%4.2f", ''), $pos + 2, $y1);
         }
         $creditbalance = $currentbalance->creditbalance($memberid);
         $debitbalance = $currentbalance->debitbalance($memberid);
         if ($creditbalance) {
             if ($debitbalance) {
                 $debitbalance1 = $debitbalance;
             } else {
                 $debitbalance1 = 0;
             }
             $currentbalance1 = $creditbalance[0]['currentbalance'] - $debitbalance1[0]['currentbalance'];
             $pos = position(sprintf("%4.2f", $currentbalance1), $x5);
             $page->drawText(sprintf("%4.2f", $currentbalance1), $pos + 2, $y1);
         } else {
             $pos = position(sprintf("%4.2f", ''), $x5);
             $page->drawText(sprintf("%4.2f", ''), $pos + 2, $y1);
         }
         $currentbalance2 += $currentbalance1;
         $perweek = $members['saving_perweek'];
         $pos = position(sprintf("%4.2f", $members['saving_perweek']), $x6);
         $page->drawText(sprintf("%4.2f", $members['saving_perweek']), $pos + 2, $y1);
         $loanoutstanding = $currentbalance->loanoutstanding($memberid);
         if ($loanoutstanding) {
             $loanoutstanding1 = $loanoutstanding[0]['outstanding'];
             $pos = position(sprintf("%4.2f", $loanoutstanding[0]['outstanding']), $x7);
             $page->drawText(sprintf("%4.2f", $loanoutstanding[0]['outstanding']), $pos + 2, $y1);
         }
         $currentbalance3 += $loanoutstanding1;
         $loandue = $currentbalance->loandue($memberid);
         if ($loandue) {
             $pos = position(sprintf("%4.2f", $loandue[0]['outstanding']), $x8);
             $page->drawText(sprintf("%4.2f", $loandue[0]['outstanding']), $pos + 2, $y1);
             $loandue1 = $loandue[0]['outstanding'];
         }
         $loandue2 += $loandue1;
         $total = $latefee + $absentfee + $currentbalance1 + $loandue1;
         $pos = position(sprintf("%4.2f", $total), $x9);
         $page->drawText(sprintf("%4.2f", $total), $pos + 2, $y1);
         $page->drawLine(50, $y1 - 10, 550, $y1 = $y1 - 10);
         $no++;
         $Topay += $members['saving_perweek'];
         $total1 += $total;
     }
     $y1 = $y1 - 15;
     $page->drawText("Total", 180, $y1);
     $pos = position(sprintf("%4.2f", $totallatefee), $x3);
     $page->drawText(sprintf("%4.2f", $totallatefee), $pos + 2, $y1);
     $pos = position(sprintf("%4.2f", $totalabsentfee), $x4);
     $page->drawText(sprintf("%4.2f", $totalabsentfee), $pos + 2, $y1);
     $pos = position(sprintf("%4.2f", $currentbalance2), $x5);
     $page->drawText(sprintf("%4.2f", $currentbalance2), $pos + 2, $y1);
     $pos = position(sprintf("%4.2f", $Topay), $x6);
     $page->drawText(sprintf("%4.2f", $Topay), $pos + 2, $y1);
     $pos = position(sprintf("%4.2f", $currentbalance3), $x7);
     $page->drawText(sprintf("%4.2f", $currentbalance3), $pos + 2, $y1);
     $pos = position(sprintf("%4.2f", $loandue2), $x8);
     $page->drawText(sprintf("%4.2f", $loandue2), $pos + 2, $y1);
     $pos = position(sprintf("%4.2f", $total1), $x9);
     $page->drawText(sprintf("%4.2f", $total1), $pos + 2, $y1);
     $page->drawLine(50, $y1 - 10, 550, $y1 = $y1 - 10);
     // Virtual table
     $page->setLineWidth(1)->drawLine(50, $y1, 50, $y3);
     //Table left vertical
     $page->setLineWidth(1)->drawLine(550, $y1, 550, $y3);
     //table rigth vertical
     $pdfData = $pdf->render();
     $pdf->save('/var/www/' . $projname . '/reports/meetingbook.pdf');
     $path = '/var/www/' . $projname . '/reports/meetingbook.pdf';
     chmod($path, 0777);
 }
예제 #12
0
}
$_GET[id] = htmlspecialchars($_GET[id]);
// html head setzen
$content = head("Uebersicht");
// spielerstatus ausgeben
$content .= '<center>' . spielerstatus() . '</center>';
$content .= '<br />';
$dbh = db_connect();
//if ($_GET[id]) {
$select = "SELECT * FROM `user` WHERE `omni` = '" . htmlspecialchars($_GET[id]) . "' ;";
$selectResult = mysql_query($select, $dbh);
$row = mysql_fetch_array($selectResult, MYSQL_ASSOC);
if (!$row[name]) {
    $row[name] = "unbewohnt (Taliban-Area)";
}
$to_position = position($_GET[id]);
$own_pos = $own_position[x] + ($own_position[y] + $own_position[z] * 500);
$to_pos = $to_position[x] + ($to_position[y] + $to_position[z] * 20);
if ($own_pos == $to_pos and $own_position[y] != $to_position[y]) {
    $entfernung = 2;
} elseif ($own_pos >= $to_pos) {
    $entfernung = $own_pos - $to_pos;
} elseif ($own_pos <= $to_pos) {
    $entfernung = $to_pos - $own_pos;
}
if (!$row[base]) {
    $row[base] = 'unbekannt';
}
if (!$row[clan]) {
    $row[clan] = '-';
}
예제 #13
0
파일: karte_new.php 프로젝트: o-wars/o-wars
////////////////////////////////////
if ($time['karte'] < date('U') - 3600) {
    $karte .= '<br />';
    $karte .= '	<script language="javascript">
	<!--
	var session = "' . session_name() . '=' . session_id() . '";
	-->
	</script>
	<script language="javascript" src="karte.js"></script>';
    $select = "SELECT * FROM `user` WHERE `omni` = '" . htmlspecialchars($_GET[id]) . "' ;";
    $selectResult = mysql_query($select);
    $row = mysql_fetch_array($selectResult);
    if (!$row['name']) {
        $row['name'] = "unbewohnt (Taliban-Area)";
    }
    $to_position = position($_GET['id']);
    $own_pos = $own_position['x'] + ($own_position['y'] + $own_position['z'] * 500);
    $to_pos = $to_position['x'] + ($to_position['y'] + $to_position['z'] * 20);
    if ($own_pos == $to_pos and $own_position['y'] != $to_position['y']) {
        $entfernung = 2;
    } elseif ($own_pos >= $to_pos) {
        $entfernung = $own_pos - $to_pos;
    } elseif ($own_pos <= $to_pos) {
        $entfernung = $to_pos - $own_pos;
    }
    if (!$row['base']) {
        $row['base'] = 'unbekannt';
    }
    if (!$row['clan']) {
        $row['clan'] = '-';
    }
예제 #14
0
 public function pdftransactionAction()
 {
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
     $pdf->pages[] = $page;
     //Path
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = '';
     for ($i = 0; $i < count($word); $i++) {
         if ($i > 0 && $i < count($word) - 1) {
             $projname .= '/' . $word[$i];
         }
     }
     // Image
     $image_name = "/var/www" . $app . "/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     $page->drawImage($image, 30, 520, 150, 570);
     $page->setLineWidth(1)->drawLine(25, 25, 810, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 570);
     //left vertical
     $page->setLineWidth(1)->drawLine(810, 25, 810, 570);
     //right vertical
     $page->setLineWidth(1)->drawLine(25, 570, 810, 570);
     //top horizontal
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 14);
     $text = array("Month", "Loan A/C", "On Time", "1-30 Days", "31-60 Days", "61-90 Days", "91-180 Days", "181-360 Days", "361 Days above", "O/S Loan", "Total");
     $this->view->savings = 10;
     $this->view->fromdate = $fromdate = $this->_request->getParam('fromdate');
     $this->view->branch = $branch = $this->_request->getParam('branch');
     $this->view->officer = $officer = $this->_request->getParam('officer');
     $viewdate = $this->view->dateconvert->phpnormalformat($fromdate);
     $par = new Par_Model_Par();
     $disp = "As of <font color=#039>" . $this->view->dateconvert->phpnormalformat($fromdate) . "</font>";
     if ($branch) {
         foreach ($par->fetchbranch($branch) as $branchname) {
         }
         $disp .= "<br> Branch : <font color=#039>" . $branchname['name'] . "</font>";
     }
     if ($officer) {
         foreach ($par->getUser1($branch) as $officername) {
         }
         $disp .= "<br> Loan officer : <font color=#039>" . $officername['officername'] . "</font>";
     }
     $this->view->resultshow = $disp;
     $parrisk1 = $this->view->parrisk = $par->parrisk($fromdate, $branch, $officer);
     $page->drawText("Portfolio at risk as of {$viewdate}", 380, 520);
     //date('Y-m-d')
     //right alignment
     function position($amt, $posValue)
     {
         $len = strlen($amt);
         $pos = $posValue - 10 - $len * 5;
         return $pos;
     }
     $pos = position("Amount in Rs", 780);
     $page->drawText("Amount in Rs", $pos, 460);
     $pos = position("Loan officer: " . $officername['officername'], 780);
     $page->drawText("Loan officer: " . $officername['officername'], $pos + 5, 480);
     $pos = position("Branch: " . $branchname['name'], 780);
     $page->drawText("Branch: " . $branchname['name'], $pos, 500);
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
     //         $page->drawText("Date : ".date('d-m-Y'),600, 510); //date('Y-m-d')
     $x = array(40, 100, 200, 250, 320, 400, 470, 540, 640, 730);
     $xl = array(35, 95, 195, 245, 315, 395, 465, 535, 615, 725, 800);
     $y = 450;
     $startpoint = $y;
     $xh1 = 95;
     $xh2 = 800;
     $page->drawLine($xh1, $y, $xh2, $y);
     $y -= 15;
     //Top line1
     for ($i = 1; $i < count($text) - 1; $i++) {
         $page->drawText($text[$i], $x[$i], $y);
     }
     $y -= 10;
     $page->drawLine($xh1, $y, $xh2, $y);
     $y -= 15;
     //Top line2
     $total30 = "0.00";
     $total60 = "0.00";
     $total90 = "0.00";
     $total180 = "0.00";
     $total360 = "0.00";
     $total360days = "0.00";
     $total = "0.00";
     $today = $this->view->fromdate;
     $date30 = date('Y-m-d', strtotime(date("Y-m-d", strtotime($today)) . " -30 days"));
     $date60 = date('Y-m-d', strtotime(date("Y-m-d", strtotime($today)) . " -60 days"));
     $date90 = date('Y-m-d', strtotime(date("Y-m-d", strtotime($today)) . " -90 days"));
     $date180 = date('Y-m-d', strtotime(date("Y-m-d", strtotime($today)) . " -180 days"));
     $date360 = date('Y-m-d', strtotime(date("Y-m-d", strtotime($today)) . " -360 days"));
     $day30 = "0.00";
     $day60 = "0.00";
     $day90 = "0.00";
     $day180 = "0.00";
     $day360 = "0.00";
     $day360above = "0.00";
     $r = "0.00";
     $total30 = "0.00";
     $total60 = "0.00";
     $total90 = "0.00";
     $total180 = "0.00";
     $total360 = "0.00";
     $total360days = "0.00";
     $total = "0.00";
     $a = array();
     foreach ($parrisk1 as $parrisk3) {
         $a[] = $parrisk3->account_number;
     }
     $a = array_unique($a);
     $a = array_values($a);
     for ($i = 0; $i < count($a); $i++) {
         $jj = 0;
         $jj1 = 0;
         $jj2 = 0;
         foreach ($parrisk1 as $parrisk2) {
             $duedate = $parrisk2->installment_date;
             if ($a[$i] == $parrisk2->account_number) {
                 if ($duedate >= $date30 and $duedate <= $today) {
                     $day30 = $parrisk2->installment_amount;
                 } else {
                     if ($duedate > $date60 and $duedate <= $date30) {
                         $day60 = $parrisk2->installment_amount;
                     } else {
                         if ($duedate > $date90 and $duedate <= $date60) {
                             $day90 = $parrisk2->installment_amount;
                         } else {
                             if ($duedate > $date180 and $duedate <= $date90) {
                                 $amt1 = $par->getAmount($date180, $date90, $parrisk2->account_number);
                                 if ($jj == 0) {
                                     foreach ($amt1 as $amt2) {
                                         $day180 += $amt2['sumofdue'];
                                     }
                                 }
                                 $jj++;
                                 // 			$day180 = $parrisk2->accountinstallment_amount;
                             } else {
                                 if ($duedate > $date360 and $duedate <= $date180) {
                                     $amt3 = $par->getAmount($date360, $date180, $parrisk2->account_number);
                                     if ($jj1 == 0) {
                                         foreach ($amt3 as $amt4) {
                                             $day360 += $amt4['sumofdue'];
                                         }
                                     }
                                     $jj1++;
                                     // 				$day360 = $parrisk2->accountinstallment_amount;
                                 } else {
                                     $amt5 = $par->getAmount1($date360, $parrisk2->account_number);
                                     if ($jj2 == 0) {
                                         foreach ($amt5 as $amt6) {
                                             $day360above += $amt6['sumofdue'];
                                         }
                                     }
                                     $jj2++;
                                     // 				$day360above = $parrisk2->accountinstallment_amount;
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $total30 += $day30;
         $total60 += $day60;
         $total90 += $day90;
         $total180 += $day180;
         $total360 += $day360;
         $total360days += $day360above;
         $page->drawText($a[$i], $x[1], $y);
         $page->drawText('', $x[2], $y);
         $pos = position(sprintf("%4.2f", $day30), $xl[4]);
         $page->drawText(sprintf("%4.2f", $day30), $pos, $y);
         $r += $day30;
         // 			$page->drawText($day30,$x[3], $y);$r+=$day30;
         $pos = position(sprintf("%4.2f", $day60), $xl[5]);
         $page->drawText(sprintf("%4.2f", $day60), $pos, $y);
         $r += $day60;
         // 			$page->drawText($day60,$x[4], $y);$r+=$day60;
         $pos = position(sprintf("%4.2f", $day90), $xl[6]);
         $page->drawText(sprintf("%4.2f", $day90), $pos, $y);
         $r += $day90;
         // 			$page->drawText($day90,$x[5], $y);$r+=$day90;
         $pos = position(sprintf("%4.2f", $day180), $xl[7]);
         $page->drawText(sprintf("%4.2f", $day180), $pos, $y);
         $r += $day180;
         // 			$page->drawText($day180,$x[6], $y);$r+=$day180;
         $pos = position(sprintf("%4.2f", $day360), $xl[8]);
         $page->drawText(sprintf("%4.2f", $day360), $pos, $y);
         $r += $day360;
         // 			$page->drawText($day360,$x[7], $y);$r+=$day360;
         $pos = position(sprintf("%4.2f", $day360above), $xl[9]);
         $page->drawText(sprintf("%4.2f", $day360above), $pos, $y);
         $r += $day360above;
         // 			$page->drawText($day360above,$x[8], $y);$r+=$day360above;
         $pos = position(sprintf("%4.2f", $r), $xl[10]);
         $page->drawText(sprintf("%4.2f", $r), $pos, $y);
         // 			$page->drawText($r,$x[9], $y);$r+=$day360;
         $y -= 15;
         $day30 = "0.00";
         $day60 = "0.00";
         $day90 = "0.00";
         $day180 = "0.00";
         $day360 = "0.00";
         $day360above = "0.00";
         $r = "0.00";
     }
     $page->setLineWidth(1)->drawLine($xh1, $y, $xh2, $y);
     //Bottom line above Total
     $y -= 15;
     $page->drawText($text[10], $x[1], $y);
     $pos = position(sprintf("%4.2f", $total30), $xl[4]);
     $page->drawText(sprintf("%4.2f", $total30), $pos, $y);
     // 		$page->drawText($total30,$x[3], $y);
     $pos = position(sprintf("%4.2f", $total60), $xl[5]);
     $page->drawText(sprintf("%4.2f", $total60), $pos, $y);
     // 		$page->drawText($total60,$x[4], $y);
     $pos = position(sprintf("%4.2f", $total90), $xl[6]);
     $page->drawText(sprintf("%4.2f", $total90), $pos, $y);
     // 		$page->drawText($total90,$x[5], $y);
     $pos = position(sprintf("%4.2f", $total180), $xl[7]);
     $page->drawText(sprintf("%4.2f", $total180), $pos, $y);
     // 		$page->drawText($total180,$x[6], $y);
     $pos = position(sprintf("%4.2f", $total360), $xl[8]);
     $page->drawText(sprintf("%4.2f", $total360), $pos, $y);
     // 		$page->drawText($total360,$x[7], $y);
     $pos = position(sprintf("%4.2f", $total360days), $xl[9]);
     $page->drawText(sprintf("%4.2f", $total360days), $pos, $y);
     // 		$page->drawText($total360days,$x[8], $y);
     $pos = position(sprintf("%4.2f", $total30 + $total60 + $total90 + $total180 + $total360 + $total360days), $xl[10]);
     $page->drawText(sprintf("%4.2f", $total30 + $total60 + $total90 + $total180 + $total360 + $total360days), $pos, $y);
     // 	        $page->drawText(($total30+$total60+$total90+$total180+$total360+$total360days),$x[9], $y);
     $y -= 10;
     $page->setLineWidth(1)->drawLine($xh1, $y, $xh2, $y);
     //Bottom line below Total
     for ($i = 1; $i < count($xl); $i++) {
         $page->setLineWidth(1)->drawLine($xl[$i], $y, $xl[$i], $startpoint);
         //All Vertical line
     }
     $pdfData = $pdf->render();
     $pdf->save('/var/www' . $projname . '/reports/par-' . date('Y-m-d') . '.pdf');
     $path = '/var/www' . $projname . '/reports/par-' . date('Y-m-d') . '.pdf';
     chmod($path, 0777);
     //		$this->_redirect("/reports/par/index/fromdate/$fromdate/branch/$branch/officer/$officer");
 }
		FROM ?_quest_template
		WHERE
			ReqCreatureOrGOId1=?
			OR ReqCreatureOrGOId2=?
			OR ReqCreatureOrGOId3=?
			OR ReqCreatureOrGOId4=?
		', $quest_cols[2], $id, $id, $id, $id);
    if ($rows_qo) {
        $npc['objectiveof'] = array();
        foreach ($rows_qo as $numRow => $row) {
            $npc['objectiveof'][] = GetQuestInfo($row, 0xffffff);
        }
    }
    unset($rows_qo);
    // Положения созданий божих:
    position($npc['entry'], 'creature');
    save_cache(1, $npc['entry'], $npc);
}
global $page;
$page = array('Mapper' => true, 'Book' => false, 'Title' => $npc['name'] . ' - ' . $smarty->get_config_vars('NPCs'), 'tab' => 0, 'type' => 1, 'typeid' => $npc['entry'], 'path' => '[0,4,' . $npc['type'] . ']');
$smarty->assign('page', $page);
// Комментарии
$smarty->assign('comments', getcomments($page['type'], $page['typeid']));
// Если хоть одна информация о вещи найдена - передаём массив с информацией о вещях шаблонизатору
if (isset($allitems)) {
    $smarty->assign('allitems', $allitems);
}
if (isset($allspells)) {
    $smarty->assign('allspells', $allspells);
}
$smarty->assign('npc', $npc);
예제 #16
0
파일: mission.php 프로젝트: o-wars/o-wars
	<tr align="center" class="standard"><td style="width:150px">Verbrauch in Einh.</td><td style="width:150px">' . $verbrauch_einh . ' Einh.</td></tr>
	<tr align="center" class="standard"><td style="width:150px">Eisen</td><td style="width:150px">' . $_POST['eisen'] . '</td></tr>
	<tr align="center" class="standard"><td style="width:150px">Titan</td><td style="width:150px">' . $_POST['titan'] . '</td></tr>
	<tr align="center" class="standard"><td style="width:150px">Oel</td><td style="width:150px">' . $_POST['oel'] . '</td></tr>
	<tr align="center" class="standard"><td style="width:150px">Uran</td><td style="width:150px">' . $_POST['uran'] . '</td></tr>
	<tr align="center" class="standard"><td style="width:150px">Gold</td><td style="width:150px">' . $_POST['gold'] . '</td></tr>
	<tr align="center" class="standard"><td style="width:150px">Chanje</td><td style="width:150px">' . $_POST['chanje'] . '</td></tr>	
	<tr align="center" class="standard"><td style="width:150px">Restplatz</td><td style="width:150px;' . $red . '">' . $restplatz . '</td></tr>';
    $content .= '<tr align="center"><td colspan="2" style="width:300px; height:20px"><br />' . percentbar(felder2time($entfernung * 10 / $maxspeed), felder2time($entfernung * 10 / $maxspeed), 290) . '</td></tr>';
    $content .= '<tr align="center"><td colspan="2" style="width:300px"><br /><b>Mission <a href="mission.php?' . SID . '&amp;missid=' . $eid . '&amp;abbrechen=1"><font class="red">ABBRECHEN</b></font></a><br /><br /></td></tr>
	</table>
	<br />';
} elseif ($_POST[action] == mission and $_POST[target]) {
    $anzahl = $_POST['anz1'] + $_POST['anz2'] + $_POST['anz3'] + $_POST['anz4'] + $_POST['anz5'] + $_POST['anz6'] + $_POST['anz7'] + $_POST['anz8'] + $_POST['anz9'] + $_POST['anz10'] + $_POST['anz11'] + $_POST['anz12'] + $_POST['anz13'] + $_POST['anz14'] + $_POST['anz15'];
    $to_position = position($_POST[target]);
    $own_position = position($_SESSION['user']['omni']);
    $own_pos = $own_position['x'] + ($own_position['y'] + $own_position['z'] * 20);
    $to_pos = $to_position['x'] + ($to_position['y'] + $to_position['z'] * 20);
    if ($own_position['x'] > $to_position['x']) {
        $entfernung = $own_position['x'] - $to_position['x'];
    } else {
        $entfernung = $to_position['x'] - $own_position['x'];
    }
    if ($own_position['y'] + $own_position['z'] * 20 > $to_position['y'] + $to_position['z'] * 20) {
        $entfernung += $own_position['y'] + $own_position['z'] * 20 - ($to_position['y'] + $to_position['z'] * 20);
    } else {
        $entfernung += $to_position['y'] + $to_position['z'] * 20 - ($own_position['y'] + $own_position['z'] * 20);
    }
    $verbrauch = ($_POST['anz1'] * $einh[1]['verbrauch'] + $_POST['anz2'] * $einh[2]['verbrauch'] + $_POST['anz3'] * $einh[3]['verbrauch'] + $_POST['anz4'] * $einh[4]['verbrauch'] + $_POST['anz5'] * $einh[5]['verbrauch'] + $_POST['anz6'] * $einh[6]['verbrauch'] + $_POST['anz7'] * $einh[7]['verbrauch'] + $_POST['anz8'] * $einh[8]['verbrauch'] + $_POST['anz9'] * $einh[9]['verbrauch'] + $_POST['anz10'] * $einh[10]['verbrauch'] + $_POST['anz11'] * $einh[11]['verbrauch'] + $_POST['anz12'] * $einh[12]['verbrauch'] + $_POST['anz13'] * $einh[13]['verbrauch'] + $_POST['anz14'] * $einh[14]['verbrauch'] + $_POST['anz15'] * $einh[15]['verbrauch']) / 10 * $entfernung;
    $verbrauch_km = $_POST['anz1'] * $einh[1]['verbrauch'] + $_POST['anz2'] * $einh[2]['verbrauch'] + $_POST['anz3'] * $einh[3]['verbrauch'] + $_POST['anz4'] * $einh[4]['verbrauch'] + $_POST['anz5'] * $einh[5]['verbrauch'] + $_POST['anz6'] * $einh[6]['verbrauch'] + $_POST['anz7'] * $einh[7]['verbrauch'] + $_POST['anz8'] * $einh[8]['verbrauch'] + $_POST['anz9'] * $einh[9]['verbrauch'] + $_POST['anz10'] * $einh[10]['verbrauch'] + $_POST['anz11'] * $einh[11]['verbrauch'] + $_POST['anz12'] * $einh[12]['verbrauch'] + $_POST['anz13'] * $einh[13]['verbrauch'] + $_POST['anz14'] * $einh[14]['verbrauch'] + $_POST['anz15'] * $einh[15]['verbrauch'];
    $platz = $_POST['anz1'] * $einh[1]['space'] + $_POST['anz2'] * $einh[2]['space'] + $_POST['anz3'] * $einh[3]['space'] + $_POST['anz4'] * $einh[4]['space'] + $_POST['anz5'] * $einh[5]['space'] + $_POST['anz6'] * $einh[6]['space'] + $_POST['anz7'] * $einh[7]['space'] + $_POST['anz8'] * $einh[8]['space'] + $_POST['anz9'] * $einh[9]['space'] + $_POST['anz10'] * $einh[10]['space'] + $_POST['anz11'] * $einh[11]['space'] + $_POST['anz12'] * $einh[12]['space'] + $_POST['anz13'] * $einh[13]['space'] + $_POST['anz14'] * $einh[14]['space'] + $_POST['anz15'] * $einh[15]['space'];
예제 #17
0
파일: umzug.php 프로젝트: o-wars/o-wars
            $row = mysql_fetch_array($result);
            if ($row) {
                $return = rand(3600, 4 * 3600);
                mysql_query("INSERT INTO `missionen` ( `id` , `pid` , `parsed` , `type` , `start` , `ziel` , `started` , `ankunft` , `return` , `speed` , `einh1` , `einh2` , `einh3` , `einh4` , `einh5` , `einh6` , `einh7` , `einh8` , `einh9` , `einh10` , `einh11` , `einh12` , `einh13` , `einh14` , `einh15` , `eisen` , `titan` , `oel` , `uran` , `gold` , `chanje` ) VALUES ( '', '" . rand(100, 999) . "', '1', '2', '" . $_POST['ubl'] . "', '0', '" . (date(U) - $return) . "', '" . date(U) . "', '" . (date(U) + $return) . "', '10', '" . $row['einh1'] . "', '" . $row['einh2'] . "', '" . $row['einh3'] . "', '" . $row['einh4'] . "', '" . $row['einh5'] . "', '" . $row['einh6'] . "', '" . $row['einh7'] . "', '" . $row['einh8'] . "', '" . $row['einh9'] . "', '" . $row['einh10'] . "', '" . $row['einh11'] . "', '" . $row['einh12'] . "', '" . $row['einh13'] . "', '" . $row['einh14'] . "', '" . $row['einh15'] . "', '" . $row['eisen'] . "', '" . $row['titan'] . "', '" . $row['oel'] . "', '" . $row['uran'] . "', '" . $row['gold'] . "', '" . $row['chanje'] . "' );");
                $eid = mysql_insert_id();
                mysql_query("INSERT INTO `events` ( `id` , `type` , `eid` , `date` ) VALUES ('', '1', '" . $eid . "', '" . (date(U) + $return) . "');");
                mysql_query("DELETE FROM `events` WHERE `eid` = '" . $row['id'] . "' AND `type` = '1';");
            }
        } while ($row);
        mysql_query("DELETE FROM `missionen` WHERE `start` = '" . $_SESSION['user']['omni'] . "';");
        $status = '<b>Du bist erfolgreich umgezogen.<br /><br />Bitte logge dich neu ein.<br /><br /></b>';
        session_destroy();
    }
} elseif ($timestamp['umzug'] <= time() - 24 * 60 * 60 * 14) {
    $status = '<form enctype="multipart/form-data" action="umzug.php?' . SID . '" method="post">
	<b>Zielbasis: <input type="text" style="width:50px" name="ubl" onChange="berechne();" onkeyup="berechne();"  />
	 - Entfernung: <a id="entfernung">-</a> km<br />
	<input type="submit" name="submit" value="umziehen" /></b>
	</form>';
} else {
    $status = '<b>Du hast die Umzugsfunktion in den letzten 14 Tagen bereits verwendet.<br />Ein Umzug ist erst wieder m&ouml;glich in:</b>';
    $status .= percentbar($timestamp['umzug'] - (time() - 24 * 60 * 60 * 14), 24 * 60 * 60 * 14, 400);
}
$content = tag2value('status', $status, $content);
$pos = position($_SESSION['user']['omni']);
$content = tag2value('x', $pos['x'], $content);
$content = tag2value('y', $pos['y'], $content);
$content = tag2value('z', $pos['z'], $content);
// send page to browser
$content = tag2value("onload", $onload, $content);
echo $content . template('footer');
예제 #18
0
파일: npc.php 프로젝트: saqar/tc_aowow
				ORDER BY a.name_loc?d
			', $_SESSION['locale'], $_SESSION['locale'], array(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE), $npc['entry'], $_SESSION['locale']);
        if ($rows) {
            $npc['criteria_of'] = array();
            foreach ($rows as $row) {
                allachievementsinfo2($row['id']);
                $npc['criteria_of'][] = achievementinfo2($row);
            }
        }
        // Положени� �озданий божих (дл� героик �ПС не задана карта, юзаем из нормала):
        if ($normal_entry) {
            // мы - героик �ПС, определ�ем позицию по нормалу
            $npc['position'] = position($normal_entry, 'creature', 2);
        } else {
            // мы - нормал �ПС или �ПС без �ложно�ти
            $npc['position'] = position($npc['entry'], 'creature', 1);
        }
        // И�править type, чтобы под�вечивали�ь event-овые NPC
        if ($npc['position']) {
            foreach ($npc['position'] as $z => $zone) {
                foreach ($zone['points'] as $p => $pos) {
                    if ($pos['type'] == 0 && ($events = event_find(array('creature_guid' => $pos['guid'])))) {
                        $names = array_select_key(event_name($events), 'name');
                        $npc['position'][$z]['points'][$p]['type'] = 4;
                        $npc['position'][$z]['points'][$p]['events'] = implode(", ", $names);
                    }
                }
            }
        }
        save_cache(NPC_PAGE, $cache_key, $npc);
    }
    $rows_qe = $DB->select('
		SELECT ?#
		FROM ?_gameobject_involvedrelation i, ?_quest_template q
		WHERE
			i.id = ?d
			AND q.entry = i.quest
		', $quest_cols[2], $id);
    if ($rows_qe) {
        $object['ends'] = array();
        foreach ($rows_qe as $numRow => $row) {
            $object['ends'][] = GetQuestInfo($row, 0xffffff);
        }
    }
    unset($rows_qe);
    // Положения объектофф:
    position($object['entry'], 'gameobject');
    save_cache(3, $object['entry'], $object);
}
global $page;
$page = array('Mapper' => false, 'Book' => false, 'Title' => $object['name'] . ' - ' . $smarty->get_config_vars('Objects'), 'tab' => 0, 'type' => 2, 'typeid' => $object['entry'], 'path' => '[0,5,' . $object['type'] . ']');
if ($object['pagetext']) {
    $page['Book'] = true;
}
$page['Mapper'] = true;
$smarty->assign('page', $page);
// Комментарии
$smarty->assign('comments', getcomments($page['type'], $page['typeid']));
if (isset($allitems)) {
    $smarty->assign('allitems', $allitems);
}
if (isset($object)) {
예제 #20
0
파일: functions.php 프로젝트: o-wars/o-wars
function entfernung($from, $to)
{
    $to_position = position($to);
    $own_position = position($from);
    $own_pos = $own_position['x'] + ($own_position['y'] + $own_position['z'] * 20);
    $to_pos = $to_position['x'] + ($to_position['y'] + $to_position['z'] * 20);
    if ($own_position['x'] > $to_position['x']) {
        $entfernung = $own_position['x'] - $to_position['x'];
    } else {
        $entfernung = $to_position['x'] - $own_position['x'];
    }
    if ($own_position['y'] + $own_position['z'] * 20 > $to_position['y'] + $to_position['z'] * 20) {
        $entfernung += $own_position['y'] + $own_position['z'] * 20 - ($to_position['y'] + $to_position['z'] * 20);
    } else {
        $entfernung += $to_position['y'] + $to_position['z'] * 20 - ($own_position['y'] + $own_position['z'] * 20);
    }
    /* buggy !!!!
    	$to_position  = position($to);
    	$own_position = position($from);
    	$own_pos = ($own_position['x']+($own_position['y']+($own_position['z']*500)));
    	$to_pos  = ($to_position['x']+($to_position['y']+($to_position['z']*20)));
    	
    	if ( $own_pos == $to_pos AND $own_position['y'] != $to_position['y'] ){ $entfernung = 2; }
    	elseif ( $own_pos >= $to_pos ) { $entfernung = ($own_pos - $to_pos) ; }
    	elseif ( $own_pos <= $to_pos ) { $entfernung = ($to_pos - $own_pos) ; }
    	*/
    return $entfernung;
}
예제 #21
0
파일: object.php 프로젝트: OregonCore/AoWoW
		SELECT ?#
		FROM gameobject_involvedrelation i, quest_template q
		WHERE
			i.id = ?d
			AND q.entry = i.quest
		', $quest_cols[2], $id);
    if ($rows_qe) {
        $object['ends'] = array();
        foreach ($rows_qe as $numRow => $row) {
            $object['ends'][] = GetQuestInfo($row, 0xffffff);
        }
    }
    unset($rows_qe);
    // Положения объектофф:
    $data = $DB->select('SELECT position_y as y, position_x as x, map as m, spawntimesecs FROM gameobject WHERE id = ?d', $id);
    position($data);
    save_cache(3, $object['entry'], $object);
}
global $page;
$page = array('Mapper' => false, 'Book' => false, 'Title' => $object['name'] . ' - ' . $smarty->get_config_vars('Objects'), 'tab' => 0, 'type' => 2, 'typeid' => $object['entry'], 'path' => '[0,5,' . $object['type'] . ']');
if ($object['pagetext']) {
    $page['Book'] = true;
}
$page['Mapper'] = true;
$smarty->assign('page', $page);
// Комментарии
$smarty->assign('comments', getcomments($page['type'], $page['typeid']));
if (isset($allitems)) {
    $smarty->assign('allitems', $allitems);
}
if (isset($object)) {
예제 #22
0
$gatherer_areas = array(36 => "ALTERAC_MOUNTAINS", 45 => "ARATHI_HIGHLANDS", 331 => "ASHENVALE", 16 => "AZSHARA", 3524 => "AZUREMYST_ISLE", 3 => "BADLANDS", 17 => "BARRENS", 3522 => "BLADES_EDGE_MOUNTAINS", 4 => "BLASTED_LANDS", 3525 => "BLOODMYST_ISLE", 3537 => "BOREAN_TUNDRA", 46 => "BURNING_STEPPES", 2817 => "CRYSTALSONG_FOREST", 4395 => "DALARAN", 148 => "DARKSHORE", 1657 => "DARNASSUS", 41 => "DEADWIND_PASS", 405 => "DESOLACE", 65 => "DRAGONBLIGHT", 1 => "DUN_MOROGH", 14 => "DUROTAR", 10 => "DUSKWOOD", 15 => "DUSTWALLOW_MARSH", 139 => "EASTERN_PLAGUELANDS", 12 => "ELWYNN_FOREST", 3430 => "EVERSONG_WOODS", 3557 => "EXODAR", 361 => "FELWOOD", 357 => "FERALAS", 3433 => "GHOSTLANDS", 394 => "GRIZZLY_HILLS", 3483 => "HELLFIRE_PENINSULA", 267 => "HILLSBRAD_FOOTHILLS", 47 => "HINTERLANDS", 495 => "HOWLING_FJORD", 4742 => "HROTHGARS_LANDING", 210 => "ICECROWN_GLACIER", 1537 => "IRONFORGE", 4197 => "LAKE_WINTERGRASP", 38 => "LOCH_MODAN", 493 => "MOONGLADE", 215 => "MULGORE", 3518 => "NAGRAND", 3523 => "NETHERSTORM", 1637 => "ORGRIMMAR", 4080 => "QUEL_DANAS", 44 => "REDRIDGE_MOUNTAINS", 51 => "SEARING_GORGE", 3520 => "SHADOWMOON_VALLEY", 3703 => "SHATTRATH", 3711 => "SHOLAZAR_BASIN", 1377 => "SILITHUS", 3487 => "SILVERMOON", 130 => "SILVERPINE_FOREST", 406 => "STONETALON_MOUNTAINS", 1519 => "STORMWIND", 67 => "STORM_PEAKS", 33 => "STRANGLETHORN_VALE", 8 => "SWAMP_OF_SORROWS", 440 => "TANARIS", 141 => "TELDRASSIL", 3519 => "TEROKKAR_FOREST", 400 => "THOUSAND_NEEDLES", 1638 => "THUNDER_BLUFF", 85 => "TIRISFAL_GLADES", 1497 => "UNDERCITY", 490 => "UNGORO_CRATER", 28 => "WESTERN_PLAGUELANDS", 40 => "WESTFALL", 11 => "WETLANDS", 618 => "WINTERSPRING", 3521 => "ZANGARMARSH", 66 => "ZULDRAK");
$version = @$DB->selectCell('SELECT db_version FROM version');
if (!$version) {
    $version = @$DB->selectCell('SELECT version FROM db_version');
}
if (!$version) {
    $version = "DataBase";
}
echo "Scroll down to download link<br>Generating positions...";
$gathererdb = array();
$current = 0;
$total = count($gatherer_objects);
foreach ($gatherer_objects as $object) {
    echo "{$current}/{$total} <br>";
    $current++;
    $positions = position($object, 'gameobject');
    foreach ($positions as $area) {
        if (isset($gatherer_areas[$area['atid']])) {
            $areaname = $gatherer_areas[$area['atid']];
            if (!isset($gathererdb[$areaname])) {
                $gathererdb[$areaname] = array();
            }
            if (!isset($gathererdb[$areaname][$object])) {
                $gathererdb[$areaname][$object] = array();
            }
            foreach ($area['points'] as $point) {
                $x = $point['x'];
                $y = $point['y'];
                if ($x >= 0 && $x <= 99.90000000000001 && $y >= 0 && $y <= 99.90000000000001) {
                    $gathererdb[$areaname][$object][] = sprintf("%03d%03d", $x * 10, $y * 10);
                }