示例#1
0
 public function get_list($lat, $long, $page, $pagesize, $activity_type)
 {
     $where = array("status" => 0, "invite_time" => array("gt", time()));
     if ($activity_type !== false) {
         $sql = "SELECT i.*, u.* FROM " . C("DB_PREFIX") . "user as u INNER JOIN " . C("DB_PREFIX") . "invitation as i ON i.uid=u.uid WHERE i.status=0 AND i.activity_type=" . $activity_type . " AND i.invite_time>" . time() . " ORDER BY i.pigcms_id DESC, u.sex DESC";
         $where["activity_type"] = intval($activity_type);
     } else {
         $sql = "SELECT i.*, u.* FROM " . C("DB_PREFIX") . "user as u INNER JOIN " . C("DB_PREFIX") . "invitation as i ON i.uid=u.uid WHERE i.status=0 AND i.invite_time>" . time() . " ORDER BY i.pigcms_id DESC, u.sex DESC";
     }
     $start = ($page - 1) * $pagesize;
     $count = $this->where($where)->count();
     $sql .= " limit {$start}, {$pagesize}";
     $mode = new Model();
     $res = $mode->query($sql);
     $today = strtotime(date("Y-m-d")) + 86400;
     $tomorrow = $today + 86400;
     $lastday = $tomorrow + 86400;
     foreach ($res as &$v) {
         $v["_time"] = date("Y-m-d H:i", $v["invite_time"]);
         $v["juli"] = ROUND(6378.138 * 2 * ASIN(SQRT(POW(SIN(($lat * PI() / 180 - $v["lat"] * PI() / 180) / 2), 2) + COS($lat * PI() / 180) * COS($v["lat"] * PI() / 180) * POW(SIN(($long * PI() / 180 - $v["long"] * PI() / 180) / 2), 2))) * 1000);
         $v["juli"] = 1000 < $v["juli"] ? number_format($v["juli"] / 1000, 1) . "km" : ($v["juli"] < 100 ? "<100m" : $v["juli"] . "m");
         $v["invite_time"] = $v["invite_time"] < $today ? "今天 " . date("H:i", $v["invite_time"]) : ($v["invite_time"] < $tomorrow ? "明天  " . date("H:i", $v["invite_time"]) : ($v["invite_time"] < $lastday ? "后天  " . date("H:i", $v["invite_time"]) : date("m-d H:i", $v["invite_time"])));
         $v["birthday"] && ($v["age"] = date("Y") - date("Y", strtotime($v["birthday"])));
         $v["age"] = 100 < $v["age"] || $v["age"] < 0 ? "保密" : $v["age"] . "岁";
     }
     return array("data" => $res, "total" => $count);
 }
示例#2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     /*for ($i = 1; $i <= 2; $i++) {
           $this->command->info('User '.$i);
       
           DB::table('users')->insert(array ( 
               "name"      => $faker->userName, 
               "email"     => $faker->unique()->safeEmail,
               //"name"      => 'embajada77', 
               //"email"     => '*****@*****.**',
               "password"  => Hash::make('1234')
           ));
       }*/
     $users_array = array();
     $tope = 5518;
     $cronom = new cronometro();
     $password = Hash::make('1234');
     for ($i = 1; $i <= $tope; $i++) {
         $users_array[$i] = array("name" => $faker->userName, "email" => $faker->unique()->safeEmail, "password" => $password);
         $prcnt = ROUND($i * 100 / $tope, 2);
         $string_time = $cronom->getTiempoTranscurrido() . ' ' . $cronom->EstimarTiempoRestante($prcnt);
         $this->command->info($string_time . ' ' . $prcnt . '% User ' . $i . '/' . $tope);
     }
     DB::table('users')->insert($users_array);
 }
示例#3
0
 public function percentFinishedCalculation($Time_Min, $esDay, $esHour, $esMin, $finished)
 {
     $PercentFinished = 0;
     if ($finished == 1) {
         $PercentFinished = 100;
     } else {
         $PercentFinished = ROUND($Time_Min / ($esDay * 24 * 60 + $esHour * 60 + $esMin) * 100);
     }
     return $PercentFinished;
 }
示例#4
0
function NumberFormat($number)
{
    if ($number % 8 == 0) {
        $number = $number / 8;
        $formatNumber = ROUND($number, 0);
    } else {
        $number = ROUND($number / 8, 0);
        $formatNumber = number_format($number, 0);
    }
    return $formatNumber;
}
示例#5
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->autor = Yii::app()->user->name;
         $this->peso = ROUND($this->archivo->getSize() / 1024, 2);
         $this->fechasubida = "" . date("Y-m-d") . "";
         $this->extension = "." . $this->archivo->getExtensionName();
         $this->ndescargas = 0;
         //$this->descridetalle=" ".date("H:i")." -->".$this->descridetalle;
     } else {
         //$this->ultimares=" ".strtoupper(trim($this->usuario=Yii::app()->user->name))." ".date("H:i")." :".$this->ultimares;
     }
     return parent::beforeSave();
 }
示例#6
0
function distribute_toll($db, $sector, $toll, $total_fighters)
{
    $result3 = $db->Execute("SELECT * FROM {$db->prefix}sector_defence WHERE sector_id=? AND defence_type ='F'", array($sector));
    db_op_result($db, $result3, __LINE__, __FILE__);
    // Put the defence information into the array "defenceinfo"
    if ($result3 > 0) {
        while (!$result3->EOF) {
            $row = $result3->fields;
            $toll_amount = ROUND($row['quantity'] / $total_fighters * $toll);
            $resa = $db->Execute("UPDATE {$db->prefix}ships SET credits=credits + ? WHERE ship_id = ?", array($toll_amount, $row['ship_id']));
            db_op_result($db, $resa, __LINE__, __FILE__);
            playerlog($db, $row['ship_id'], LOG_TOLL_RECV, "{$toll_amount}|{$sector}");
            $result3->MoveNext();
        }
    }
}
示例#7
0
 public function create_bar($title, $value, $max, $width = 300, $onlyperc = true)
 {
     $perc = ROUND($value * 100 / $max);
     if ($perc > 100) {
         $perc = 100;
     }
     $wcell1 = $width / 100 * $perc;
     $wcell2 = $width / 100 * (100 - $perc);
     if ($onlyperc) {
         $printval = "{$perc}%";
     } else {
         $printval = "{$value}({$perc}%)";
     }
     $output .= "<table border=0 cellpadding=0 cellspacing=2 frame=void ><tr><td>{$title}</td><td width={$wcell1}px style='background-color: #888888'><center><strong>{$printval}</strong></center></td><td width={$wcell2} style='background-color: #dddddd'></td></tr></table>";
     return $output;
 }
 public static function pilot_pay($pilotid)
 {
     $ft = "SELECT flighttime FROM phpvms_pireps WHERE pilotid = '{$pilotid}' ORDER BY submitdate DESC";
     $flttme = DB::get_row($ft);
     $hr = intval($flttme->flighttime);
     $mn = ($flttme->flighttime - $hr) * 100;
     $min = $hr * 60 + $mn;
     $fr = "SELECT pilotpay FROM phpvms_pireps WHERE pilotid = '{$pilotid}' ORDER BY submitdate DESC";
     $payrate = DB::get_row($fr);
     $pay = $payrate->pilotpay / 60;
     $pp = "SELECT totalpay FROM phpvms_pilots WHERE pilotid = '{$pilotid}'";
     $ppay = DB::get_row($pp);
     $pipay = $payrate->totalpay;
     $ftupdt = $min * $pay;
     $ttalpay = $ftupdt + $pipay;
     $totalpay = ROUND($ttalpay, 2);
     $updt = "UPDATE phpvms_pilots SET totalpay = '{$totalpay}' + totalpay WHERE pilotid = '{$pilotid}'";
     DB::query($updt);
 }
