function generatePDF($print_id, $print_type = 1) { include "config.php"; require_once 'fpdf/fpdf.php'; $db = go\DB\DB::create($db_params, 'mysql'); $db->query('SET CHARACTER SET cp1251'); $get_print = $db->query('SELECT `finish_number`, `valve_type_id` FROM {numbers} WHERE `print_id`=?', array($_GET['print_id']))->assoc(); $get_print_info = $db->query('SELECT DISTINCT(`nm`.`order`) as `order`, `us`.`name` as `name`, `nm`.`print_id` as `print_id` FROM {numbers} `nm` LEFT JOIN {users} `us` ON (`nm`.`user_id` = `us`.`id`) WHERE `print_id`=?', array($_GET['print_id']))->row(); define('FPDF_FONTPATH', 'fpdf/fonts'); $pdf = new FPDF("L", "mm", array("88", "7")); $pdf->AddFont('Arial-BoldMT', 'B', 'arial_bold.php'); $pdf->SetFont('Arial-BoldMT', 'B', 11); $pdf->SetTextColor(0); //Add info for this order $pdf->AddPage('L'); $pdf->SetAutoPageBreak(false); $pdf->SetXY(0, 0); $pdf->Cell(43, 7, $get_print_info['name'], 0, 0, "C", 0); $pdf->Cell(4, 7, '', 0, 0, "C", 0); $pdf->Cell(43, 7, $get_print_info['order'], 0, 0, "C", 0); //End of add for ($i = 0; $i < count($get_print); $i++) { $pdf->AddPage('L'); $pdf->SetAutoPageBreak(false); $pdf->SetXY(0, 0); $pdf->Cell(43, 7, 'Ser.: ' . $get_print[$i]['finish_number'], 0, 0, "C", 0); $pdf->Cell(4, 7, '', 0, 0, "C", 0); if ($i + $print_type < count($get_print)) { $pdf->Cell(43, 7, 'Ser.: ' . $get_print[$i + $print_type]['finish_number'], 0, 0, "C", 0); } $pdf->SetAutoPageBreak(false); $i += $print_type; } return $pdf->Output($get_print_info['print_id'] . '.pdf', 'I'); }
function calcVesTeam($team_id) { include "config.php"; \go\DB\autoloadRegister(); $db = go\DB\DB::create($db_params, 'mysql'); $team = $db->query('SELECT `id`,`size`,`pol` FROM {peop} WHERE `team_id` = ?', array($team_id))->assoc(); $team_ves = 0; foreach ($team as $peop) { $team_ves = $team_ves + calcVes($peop['size'], $peop['pol']); } return $team_ves; }
<?php session_start(); include "config.php"; require_once 'goDB/autoload.php'; // path to goDB require_once 'asana-api-php-class/asana.php'; \go\DB\autoloadRegister(); $db = go\DB\DB::create($db_params, 'mysql'); if (isset($_SESSION['user_id'])) { $get_asana_data = $db->query('SELECT `apikey`, `asana_tag`, `workspace_id`, `asana_user_id` FROM {users} WHERE `id` = ?', array($_SESSION['user_id']))->row(); $asana = new Asana(array('apiKey' => $get_asana_data['apikey'])); } $global_options = array(); $global_options['title'] = "Асаначет"; $global_options['menu_label'] = "AC"; $report_types = array("by_user" => "По пользователю", "by_tag" => "По тегу"); function generateLoginCode($length = 6) { $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHI JKLMNOPRQSTUVWXYZ0123456789"; $code = ""; $clen = strlen($chars) - 1; while (strlen($code) < $length) { $code .= $chars[mt_rand(0, $clen)]; } return $code; } function get_a($text) { return preg_replace("#(https?|ftp)://\\S+[^\\s.,> )\\];'\"!?]#", '<a href="\\0">\\0</a>', htmlspecialchars($text)); }