function loadParvazInfo($inp) { $out = " "; $inp = (int) $inp; $parvaz = new parvaz_det_class($inp); if ($parvaz->getId() > 0) { $out = loadCity($parvaz->mabda_id) . "--" . loadCity($parvaz->maghsad_id) . ' شماره ' . $parvaz->shomare . " <br/>" . hamed_pdate($parvaz->tarikh); } return $out; }
function loadParvazInfo($inp) { $out = " "; $inp = (int) $inp; $parvaz = new parvaz_det_class($inp); if ($parvaz->getId() > 0) { $out = $parvaz->shomare . "( " . loadCity($parvaz->mabda_id) . " -> " . loadCity($parvaz->maghsad_id) . " )" . jdate("j / m / Y", strtotime($parvaz->tarikh)) . '<br />' . date("F d", strtotime($parvaz->tarikh)); } return $out; }
function reserve_tmp($user, $enc_pass, $parvaz_det_ids, $tedad) { $out = "auth_error"; if (user_class::is_authonticated($enc_pass, $user)) { $u = new user_class(); $u->loadByUser($user); $timeout = 5; $parvaz_det_ids_array = explode(',', $parvaz_det_ids); $out_array = array(); foreach ($parvaz_det_ids_array as $parvaz_det_id) { $out_array[] = ticket_class::addTmp($parvaz_det_id, $tedad, $timeout, $u->customer_id); $p = new parvaz_det_class($parvaz_det_id); $p->setZarfiat($tedad, $u->customer_id); } $out = count($out_array) > 0 ? implode('|', $out_array) : 'false'; } return $out; }
function loadCustomerZakhire($inp) { //$out = "ذخیره $inp"; $inp = (int) $inp; $parvaz_det = new parvaz_det_class($inp); $zakhire = enToPerNums($parvaz_det->zarfiat - $parvaz_det->getZarfiat()); $out = "<u><span style=\"color:blue;cursor:pointer;\" onclick=\"wopen('zakhire.php?parvaz_det_id={$inp}&','',600,400);\">{$zakhire}</span></u>"; return $out; }
/* for($i=0;$i<count($ticket_ids);$i++) mysql_class::ex_sqlx("delet from `ticket` where `id`= ".$ticket_ids[$i]); */ ticket_class::clearTickets(); pay_class::revers($SaleOrderId, $SaleReferenceId); die('<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body><center>در پردازش مشکلی پیش آمده است مجدد تلاش نمایید در صورت پرداخت وجه مبلغی از حساب شما کم نشده است <br/><a href="index.php" >بازگشت</a></center></body></html>'); } else { $customer = new customer_class($info[0]->customer_id); $customer->buyTicket($sanad_record_id, $pardakht->mablagh, FALSE); $pardakht->update($sanad_record_id); //-------------- shenavar sanad------------ $sanad_record_id = sanad_class::getLastSanad_record_id(); $user_id = isset($_SESSION[conf::app . '_user_id']) ? (int) $_SESSION[conf::app . '_user_id'] : -1; foreach ($shenavar as $par) { parvaz_det_class::sanad_shenavar_kharid($par, $tedad, $sanad_record_id, $user_id); } //Sabte sanade pardakht parvaz.------------ $sanad_record_id = sanad_class::getLastSanad_record_id(); $tozihat = ' بابت خرید نقدی بلیت به شماره سند ' . $sanad_record_id_ticket; customer_class::pardakht($sanad_record_id, $info[0]->customer_id, $pardakht->mablagh, $tozihat, $user_id); } foreach ($res_tmp as $tmpid) { mysql_class::ex_sqlx("delete from `reserve_tmp` where `id` = " . $tmpid); } $rev = pay_class::settle($SaleOrderId, $SaleReferenceId); $rahgiri = pardakht_class::getBarcode($pardakht->id); $out = '<script langauge="javascript" >window.location = "finalticket2.php?ticket_type=0&sanad_record_id=' . $sanad_record_id_ticket . '&rahgiri=' . $rahgiri . '"</script>'; } else { $out = ' پرداخت انجام نشد مجدد سعی نمایید درصورت پرداخت وجه ، مبلغ از حساب شما کم نشده است <br/>
public function fromDateToDate($start_date, $stop_date, $week_day = array()) { $mysql = new mysql_class(); $days = array(1 => "دوشنبه", 2 => "سهشنبه", 3 => "چهارشنبه", 4 => "پنجشنبه", 5 => "جمعه", 6 => "شنبه", 7 => "یکشنبه"); if (strtotime($stop_date) >= strtotime($start_date)) { $tmp = $start_date; while (strtotime($stop_date) >= strtotime($tmp)) { $ok = FALSE; $this_day = strtotime($tmp); $dayOfW = date("N", $this_day); for ($i = 0; $i < count($week_day); $i++) { if ($dayOfW == $week_day[$i]) { $ok = TRUE; } } if ($ok) { $mysql->ex_sql("select `id` from `parvaz_det` where `parvaz_id` = '" . $this->id . "' and `tarikh`='{$tmp}' and `saat`='" . $this->saat_def . "' and `en`='1' ", $q); if (!isset($q[0])) { $mysql->ex_sqlx("insert into `parvaz_det` (`parvaz_id`, `tarikh`, `saat`,`saat_kh`, `zarfiat`, `ghimat`, `typ`, `zakhire`, `poor_def`,`mablagh_kharid`,`customer_id`) values ('" . $this->id . "','{$tmp}','" . $this->saat_def . "','" . $this->saat_kh_def . "','" . $this->zarfiat_def . "','" . $this->ghimat_def . "','" . $this->typ_def . "','" . $this->zarfiat_def . "','" . $this->poor_def . "','" . $this->mablgh_kharid_def . "','" . $this->customer_id_det . "')"); if ($this->is_shenavar) { $mysql->ex_sql("SELECT `id` FROM `parvaz_det` WHERE `parvaz_id`='" . $this->id . "' and `tarikh`='{$tmp}' and `saat`='" . $this->saat_def . "' and `saat_kh`='" . $this->saat_kh_def . "' and `zarfiat`='" . $this->zarfiat_def . "' and `ghimat`='" . $this->ghimat_def . "' and `typ`='" . $this->typ_def . "' and `zakhire`='" . $this->zarfiat_def . "' and `poor_def`='" . $this->poor_def . "' and `mablagh_kharid`='" . $this->mablgh_kharid_def . "' and `customer_id`='" . $this->customer_id_det . "'", $qu); if (isset($qu)) { $r = $qu[0]; $parvaz_det = new parvaz_det_class($r['id']); $parvaz_det->kharidParvaz($this->zarfiat_def); } } } } $tmp = strtotime($tmp . " + 1 day"); $tmp = date("Y-m-d", $tmp); } } }
public function deleteTicket($ticket_id) { $conf = new conf(); $ticket = new ticket_class((int) $ticket_id); $sanad_record_id = $ticket->sanad_record_id; $parvaz = new parvaz_det_class($ticket->parvaz_det_id); $today = date("Y-m-d H:i:s"); $out = FALSE; if ($today < $parvaz->tarikh . " " . $parvaz->saat) { $mysql = new mysql_class(); $mablagh = $ticket->mablagh * (1 - $ticket->poorsant / 100); $arg["toz"] = "حذف کامل بلیت شماره " . $ticket->shomare; $arg["toz"] .= 'از پرواز شماره ' . $parvaz->shomare . ' تاریخ ' . audit_class::hamed_pdate($parvaz->tarikh); $arg["user_id"] = $_SESSION[$conf->app . "_user_id"]; $arg["host"] = $_SERVER["REMOTE_ADDR"]; $arg["page_address"] = $_SERVER["SCRIPT_NAME"]; $arg["typ"] = 8; log_class::add($arg); $mysql->ex_sql("select `id`,`mablagh` from `customer_daryaft` where `sanad_record_id` = {$sanad_record_id}", $q); if (isset($q[0])) { if ((int) $q[0]["mablagh"] == $mablagh) { $mysql->ex_sqlx("delete from `customer_daryaft` where `id` = " . (int) $q[0]["id"]); } } $mysql->ex_sqlx("update `customer_daryaft` set `mablagh`=`mablagh`-{$mablagh} where `sanad_record_id` = {$sanad_record_id}"); $mysql->ex_sqlx("delete from `ticket` where `id` = " . $ticket->getId()); if ($ticket->adult < 2) { $parvaz->resetZarfiat(1); } $out = TRUE; } return $out; }
function loadZarfiat($inp) { $inp = (int) $inp; $par = new parvaz_det_class($inp); $out = $par->getZarfiat(); $zarfiat = $out; $id = 'zarfiat_' . $inp; $onclick = "onclick=\"sendZarfiat({$inp})\""; $out = '<span style=\'cursor:pointer;\' ' . $onclick . ' >' . $zarfiat . '</span>'; if ($zarfiat == 0) { $out = '<span class=\'notice\' style=\'cursor:pointer;\' ' . $onclick . ' >CLOSED</span>'; } return $out; }
mysql_class::ex_sql("select `id` from `reserve_tmp` where `id` = " . $tmp_id[0], $qqq); if (!($rrr = mysql_fetch_array($qqq))) { die('<script>window.location = "index.php";</script>'); } mysql_class::ex_sql("select MAX(`sanad_record_id`) as `sss` from `customer_daryaft`", $q); if ($r = mysql_fetch_array($q)) { $sanad_record_id = (int) $r["sss"] > 199 ? (int) $r["sss"] : 199; $sanad_record_id++; } $ticket = new ticket_class(); $ticket->clearTickets(); $ok = TRUE; $jam_ghimat1 = 0; $index = 0; $domasire_ast = FALSE; if (count($selectedParvaz) == 2 && parvaz_det_class::check_raft_bargasht($selectedParvaz[0]->getId(), $selectedParvaz[1]->getId())) { $domasire_ast = TRUE; } $p_i = 0; $adl_last = array(); $chd_last = array(); $inf_last = array(); foreach ($selectedParvaz as $parvaz) { for ($i = 0; $i < $adl; $i++) { //$ticket->fname = $_REQUEST["adl_fname_$i"]; $ticket->lname = $_REQUEST["adl_lname_{$i}"]; $ticket->tel = isset($_REQUEST["adl_tel_{$i}"]) ? $_REQUEST["adl_tel_{$i}"] : ''; $ticket->adult = 0; $ticket->parvaz_det_id = $parvaz->getId(); $ticket->mablagh = $parvaz->ghimat; $ticket->poorsant = $customer->getPoorsant($parvaz->getId());
} else { if ($conf->ps === TRUE) { $redirect = "<script language=\"javascript\">alert(\"کد رهگیری شما \\n {$rahgiri} \\n میباشد . آن را یادداشت کنید.\");ps_postRefId('{$pay_code}');</script>"; } else { die('خطا در ارتباط با بانک'); } } } } else { die("err"); } } else { if ($kharid_typ == 'etebari') { $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); } if ($ok) { echo "<div style='font-size:130%;height:100px;padding:50px;' class='msg detail_div' onclick=\"printTicket('{$sanad_record_id}');\" >ثبت با موفقیت انجام شد جهت مشاهده بلیتها <span class='notice' >اینجا</span> کلیک کنید</div>"; } else { die("<script language=\"javascript\">alert('ثبت ناموفق');</script>"); } } } } $gname = 'grid_checkflight'; $input = array($gname => array('table' => 'parvaz_det', 'div' => 'grid_checkflight_div')); $xgrid = new xgrid($input); //$xgrid->eRequest[$gname] = array('adl'=>$adl,'chd'=>$chd,'inf'=>$inf,'selected_parvaz'=>$selected_parvaz,'ticket_type'=>$ticket_type,'kharid_typ'=>$kharid_typ); /* $xgrid->whereClause[$gname] = "`id`='$selected_parvaz'";
function zarfiat($inp) { $inp = (int) $inp; $conf = new conf(); $par = new parvaz_det_class($inp); $inp = $par->getZarfiat((int) $_SESSION[$conf->app . '_customer_id']); if ($inp > 9) { $inp = 9; } $out = $inp; if ($out == 0) { $out = '<span class="notice" >CLOSED</span>'; } return $out; }
register_shutdown_function('session_write_close'); session_start(); if (!isset($_SESSION[$conf->app . '_user_id'])) { die($conf->access_deny); } $se = security_class::auth((int) $_SESSION[$conf->app . '_user_id']); if (!$se->can_view) { die(lang_fa_class::access_deny); } function hamed_pdate($str) { $out = jdate('Y/n/j', strtotime($str)); return enToPerNums($out); } $parvaz_det_id = isset($_REQUEST["parvaz_det_id"]) ? (int) $_REQUEST["parvaz_det_id"] : -1; $parvaz = new parvaz_det_class($parvaz_det_id); $par = new parvaz_class($parvaz->parvaz_id); $zarfiat = isset($_REQUEST["zarfiat"]) ? (int) $_REQUEST["zarfiat"] : $parvaz->zarfiat; $out = ''; if (isset($_REQUEST["zarfiat"])) { $mysql = new mysql_class(); //die($parvaz->zarfiat." ".$parvaz->getZarfiat().' '.$zarfiat); if ($zarfiat > $parvaz->zarfiat) { $parvaz->kharidParvaz($zarfiat - $parvaz->zarfiat); } else { if ($zarfiat < $parvaz->zarfiat) { $parvaz->mablagh_kharid = -1 * $parvaz->mablagh_kharid; $parvaz->kharidParvaz($zarfiat < $parvaz->zarfiat); } } if ($parvaz->zarfiat - $parvaz->getZarfiat() <= $zarfiat) {
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; }
public function addTmp($parvaz_det_id, $tedad, $timeout, $netlog, $rwaitlog, $adlprice, $chdprice, $infprice, $adl, $chd, $inf, $customer_id = -1) { $mysql = new mysql_class(); $conf = new conf(); if ($customer_id <= 0) { if (isset($_SESSION[$conf->app . "_customer_id"])) { $customer_id = (int) $_SESSION[$conf->app . "_customer_id"]; } } $cust = new customer_class($customer_id); $parvaz_det = new parvaz_det_class((int) $parvaz_det_id); $free_zarfiat = $parvaz_det->getZarfiat(-1); $zakhire = 0; $zarfiat = 0; if ($free_zarfiat < $tedad) { $zakhire = $tedad - $free_zarfiat; } $zarfiat = $tedad; $arg["toz"] = "ثبت موقت برای پرواز شماره \n\t\t\t" . $parvaz_det->shomare . ' تاریخ ' . audit_class::hamed_pdate($parvaz_det->tarikh) . "\n\t\t\t\t\t\t\t\t به تعداد\n\t\t\t{$tedad}\n\t\t\t\t\t\t\t\t از طریق" . $cust->name; $arg["user_id"] = isset($_SESSION) ? $_SESSION[$conf->app . "_user_id"] : -1; $arg["host"] = $_SERVER["REMOTE_ADDR"]; $arg["page_address"] = $_SERVER["SCRIPT_NAME"]; $arg["typ"] = 4; log_class::add($arg); $tarikh = date("Y-m-d H:i:s"); $con = $mysql->ex_sqlx("insert into `reserve_tmp` (`parvaz_det_id`,`tedad`,`customer_id`,`zakhire`,`zarfiat`,`tarikh`,`timeout`,`netlog`,`rwaitlog`,`adlprice`,`chdprice`,`infprice`,`adltedad`, `chdtedad`, `inftedad`,`parvaz_det_info`) values ('{$parvaz_det_id}','{$tedad}','{$customer_id}','{$zakhire}','{$zarfiat}','{$tarikh}','{$timeout}','{$netlog}','{$rwaitlog}',{$adlprice},{$chdprice},{$infprice},{$adl},{$chd},{$inf},'" . serialize($parvaz_det) . "') ", FALSE); $out = $mysql->insert_id($con); $mysql->close($con); return $out; }
function edit_item($id, $field, $value) { $lastvalue = ""; $mysql = new mysql_class(); $mysql->ex_sql("select `{$field}` from `parvaz_det` where `id`='{$id}'", $q); if (isset($q[0])) { $lastvalue = $q[0][$field]; } $arg["toz"] = "اصلاح فیلد {$field} از id {$id} به مقدار {$value} از مقدار {$lastvalue}"; $arg["user_id"] = $_SESSION[$conf->app . "_user_id"]; $arg["host"] = $_SERVER["REMOTE_ADDR"]; $arg["page_address"] = $_SERVER["SCRIPT_NAME"]; $arg["typ"] = 2; log_class::add($arg); switch ($field) { case 'mablagh_kharid': $par = new parvaz_det_class((int) $id); $par->mablagh_kharid = $value - $lastvalue; $par->kharidParvaz($par->zarfiat, 'بابت تغییر قیمت خرید پرواز از ' . $lastvalue . ' به ' . $value); break; case 'customer_id': $par = new parvaz_det_class((int) $id); $par->mablagh_kharid = -1 * $par->mablagh_kharid; $cust1 = new customer_class($par->customer_id); $cust1 = $par->customer_id > 0 ? $cust1->name : 'مدیریت'; $cust2 = new customer_class($value); $cust2 = $value > 0 ? $cust2->name : 'مدیریت'; $par->kharidParvaz($par->zarfiat, 'بابت تغییر فروشنده از ' . $cust1 . ' به ' . $cust2); $par->mablagh_kharid = -1 * $par->mablagh_kharid; $par->customer_id = $value; $par->kharidParvaz($par->zarfiat, 'بابت تغییر فروشنده از ' . $cust1 . ' به ' . $cust2); break; case 'j_id': if ($lastvalue == 0 && $value == 1) { $GLOBALS['extraScript'] = "openjid('{$id}');"; } break; } $mysql->ex_sqlx("update `parvaz_det` set `{$field}`='{$value}' where `id`='{$id}'"); }