public function actionCreate() { // return; $model = new MtPinjamKendaraan(); if (!Yii::app()->request->isAjaxRequest) { return; } if (isset($_POST) && !empty($_POST)) { $status = false; $msg = 'Peminjaman kendaraan berhasil disimpan.'; $transaction = app()->db->beginTransaction(); $id = -1; try { $ref = new MtReferenceCom(); $docref = $ref->get_next_reference(PINJAM_KENDARAAN); $user = app()->user->getId(); foreach ($_POST as $k => $v) { if ($k == 'ongkos_sewa' || $k == 'ongkos_driver' || $k == 'ongkos_bbm' || $k == 'total_ongkos' || $k == 'dp' || $k == 'sisa_tagihan' || $k == 'disc' || $k == 'total') { $v = get_number($v); } $_POST['MtPinjamKendaraan'][$k] = $v; } $_POST['MtPinjamKendaraan']['entry_time'] = Now(); $_POST['MtPinjamKendaraan']['id_driver'] = is_integer($_POST['MtPinjamKendaraan']['id_driver']) ? $_POST['MtPinjamKendaraan']['id_driver'] : NULL; $_POST['MtPinjamKendaraan']['users_id'] = $user; $_POST['MtPinjamKendaraan']['doc_ref'] = $docref; $model->attributes = $_POST['MtPinjamKendaraan']; $msg = "Data gagal disimpan"; if ($model->save()) { $status = true; $msg = "Data berhasil di simpan dengan id " . $model->id_pinjam; } else { $status = false; } $id = $docref; $date = $model->trans_date; $ref->save(PINJAM_KENDARAAN, $model->id_pinjam, $docref); if ($model->dp > 0) { $bank_account = '0'; if ($model->trans_via == "Tunai") { $bank_account = Mt::get_act_code_from_bank_act(Mt::get_prefs('akun_kas_ditangan')); } else { $bank_account = Mt::get_act_code_from_bank_act(Mt::get_prefs('akun_kas_dibank')); } // debet kas - kredit pendapatan Mt::add_gl(PINJAM_KENDARAAN, $model->id_pinjam, $date, $docref, $bank_account, '-', $model->dp, $user, $model->id_mobil); Mt::add_gl(PINJAM_KENDARAAN, $model->id_pinjam, $date, $docref, Mt::get_prefs('akun_uang_muka'), '-', -$model->dp, $user, $model->id_mobil); } $transaction->commit(); } catch (Exception $ex) { $transaction->rollback(); $status = false; $msg = $ex; } echo CJSON::encode(array('success' => $status, 'msg' => $msg, 'id' => $id)); Yii::app()->end(); } }
function menu_footer($no_menu, $is_index) { global $version, $allow_demo_mode, $app_title, $power_url, $power_by, $path_to_root, $Pagehelp, $Ajax; include_once $path_to_root . "/includes/date_functions.inc"; $context = array('isIndex' => $is_index, 'date' => Today(), 'time' => Now()); if ($no_menu == false) { $footer = ThemeBootstrap::get()->renderBlock('page.twig.html', 'footer', $context); echo $footer; } }
public function Base_AfterBody_Handler($Sender) { $Session = Gdn::Session(); if (!Debug() && !$Session->CheckPermission('Plugins.Debugger.View')) { return; } if (!$Sender->Head) { $Sender->Head = new HeadModule($Sender); } $Sender->Head->AddCss('/plugins/Debugger/style.css'); //$Session = Gdn::Session(); //if ($Session->CheckPermission('Plugins.Debugger.View')) { $String = '<div id="Sql" class="DebugInfo">'; $String .= '<h2>' . T('Debug Information') . '</h2>'; // Add the canonical Url. if (method_exists($Sender, 'CanonicalUrl')) { $CanonicalUrl = htmlspecialchars($Sender->CanonicalUrl(), ENT_COMPAT, 'UTF-8'); $String .= '<div class="CanonicalUrl"><b>' . T('Canonical Url') . "</b>: <a href=\"{$CanonicalUrl}\">{$CanonicalUrl}</a></div>"; } $Database = Gdn::Database(); $SQL = $Database->SQL(); if (!is_null($Database)) { $Queries = $Database->Queries(); $QueryTimes = $Database->QueryTimes(); $String .= '<h3>' . count($Queries) . ' queries in ' . $Database->ExecutionTime() . 's</h3>'; foreach ($Queries as $Key => $QueryInfo) { $Query = $QueryInfo['Sql']; // this is a bit of a kludge. I found that the regex below would mess up when there were incremented named parameters. Ie. it would replace :Param before :Param0, which ended up with some values like "'4'0". if (isset($QueryInfo['Parameters']) && is_array($QueryInfo['Parameters'])) { $tmp = $QueryInfo['Parameters']; $Query = $SQL->ApplyParameters($Query, $tmp); } $String .= $QueryInfo['Method'] . '<small>' . @number_format($QueryTimes[$Key], 6) . 's</small>' . (isset($QueryInfo['Cache']) ? '<div><b>Cache:</b> ' . var_export($QueryInfo['Cache'], TRUE) . '</div>' : '') . '<pre>' . htmlspecialchars($Query) . ';</pre>'; } } $String .= '<h3>Controller Data</h3><pre>'; $String .= self::FormatData($Sender->Data); $String .= '</pre>'; global $Start; $String .= '<h3>Page completed in ' . round(Now() - $_SERVER['REQUEST_TIME'], 4) . 's</h3>'; /* <div> <strong>Application:</strong> ' . $Sender->ApplicationFolder . '; <strong>Controller:</strong> ' . $Sender->ClassName . '; <strong>Method:</strong> ' . $Sender->RequestMethod . '; </div> </div>'; */ $String .= '</div>'; echo $String; //} }
public function actionCreate() { if (!Yii::app()->request->isAjaxRequest) { return; } if (isset($_POST) && !empty($_POST)) { $gl = new GlPah(); $status = false; $msg = 'Kas masuk berhasil disimpan.'; $user = Yii::app()->user->getId(); $id = -1; //require_once(Yii::app()->basePath . '/vendors/frontaccounting/ui.inc'); app()->db->autoCommit = false; $transaction = app()->db->beginTransaction(); try { $ref = new PahReferenceCom(); $docref = $ref->get_next_reference(KAS_MASUK); $kas_masuk = new PahKasMasuk(); foreach ($_POST as $k => $v) { if ($k == 'amount') { $v = get_number($v); } $_POST['PahKasMasuk'][$k] = $v; } $date = $_POST['PahKasMasuk']['trans_date']; $_POST['PahKasMasuk']['entry_time'] = Now(); $_POST['PahKasMasuk']['users_id'] = $user; $_POST['PahKasMasuk']['doc_ref'] = $docref; $kas_masuk->attributes = $_POST['PahKasMasuk']; if (!$kas_masuk->save()) { throw new Exception("Gagal menyimpan kas masuk."); } $id = $docref; $ref->save(KAS_MASUK, $kas_masuk->kas_masuk_id, $docref); $bank_account = Pah::get_act_code_from_bank_act($kas_masuk->pah_bank_accounts_id); $act_donatur = $kas_masuk->pahDonatur->pah_chart_master_account_code; //debet kode kas/bank - kredit pendapatan $gl->add_gl(KAS_MASUK, $kas_masuk->kas_masuk_id, $date, $docref, $bank_account, '-', $kas_masuk->amount, $user); $gl->add_gl(KAS_MASUK, $kas_masuk->kas_masuk_id, $date, $docref, $act_donatur, $kas_masuk->note, -$kas_masuk->amount, $user); $gl->validate(); $transaction->commit(); $status = true; } catch (Exception $ex) { $transaction->rollback(); $status = false; $msg = $ex; } } echo CJSON::encode(array('success' => $status, 'id' => $id, 'msg' => $msg)); Yii::app()->end(); }
public function actionCreate() { if (!Yii::app()->request->isAjaxRequest) { return; } if (isset($_POST) && !empty($_POST)) { $gl = new GlPah(); $status = false; $msg = 'Anggaran berhasil disimpan.'; $user = Yii::app()->user->getId(); $id = -1; //require_once(Yii::app()->basePath . '/vendors/frontaccounting/ui.inc'); app()->db->autoCommit = false; $transaction = app()->db->beginTransaction(); try { $ref = new PahReferenceCom(); $docref = $ref->get_next_reference(AKTIVITAS); $aktivitas = new PahAktivitas(); foreach ($_POST as $k => $v) { if ($k == 'amount') { $v = get_number($v); } $_POST['PahAktivitas'][$k] = $v; } $date = $_POST['PahAktivitas']['trans_date']; $_POST['PahAktivitas']['entry_time'] = Now(); $_POST['PahAktivitas']['users_id'] = $user; $_POST['PahAktivitas']['doc_ref'] = $docref; $aktivitas->attributes = $_POST['PahAktivitas']; if (!$aktivitas->save()) { throw new Exception("Gagal menyimpan aktivitas."); } $id = $docref; $ref->save(AKTIVITAS, $aktivitas->aktivitas_id, $docref); $bank_account = Pah::get_act_code_from_bank_act($aktivitas->pah_bank_accounts_id); $act_sub = $aktivitas->pahSubAktivitas->account_code; //debet kode beban - kredit kas bank $gl->add_gl(AKTIVITAS, $aktivitas->aktivitas_id, $date, $docref, $act_sub, $aktivitas->note, $aktivitas->amount, $user); $gl->add_gl(AKTIVITAS, $aktivitas->aktivitas_id, $date, $docref, $bank_account, '-', -$aktivitas->amount, $user); $gl->validate(); $transaction->commit(); $status = true; } catch (Exception $ex) { $transaction->rollback(); $status = false; $msg = $ex; } echo CJSON::encode(array('success' => $status, 'id' => $id, 'msg' => $msg)); Yii::app()->end(); } }
public function actionCreate() { if (!Yii::app()->request->isAjaxRequest) { return; } if (isset($_POST) && !empty($_POST)) { $status = false; $msg = 'Kas keluar berhasil disimpan.'; $user = Yii::app()->user->getId(); $id = -1; //require_once(Yii::app()->basePath . '/vendors/frontaccounting/ui.inc'); app()->db->autoCommit = false; $transaction = app()->db->beginTransaction(); try { $ref = new PeReferenceCom(); $docref = $ref->get_next_reference(KAS_KELUAR); $kas_keluar = new PeKasKeluar(); foreach ($_POST as $k => $v) { if ($k == 'amount') { $v = get_number($v); } $_POST['PeKasKeluar'][$k] = $v; } $date = $_POST['PeKasKeluar']['trans_date']; $_POST['PeKasKeluar']['entry_time'] = Now(); $_POST['PeKasKeluar']['users_id'] = $user; $_POST['PeKasKeluar']['doc_ref'] = $docref; $kas_keluar->attributes = $_POST['PeKasKeluar']; if (!$kas_keluar->save()) { throw new Exception("Gagal menyimpan kas_keluar."); } $id = $docref; $ref->save(KAS_KELUAR, $kas_keluar->kas_keluar_id, $docref); $bank_account = Pe::get_act_code_from_bank_act($kas_keluar->pe_bank_accounts_id); //debet kode beban - kredit kas/bank Pe::add_gl(KAS_KELUAR, $kas_keluar->kas_keluar_id, $date, $docref, $kas_keluar->pe_account_code, $kas_keluar->note, $kas_keluar->amount, $user); Pe::add_gl(KAS_KELUAR, $kas_keluar->kas_keluar_id, $date, $docref, $bank_account, '-', -$kas_keluar->amount, $user); $transaction->commit(); $status = true; } catch (Exception $ex) { $transaction->rollback(); $status = false; $msg = $ex; } } echo CJSON::encode(array('success' => $status, 'id' => $id, 'msg' => $msg)); Yii::app()->end(); }
function menu_footer($no_menu, $is_index) { global $path_to_root, $power_url, $power_by; include_once $path_to_root . "/includes/date_functions.inc"; if ($no_menu == false) { echo "<div id='footer'>\n"; if (isset($_SESSION['wa_current_user'])) { echo "<span class='power'><a target='_blank' href='{$power_url}'>{$power_by}</a></span\n"; echo "<span class='date'>" . Today() . " | " . Now() . "</span>\n"; echo "<span class='date'>" . show_users_online() . "</span>\n"; } echo "</div>\n"; } echo "</div>\n"; echo "</div>\n"; }
public function Base_Render_Before($Sender) { $Session = Gdn::Session(); if (!$Session->CheckPermission('Garden.Settings.Manage')) { return; } if (!$Sender->Head) { $Sender->Head = new HeadModule($Sender); } $Sender->Head->AddCss('/plugins/Debugger/style.css'); //$Session = Gdn::Session(); //if ($Session->CheckPermission('Plugins.Debugger.View')) { $String = '<div id="Sql">'; $Database = Gdn::Database(); if (!is_null($Database)) { $Queries = $Database->Queries(); $QueryTimes = $Database->QueryTimes(); $String .= '<h3>' . count($Queries) . ' queries in ' . $Database->ExecutionTime() . 's</h3>'; foreach ($Queries as $Key => $QueryInfo) { $Query = $QueryInfo['Sql']; // this is a bit of a kludge. I found that the regex below would mess up when there were incremented named parameters. Ie. it would replace :Param before :Param0, which ended up with some values like "'4'0". if (isset($QueryInfo['Parameters']) && is_array($QueryInfo['Parameters'])) { $tmp = $QueryInfo['Parameters']; arsort($tmp); foreach ($tmp as $Name => $Parameter) { $Pattern = '/(.+)(' . $Name . ')([\\W\\s]*)(.*)/'; $Replacement = "\$1'" . htmlentities($Parameter, ENT_COMPAT, 'UTF-8') . "'\$3\$4"; $Query = preg_replace($Pattern, $Replacement, $Query); } } $String .= '<div>' . $QueryInfo['Method'] . '</div><pre>' . $Query . ';</pre><small>' . number_format($QueryTimes[$Key], 6) . 's</small>'; } } global $Start; $String .= '<h3>Page completed in ' . round(Now() - $_SERVER['REQUEST_TIME'], 4) . 's</h3>'; /* <div> <strong>Application:</strong> ' . $Sender->ApplicationFolder . '; <strong>Controller:</strong> ' . $Sender->ClassName . '; <strong>Method:</strong> ' . $Sender->RequestMethod . '; </div> </div>'; */ $String .= '</div>'; $Sender->AddAsset('Foot', $String); //} }
function druckstatusR(&$r) { $tname = $r->RecordSource; if (IsNull($tname)) { $tname = 'Keine Tabelle'; } if (Left($tname, 7) == 'SELECT ') { $tname = 'SQL direkt'; } if (!is_a($r, 'AmberObject')) { $Rname = 'Falscher Parameter!!!'; } else { $Rname = $r->Name; } $d = ' am ' . Format(Now(), 'ddd dd.mmm.yyyy') . ' um ' . Format(Now(), 'hh.nn'); $s = $_SERVER['SERVER_NAME']; return 'Bericht: [' . $Rname . '] Tabelle/Abfrage: (' . $tname . ')' . $d . ' Server: [' . $s . ']'; }
public function Base_AfterBody_Handler($Sender) { $Session = Gdn::Session(); if (!$Session->CheckPermission('Garden.Settings.Manage')) { return; } if (!$Sender->Head) { $Sender->Head = new HeadModule($Sender); } $Sender->Head->AddCss('/plugins/Debugger/style.css'); //$Session = Gdn::Session(); //if ($Session->CheckPermission('Plugins.Debugger.View')) { $String = '<div id="Sql">'; $Database = Gdn::Database(); $SQL = $Database->SQL(); if (!is_null($Database)) { $Queries = $Database->Queries(); $QueryTimes = $Database->QueryTimes(); $String .= '<h3>' . count($Queries) . ' queries in ' . $Database->ExecutionTime() . 's</h3>'; foreach ($Queries as $Key => $QueryInfo) { $Query = $QueryInfo['Sql']; // this is a bit of a kludge. I found that the regex below would mess up when there were incremented named parameters. Ie. it would replace :Param before :Param0, which ended up with some values like "'4'0". if (isset($QueryInfo['Parameters']) && is_array($QueryInfo['Parameters'])) { $tmp = $QueryInfo['Parameters']; $Query = $SQL->ApplyParameters($Query, $tmp); } $String .= $QueryInfo['Method'] . '<small>' . @number_format($QueryTimes[$Key], 6) . 's</small>' . '<pre>' . $Query . ';</pre>'; } } global $Start; $String .= '<h3>Page completed in ' . round(Now() - $_SERVER['REQUEST_TIME'], 4) . 's</h3>'; /* <div> <strong>Application:</strong> ' . $Sender->ApplicationFolder . '; <strong>Controller:</strong> ' . $Sender->ClassName . '; <strong>Method:</strong> ' . $Sender->RequestMethod . '; </div> </div>'; */ $String .= '</div>'; echo $String; //} }
function Process() { if (_GET('filename') == '') { $this->Haxor(); return; } $img = new Image(); if (!$img->Find(array('filename' => _GET('filename')))) { $this->Error('Requested file not found'); return; } if (!InSESSION('view:' . _GET('filename'))) { $_SESSION['view:' . _GET('filename')] = true; $img->views++; } $img->lastshow = Now(); $img->Save(); $this->img = $img; $this->Render(); }
public function actionCreate() { $model = new PahLampiran(); if (!Yii::app()->request->isAjaxRequest) { return; } if (isset($_POST) && !empty($_POST)) { foreach ($_POST as $k => $v) { $_POST['PahLampiran'][$k] = $v; } $_POST['PahLampiran']['entry_time'] = Now(); $model->attributes = $_POST['PahLampiran']; $msg = "Data gagal disimpan"; if ($model->save()) { $status = true; $msg = "Data berhasil di simpan dengan id " . $model->id_lampiran; } else { $msg .= " " . CHtml::errorSummary($model); $status = false; } echo CJSON::encode(array('success' => $status, 'msg' => $msg)); Yii::app()->end(); } }
system('java -jar yuicompressor/yuicompressor-2.4.8.jar -o ' . $dest . substr($file, strlen($src)) . ' ' . $file); ++$totalYui; } else { copy($file, $dest . substr($file, strlen($src))); } } ++$totalFiles; } } } function ReplaceVersionName($fileName) { global $versionName; echo "Version name: {$versionName}\n"; $str = file_get_contents($fileName); $oldValue = "define('PACKAGE_STRING', 'lite_development');"; $newValue = "define('PACKAGE_STRING', '{$versionName}');"; $str = str_replace($oldValue, $newValue, $str); file_put_contents($fileName, $str); } $t0 = Now(); if (!EndsWith($src, '/')) { $src .= '/'; } if (!EndsWith($dest, '/')) { $dest .= '/'; } ProcessDir($src); ReplaceVersionName($dest . 'version.php'); $t = (Now() - $t0) / 1000; echo "Total: {$totalFiles} files ({$totalYui} minified) within {$totalDirs} directories in {$t} seconds.\n";
function menu_footer($no_menu, $is_index) { global $version, $allow_demo_mode, $app_title, $power_url, $power_by, $path_to_root, $Pagehelp, $Ajax; include_once $path_to_root . "/includes/date_functions.inc"; echo "</td></tr></table>\n"; // 'main_page' if ($no_menu == false) { if ($is_index) { echo "<table class='bottomBar'>\n"; } else { echo "<table class='bottomBar2'>\n"; } echo "<tr>"; if (isset($_SESSION['wa_current_user'])) { $phelp = implode('; ', $Pagehelp); echo "<td class='bottomBarCell'>" . Today() . " | " . Now() . "</td>\n"; $Ajax->addUpdate(true, 'hotkeyshelp', $phelp); echo "<td id='hotkeyshelp'>" . $phelp . "</td>"; } echo "</tr></table>\n"; } echo "</td></tr> </table>\n"; // 'callout_main' if ($no_menu == false) { echo "<table align='center' id='footer'>\n"; echo "<tr>\n"; echo "<td align='center' class='footer'><a target='_blank' href='{$power_url}' tabindex='-1'><font color='#ffffff'>{$app_title} {$version} - " . _("Theme:") . " " . user_theme() . " - " . show_users_online() . "</font></a></td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td align='center' class='footer'><a target='_blank' href='{$power_url}' tabindex='-1'><font color='#ffff00'>{$power_by}</font></a></td>\n"; echo "</tr>\n"; if ($allow_demo_mode == true) { echo "<tr>\n"; //echo "<td><br><div align='center'><a href='http://sourceforge.net'><img src='http://sourceforge.net/sflogo.php?group_id=89967&type=5' alt='SourceForge.net Logo' width='210' height='62' border='0' align='center' /></a></div></td>\n"; echo "</tr>\n"; } echo "</table><br><br>\n"; } }
$Database = Gdn::database(); $SQL = $Database->sql(); if (!is_null($Database)) { $String = ''; $Queries = $Database->Queries(); $String .= '<h3>' . count($Queries) . ' queries in ' . $Database->ExecutionTime() . 's</h3>'; foreach ($Queries as $Key => $QueryInfo) { $Query = $QueryInfo['Sql']; // this is a bit of a kludge. I found that the regex below would mess up when there were incremented named parameters. Ie. it would replace :Param before :Param0, which ended up with some values like "'4'0". if (isset($QueryInfo['Parameters']) && is_array($QueryInfo['Parameters'])) { $tmp = $QueryInfo['Parameters']; $Query = $SQL->ApplyParameters($Query, $tmp); } $String .= $QueryInfo['Method'] . ' <small>' . $QueryInfo['connection'] . '</small>' . ' <small>' . @number_format($QueryInfo['Time'], 6) . 's</small> ' . (isset($QueryInfo['Cache']) ? '<div><b>Cache:</b> ' . var_export($QueryInfo['Cache'], true) . '</div>' : '') . '<pre>' . htmlspecialchars($Query) . ';</pre>'; } echo $String; } global $Start; echo '<h3>Page completed in ' . round(Now() - $_SERVER['REQUEST_TIME'], 4) . 's</h3>'; ?> <h3>Controller Data</h3> <pre> <?php echo DebuggerPlugin::FormatData(Gdn::controller()->Data); ?> </pre> </div>
function menu_footer($no_menu, $is_index) { global $version, $allow_demo_mode, $app_title, $power_url, $power_by, $path_to_root, $Pagehelp, $Ajax; include_once $path_to_root . "/includes/date_functions.inc"; echo "</div>"; // column echo "</td></tr><tr><td colspan='2'>"; if ($no_menu == false) { if ($is_index) { echo "<table class=bottomBar>\n"; } else { echo "<table class=bottomBar2>\n"; } echo "<tr>"; if (isset($_SESSION['wa_current_user'])) { $phelp = implode('; ', $Pagehelp); echo "<td class=bottomBarCell>" . Today() . " | " . Now() . "</td>\n"; $Ajax->addUpdate(true, 'hotkeyshelp', $phelp); echo "<td id='hotkeyshelp'>" . $phelp . "</td>"; } echo "</tr></table>\n"; } echo "</td></tr></table></td>\n"; echo "</table>\n"; if ($no_menu == false) { echo "<table align='center' id='footer'>\n"; echo "<tr>\n"; echo "<td align='center' class='footer'><a target='_blank' href='{$power_url}'><font color='#ffffff'>{$app_title} {$version} - " . _("Theme:") . " " . user_theme() . " - " . show_users_online() . "</font></a></td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td align='center' class='footer'><a target='_blank' href='{$power_url}'><font color='#ffff00'>{$power_by}</font></a></td>\n"; echo "</tr>\n"; if ($allow_demo_mode == true) { echo "<tr>\n"; echo "</tr>\n"; } echo "</table><br><br>\n"; } }
function menu_footer($no_menu, $is_index) { global $path_to_root, $power_url, $power_by, $version, $db_connections; include_once $path_to_root . "/includes/date_functions.inc"; if (!$no_menu) { echo "</div>\n"; } // fa-content echo "</div>\n"; // fa-body if (!$no_menu) { echo "<div class='fa-footer'>\n"; if (isset($_SESSION['wa_current_user'])) { echo "<span class='power'><a target='_blank' href='{$power_url}'>{$power_by} {$version}</a></span>\n"; echo "<span class='date'>" . Today() . " " . Now() . "</span>\n"; echo "<span class='date'>" . $db_connections[$_SESSION["wa_current_user"]->company]["name"] . "</span>\n"; echo "<span class='date'>" . $_SERVER['SERVER_NAME'] . "</span>\n"; echo "<span class='date'>" . $_SESSION["wa_current_user"]->name . "</span>\n"; echo "<span class='date'>" . _("Theme:") . " " . user_theme() . "</span>\n"; echo "<span class='date'>" . show_users_online() . "</span>\n"; } echo "</div>\n"; // footer } echo "</div>\n"; // fa-main }
public function actionCreate() { $model = new MtKembaliKendaraan(); if (!Yii::app()->request->isAjaxRequest) { return; } if (isset($_POST) && !empty($_POST)) { $status = false; $msg = 'Peminjaman kendaraan berhasil disimpan.'; $transaction = app()->db->beginTransaction(); $id = -1; try { $ref = new MtReferenceCom(); $docref = $ref->get_next_reference(KEMBALI_KENDARAAN); $user = app()->user->getId(); foreach ($_POST as $k => $v) { if ($k == 'ongkos_sewa' || $k == 'ongkos_driver' || $k == 'ongkos_bbm' || $k == 'total_ongkos' || $k == 'dp' || $k == 'ongkos_extend' || $k == 'disc' || $k == 'total' || $k == 'pelunasan') { $v = get_number($v); } $_POST['MtKembaliKendaraan'][$k] = $v; } $_POST['MtKembaliKendaraan']['entry_time'] = Now(); $_POST['MtKembaliKendaraan']['users_id'] = $user; $_POST['MtKembaliKendaraan']['doc_ref_kembali'] = $docref; $model->attributes = $_POST['MtKembaliKendaraan']; $msg = "Data gagal disimpan"; if ($model->save()) { $status = true; $msg = "Data berhasil di simpan dengan id " . $model->id_kembali; } else { $status = false; } $id = $docref; $date = $model->trans_date; $ref->save(KEMBALI_KENDARAAN, $model->id_kembali, $docref); if ($model->pelunasan > 0) { $bank_account = '0'; if ($model->trans_via == "Tunai") { $bank_account = Mt::get_act_code_from_bank_act(Mt::get_prefs('akun_kas_ditangan')); } else { $bank_account = Mt::get_act_code_from_bank_act(Mt::get_prefs('akun_kas_dibank')); } Mt::add_gl(KEMBALI_KENDARAAN, $model->id_kembali, $date, $docref, $bank_account, '-', $model->pelunasan, $user, $model->idPinjam->id_mobil); Mt::add_gl(KEMBALI_KENDARAAN, $model->id_kembali, $date, $docref, Mt::get_prefs('akun_uang_muka'), "-", $model->dp, $user, $model->idPinjam->id_mobil); Mt::add_gl(KEMBALI_KENDARAAN, $model->id_kembali, $date, $docref, Mt::get_prefs('akun_pendapatan_sewa'), '-', -$model->total, $user, $model->idPinjam->id_mobil); if ($model->disc > 0) { Mt::add_gl(KEMBALI_KENDARAAN, $model->id_kembali, $date, $docref, Mt::get_prefs('akun_diskon'), "-", $model->disc, $user, $model->idPinjam->id_mobil); } } $pinjam = $this->loadModel($model->id_pinjam, 'MtPinjamKendaraan'); $pinjam->is_back = 1; $pinjam->id_driver = $_POST['MtKembaliKendaraan']['id_driver']; $pinjam->save(); $transaction->commit(); } catch (Exception $ex) { $transaction->rollback(); $status = false; $msg = $ex; } echo CJSON::encode(array('success' => $status, 'msg' => $msg, 'id' => $id)); Yii::app()->end(); } }
if (isset($_POST['form_type'])) { if ($_SESSION['token'] != $_POST['token']) { die("Request forgery detected"); } //post a new story if ($_POST['form_type'] == 'postStory') { $username = $_SESSION['username']; $storyTitle = $_POST['storyTitle']; $storyContent = $_POST['textArea']; $storyCategory = $_POST['storyCategory']; $stmt = $mysqli->prepare("insert into story (username, title, story_content, cat_name, post_time) values ('s', 's', 's', 's', NOW())"); if (!$stmt) { printf("Query Prep Failed: %s\n", $mysqli->error); exit; } $stmt->bind_param('ssss', $username, $storyTtitle, $storyContent, Now()); $stmt->execute(); $stmt->close(); printf("<h3>Post successfully</h3><a href='person.php'>Go back</a>"); //delete a story } else { if ($_POST['form_type'] == 'deleteStory') { $deleteStoryId = $_POST['deleteStoryId']; $stmt = $mysqli->prepare("delete from comment where story_id=?"); if (!$stmt) { printf("Query Prep Failed: %s\n", $mysqli->error); exit; } $stmt->bind_param('s', $deleteStoryId); $stmt->execute(); $stmt->close();
public static function TimeSeconds() { static $Started; if (is_null($Started)) { $Started = Now(); } return FormatTimespan(Now() - $Started); }
public function Query($Sql, $InputParameters = NULL, $Options = array()) { $Trace = debug_backtrace(); $Method = ''; foreach ($Trace as $Info) { $Class = GetValue('class', $Info, ''); if ($Class === '' || StringEndsWith($Class, 'Model', TRUE) || StringEndsWith($Class, 'Plugin', TRUE)) { $Type = ArrayValue('type', $Info, ''); $Method = $Class . $Type . $Info['function'] . '(' . self::FormatArgs($Info['args']) . ')'; break; } } // Save the query for debugging // echo '<br />adding to queries: '.$Sql; $Query = array('Sql' => $Sql, 'Parameters' => $InputParameters, 'Method' => $Method); $SaveQuery = TRUE; if (isset($Options['Cache'])) { $CacheKeys = (array) $Options['Cache']; $Cache = array(); $AllSet = TRUE; foreach ($CacheKeys as $CacheKey) { $Value = Gdn::Cache()->Get($CacheKey); $CacheValue = $Value !== Gdn_Cache::CACHEOP_FAILURE; $AllSet &= $CacheValue; $Cache[$CacheKey] = $CacheValue; } $SaveQuery = !$AllSet; $Query['Cache'] = $Cache; } // Start the Query Timer $TimeStart = Now(); $Result = parent::Query($Sql, $InputParameters, $Options); // Aggregate the query times $TimeEnd = Now(); $this->_ExecutionTime += $TimeEnd - $TimeStart; if ($SaveQuery && !StringBeginsWith($Sql, 'set names')) { $Query['Time'] = $TimeEnd - $TimeStart; $this->_Queries[] = $Query; } return $Result; }
} else { // $coy = $def_coy; text_row(_("Company"), "company_login_nickname", "", 20, 50); } start_row(); label_cell("Please enter your e-mail", "colspan=2 align='center' id='log_msg'"); end_row(); end_table(1); echo "<center><input type='submit' value=' " . _("Send password -->") . " ' name='SubmitReset'\n\t\t onclick='set_fullmode();'></center>\n"; end_form(1); $Ajax->addScript(true, "document.forms[0].password.focus();"); echo "<script language='JavaScript' type='text/javascript'>\n //<![CDATA[\n <!--\n document.forms[0].email_entry_field.select();\n document.forms[0].email_entry_field.focus();\n //-->\n //]]>\n </script>"; div_end(); echo "<table class='bottomBar'>\n"; echo "<tr>"; if (isset($_SESSION['wa_current_user'])) { $date = Today() . " | " . Now(); } else { $date = date("m/d/Y") . " | " . date("h.i am"); } echo "<td class='bottomBarCell'>{$date}</td>\n"; echo "</tr></table>\n"; echo "<table class='footer'>\n"; echo "<tr>\n"; echo "<td><a target='_blank' href='{$power_url}' tabindex='-1'>{$app_title} {$version} - " . _("Theme:") . " " . $def_theme . "</a></td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td><a target='_blank' href='{$power_url}' tabindex='-1'>{$power_by}</a></td>\n"; echo "</tr>\n"; echo "</table><br><br>\n"; echo "</body></html>\n";
function Image() { parent::DBEntity(true); $this->uploaded = Now(); $this->lastshow = Now(); }