示例#9
0
文件: init.php 项目: laiello/yt-cache
function number_readable($number, $unit = "bytes")
{
    if ($unit == "bytes") {
        if ($number > 1000000000) {
            $number = ROUND($number / 1000000000) . "GB";
        } else {
            if ($number > 1000000) {
                $number = ROUND($number / 1000000) . "MB";
            } else {
                if ($number > 1000) {
                    $number = ROUND($number / 1000) . "KB";
                }
            }
        }
    } else {
        if ($unit == "decimals") {
            $number = number_format($number, 0, ".", ",");
        }
    }
    return $number;
}
示例#10
0
}
if ($sth->rowCount() >= 1) {
    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
        //USER REGISTERED/CONFIRMED BNET ACCOUNT
        if ($row["user_bnet"] >= 1) {
            $sth2 = $db->prepare("SELECT * FROM " . OSDB_STATS . " \r\n\t WHERE player = '" . $row["user_name"] . "' \r\n\t ORDER BY id DESC \r\n\t LIMIT 1 ");
            $result = $sth2->execute();
            $row2 = $sth2->fetch(PDO::FETCH_ASSOC);
            $MemberData[$c]["points"] = number_format($row2["points"]);
            $MemberData[$c]["games"] = $row2["games"];
            $MemberData[$c]["score"] = $row2["score"];
            $MemberData[$c]["wins"] = $row2["wins"];
            $MemberData[$c]["losses"] = $row2["losses"];
            $MemberData[$c]["uid"] = $row2["id"];
            if ($row2["wins"] > 0) {
                $MemberData[$c]["winslosses"] = ROUND($row2["wins"] / ($row2["wins"] + $row2["losses"]), 3) * 100;
            } else {
                $MemberData[$c]["winslosses"] = 0;
            }
        }
        $MemberData[$c]["user_id"] = $row["user_id"];
        $MemberData[$c]["user_name"] = $row["user_name"];
        $MemberData[$c]["user_bnet"] = $row["user_bnet"];
        $MemberData[$c]["user_ppwd"] = $row["user_ppwd"];
        $MemberData[$c]["bnet_username"] = $row["bnet_username"];
        $MemberData[$c]["user_email"] = $row["user_email"];
        $MemberData[$c]["user_level"] = $row["user_level"];
        $MemberData[$c]["total_comments"] = $row["total_comments"];
        $MemberData[$c]["user_joined"] = date(OS_DATE_FORMAT, $row["user_joined"]);
        $MemberData[$c]["user_joined_date"] = $row["user_joined"];
        $MemberData[$c]["user_location"] = $row["user_location"];
示例#11
0
 private function getstats()
 {
     $row = $this->db->get_row("stats");
     extract($row);
     $efficiency_size = ROUND($localtraffic * 100 / $internettraffic);
     $efficiency_hit = ROUND($hit * 100 / $miss);
     $localtraffic = number_readable($localtraffic);
     $internettraffic = number_readable($internettraffic);
     $troughput_internet = number_readable($troughput_internet) . "/sec";
     $troughput_local = number_readable($troughput_local) . "/sec";
     $res = $this->db->sql("SELECT SUM(size) as size_sum, path FROM `videos` GROUP by path");
     foreach ($res as $res1) {
         $space[$res1["path"]] = $res1["size_sum"];
     }
     $this->addtostats("START");
     $this->addtostats("Miss: " . number_readable($miss, "decimals"));
     $this->addtostats("Hit: " . number_readable($hit, "decimals"));
     $this->addtostats("Local traffic: {$localtraffic}");
     $this->addtostats("Internet traffic: {$internettraffic}");
     $this->addtostats("Connect time: {$connect_time}ms");
     $this->addtostats("File access time: {$file_access_time}ms");
     $this->addtostats("Internet troughput: {$troughput_internet}");
     $this->addtostats("Local troughput: {$troughput_local}");
     $vcount = $this->db->sql("select count(*) as cnt from videos");
     $count = $vcount[0]["cnt"];
     $this->addtostats("Cached videos: " . number_readable($count, "decimals"));
     $totalsum = $this->db->sql("SELECT SUM(size) as totalsum FROM `videos`");
     $totalsum = $totalsum[0]["totalsum"];
     $totalsum = number_readable($totalsum);
     $this->addtostats("Total video size: {$totalsum}");
     $this->addtostats("Size Efficiency: {$efficiency_size}%");
     $this->addtostats("Hit Efficiency: {$efficiency_hit}%");
     $lastday = $this->db->sql("select count(*) as cnt from visits where `visit_date`>DATE_SUB(NOW(),INTERVAL 1 DAY)");
     $lastday = $lastday[0]["cnt"];
     $this->addtostats("Last day hits: " . number_readable($lastday, "decimals"));
     $lasthr = $this->db->sql("select count(*) as cnt from visits where `visit_date`>DATE_SUB(NOW(),INTERVAL 1 HOUR)");
     $lasthr = $lasthr[0]["cnt"];
     $this->addtostats("Last hour hits: " . number_readable($lasthr, "decimals"));
     $lastmin = $this->db->sql("select count(*) as cnt from visits where `visit_date`>DATE_SUB(NOW(),INTERVAL 1 MINUTE)");
     $lastmin = $lastmin[0]["cnt"];
     $this->addtostats("Last minute hits: " . number_readable($lastmin, "decimals"));
     $totalsize = 0;
     $bars = "";
     foreach ($space as $spath => $ssize) {
         $stotal = disk_total_space($spath);
         $bars .= $this->page_manager->create_bar($spath, $ssize, $stotal, 600, true);
         $perc = ROUND($ssize * 100 / $stotal);
         $totalsize += $stotal;
         $ssize = number_readable($ssize);
         $stotal = number_readable($stotal);
         $this->addtostats("Store path: <em>{$spath}</em> size <strong>{$ssize} ({$perc}%)</strong> total <strong>{$stotal}</strong>");
     }
     // storage paths
     $this->addtostats("Total storage size: <strong>" . number_readable($totalsize) . "</strong>");
     $this->addtostats("END");
     $this->content .= $bars . "<br />\n";
 }
示例#12
0
<?php

/* 
 * Trae el presupuesto asociado al área determinada
 */
$sbNombAre = $_REQUEST['sbNombAre'];
$BeanAreas = BeanFactory::getBean('opalo_area');
if ($sbNombAre != 'ninguno') {
    $bnAreas = $BeanAreas->get_full_list('', "opalo_area.name like '{$sbNombAre}'");
    $nuRes = 0;
    if ($bnAreas != null) {
        foreach ($bnAreas as $area) {
            $nuRes = $area->nuCostoArea;
        }
    }
} else {
    $nuRes = 0;
}
echo json_encode(ROUND($nuRes, 2));
示例#13
0
function OS_DrawStars($stars = 1, $width = 24)
{
    $stars = ROUND($stars);
    $LeftStars = 5 - $stars;
    if ($stars >= 1) {
        for ($x = 1; $x <= $stars; $x++) {
            ?>
<img class="imgvalign" src="<?php 
            echo OS_THEME_PATH;
            ?>
images/star-1.png" width="<?php 
            echo $width;
            ?>
" height="<?php 
            echo $width;
            ?>
" alt="rating star" /><?php 
        }
    }
    if ($LeftStars >= 1) {
        for ($x = 1; $x <= $LeftStars; $x++) {
            ?>
<img class="imgvalign" src="<?php 
            echo OS_THEME_PATH;
            ?>
images/star-0.png" width="<?php 
            echo $width;
            ?>
" height="<?php 
            echo $width;
            ?>
" alt="rating star" /> <?php 
        }
    }
}
示例#14
0
        }
        //----------------------------------------------------
        //--------------------------- კავშირის გაწყვეტის მიზეზეი
        $row_COMPLETECALLER = mysql_fetch_assoc(mysql_query("SELECT  COUNT(*) AS `count`\n                                                           FROM `asterisk_incomming`\n                                                           WHERE disconnect_cause != 'ABANDON'  \n                                                             AND DATE(call_datetime) >= '{$start_time}'\n                                                             AND DATE(call_datetime) <= '{$end_time}' \n                                                             AND dst_queue IN ({$queue}) \n                                                             AND dst_extension in ({$agent})\n                                                             AND disconnect_cause = 'COMPLETECALLER'"));
        $row_AGENT = mysql_fetch_assoc(mysql_query("SELECT  COUNT(*) AS `count`\n                                                  FROM `asterisk_incomming`\n                                                 WHERE\tdisconnect_cause != 'ABANDON' \n                                                   AND  DATE(call_datetime) >= '{$start_time}'\n                                                   AND  DATE(call_datetime) <= '{$end_time}'\n                                                   AND  dst_queue IN ({$queue})\n                                                   AND  dst_extension in ({$agent})\n                                                   AND  disconnect_cause = 'COMPLETEAGENT'"));
        $data['page']['disconnection_cause'] = '

                    <tr>
    					<td>ოპერატორმა გათიშა:</td>
    					<td id="close_agent" style="cursor: pointer; text-decoration: underline;">' . $row_AGENT[count] . ' ზარი</td>
    					<td>' . ROUND($row_AGENT[count] / ($row_COMPLETECALLER[count] + $row_AGENT[count]) * 100, 2) . ' %</td>
					</tr>
					<tr>
    					<td>აბონენტმა გათიშა:</td>
    					<td id="close_celer" style="cursor: pointer; text-decoration: underline;">' . $row_COMPLETECALLER[count] . ' ზარი</td>
    					<td>' . ROUND($row_COMPLETECALLER[count] / ($row_COMPLETECALLER[count] + $row_AGENT[count]) * 100, 2) . ' %</td>
					</tr>';
        //-----------------------------------------------
    }
    if ($_REQUEST['act'] == 'tab_2') {
        //----------------------------------- უპასუხო ზარები
        $data['page']['unanswer_call'] = '
    
                   	<tr>
        				<td>უპასუხო ზარების რაოდენობა:</td>
        				<td>' . $row_abadon[count] . ' ზარი</td>
    				</tr>
    				<tr>
        				<td>ლოდინის საშ. დრო კავშირის გაწყვეტამდე:</td>
        				<td>' . $row_abadon[sec] . '</td>
    				</tr>
示例#15
0
function ajout_global_groupe($choix_groupe, $tab_new_nb_conges_all, $tab_calcul_proportionnel, $tab_new_comment_all, $DEBUG = FALSE)
{
    $PHP_SELF = $_SERVER['PHP_SELF'];
    $session = session_id();
    // recup de la liste des users d'un groupe donné
    $list_users = get_list_users_du_groupe($choix_groupe, $DEBUG);
    foreach ($tab_new_nb_conges_all as $id_conges => $nb_jours) {
        if ($nb_jours != 0) {
            $comment = $tab_new_comment_all[$id_conges];
            $sql1 = "SELECT u_login, u_quotite FROM conges_users WHERE u_login IN ({$list_users}) ORDER BY u_login ";
            $ReqLog1 = SQL::query($sql1);
            while ($resultat1 = $ReqLog1->fetch_array()) {
                $current_login = $resultat1["u_login"];
                $current_quotite = $resultat1["u_quotite"];
                if (!isset($tab_calcul_proportionnel[$id_conges]) || $tab_calcul_proportionnel[$id_conges] != TRUE) {
                    $nb_conges = $nb_jours;
                } else {
                    // pour arrondir au 1/2 le + proche on  fait x 2, on arrondit, puis on divise par 2
                    $nb_conges = ROUND($nb_jours * ($current_quotite / 100) * 2) / 2;
                }
                $valid = verif_saisie_decimal($nb_conges, $DEBUG);
                if ($valid) {
                    // 1 : on update conges_solde_user
                    $req_update = 'UPDATE conges_solde_user SET su_solde = su_solde+ ' . intval($nb_conges) . '
							WHERE  su_login = \'' . SQL::quote($current_login) . '\' AND su_abs_id = ' . intval($id_conges) . ';';
                    $ReqLog_update = SQL::query($req_update);
                    // 2 : on insert l'ajout de conges dans la table periode
                    // recup du nom du groupe
                    $groupename = get_group_name_from_id($choix_groupe, $DEBUG);
                    $commentaire = _('resp_ajout_conges_comment_periode_groupe') . " {$groupename}";
                    // ajout conges
                    insert_ajout_dans_periode($DEBUG, $current_login, $nb_conges, $id_conges, $commentaire);
                }
            }
            $group_name = get_group_name_from_id($choix_groupe, $DEBUG);
            if (!isset($tab_calcul_proportionnel[$id_conges]) || $tab_calcul_proportionnel[$id_conges] != TRUE) {
                $comment_log = "ajout conges pour groupe {$group_name} ({$nb_jours} jour(s)) ({$comment}) (calcul proportionnel : No)";
            } else {
                $comment_log = "ajout conges pour groupe {$group_name} ({$nb_jours} jour(s)) ({$comment}) (calcul proportionnel : Yes)";
            }
            log_action(0, "ajout", "groupe", $comment_log, $DEBUG);
        }
    }
}
     $targetnum=rand(1,$reccount);
     while (!$doomsday->EOF)
     {
        if ($i==$targetnum)
        {
           $targetinfo=$doomsday->fields;
           break;
        }
        $i++;
        $doomsday->MoveNext();
     }
     if($affliction == 1) // Space Plague
     {
        echo "The horsmen release the Space Plague!<BR>.";
        $db->Execute("UPDATE $dbtables[planets] SET colonists = ROUND(colonists-colonists*$space_plague_kills) WHERE planet_id = $targetinfo[planet_id]");
        $logpercent = ROUND($space_plague_kills * 100);
        playerlog($targetinfo[owner],LOG_SPACE_PLAGUE,"$targetinfo[name]|$targetinfo[sector_id]|$logpercent"); 
		$name = get_player_name($targetinfo[owner]);
        $headline="Travel Advisory";
		$news = addslashes("The Universe Health Organization warned visitors to refrain from visiting $targetinfo[name] due to an outbreak of Space Plague. Millions are reported dead. The plague was blamed on colonist overcrowding by $name. Shame!");
   		$db->Execute("INSERT INTO $dbtables[news] (headline, newstext, user_id, date, news_type) VALUES ('$headline','$news','$targetinfo[owner]',NOW(), 'plague')");
     }
     else
     {
        echo "The horsemen release a Plasma Storm!<BR>.";
        $db->Execute("UPDATE $dbtables[planets] SET energy = 0 WHERE planet_id = $targetinfo[planet_id]");
        playerlog($targetinfo[owner],LOG_PLASMA_STORM,"$targetinfo[name]|$targetinfo[sector_id]");
		$name = get_player_name($targetinfo[owner]);
        $headline="Weather Report";
		$news = addslashes("A plasma storm struck $name's sector today. No casualties were reported.");
   		$db->Execute("INSERT INTO $dbtables[news] (headline, newstext, user_id, date, news_type) VALUES ('$headline','$news','$targetinfo[owner]',NOW(), 'plasma')");
 $csv .= $separador;
 $csv .= $separador;
 $csv .= $separador;
 $csv .= $separador;
 $csv .= interpretaComa($row31['textoCabecera']) . $separador;
 $csv .= $row40['claveCuenta'] . $separador;
 $csv .= $row40['cuenta'] . $separador;
 $csv .= $separador;
 $csv .= $separador;
 $csv .= $separador;
 $csv .= $separador;
 $csv .= $separador;
 $csv .= $row31['calImp'] . $separador;
 $csv .= $row31['codImp'] . $separador;
 $csv .= $separador;
 $csv .= $rowPais['p_id'] == 2 || $rowPais['p_id'] == 13 ? ROUND($row40['monto']) . $separador : $row40['monto'] . $separador;
 $csv .= $separador;
 $csv .= $separador;
 $csv .= $separador;
 $csv .= $row40['ceco'] . $separador;
 $csv .= $row31['orden'] . $separador;
 $csv .= $separador;
 $csv .= $separador;
 $csv .= $separador;
 $csv .= $separador;
 $csv .= $separador;
 $csv .= $separador;
 $csv .= $separador;
 $csv .= $row31['acreedor'] . " - " . $row31['solicitud'] . $separador;
 $csv .= interpretaComa($row31['textoCabecera']) . $separador;
 $csv .= $separador;
示例#18
0
" target="_blank" >#<?php 
                echo $row["gameid"];
                ?>
</a></td>
			  <td width="180"><a href="<?php 
                echo OS_HOME;
                ?>
?u=<?php 
                echo strtolower($row["name"]);
                ?>
" target="_blank" ><b><?php 
                echo $row["name"];
                ?>
</b></a></td>
			  <td width="90"><span class="banned"><b>-<?php 
                echo ROUND(($row["duration"] - $row["left"]) / 60, 1);
                ?>
</b></span> min. </td>
			  <td>
			  <?php 
                if ($skip == 1) {
                    ?>
(<b>skipping</b>)<?php 
                }
                ?>
			  <?php 
                if ($b == 1) {
                    ?>
 <b>banned</b><?php 
                }
                ?>
 /**
  * 設定洗髮佔比
  * @param type $empAry
  * @param type $result
  * @param type $col
  * @param type $rate
  * @return type
  */
 private function setWashEmpAry($empAry, $result, $col, $rate)
 {
     for ($i = 0; $i < count($result); $i++) {
         $empno = $result[$i]['empno'];
         if (isset($empAry[$empno])) {
             $emp = $empAry[$empno];
             $emp[$col] = $result[$i]['wash'];
             if ($result[$i]['cut'] > 0) {
                 $emp[$rate] = ROUND($result[$i]['wash'] / $result[$i]['cut'], 4) * 100 . "%";
             } else {
                 $emp[$rate] = "0%";
             }
             $empAry[$empno] = $emp;
         } else {
             continue;
         }
     }
     return $empAry;
 }
示例#20
0
        $res_post_read = sql_query('SELECT last_post_read FROM read_posts WHERE user_id=' . $CURUSER['id'] . ' AND topic_id=' . $arr_unread['topic_id']);
        $arr_post_read = mysql_fetch_row($res_post_read);
        $did_i_post_here = sql_query('SELECT user_id FROM posts WHERE user_id=' . $CURUSER['id'] . ' AND topic_id=' . $arr_unread['topic_id']);
        $posted = mysql_num_rows($did_i_post_here) > 0 ? 1 : 0;
        if ($arr_post_read[0] < $arr_unread['last_post'] && $posted) {
            //=== change colors
            $colour = ++$colour % 2;
            $class = $colour == 0 ? 'one' : 'two';
            $locked = $arr_unread['locked'] == 'yes';
            $sticky = $arr_unread['sticky'] == 'yes';
            $topic_poll = $arr_unread['poll_id'] > 0;
            $first_unread_poster = sql_query('SELECT added FROM posts WHERE status = \'ok\'  AND topic_id=' . $arr_unread['topic_id'] . ' ORDER BY id ASC LIMIT 1');
            $first_unread_poster_arr = mysql_fetch_row($first_unread_poster);
            $thread_starter = ($arr_unread['username'] !== '' ? print_user_stuff($arr_unread) : 'Lost [' . $arr_unread['id'] . ']') . '<br />' . get_date($first_unread_poster_arr[0], '');
            $topicpic = $arr_unread['post_count'] < 30 ? $locked ? 'lockednew' : 'topicnew' : ($locked ? 'lockednew' : 'hot_topic_new');
            $rpic = $arr_unread['num_ratings'] != 0 ? ratingpic_forums(ROUND($arr_unread['rating_sum'] / $arr_unread['num_ratings'], 1)) : '';
            $sub = sql_query('SELECT user_id FROM subscriptions WHERE user_id=' . $CURUSER['id'] . ' AND topic_id=' . $arr_unread['topic_id']);
            $subscriptions = mysql_num_rows($sub) > 0 ? 1 : 0;
            $icon = $arr_unread['icon'] == '' ? '<img src="pic/forums/topic_normal.gif" alt="Topic" title="Topic" />' : '<img src="pic/smilies/' . htmlspecialchars($arr_unread['icon']) . '.gif" alt="' . htmlspecialchars($arr_unread['icon']) . '" title="' . htmlspecialchars($arr_unread['icon']) . '" />';
            $first_post_text = tool_tip(' <img src="pic/forums/mg.gif" height="14" alt="Preview" title="Preview" />', format_comment($arr_unread['body']), 'Last Post Preview');
            $topic_name = ($sticky ? '<img src="pic/forums/pinned.gif" alt="Pinned" title="Pinned" /> ' : ' ') . ($topicpoll ? '<img src="pic/forums/poll.gif" alt="Poll" title="Poll" /> ' : ' ') . '
        		<a class="altlink" href="?action=view_topic&amp;topic_id=' . $arr_unread['topic_id'] . '" title="First post in thread">' . htmlentities($arr_unread['topic_name'], ENT_QUOTES) . '</a> 
				<a class="altlink" href="forums.php?action=view_topic&amp;topic_id=' . $arr_unread['topic_id'] . '&amp;page=0#' . $arr_post_read[0] . '" title="First unread post in this thread"><img src="pic/forums/last_post.gif" alt="First unread post" title="First unread post" /></a> 
        		' . ($posted ? '<img src="pic/forums/posted.gif" alt="Posted" title="Posted" /> ' : ' ') . ($subscriptions ? '<img src="pic/forums/subscriptions.gif" alt="subscribed" title="subscribed" /> ' : ' ') . ' <img src="pic/forums/new.gif" alt="New post in topic!" title="New post in topic!" />';
            //=== print here
            $HTMLOUT .= '<tr>
		<td class="' . $class . '" align="center"><img src="pic/forums/' . $topicpic . '.gif" alt="topic" title="topic" /></td>
		<td class="' . $class . '" align="center">' . $icon . '</td>
		<td align="left" valign="middle" class="' . $class . '">
		<table border="0" cellspacing="0" cellpadding="0">
		<tr>
示例#21
0
 public static function statusession()
 {
     $sesion_activa = Yii::app()->user->um->findSession(Yii::app()->user->um->LoadUserById(yii::app()->user->id));
     $minutosrestantes = ROUND(($sesion_activa->expire - time()) / 60, 0);
     $porcentaje = 100 * round((time() - $sesion_activa->created) / ($sesion_activa->expire - $sesion_activa->created), 1);
     return array('porcentaje' => $porcentaje, 'minutosrestantes' => $minutosrestantes);
 }
示例#22
0
 $page = isset($_GET["page"]) ? $_GET["page"] : 0;
 // ------ Get topic info
 $res = sql_query("SELECT " . ($use_poll_mod ? 't.pollid, ' : '') . "t.locked, t.subject, t.sticky, t.userid AS t_userid, t.forumid, t.numratings, t.ratingsum, f.name AS forum_name, f.minclassread, f.minclasswrite, f.minclasscreate, (SELECT COUNT(id)FROM posts WHERE topicid = t.id) AS p_count " . "FROM topics AS t " . "LEFT JOIN forums AS f ON f.id = t.forumid " . "WHERE t.id = " . sqlesc($topicid)) or sqlerr(__FILE__, __LINE__);
 $arr = mysql_fetch_assoc($res) or stderr("Error", "Topic not found");
 mysql_free_result($res);
 $use_poll_mod ? $pollid = (int) $arr["pollid"] : null;
 $t_userid = (int) $arr['t_userid'];
 $locked = $arr['locked'] == 'yes' ? true : false;
 $subject = $arr['subject'];
 $sticky = $arr['sticky'] == "yes" ? true : false;
 $forumid = (int) $arr['forumid'];
 $forum = $arr["forum_name"];
 $postcount = (int) $arr['p_count'];
 $rating = '';
 if ($arr["numratings"] != 0) {
     $rating = ROUND($arr["ratingsum"] / $arr["numratings"], 1);
 }
 $rpic = ratingpic($rating);
 if ($CURUSER["class"] < $arr["minclassread"]) {
     stderr("Error", "You are not permitted to view this topic.");
 }
 // ------ Update hits column
 sql_query("UPDATE topics SET views = views + 1 WHERE id={$topicid}") or sqlerr(__FILE__, __LINE__);
 // ------ Make page menu
 $pagemenu1 = "<p align='center'>";
 $perpage = $postsperpage;
 $pages = ceil($postcount / $perpage);
 if ($page[0] == "p") {
     $findpost = substr($page, 1);
     $res = sql_query("SELECT id FROM posts WHERE topicid={$topicid} ORDER BY added") or sqlerr(__FILE__, __LINE__);
     $i = 1;
示例#23
0
 } else {
     $ComparePlayersData[$c]["ckpg"] = 0;
 }
 if ($row["games"] >= 1 and $row["neutrals"] >= 1) {
     $ComparePlayersData[$c]["ne"] = ROUND($row["neutrals"] / $row["games"], 2);
 } else {
     $ComparePlayersData[$c]["ne"] = 0;
 }
 if ($row["games"] > 0 and $row["denies"] > 0) {
     $ComparePlayersData[$c]["cd"] = ROUND($row["denies"] / $row["games"], 2);
 } else {
     $ComparePlayersData[$c]["cd"] = 0;
 }
 //KD Ratio
 if ($row["deaths"] >= 1) {
     $ComparePlayersData[$c]["kd"] = ROUND($row["kills"] / $row["deaths"], 2);
 } else {
     $ComparePlayersData[$c]["kd"] = $row["kills"];
 }
 //MOST GAMES
 if (!isset($MostGames)) {
     $MostGames = $row["player"];
     $temp_games = $ComparePlayersData[$c]["games"];
     $PlayerGames = $ComparePlayersData[$c]["games"];
 }
 if ($ComparePlayersData[$c]["games"] > $temp_games) {
     $MostGames = $row["player"];
     $PlayerGames = $ComparePlayersData[$c]["games"];
     $temp_games = $ComparePlayersData[$c]["games"];
 }
 //MOST WINS
示例#24
0
    }
    else
    {
      if( ($targetscore / $playerscore < $bounty_ratio || $targetinfo[turns_used] < $bounty_minturns) && substr($targetinfo[email], -8) != "furangee" && $targetscore < 500000 ) 
      {
         // Check to see if there is Federation fine on the player. If there is, people can attack regardless.
         $btyamount = 0;
         $hasbounty = $db->Execute("SELECT SUM(amount) AS btytotal FROM $dbtables[bounty] WHERE bounty_on = $targetinfo[player_id] AND placed_by = 0");
         if($hasbounty)
         {
            $resx = $hasbounty->fields;
            $btyamount = $resx[btytotal];
         }
         if($btyamount <= 0) 
         {
		 	$bounty = ROUND($playerscore * $playerscore * $bounty_maxvalue);
			// Let's find out if the Feds have done this already
			//echo "DEBUG: SELECT SUM(amount) AS btytotal FROM $dbtables[bounty] WHERE bounty_on=$playerinfo[ship_id] AND placed_by =0<br>";
			$hasbounty2 = $db->Execute("SELECT SUM(amount) AS btytotal FROM $dbtables[bounty] WHERE bounty_on=$playerinfo[player_id] AND placed_by =0");
			$resy = $hasbounty2->fields;
			$btyamount2 = $resy[btytotal];
			//echo "DEBUG: Bounty = $bountyCurrent bounty = $btyamount2<br>";
			if ($bounty > $btyamount2 && $btyamount2 != NULL) {
				$bounty = $bounty - $btyamount2; // Only increase it to current %age level
				$insert = $db->Execute("INSERT INTO $dbtables[bounty] (bounty_on,placed_by,amount) values ($playerinfo[player_id], 0 ,$bounty)");
				playerlog($playerinfo[player_id],LOG_BOUNTY_FEDBOUNTY,"$bounty");
				playerlog(1,LOG_RAW,"Additional fine of ".NUMBER($bounty)." placed on $playerinfo[character_name] score $playerscore for attacking $targetinfo[character_name] score $targetscore");
				echo "The Federation added to your fine!<BR><BR>";
			} else if ($btyamount2 != NULL) {
				playerlog($playerinfo[player_id],LOG_RAW,"The Federation kept their fine on you at its current level.");
				playerlog(1,LOG_RAW,"Kept fine on $playerinfo[character_name] score $playerscore for attacking $targetinfo[character_name] score $targetscore");
示例#25
0
    $contripercent1 = 50;
    $contripercent2 = 50;
} else {
    $contripercent1 = ROUND($contribution1 * 100 / $totalcontribution);
    $contripercent2 = ROUND($contribution2 * 100 / $totalcontribution);
}
$val_rank1 = getNumberFromRank($rank1);
$val_rank2 = getNumberFromRank($rank2);
$val_maxrank1 = getNumberFromRank($maxrank1);
$val_maxrank2 = getNumberFromRank($maxrank2);
$totalval_rank = $val_rank1 + $val_rank2;
$val_percent1 = ROUND($val_rank1 * 100 / $totalval_rank);
$val_percent2 = ROUND($val_rank2 * 100 / $totalval_rank);
$totalval_maxrank = $val_maxrank1 + $val_maxrank2;
$maxval_percent1 = ROUND($val_maxrank1 * 100 / $totalval_maxrank);
$maxval_percent2 = ROUND($val_maxrank2 * 100 / $totalval_maxrank);
?>
			</div>
		</div>

		<table class="table" width='70%'>
			<tr>
				<td align='center'>
					<?php 
echo $handle1;
?>
				</td>
				
				<td>
				</td>
				
示例#26
0
 public function mysign()
 {
     $invitation_signs = D("Invitation_sign")->field("invid")->where(array("uid" => $this->user_session["uid"]))->order("invid DESC")->select();
     $invids = $pre = "";
     foreach ($invitation_signs as $is) {
         $invids .= $pre . $is["invid"];
         $pre = ",";
     }
     $today = strtotime(date("Y-m-d")) + 86400;
     $tomorrow = $today + 86400;
     $lastday = $tomorrow + 86400;
     if ($invids) {
         $sql = "SELECT i.*, u.* FROM " . C("DB_PREFIX") . "user as u INNER JOIN " . C("DB_PREFIX") . "invitation as i ON i.uid=u.uid WHERE i.pigcms_id IN ({$invids}) ORDER BY i.pigcms_id DESC, u.sex DESC";
         $mode = new Model();
         $res = $mode->query($sql);
         foreach ($res as &$v) {
             $v["_time"] = date("Y-m-d H:i", $v["invite_time"]);
             $v["juli"] = ROUND(6378.138 * 2 * ASIN(SQRT(POW(SIN(($this->_lat * PI() / 180 - $v["lat"] * PI() / 180) / 2), 2) + COS($this->_lat * PI() / 180) * COS($v["lat"] * PI() / 180) * POW(SIN(($this->_long * PI() / 180 - $v["long"] * PI() / 180) / 2), 2))) * 1000);
             $v["juli"] = 1000 < $v["juli"] ? number_format($v["juli"] / 1000, 1) . "km" : ($v["juli"] < 100 ? "<100m" : $v["juli"] . "m");
             $v["invite_time"] = $v["invite_time"] < $today ? "今天 " . date("H:i", $v["invite_time"]) : ($v["invite_time"] < $tomorrow ? "明天  " . date("H:i", $v["invite_time"]) : ($v["invite_time"] < $lastday ? "后天  " . date("H:i", $v["invite_time"]) : date("m-d H:i", $v["invite_time"])));
             $v["birthday"] && ($v["age"] = date("Y") - date("Y", strtotime($v["birthday"])));
         }
         $this->assign("date_list", $res);
     }
     $this->display();
 }
示例#27
0
function crearProforma($IdOrdenCompra, $IdCliente, $CodigoOC)
{
    global $UltimaInsercion;
    $IdLocal = getSesionDato("IdTienda");
    $IdUsuario = CleanID(getSesionDato("IdUsuario"));
    $TipoPresupuesto = 'Proforma';
    $TipoVenta = getSesionDato("TipoVentaTPV") != 1 ? getSesionDato("TipoVentaTPV") : 'VD';
    $Impuesto = getSesionDato("IGV");
    $mensaje = 'Orden Compra cod -' . $CodigoOC . '-';
    $vigencia = getSesionDato("VigenciaPresupuesto");
    // Serie presupuesto
    $sql = "SELECT Serie FROM ges_presupuestos " . "WHERE IdLocal = {$IdLocal} AND Eliminado = 0 ORDER BY IdPresupuesto DESC LIMIT 1 ";
    $row = queryrow($sql);
    $sreDocumento = $row["Serie"] ? $row["Serie"] : 1;
    // Nro Presupuesto
    $sql = "SELECT MAX(NPresupuesto) as NPresupuesto FROM ges_presupuestos " . "WHERE IdLocal = {$IdLocal} AND Serie = '{$sreDocumento}' AND Eliminado = 0 LIMIT 1 ";
    $row = queryrow($sql);
    $NroDocumento = $row["NPresupuesto"] ? $row["NPresupuesto"] + 1 : 1;
    //Tipo Cliente
    $sql = "SELECT TipoCliente FROM ges_clientes " . "WHERE IdCliente = {$IdCliente} AND Eliminado = 0 LIMIT 1 ";
    $row = queryrow($sql);
    $TipoCliente = $row["TipoCliente"];
    //$TipoVenta = ($TipoCliente == 'Empresa' || $TipoCliente == 'Gobierno')? 'VC':$TipoVenta;
    $esquema = "IdLocal, IdUsuario, NPresupuesto,TipoPresupuesto," . "TipoVentaOperacion,FechaPresupuesto," . "Impuesto, Status,IdCliente," . "Observaciones,VigenciaPresupuesto,Serie";
    $datos = "'{$IdLocal}','{$IdUsuario}','{$NroDocumento}','{$TipoPresupuesto}'," . "'{$TipoVenta}',NOW(),'{$Impuesto}','Pendiente','{$IdCliente}'," . "'{$mensaje}','{$vigencia}','{$sreDocumento}'";
    $sql = "INSERT INTO ges_presupuestos (" . $esquema . ") VALUES (" . $datos . ")";
    query($sql);
    $IdPresupuesto = $UltimaInsercion;
    $sql = "SELECT IdProducto, Unidades, Costo FROM ges_ordencompradet WHERE IdOrdenCompra = {$IdOrdenCompra} ";
    $res = query($sql);
    $xvalue = "";
    $TotalImporte = 0;
    while ($row = Row($res)) {
        $IdProducto = $row["IdProducto"];
        $Unidades = $row["Unidades"];
        $sql = "SELECT PrecioVenta, PrecioVentaCorporativo,CodigoBarras,Referencia " . " FROM ges_almacenes " . "INNER JOIN ges_productos ON ges_almacenes.IdProducto = ges_productos.IdProducto " . " WHERE ges_almacenes.IdProducto = {$IdProducto} AND IdLocal = {$IdLocal}";
        $row = queryrow($sql);
        $Referencia = $row["Referencia"];
        $CodigoBarras = $row["CodigoBarras"];
        $Precio = $row["PrecioVenta"];
        $PrecioCorp = $row["PrecioVentaCorporativo"];
        $Importe = $TipoVenta == 'VD' ? round($Unidades * $Precio, 2) : round($Unidades * $PrecioCorp, 2);
        $TotalImporte = $TotalImporte + $Importe;
        $xvalue .= "(NULL, " . $IdPresupuesto . "," . $IdProducto . ", " . $Unidades . ",'" . $CodigoBarras . "','" . $Referencia . "'," . $Precio . "," . $Importe . " ),";
    }
    $xvalue = substr($xvalue, 0, -1);
    $sql = "INSERT INTO ges_presupuestosdet (idpresupuestodet, idpresupuesto, idproducto, cantidad,codigobarras,referencia,precio,importe) VALUES " . $xvalue;
    query($sql);
    $ImporteNeto = ROUND(100 * $TotalImporte / (100 + $Impuesto), 2);
    $ImporteImpuesto = $TotalImporte - $ImporteNeto;
    $sql = "UPDATE ges_presupuestos SET ImporteNeto = {$ImporteNeto}, " . "ImporteImpuesto = {$ImporteImpuesto}, TotalImporte = {$TotalImporte} " . "WHERE IdPresupuesto = {$IdPresupuesto} ";
    query($sql);
    return "~" . $sreDocumento . "-" . $NroDocumento;
}
示例#28
0
 function constrByMask($pvdzID)
 {
     $tmp_rowCount = 1;
     $tilpums_bruto_KOPA = 0;
     $tilpums_virsmers_KOPA = 0;
     $tilpums_redukcija_KOPA = 0;
     $tilpums_neto_KOPA = 0;
     $tilpums_brakis_KOPA = 0;
     $tmp_balkuSkaits = 0;
     $tilpums_skaits_brakis_KOPA = 0;
     $bbq_temp = false;
     $tmp_arrCollName['nosaukums'] = 1;
     $tmp_arrCollName['suga'] = "Suga";
     $tmp_arrCollName['skira'] = "Šķira";
     $tmp_arrCollName['diametrs'] = "Diametrs";
     $tmp_arrCollName['garums'] = "Garums";
     $tmp_arrCollName['brakis_kods'] = "Brāķa iemesls";
     $tmp_arrCollName['skaits'] = "Skaits";
     $tmp_arrCollName['bruto'] = "Bruto";
     $tmp_arrCollName['virsmers'] = "Virsmērs";
     $tmp_arrCollName['redukcija'] = "Redukcija";
     $tmp_arrCollName['redukcija_un_virsmers'] = "Red. un virsm.";
     $tmp_arrCollName['brakis'] = "Brāķis";
     $tmp_arrCollName['neto'] = "Neto";
     $tmp_arrCollName['brakis_un_neto'] = "Brāķis un Neto";
     $tmp_getDataQuery_txt = "SELECT * FROM " . $this->tblName . "balkis_temp WHERE pavadzime = " . $pvdzID . " ORDER BY mind_pirms_red";
     if (!$pvdzID) {
         $tmp_getDataQuery_txt = "SELECT * FROM " . $this->tblName . "balkis_temp ORDER BY mind_pirms_red";
         $bbq_temp = true;
     }
     $tmp_getDataQuery_query = mysql_query($tmp_getDataQuery_txt);
     /*  
       While($tmp_getDataQuery_arr_tmp = mysql_fetch_assoc($tmp_getDataQuery_query)){
         $tmp_getDataQuery_arr_tmp_first[] = $tmp_getDataQuery_arr_tmp;
         $tmp_getDataQuery_arr_tmp_second[] = $tmp_getDataQuery_arr_tmp;
       }
       
       $tmp_getDataQuery_arr_tmp_third = array_chunk($tmp_getDataQuery_arr_tmp_second,500);
       foreach($tmp_getDataQuery_arr_tmp_third as $item_ttt){
            
       foreach($item_ttt as $tmp_getDataQuery_arr){
     */
     /*
       $part_count = 0;
       $tmp_getDataQuery_txt_temp = run_mysql_by_partitions($part_count,$tmp_getDataQuery_txt);
       $tmp_getDataQuery_query = mysql_query($tmp_getDataQuery_txt_temp);
     
       while(mysql_num_rows($tmp_getDataQuery_query) > 1){
       $tmp_getDataQuery_txt_temp = run_mysql_by_partitions($part_count,$tmp_getDataQuery_txt);
       $tmp_getDataQuery_query = mysql_query($tmp_getDataQuery_txt_temp);
       
         $part_count++;
     */
     while ($tmp_getDataQuery_arr = mysql_fetch_assoc($tmp_getDataQuery_query)) {
         $tilpums_bruto = 0;
         $tilpums_virsmers = 0;
         $tilpums_redukcija = 0;
         $tilpums_neto = 0;
         $tilpums_brakis = 0;
         $isBrakaVirsmOn = $this->MyPOST['braka_virsmers'];
         if ($tmp_getDataQuery_arr['pavadzime'] == 76806 && $this->firmCode == 2) {
             $isBrakaVirsmOn = 'off';
         }
         //-#001-FUNC-START--Nepieciešamo datu kolekcionēšana no datubāzes------------------------------------------------------------------------------------
         $tmp_ident_balkis = $tmp_getDataQuery_arr['id'];
         $var_Suga = $tmp_getDataQuery_arr['suga'];
         $tmp_tilpumsBruto = $tmp_getDataQuery_arr['tilpums'];
         $tmp_tilpumsNeto = $tmp_getDataQuery_arr['tilpums_scan'];
         $tmp_garums_pirms_red = $tmp_getDataQuery_arr['garums'];
         $tmp_garums_pec_red = $tmp_getDataQuery_arr['gar_pec_red'];
         $tmp_tievgalis_pirms_red = $tmp_getDataQuery_arr['mind_pirms_red'];
         $tmp_tievgalis_pec_red = $tmp_getDataQuery_arr['mind_pec_red'];
         $tmp_vidusdiametrs_pirms_red = $tmp_getDataQuery_arr['mind_miza'];
         $tmp_vidusdiametrs_pec_red = $tmp_getDataQuery_arr['mind_miza'] - ($tmp_getDataQuery_arr['mind_pirms_red'] - $tmp_getDataQuery_arr['mind_pec_red']);
         $tmp_resgalis_pirms_red = $tmp_getDataQuery_arr['maxd_miza'];
         $tmp_resgalis_pec_red = $tmp_getDataQuery_arr['maxd_miza'] - ($tmp_getDataQuery_arr['mind_pirms_red'] - $tmp_getDataQuery_arr['mind_pec_red']);
         //-#001-FUNC-END------------------------------------------------------------------------------------------------------------------------------------
         //-#002-FUNC-START--Nepieciešamās grupas atrašana---------------------------------------------------------------------------------------------------
         $igc = 1;
         // Grupu skaits
         $init_Group = false;
         while ($igc < 9 && $init_Group == false) {
             $tmp_igcCheck = 0;
             for ($igo = 1; $igo < 6; $igo++) {
                 //Grupēšanas nosacījumus cikls
                 for ($subcount = 0; $subcount < 3; $subcount++) {
                     if ($this->tmpAllGroup[$igc][$this->GroupOrder[$igo]][$subcount]) {
                         $tmp_SubResult = $this->tmpAllGroup[$igc][$this->GroupOrder[$igo]][$subcount];
                         if (!$this->tmpAllGroup[$igc][$this->GroupOrder[$igo]][0]) {
                             $tmp_SubResult = $this->tmpAllGroup[$igc][$this->GroupOrder[$igo]][$var_Suga];
                         }
                         $tmp_ALLbResult = $this->getMaskGroup($tmp_SubResult, $tmp_getDataQuery_arr[$this->GroupOrder[$igo]], $this->GroupOrder[$igo]);
                         $tmp_inputArrVal[$this->GroupOrder[$igo]] = $tmp_ALLbResult;
                         if ($tmp_ALLbResult != '') {
                             $tmp_igcCheck = $tmp_igcCheck + 1;
                         }
                     } else {
                         $tmp_igcCheck = $tmp_igcCheck + 1;
                     }
                 }
                 if ($igo == 5 && $tmp_igcCheck == 15) {
                     // Grupas noteikšana līdz pirmajiem sakritības rezultātiem (rekursija ar limitētu ciklu skaitu)
                     $init_Group = true;
                     $globalGroupIdent = $igc;
                 }
             }
             $igc++;
         }
         //-#002-FUNC-END-------------------------------------------------------------------------------------------------------------------------------------
         //-#003-FUNC-START--Tilpuma aprēķināšana-------------------------------------------------------------------------------------------------------------
         $prnt_Nosaukums = 0;
         $prnt_Suga = $this->sugas[$var_Suga]['LAT'];
         $prnt_Skira = $tmp_getDataQuery_arr['skira'];
         $prnt_Brakis = $this->braki[$tmp_getDataQuery_arr['brakis']]['LAT'];
         $prnt_Diametrs = $tmp_inputArrVal['mind_pirms_red'];
         $prnt_Garums = $tmp_inputArrVal['garums'];
         //---------------------------------------------------------------------------------------------------------------------------------------------------
         if ($this->firmCode == 35 && $prnt_Skira == 3) {
             $prnt_Skira = 9;
             $prnt_Brakis = $this->braki['010']['LAT'];
         }
         //---------------------------------------------------------------------------------------------------------------------------------------------------
         if ($this->MyPOST['noapalot_garumu'] == '1') {
             $tmp_garums_pirms_red = floor($tmp_garums_pirms_red / 10) * 10;
         } elseif ($this->MyPOST['noapalot_garumu'] == '2') {
             $tmp_garums_pirms_red = (floor($tmp_garums_pirms_red / 10) + 0.5) * 10;
         }
         $tmp_raukumaRinda = $this->tmpRaukGroup[$globalGroupIdent][0];
         if (!$tmp_raukumaRinda) {
             $tmp_raukumaRinda = $this->tmpRaukGroup[$globalGroupIdent][$var_Suga];
         }
         $raukums = raukums_2_array($tmp_raukumaRinda);
         $rauk_koef = get_raukums_no_diam($raukums, $tmp_tievgalis_pirms_red);
         $tmp_DiamRedukcija = $tmp_tievgalis_pirms_red - $tmp_tievgalis_pec_red;
         $tilpums_bruto = $this->calc_Volume($tmp_tievgalis_pirms_red, $tmp_vidusdiametrs_pirms_red, $tmp_resgalis_pirms_red, $tmp_garums_pirms_red, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']);
         if ($this->MyPOST['noapalot_diametru'] == 'on') {
             $tmp_tievgalis_pec_red = (floor($tmp_tievgalis_pec_red / 10) + 0.5) * 100;
         }
         $tmp_virsmeraRinda = $this->tmpNomGarGroup[$globalGroupIdent][0];
         if (!$tmp_virsmeraRinda) {
             $tmp_virsmeraRinda = $this->tmpNomGarGroup[$globalGroupIdent][$var_Suga];
         }
         $tmp_virsmeraRindaBrakis = $this->tmpNomGarBrakGroup[$globalGroupIdent][0];
         if (!$tmp_virsmeraRindaBrakis) {
             $tmp_virsmeraRindaBrakis = $this->tmpNomGarBrakGroup[$globalGroupIdent][$var_Suga];
         }
         if ($tmp_virsmeraRindaBrakis) {
             $virsmeri_brakim = explode(',', $tmp_virsmeraRindaBrakis);
             for ($i = 0; $i < count($virsmeri_brakim); $i++) {
                 $virsmeri_brakim[$i] = $virsmeri_brakim[$i];
             }
         }
         $virsmeri = explode(',', $tmp_virsmeraRinda);
         for ($i = 0; $i < count($virsmeri); $i++) {
             $virsmeri[$i] = $virsmeri[$i];
         }
         $tmp_mini_virsmeraRinda = $this->tmpVirsmGroup[$globalGroupIdent][0];
         if (!$tmp_mini_virsmeraRinda) {
             $tmp_mini_virsmeraRinda = $this->tmpVirsmGroup[$globalGroupIdent][$var_Suga];
         }
         $tmp_nom_garums_pirms_red = nominalGarums($tmp_getDataQuery_arr['garums'], $virsmeri, $tmp_mini_virsmeraRinda);
         $tmp_nom_garums_pec_red = nominalGarums($tmp_garums_pec_red, $virsmeri, $tmp_mini_virsmeraRinda);
         if ($this->MyPOST['is_vika'] == 'on') {
             $tmp_garums_pec_red = $tmp_garums_pec_red + $tmp_mini_virsmeraRinda;
             $tmp_nom_garums_pec_red = nominalGarums($tmp_garums_pec_red, $virsmeri, $tmp_mini_virsmeraRinda);
             $tilpums_neto = $this->calc_Volume($tmp_tievgalis_pec_red, $tmp_vidusdiametrs_pec_red, $tmp_resgalis_pec_red, $tmp_nom_garums_pec_red, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']);
             $tilpums_bruto_virsmeram = $this->calc_Volume($tmp_tievgalis_pirms_red, $tmp_vidusdiametrs_pirms_red, $tmp_resgalis_pirms_red, $tmp_nom_garums_pirms_red, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']);
             $tilpums_virsmers = ROUND($tilpums_bruto - $tilpums_bruto_virsmeram, 3);
             $tilpums_redukcija = $tilpums_bruto_virsmeram - $tilpums_neto;
         } else {
             $tilpums_neto = $this->calc_Volume($tmp_tievgalis_pec_red, $tmp_vidusdiametrs_pec_red, $tmp_resgalis_pec_red, $tmp_nom_garums_pec_red, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']);
             $tilpums_bruto_virsmeram = $this->calc_Volume($tmp_tievgalis_pirms_red, $tmp_vidusdiametrs_pirms_red, $tmp_resgalis_pirms_red, $tmp_nom_garums_pirms_red, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']);
             $tilpums_virsmers = ROUND($tilpums_bruto - $tilpums_bruto_virsmeram, 3);
             $tilpums_redukcija = $tilpums_bruto_virsmeram - $tilpums_neto;
         }
         if ($this->MyPOST['metode'] == 4) {
             if ($this->firmCode == 27) {
                 $tilpums_bruto = floor($tmp_tilpumsBruto / 10) / 1000;
                 $tilpums_neto = floor($tmp_tilpumsNeto / 10) / 1000;
                 $tilpums_bruto_virsmeram = floor($tmp_tilpumsNeto / 10) / 1000;
                 $tilpums_virsmers = $tilpums_bruto - $tilpums_bruto_virsmeram;
                 $tilpums_redukcija = 0;
             } else {
                 $tilpums_bruto = $tmp_tilpumsBruto;
                 $tilpums_neto = $tmp_tilpumsNeto;
                 $tilpums_bruto_virsmeram = $tmp_tilpumsNeto;
                 $tilpums_virsmers = $tilpums_bruto - $tilpums_bruto_virsmeram;
                 $tilpums_redukcija = 0;
             }
         }
         if ($tilpums_virsmers < 0) {
             $tilpums_virsmers = 0;
         }
         if ($tilpums_bruto_virsmeram == 0) {
             $tilpums_virsmers = 0;
         }
         if ($tilpums_redukcija < 0) {
             $tilpums_redukcija = 0;
         }
         //-#003-FUNC-END--------------------------------------------------------------------------------------------------------------------------------------
         //-#004-FUNC-START--Papildus dimensijas brāķa priešķiršana--------------------------------------------------------------------------------------------
         $takeReCallOn4 = false;
         if ($tmp_nom_garums_pec_red < 1 && !$prnt_Brakis) {
             $prnt_Skira = 9;
             $prnt_Brakis = $this->braki['899']['LAT'];
             $takeReCallOn4 = true;
         }
         if (substr($prnt_Diametrs, 0, 1) == 'b' && !$prnt_Brakis) {
             $prnt_Skira = 9;
             $prnt_Brakis = $this->braki['899']['LAT'];
             $prnt_Diametrs = str_replace('b', '', $prnt_Diametrs);
             $takeReCallOn4 = true;
         }
         if (substr($prnt_Garums, 0, 1) == 'b' && !$prnt_Brakis) {
             $prnt_Skira = 9;
             $prnt_Brakis = $this->braki['899']['LAT'];
             $prnt_Garums = str_replace('b', '', $prnt_Garums);
             $takeReCallOn4 = true;
         }
         if ($prnt_Brakis == 'D') {
             // XML nobrāķēšana ar 4 kodu
             $takeReCallOn4 = true;
         }
         if ($takeReCallOn4) {
             $tmp_is4 = mod_ResignLVMRejectCode($this->firmCode, $tmp_getDataQuery_arr['garums'], $tmp_getDataQuery_arr['mind_pirms_red'], $tmp_getDataQuery_arr['suga'], $tmp_getDataQuery_arr['skira']);
             if ($tmp_is4) {
                 $prnt_Brakis = $this->braki['856']['LAT'];
             }
         }
         //-#004-FUNC-END-----------------------------------------------------------------------------------------------------
         //-#005-FUNC-START--Brāķa tilpuma aprēķināšana---------------------------------------------------------------------------------------------------
         if ($prnt_Brakis) {
             $tilpums_neto = 0;
             $tilpums_redukcija = 0;
             if ($isBrakaVirsmOn == 'on') {
                 if ($virsmeri_brakim) {
                     $tmp_nom_garums_pirms_red_brakim = nominalGarums($tmp_getDataQuery_arr['garums'], $virsmeri_brakim, $tmp_mini_virsmeraRinda);
                     $tilpums_bruto_virsmeram = $this->calc_Volume($tmp_tievgalis_pirms_red, $tmp_vidusdiametrs_pirms_red, $tmp_resgalis_pirms_red, $tmp_nom_garums_pirms_red_brakim, $rauk_koef, $koeficients, $gostu_tabula, $this->MyPOST['metode']);
                     if ($tilpums_bruto_virsmeram > 0) {
                         $tilpums_virsmers = $tilpums_bruto - $tilpums_bruto_virsmeram;
                         $tilpums_brakis = $tilpums_bruto_virsmeram;
                     } else {
                         $tilpums_virsmers = 0;
                         $tilpums_brakis = $tilpums_bruto;
                     }
                 } else {
                     if ($tilpums_bruto_virsmeram > 0) {
                         $tilpums_brakis = $tilpums_bruto_virsmeram;
                     } else {
                         $tilpums_virsmers = 0;
                         $tilpums_brakis = $tilpums_bruto;
                     }
                 }
             } else {
                 $tilpums_virsmers = 0;
                 $tilpums_brakis = $tilpums_bruto;
             }
         }
         $tmp_inputArrVal['mind_pirms_red'] = str_replace('b', '', $tmp_inputArrVal['mind_pirms_red']);
         $prnt_Diametrs = str_replace('b', '', $prnt_Diametrs);
         $tmp_inputArrVal['garums'] = str_replace('b', '', $tmp_inputArrVal['garums']);
         $prnt_Garums = str_replace('b', '', $prnt_Garums);
         //-#005-FUNC-END-----------------------------------------------------------------------------------------------------
         //-#006-FUNC-START--Vienādo grupēšanu pāskats---------------------------------------------------------------------------------------------------
         $pilnaGrupesana = false;
         if ($this->report_XML) {
             $pilnaGrupesana = true;
         }
         if (($this->firmCode == 16 || $this->firmCode == 18 || $this->isAllReport) && !$this->report_PDF) {
             $pilnaGrupesana = true;
         }
         $rowExist = 0;
         if (!$pilnaGrupesana) {
             for ($protoKey = $tmp_rowCount - 1; $protoKey > 0; $protoKey--) {
                 if ($this->arrPrintOut[$protoKey]['suga'] == $prnt_Suga) {
                     if ($this->arrPrintOut[$protoKey]['skira'] == $prnt_Skira) {
                         if ($this->arrPrintOut[$protoKey]['diametrs'] == $prnt_Diametrs) {
                             if ($this->arrPrintOut[$protoKey]['brakis_kods'] == $prnt_Brakis) {
                                 $rowExist = $protoKey;
                             }
                         }
                     }
                 }
             }
         } else {
             for ($protoKey = $tmp_rowCount - 1; $protoKey > 0; $protoKey--) {
                 if ($this->arrPrintOut[$protoKey]['suga'] == $prnt_Suga) {
                     if ($this->arrPrintOut[$protoKey]['skira'] == $prnt_Skira) {
                         if ($this->arrPrintOut[$protoKey]['diametrs'] == $prnt_Diametrs) {
                             if ($this->arrPrintOut[$protoKey]['garums'] == $prnt_Garums) {
                                 if ($this->arrPrintOut[$protoKey]['brakis_kods'] == $prnt_Brakis) {
                                     $rowExist = $protoKey;
                                 }
                             }
                         }
                     }
                 }
             }
         }
         //-#006-FUNC-END-----------------------------------------------------------------------------------------------------
         //-#007-FUNC-START--Statisko vērtību ievietošana---------------------------------------------------------------------------------------------------
         $insertRow = $tmp_rowCount;
         if ($rowExist != 0) {
             $insertRow = $rowExist;
         }
         $this->arrPrintOut[$insertRow]['nosaukums'] = 0;
         $this->arrPrintOut[$insertRow]['suga'] = $prnt_Suga;
         $this->arrPrintOut[$insertRow]['skira'] = $prnt_Skira;
         $this->arrPrintOut[$insertRow]['diametrs'] = $prnt_Diametrs;
         $this->arrPrintOut[$insertRow]['garums'] = $prnt_Garums;
         $this->arrPrintOut[$insertRow]['brakis_kods'] = $prnt_Brakis;
         if ($this->report_XML) {
             $this->arrPrintOut[$insertRow]['diametrs_tmp'] = $tmp_getDataQuery_arr['mind_pirms_red'];
             $this->arrPrintOut[$insertRow]['garums_tmp'] = $tmp_getDataQuery_arr['garums'];
         }
         $this->arrPrintOut[$insertRow]['skaits'] += 1;
         if ($this->arrPrintOut[$insertRow]['brakis_kods'] != '') {
             $tilpums_skaits_brakis_KOPA += 1;
         }
         //-#007-FUNC-END-----------------------------------------------------------------------------------------------------
         //-#008-FUNC-START--Dinamisko vērtību piešķiršana---------------------------------------------------------------------------------------------------
         $this->arrPrintOut[$insertRow]['bruto'] += $tilpums_bruto;
         $this->arrPrintOut[$insertRow]['virsmers'] += $tilpums_virsmers;
         $this->arrPrintOut[$insertRow]['redukcija'] += $tilpums_redukcija;
         $this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] += $tilpums_bruto - $tilpums_neto;
         $this->arrPrintOut[$insertRow]['brakis'] += $tilpums_brakis;
         $this->arrPrintOut[$insertRow]['neto'] += $tilpums_neto;
         $this->arrPrintOut[$insertRow]['brakis_un_neto'] += $tilpums_neto + $tilpums_brakis;
         //------------------------------------------------------------------------------------------------------
         if ($this->arrPrintOut[$insertRow]['bruto'] != '') {
             $this->arrPrintOut[$insertRow]['bruto'] = number_format($this->arrPrintOut[$insertRow]['bruto'], 3, '.', '');
         } else {
             $this->arrPrintOut[$insertRow]['bruto'] = '';
         }
         if ($this->arrPrintOut[$insertRow]['virsmers'] != '') {
             $this->arrPrintOut[$insertRow]['virsmers'] = number_format($this->arrPrintOut[$insertRow]['virsmers'], 3, '.', '');
         } else {
             $this->arrPrintOut[$insertRow]['virsmers'] = '';
         }
         if ($this->arrPrintOut[$insertRow]['redukcija'] != '') {
             $this->arrPrintOut[$insertRow]['redukcija'] = number_format($this->arrPrintOut[$insertRow]['redukcija'], 3, '.', '');
         } else {
             $this->arrPrintOut[$insertRow]['redukcija'] = '';
         }
         if ($this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] != '') {
             $this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] = number_format($this->arrPrintOut[$insertRow]['redukcija_un_virsmers'], 3, '.', '');
         } else {
             $this->arrPrintOut[$insertRow]['redukcija_un_virsmers'] = '';
         }
         if ($this->arrPrintOut[$insertRow]['brakis'] != '') {
             $this->arrPrintOut[$insertRow]['brakis'] = number_format($this->arrPrintOut[$insertRow]['brakis'], 3, '.', '');
         } else {
             $this->arrPrintOut[$insertRow]['brakis'] = '';
         }
         if ($this->arrPrintOut[$insertRow]['neto'] != '') {
             $this->arrPrintOut[$insertRow]['neto'] = number_format($this->arrPrintOut[$insertRow]['neto'], 3, '.', '');
         } else {
             $this->arrPrintOut[$insertRow]['neto'] = '';
         }
         if ($this->arrPrintOut[$insertRow]['brakis_un_neto'] != '') {
             $this->arrPrintOut[$insertRow]['brakis_un_neto'] = number_format($this->arrPrintOut[$insertRow]['brakis_un_neto'], 3, '.', '');
         } else {
             $this->arrPrintOut[$insertRow]['brakis_un_neto'] = '';
         }
         //------------------------------------------------------------------------------------------------------
         $tilpums_bruto_KOPA = $tilpums_bruto_KOPA + $tilpums_bruto;
         $tilpums_virsmers_KOPA = $tilpums_virsmers_KOPA + $tilpums_virsmers;
         $tilpums_redukcija_KOPA = $tilpums_redukcija_KOPA + $tilpums_redukcija;
         $tilpums_neto_KOPA = $tilpums_neto_KOPA + $tilpums_neto;
         $tilpums_brakis_KOPA = $tilpums_brakis_KOPA + $tilpums_brakis;
         $tmp_balkuSkaits++;
         $tmp_rowCount++;
     }
     //  }
     //-#008-FUNC-END-----------------------------------------------------------------------------------------------------
     //-#009-FUNC-START--Rindu pārgrupēšana masīvā---------------------------------------------------------------------------------------------------
     if (($this->firmCode == 16 || $this->firmCode == 20 || $this->isAllReport) && !$this->report_PDF && !$this->report_XML) {
         $this->arrPrintOut = array_orderby($this->arrPrintOut, 'suga', SORT_ASC, 'skira', SORT_ASC, 'diametrs', SORT_ASC, 'garums', SORT_ASC, 'brakis_kods', SORT_ASC);
     } else {
         $this->arrPrintOut = array_orderby($this->arrPrintOut, 'suga', SORT_ASC, 'skira', SORT_ASC, 'diametrs', SORT_ASC, 'brakis_kods', SORT_ASC);
     }
     array_unshift($this->arrPrintOut, $tmp_arrCollName);
     //-#009-FUNC-END-----------------------------------------------------------------------------------------------------
     //-#010-FUNC-START--Kopsummas rindas pievienošana---------------------------------------------------------------------------------------------------
     $this->arrPrintOut[$tmp_rowCount]['nosaukums'] = 1;
     $this->arrPrintOut[$tmp_rowCount]['suga'] = "";
     $this->arrPrintOut[$tmp_rowCount]['skira'] = "";
     $this->arrPrintOut[$tmp_rowCount]['diametrs'] = "";
     $this->arrPrintOut[$tmp_rowCount]['garums'] = "";
     $this->arrPrintOut[$tmp_rowCount]['brakis_kods'] = "";
     $this->arrPrintOut[$tmp_rowCount]['skaits'] = $tmp_balkuSkaits;
     $this->arrPrintOut[$tmp_rowCount]['bruto'] = number_format($tilpums_bruto_KOPA, 3, '.', '') . "*";
     $this->arrPrintOut[$tmp_rowCount]['virsmers'] = number_format($tilpums_virsmers_KOPA, 3, '.', '') . "*";
     $this->arrPrintOut[$tmp_rowCount]['redukcija'] = number_format($tilpums_redukcija_KOPA, 3, '.', '') . "*";
     $this->arrPrintOut[$tmp_rowCount]['redukcija_un_virsmers'] = number_format($tilpums_bruto_KOPA - $tilpums_neto_KOPA, 3, '.', '') . "*";
     $this->arrPrintOut[$tmp_rowCount]['brakis'] = number_format($tilpums_brakis_KOPA, 3, '.', '') . "*";
     $this->arrPrintOut[$tmp_rowCount]['neto'] = number_format($tilpums_neto_KOPA, 3, '.', '') . "*";
     $this->arrPrintOut[$tmp_rowCount]['brakis_un_neto'] = number_format($tilpums_brakis_KOPA + $tilpums_neto_KOPA, 3, '.', '') . "*";
     $this->regSuperSum['bruto'] = $tilpums_bruto_KOPA;
     $this->regSuperSum['virsmers'] = $tilpums_virsmers_KOPA;
     $this->regSuperSum['redukcija'] = $tilpums_redukcija_KOPA;
     $this->regSuperSum['brakis'] = $tilpums_brakis_KOPA;
     $this->regSuperSum['neto'] = $tilpums_neto_KOPA;
     $this->regSuperSum['skaits'] = $tmp_balkuSkaits;
     $this->regSuperSum['skaits_brakis'] = $tilpums_skaits_brakis_KOPA;
     //-#010-FUNC-END-----------------------------------------------------------------------------------------------------
     //-#011-FUNC-START-END-Rezultāts---------------------------------------------------------------------------------------------------
     //    fb($this->arrPrintOut,'arrPrintOut');
     //  break;
     return true;
 }
示例#29
0
 public function actionSubearchivo($id)
 {
     $model = new Archivador();
     //ECHO "la magen ".$_POST['image'];
     if (isset($_POST['Archivador'])) {
         $model->attributes = $_POST['Archivador'];
         $model->imagen = CUploadedFile::getInstance($model, 'imagen');
         $mensaje = "";
         $mensaje2 = "";
         if (!(strtoupper($model->imagen->getExtensionName()) == 'JPG' or strtoupper($model->imagen->getExtensionName() == 'JPEG'))) {
             $mensaje = "El archivo no es una imagen valida  " . $model->imagen->getExtensionName();
         }
         $tamanomaximo = 3000;
         if ($model->imagen->getSize() > 1024 * $tamanomaximo) {
             $mensaje2 = "El archivo  es muy pesado :" . ROUND($model->imagen->getSize() / 1024, 2) . " suba imagenes menores a " . $tamanomaximo . " KB ";
         }
         if (trim($mensaje . $mensaje2 == "")) {
             $fot = new Fotos($model->codigosap, Yii::app()->params['rutafotosinventario'], '.JPG');
             $fotonueva = $fot->siguiente_numero();
             $model->imagen->saveAs($fot->rutadearchivos . $fotonueva);
             $this->redirect(array('detalle', 'id' => $id));
         } else {
             $this->render('vw_error_foto', array('mensaje' => $mensaje, 'mensaje2' => $mensaje2));
             Yii::app()->end();
         }
     }
     $model = $this->loadModel($id);
     $this->render('vw_subir_archivo', array('model' => $model, 'id' => $id));
 }
示例#30
0
        $gela .= '<Cell ss:StyleID="s68"><Data ss:Type="Number">' . $row_total_req[1] . '</Data></Cell>';
        $gela .= '<Cell ss:StyleID="s68"><Data ss:Type="Number">' . ROUND($row_total_req[1] / $row_total_total_req * 100, 2) . '</Data></Cell>';
    } else {
        $gela .= '<Cell ss:StyleID="s68"><Data ss:Type="Number">0</Data></Cell>';
        $gela .= '<Cell ss:StyleID="s68"><Data ss:Type="Number">0</Data></Cell>';
    }
    if ($row_answer_req[0] == $user_req[0]) {
        $gela .= '<Cell ss:StyleID="s68"><Data ss:Type="Number">' . $row_answer_req[1] . '</Data></Cell>';
        $gela .= '<Cell ss:StyleID="s68"><Data ss:Type="Number">' . ROUND($row_answer_req[1] / $row_answer_total_req * 100, 2) . '</Data></Cell>';
    } else {
        $gela .= '<Cell ss:StyleID="s68"><Data ss:Type="Number">0</Data></Cell>';
        $gela .= '<Cell ss:StyleID="s68"><Data ss:Type="Number">0</Data></Cell>';
    }
    if ($row_dadebit_req[0] == $user_req[0]) {
        $gela .= '<Cell ss:StyleID="s68"><Data ss:Type="Number">' . $row_dadebit_req[1] . '</Data></Cell>';
        $gela .= '<Cell ss:StyleID="s68"><Data ss:Type="Number">' . ROUND($row_dadebit_req[1] / $row_dadebit_total_req * 100, 2) . '</Data></Cell>';
    } else {
        $gela .= '<Cell ss:StyleID="s68"><Data ss:Type="Number">0</Data></Cell>';
        $gela .= '<Cell ss:StyleID="s68"><Data ss:Type="Number">0</Data></Cell>';
    }
    $gela .= '</Row>';
}
$data = '
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o="urn:schemas-microsoft-com:office:office"
 xmlns:x="urn:schemas-microsoft-com:office:excel"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html="http://www.w3.org/TR/REC-html40">
 <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">