示例#1
0
 function poorsant1($inp)
 {
     $customer_id = $_SESSION["customer_id"];
     $cust = new customer_class($customer_id);
     $out = enToPerNums($cust->getPoorsant($inp));
     return $out . '%';
 }
$tmp_id = array();
if (!isset($_REQUEST["mod"])) {
    if ($msg == "") {
        $adl_ghimat = 0;
        $chd_ghimat = 0;
        $inf_ghimat = 0;
        $poorsant = 0;
        $radif = '۱';
        foreach ($selectedParvaz as $tmp) {
            $alaki = ticket_class::addTmp($tmp->getId(), $tedad);
            $tmp->setZarfiat($tedad);
            $tmp_id[] = $alaki;
            $adl_ghimat += $tmp->ghimat;
            $chd_ghimat += $tmp->ghimat;
            $inf_ghimat += $tmp->ghimat / 10;
            $poorsant += $tmp->ghimat * ($customer->getPoorsant($tmp->getId()) / 100);
        }
        $adl_ghimat = enToPerNums(monize($adl_ghimat));
        $chd_ghimat = enToPerNums(monize($chd_ghimat));
        $inf_ghimat = enToPerNums(monize($inf_ghimat));
        $poorsant = enToPerNums(monize($poorsant));
        $adults = <<<adul
\t\t\t\t<tr class="showgrid_row_odd">
                                        <th class="showgrid_row_td_reserve_reserve">ردیف</th>
\t\t\t\t\t<th colspan='3'\tclass="showgrid_row_td_reserve_reserve">بزرگسال</th>
\t\t\t\t\t<th colspan='2' >شماره تیکت</th>
\t\t\t\t\t<th class="showgrid_row_td_reserve_reserve">بهای فروش</th>
                                        <th class="showgrid_row_td_reserve_reserve">کمیسین</th>
                                        <th class="showgrid_row_td_reserve_reserve">بهای خالص</th>
\t\t\t\t</tr>
adul;
示例#3
0
function poorsant($inp)
{
    $conf = new conf();
    $customer_id = (int) $_SESSION[$conf->app . "_customer_id"];
    $cust = new customer_class($customer_id);
    $out = $cust->getPoorsant($inp);
    return $out . '%';
}
示例#4
0
function poorsant($inp)
{
    $conf = new conf();
    $par = new parvaz_det_class((int) $inp);
    $customer_id = $_SESSION[$conf->app . "_customer_id"];
    $cust = new customer_class($customer_id);
    $out = $cust->getPoorsant($inp) * $par->ghimat / 100;
    return enToPerNums(monize($out));
}
示例#5
0
function reserve($user, $enc_pass, $tmp_ids, $fnames, $lnames, $isInfs, $genders, $tell)
{
    $aaaa = $GLOBALS['aaaa'];
    function flightZarfiat($parvaz)
    {
        $out = $parvaz->getZarfiat();
        return $out;
    }
    $out = "auth_error";
    if (user_class::is_authonticated($enc_pass, $user)) {
        $u = new user_class();
        $u->loadByUser($user);
        $customer = new customer_class($u->customer_id);
        $ticket_ids = array();
        $t = new ticket_class();
        $gender = explode(',', $genders);
        $fname = explode(',', $fnames);
        $lname = explode(',', $lnames);
        $isInf = explode(',', $isInfs);
        $tmp_id = explode(',', $tmp_ids);
        $tedad = 0;
        $jam_ghimat = 0;
        foreach ($isInf as $inf) {
            if ($inf != 2) {
                $tedad++;
            }
        }
        $shomare_last = array();
        $shomare_last_index = 0;
        $sanads = array();
        $qqq = null;
        $mysql = new mysql_class();
        $selectedParvaz = array();
        $mysql->ex_sql("select `id` ,parvaz_det_id from `reserve_tmp` where `id` in (" . $tmp_ids . ")", $qqq);
        foreach ($qqq as $r) {
            $selectedParvaz[] = new parvaz_det_class($r['parvaz_det_id']);
            $tmp_parvaz = $selectedParvaz[count($selectedParvaz) - 1];
            if (flightZarfiat($tmp_parvaz) < $tedad) {
                $tedad_ok = FALSE;
            }
            $jam_ghimat += $tedad * $tmp_parvaz->ghimat;
            $jam_ghimat += $inf * $tmp_parvaz->ghimat / 10;
        }
        $ok = FALSE;
        $error = "parvaz expired";
        $etebar_ok = $customer->max_amount >= $jam_ghimat;
        if ($etebar_ok) {
            $domasire_ast = count($selectedParvaz) == 2 && parvaz_det_class::check_raft_bargasht($selectedParvaz[0]->getId(), $selectedParvaz[1]->getId());
            if ($aaaa) {
                var_dump($domasire_ast);
            }
            $p_i = 0;
            foreach ($selectedParvaz as $tt => $parvaz) {
                if ($p_i == 0) {
                    $error = "";
                }
                $tmp_idi = $tmp_id[$tt];
                $adl = 0;
                $chd = 0;
                $inf = 0;
                $mysql = new mysql_class();
                $sanad_record_id = 200;
                $mysql->ex_sql("select MAX(`sanad_record_id`) as `sss` from `customer_daryaft`", $q);
                if (isset($q[0])) {
                    $sanad_record_id = (int) $q[0]["sss"] > 199 ? (int) $q[0]["sss"] : 199;
                    $sanad_record_id++;
                }
                $sanads[] = $sanad_record_id;
                $ok = TRUE;
                $jam_ghimat1 = 0;
                $index = 0;
                $adl_last = array();
                $chd_last = array();
                $inf_last = array();
                $ghimat_kharid = 0;
                $ticket_type = 0;
                $zarib = (100 - $customer->getPoorsant($parvaz->getId())) / 100;
                foreach ($gender as $i => $g) {
                    switch ($isInf[$i]) {
                        case 0:
                            $adl++;
                            break;
                        case 1:
                            $chd++;
                            break;
                        case 2:
                            $inf++;
                            break;
                    }
                    $ticket = new ticket_class();
                    $ticket->fname = '';
                    $ticket->lname = $fname[$i] . ' ' . $lname[$i];
                    $ticket->tel = $tell;
                    $ticket->adult = $isInf[$i];
                    $ticket->parvaz_det_id = $parvaz->getId();
                    $ticket->mablagh = $parvaz->ghimat * $zarib;
                    $ticket->poorsant = $customer->getPoorsant($parvaz->getId());
                    $ticket->customer_id = $customer->getId();
                    $ticket->user_id = (int) $u->id;
                    $ticket->typ = $ticket_type;
                    $ticket->gender = $gender[$i];
                    $ticket->en = 1;
                    $ticket->sanad_record_id = $sanad_record_id;
                    $j = 0;
                    $shomare = -1;
                    if ($aaaa) {
                        var_dump($p_i);
                    }
                    if ($domasire_ast && $p_i == 0 || !$domasire_ast) {
                        $ticket->shomare = $customer->decTicketCount();
                        $shomare_last[] = $ticket->shomare;
                    } else {
                        if ($domasire_ast && $p_i > 0) {
                            $ticket->shomare = $shomare_last[$shomare_last_index];
                            $shomare_last_index++;
                        }
                    }
                    $tttt = $ticket->add($tmp_id[$index], $noth);
                    if (!$tttt) {
                        $error .= 'ticket registereation error...(' . $tmp_id[$index] . ')';
                    }
                    $ok = $ok and $tttt;
                    $ghimat_kharid += $parvaz->mablagh_kharid;
                    if ($aaaa) {
                        var_dump($ticket);
                        var_dump($shomare_last);
                    }
                }
                $mysql->ex_sqlx("delete from `reserve_tmp` where `id` = " . $tmp_id[$index]);
                $tedad = $adl + $chd;
                $jam_ghimat1 += $zarib * $tedad * $parvaz->ghimat + $zarib * $inf * $parvaz->ghimat / 10;
                $index++;
                $p_i++;
                $customer->buyTicket($sanad_record_id, $jam_ghimat1);
                if ($parvaz->is_shenavar) {
                    parvaz_det_class::sanad_shenavar_kharid($parvaz, $adl + $chd, $sanad_record_id, $user_id);
                }
            }
        } else {
            $ok = FALSE;
            $error = "etebar is less";
        }
        $out = $ok ? "true|" . implode(',', $sanads) : "false|" . $error;
    }
    return $out;
}