public function overwriteForm($return, $returnfull) { $return = parent::overwriteForm($return, $returnfull); $return['app_active'] = new Leap\View\InputSelect($this->arrayYesNO, "app_active", "app_active", $this->app_active); $acc = new Account(); $arr1 = $acc->getWhere("admin_type = 1 ORDER BY admin_nama_depan ASC"); foreach ($arr1 as $cc) { $arrClient[$cc->admin_id] = $cc->admin_nama_depan; } $return['app_client_id'] = new \Leap\View\InputSelect($arrClient, "app_client_id", "app_client_id", $this->app_client_id); $acc = new Paket(); $arr1 = $acc->getWhere("paket_active = 1 ORDER BY paket_id ASC"); foreach ($arr1 as $cc) { $arrClient[$cc->paket_id] = $cc->paket_name; } $return['app_paket_id'] = new \Leap\View\InputSelect($arrClient, "app_paket_id", "app_paket_id", $this->app_paket_id); return $return; }
function pay() { $id = addslashes($_GET['app_id']); $acc = new App2Acc(); $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id AND ac_app_id = '{$id}' ", array("AppAccount")); if (count($apps) < 1) { die("hacking attempt"); } else { $app = $apps[0]; } $paket = new Paket(); $paket->getByID($app->app_paket_id); $dibayarkan = $paket->paket_price * 12; //veritrans config Veritrans_Config::$serverKey = self::$serverKey; $transaction_details = array('order_id' => rand(), 'gross_amount' => $dibayarkan); $item1_details = array('id' => $app->app_id, 'price' => $dibayarkan, 'quantity' => 1, 'name' => "Payment for " . $app->app_name); $item_details = array($item1_details); $ac = Account::getAccountObject(); $exp = explode(" ", Account::getMyName()); $lastname = array_pop($exp); $billing_address = array('first_name' => implode(" ", $exp), 'last_name' => $lastname, 'address' => "Mangga 20", 'city' => "Jakarta", 'postal_code' => "16602", 'phone' => "081122334455", 'country_code' => 'IDN'); $customer_details = array('first_name' => implode(" ", $exp), 'last_name' => $lastname, 'email' => $ac->admin_email, 'phone' => "081122334455", 'billing_address' => $billing_address); $transaction = array('transaction_details' => $transaction_details, 'customer_details' => $customer_details, 'item_details' => $item_details); try { // Redirect to Veritrans VTWeb page header('Location: ' . Veritrans_VtWeb::getRedirectionUrl($transaction)); } catch (Exception $e) { echo $e->getMessage(); if (strpos($e->getMessage(), "Access denied due to unauthorized")) { echo "<code>"; echo "<h4>Please set real server key from sandbox</h4>"; echo "In file: " . __FILE__; echo "<br>"; echo "<br>"; echo htmlspecialchars('Veritrans_Config::$serverKey = \'<your server key>\';'); die; } } }
public function paket_update($id) { $paket = Paket::find($id); $paket->user_id = Session::get('user_id'); $paket->id_cat = Input::get('jenis'); $paket->nama_paket = Input::get('nama_paket'); $paket->sumber_dana = Input::get('sumber_dana'); $paket->thn_anggaran = Input::get('thn_anggaran'); $paket->pagu = Input::get('pagu'); $paket->kode_rek = Input::get('kode_rek'); $paket->kode_rup = Input::get('kode_rup'); $paket->jenis_bayar = Input::get('jenis_bayar'); $paket->save(); return Redirect::to('admin/paket/add/' . $paket->id); }
function receipt() { $order_id = addslashes($_GET['order_id']); $order = new VpTransaction(); $order->getByID($order_id); // pr($order); //TODO : harus dibikin if ($order->order_acc_id != Account::getMyID() && !in_array("master_admin", Account::getMyRoles())) { die("hacking attempt"); } $app = new AppAccount(); $app->getByID($order->order_app_id); if ($app->app_active == 0) { die("App not active"); } $acc = new Account(); $acc->getByID($app->app_client_id); $paket = new Paket(); $paket->getByID($order->order_paket_id); $vpData = new VpData(); $arr = $vpData->getWhere("order_id = '{$order_id}' LIMIT 0,1"); if (count($arr) > 0) { $data = $arr[0]; } else { $data = new VpData(); } if ($acc->admin_marketer != "") { $arrAg = $acc->getWhere("admin_username = '******' LIMIT 0,1"); if (count($arrAg) > 0) { $agent = $arrAg[0]; } } // pr($arr); ?> <style> h1{ font-size: 25px; padding-top: 30px; } h3{ font-size: 20px; font-style: italic; } h4{ font-size: 17px; margin-top: 20px; margin-bottom: 30px; } .billings td{ padding-right: 20px; padding-bottom: 10px; } @media (max-width: 768px) { .monly { display: initial; } .donly { display: none; } h1{ font-size: 20px; } h3{ font-size: 17px; font-style: italic; } h4{ font-size: 14px; margin-bottom: 30px; } .billings td{ padding-bottom: 10px; } } @media (min-width: 768px) { .monly { display: none; } .donly { display: initial; } } @media print { .pure-toggle-label[data-toggle-label='left']{ display: none; } #printme{ display: none; } body{ background-color: #ffffff; } } </style> <div class="container attop" > <div class="col-md-8 col-md-offset-2"> <div style="text-align: center; background-color: #ffffff; padding: 20px; min-height: 800px; margin-top: 20px; padding-top: 20px; padding-bottom: 20px; "> <img src="<?php echo _SPPATH; ?> images/header_appear.jpg" width="100%"> <h1>PAYMENT RECEIPT</h1> <h3>Your payment has been completed successfully</h3> <div class="receipt" style=" margin-top: 30px;"> <h4>TRANSACTION DETAILS</h4> <table class="billings" align="center" style="text-align: left;"> <tr> <td>ORDER ID</td> <td><?php echo $order_id; ?> </td> </tr> <tr> <td>PAYMENT DATE / TIME</td> <td><?php echo date("F j, Y, g:i a", strtotime($order->order_date)); ?> </td> </tr> <tr> <td>PACKAGE NAME</td> <td><?php echo $paket->paket_name; ?> </td> </tr> <tr> <td>APP ID</td> <td><?php echo $app->app_id; ?> </td> </tr> <tr> <td>ACCOUNT ID</td> <td><?php echo $acc->admin_nama_depan; ?> </td> </tr> <tr> <td>AMOUNT</td> <td>IDR <?php echo idr($paket->paket_price); ?> </td> </tr> <tr> <td>STATUS</td> <td><?php echo $data->transaction_status; ?> </td> </tr> <tr> <td>PAYMENT TYPE</td> <td><?php echo $data->payment_type; ?> </td> </tr> <tr> <td>BANK NAME</td> <td><?php echo $data->bank; ?> </td> </tr> <?php if (count($arrAg) > 0) { ?> <tr> <td>AGENT ID</td> <td><?php echo $agent->admin_username; ?> </td> </tr> <?php } ?> </table> </div> </div> <div id="printme" style="text-align: right; margin-top: 5px; margin-bottom: 100px;" > <a href="#" onclick="window.print();"><i class="glyphicon glyphicon-print"></i> print</a> | <a href="<?php echo _SPPATH; ?> myOrders">back to my transactions</a> </div> </div> </div> <?php }
public function createPaketTableCustomer() { $paket = new Paket(); $arrPaket = $paket->getWhere("paket_active = 1"); $syarat = new PaketSyarat(); $arrSyarat = $syarat->getWhere("syarat_active = 1"); ?> <style> body{ background-color: #24e0ba; } label { /* display: inline-block; */ /* max-width: 100%; */ margin-bottom: 0px; /* font-weight: 700; */ } </style> <div class="pricing-container"> <div class="pricing-switcher"> <p class="fieldset"> <input type="radio" name="duration-1" value="monthly" id="monthly-1" checked> <label for="monthly-1">Monthly</label> <input type="radio" name="duration-1" value="yearly" id="yearly-1"> <label for="yearly-1">Yearly</label> <span class="switch"></span> </p> </div> <ul class="pricing-list bounce-invert"> <?php foreach ($arrPaket as $num => $pak) { ?> <li <?php if ($num == 1) { echo 'class="exclusive"'; } ?> > <ul class="pricing-wrapper"> <li data-type="monthly" class="is-visible"> <header class="pricing-header"> <h2><?php echo $pak->paket_name; ?> </h2> <div class="price"> <span class="currency">IDR</span> <span class="value"><?php echo idrK($pak->paket_price); ?> </span> <span class="duration">mo</span> </div> </header> <div class="pricing-body"> <ul class="pricing-features"> <?php foreach ($arrSyarat as $sya) { $mm = new PaketMatrix(); $mmid = $pak->paket_id . "_" . $sya->syarat_id; $mm->getByID($mmid); $val = $mm->ps_isi; if ($sya->syarat_rumus == "bool") { if ($val == "1") { ?> <li><?php echo $sya->syarat_name; ?> </li> <?php } else { ?> <li>-</li> <?php } } else { $exp = explode(",", $sya->syarat_rumus); $jenis = $exp[0]; $check = $exp[1]; if ($val == "") { $val = 0; } if ($jenis == "int" && $check == "=") { // echo $val; if ($val > 0) { ?> <li><em><?php echo $val; ?> </em> <?php echo $sya->syarat_name; ?> </li> <?php } } } ?> <?php } ?> <!-- <li><em>1</em> Template Style</li>--> <!-- <li><em>25</em> Products Loaded</li>--> <!-- <li><em>1</em> Image per Product</li>--> <!-- <li><em>Unlimited</em> Bandwidth</li>--> <!-- <li><em>24/7</em> Support</li>--> </ul> </div> <footer class="pricing-footer"> <a class="select" href="#">Sign Up</a> </footer> </li> <li data-type="yearly" class="is-hidden"> <header class="pricing-header"> <h2>Basic</h2> <div class="price"> <span class="currency">IDR</span> <span class="value"><?php echo idrK($pak->paket_price * 12); ?> </span> <span class="duration">yr</span> </div> </header> <div class="pricing-body"> <ul class="pricing-features"> <?php foreach ($arrSyarat as $sya) { $mm = new PaketMatrix(); $mmid = $pak->paket_id . "_" . $sya->syarat_id; $mm->getByID($mmid); $val = $mm->ps_isi; if ($sya->syarat_rumus == "bool") { if ($val == "1") { ?> <li><?php echo $sya->syarat_name; ?> </li> <?php } else { ?> <li>-</li> <?php } } else { $exp = explode(",", $sya->syarat_rumus); $jenis = $exp[0]; $check = $exp[1]; if ($val == "") { $val = 0; } if ($jenis == "int" && $check == "=") { // echo $val; if ($val > 0) { ?> <li><em><?php echo $val; ?> </em> <?php echo $sya->syarat_name; ?> </li> <?php } } } ?> <?php } ?> </ul> </div> <footer class="pricing-footer"> <a class="select" href="#">Sign Up</a> </footer> </li> </ul> </li> <?php } ?> </ul> </div> <style> ul,li{ margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; } /* HTML5 display-role reset for older browsers */ article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section, main { display: block; } body { line-height: 1; } ol, ul { list-style: none; } blockquote, q { quotes: none; } blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; } table { border-collapse: collapse; border-spacing: 0; } *, *::after, *::before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } html { font-size: 62.5%; } html * { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } body { font-size: 1.6rem; font-family: "Open Sans", sans-serif; color: #2d3d4f; background-color: #1bbc9d; } a { text-decoration: none; } </style> <?php }
function addConfirm() { $err = array(); $json['bool'] = 0; // $json['err'] = array("apptitle"=>"harus diisi"); $ttdate = addslashes($_POST['ttdate']); if ($ttdate == "") { $err['ttdate'] = "Date must be filled"; } $ttname = addslashes($_POST['ttname']); if ($ttname == "") { $err['ttname'] = "Name must be filled"; } $ttamount = addslashes($_POST['ttamount']); if ($ttamount == "") { $err['ttamount'] = "Amount must be filled"; } $ttto = addslashes($_POST['ttto']); if ($ttto == "") { $err['ttto'] = "Bank Account must be filled"; } if (count($err) > 0) { $json['bool'] = 0; $json['err'] = $err; } else { //save here $pc = new PaymentConfirm(); $pc->confirm_app_id = addslashes($_POST['appid']); $pc->confirm_bank = $ttto; $pc->confirm_amount = $ttamount; $pc->confirm_create_date = leap_mysqldate(); $pc->confirm_date = $ttdate; $pc->confirm_name = $ttname; $pc->confirm_receipt = addslashes($_POST['ttfile']); $pc->confirm_status = "not reviewed"; $pc->confirm_user_id = Account::getMyID(); $confirmID = $pc->save(); if ($confirmID) { $app = new AppAccount(); $app->getByID($pc->confirm_app_id); $app->app_active = 2; $app->load = 1; $app->app_pulsa = 1000; $app->save(); $paket = new Paket(); $paket->getByID($app->app_paket_id); //add pporder $ppo = new PaypalOrder(); $ppo->payment_id = $confirmID; $ppo->payment_type = "banktt"; $ppo->amount = $pc->confirm_amount; $ppo->currency = "IDR"; $ppo->created_time = leap_mysqldate(); $ppo->state = "pending"; $ppo->user_id = Account::getMyID(); $ppo->description = "Payment " . $app->app_name . " Paket " . $paket->paket_name . " ID : " . $app->app_id; $succ = $ppo->save(); if ($succ) { $json['bool'] = 1; $json['order_id'] = $succ; } else { $json['bool'] = 0; $json['all'] = "Saving PPO Error"; } } else { $json['bool'] = 0; $json['all'] = "Saving PConfirm Error"; } } echo json_encode($json); die; }
function free() { $app = new AppAccount(); $arrApp = $app->getWhere("app_active = 1 AND app_type = 1 ORDER BY app_contract_start ASC"); // pr($arrApp); ?> <h1>Free Approval Queue</h1> <div class="table-responsive"> <table class="table table-striped"> <thead> <tr> <th> App Details </th> <th> Organization Details </th> <th> User & Agent </th> <th> Contract </th> <th> Paket </th> <th> Status </th> </tr> </thead> <tbody> <?php foreach ($arrApp as $app) { $paket = new Paket(); $paket->getByID($app->app_paket_id); $acc = new Account(); $acc->getByID($app->app_client_id); $agent = new Account(); if ($acc->admin_marketer != "") { $agent->getByUsername($acc->admin_marketer); } $vp = new VpTransaction(); $arrT = $vp->getWhere("order_app_id = '{$app->app_id}'"); $free = new AppFree(); $free->getByID($app->app_id); ?> <tr> <td> ID :<?php echo $app->app_id; ?> <br> <?php echo $app->app_name; ?> </td> <td> Apply Date : <?php echo $free->free_date; ?> <br> Org Name : <?php echo $free->free_org_name; ?> <br> Org Type : <?php echo $free->free_org_type; ?> <br> Address : <?php echo $free->free_address; ?> <br> Contact Name : <?php echo $free->free_org_name; ?> <br> Phone : <?php echo $free->free_org_name; ?> <br> Email : <?php echo $free->free_org_name; ?> <br> Docs : <br><?php $exp = explode(",", $free->free_org_docs); foreach ($exp as $x) { ?> <a href="<?php echo _SPPATH . _PHOTOURL . "inputfiles/" . $x; ?> " target="_blank"> <img src="<?php echo _SPPATH . _PHOTOURL . "inputfiles/" . $x; ?> " width="100px"> </a> <?php } ?> </td> <td> <?php echo $acc->admin_username; ?> <?php echo $acc->admin_nama_depan; ?> <br> <?php echo $acc->admin_email; ?> <br> <?php echo $acc->admin_phone; ?> <hr> Agent <br> <?php echo $agent->admin_username; ?> <?php echo $agent->admin_nama_depan; ?> <br> <?php echo $agent->admin_email; ?> <br> <?php echo $agent->admin_phone; ?> </td> <td>Start : <?php echo $app->app_contract_start; ?> <br> End : <?php echo $app->app_contract_end; ?> </td> <td><?php echo $paket->paket_name; ?> </td> <td> <?php echo $app->app_active; ?> <br> <button onclick="accept_free('<?php echo $app->app_id; ?> ');" class="btn btn-default">Accept App</button><br> <button onclick="reject_free('<?php echo $app->app_id; ?> ');" class="btn btn-default">Reject App</button><br> <button onclick="view_free('<?php echo $app->app_id; ?> ');" class="btn btn-default">View App</button> </td> </tr> <?php } ?> </tbody> </table> </div> <script> function accept_free(id){ if(confirm("this will accept the app")) $.post("<?php echo _SPPATH; ?> JobBE/actionfree",{app_id:id,action : "accept"},function(data){ console.log(data); if(data.bool){ alert("Sukses"); lwrefresh('Accept_Free_Apps'); }else{ alert("Gagal"); } },'json'); } function reject_free(id){ if(confirm("this will reject the app")) $.post("<?php echo _SPPATH; ?> JobBE/actionfree",{app_id:id,action : "reject"},function(data){ console.log(data); if(data.bool){ alert("Sukses"); lwrefresh('Accept_Free_Apps'); }else{ alert("Gagal"); } },'json'); } function view_free(id){ } </script> <?php }
public static function myorderspage() { $arrPaymentStatus = array("1" => array("settlement", "success"), "2" => array("success", "success"), "3" => array("challenge", "failed"), "4" => array("pending", "pending"), "5" => array("deny", "denied"), "6" => array("cancel", "canceled")); ?> <style> @media (max-width: 768px) { .monly { display: initial; } .donly { display: none; } } @media (min-width: 768px) { .monly { display: none; } .donly { display: initial; } } </style> <style> .heading_earning{ font-size: 17px; font-style: italic; } .heading_amount{ font-size: 40px; } .inside{ padding: 20px; } .selectMonth{ /*padding-left: 10px;*/ } .payout{ color: #95abc2; } .money{ font-size: 22px; color: #73879C; } .big{ font-size: 25px; color: #73879C; } .rev_item{ background-color: #ffffff; margin-top: 20px; margin-bottom: 20px; } .order_id{ font-size: 20px; color: #73879C; } .pdate{ color: #73879C; font-style: italic; } .heading_amount{ font-size: 30px; text-align: right; padding-bottom: 100px; } .heading_amount_Sales{ font-size: 18px; text-align: right; /*padding-bottom: 20px;*/ } @media (max-width: 768px) { .monly { display: initial; } .donly { display: none; } .selectMonth{ padding-left: 0px; padding-bottom: 20px; border-bottom: 1px solid #CCCCCC; } .rightborder{ border-bottom: 1px solid #CCCCCC; } .leftborder{ border-top: 1px solid #CCCCCC; } .inside{ padding: 10px; } .tarmob{ /*text-align: right;*/ } } @media (min-width: 768px) { .monly { display: none; } .donly { display: initial; } .leftborder{ border-left: 1px solid #CCCCCC; min-height: 120px; } .rightborder{ border-right: 1px solid #CCCCCC; } } </style> <div class="container attop" > <div class="col-md-12"> <div class="appear_logo_pages"> <a href="<?php echo _SPPATH; ?> "> <img src="<?php echo _SPPATH; ?> images/appear-order.png" > </a> </div> <?php $orders = new VpTransaction(); $arrOrder = $orders->getWhere("order_acc_id = '" . Account::getMyID() . "' ORDER BY order_date DESC"); if (count($arrOrder) > 0) { foreach ($arrOrder as $num => $orders) { $app = new AppAccount(); $app->getByID($orders->order_app_id); $paket = new Paket(); $paket->getByID($orders->order_paket_id); ?> <div class="rev_item col-md-12"> <div class="col-md-5 "> <div class="inside"> <div class="payout col-md-6 col-sm-6 col-xs-6"> <div class="rev_details2"> <small>Order ID</small> <div class="order_id"><?php echo $orders->order_id; ?> </div> </div> </div> <div class="payout col-md-6 col-sm-6 col-xs-6"> <div class="rev_details"> Date : <?php echo date("F j, Y, g:i a", strtotime($orders->order_date)); ?> </div> <div class="rev_details"> App : <?php echo $app->app_name; ?> </div> <div class="rev_details"> Paket : <?php echo $paket->paket_name; ?> </div> </div> <div class="clearfix"></div> </div> </div> <div class="col-md-3 payout leftborder rightborder"> <div class="inside"> <div class="komisi tarmob"> Order Value <div class="order_id"> IDR <?php echo idr($orders->order_value); ?> </div> </div> </div> </div> <div class="col-md-4 "> <div class="inside tarmob"> <small>Status</small> <div class="money big"><?php echo $arrPaymentStatus[$orders->order_status][1]; ?> </div> <?php if ($orders->order_status == "1" || $orders->order_status == "2") { ?> <a href="<?php echo _SPPATH; ?> PaymentWeb/receipt?order_id=<?php echo $orders->order_id; ?> ">receipt</a> <?php } ?> <?php if ($orders->order_status != "1" && $orders->order_status != "2" && $orders->order_status != "4") { if ($app->app_active == 0) { ?> <a href="<?php echo _SPPATH; ?> PaymentWeb/pay?app_id=<?php echo $app->app_id; ?> ">pay again using different method</a> <?php } } ?> </div> </div> <div class="clearfix"></div> </div> <?php } ?> <div class="clearfix"></div> <?php } else { ?> <h1>No orders has been made yet</h1> <?php } ?> </div> </div> <?php }
public static function payoutWS($acc) { $agent_id = $acc->admin_id; $mon = isset($_GET['mon']) ? addslashes($_GET['mon']) : date("n"); $y = isset($_GET['y']) ? addslashes($_GET['y']) : date("Y"); $json['acc_id'] = $acc->admin_id; $json['mon'] = $mon; $json['y'] = $y; $arr = AppearSales::getPayoutArray($acc->admin_id, $mon, $y); foreach ($arr['pertama'] as $tt) { $app = new AppAccount(); $app->getByID($tt->komisi_app_id); $acc = new Account(); $acc->getByID($tt->komisi_app_client_id); $paket = new Paket(); $paket->getByID($tt->komisi_paket_id); $earn = array(); $earn['order_id'] = $tt->komisi_order_id; $earn['komisi_app_date'] = $tt->komisi_app_date; $earn['app_name'] = $app->app_name; $earn['app_id'] = $app->app_id; $earn['client_name'] = $acc->admin_nama_depan; $earn['paket_id'] = $paket->paket_id; $earn['paket_name'] = $paket->paket_name; // $earn['komisi_tingtong'] = $tt->komisi_ting_tong; // $earn['komisi_tingtong_date'] = $tt->komisi_tingtong_date; $earn['komisi_bagi_pertama_value'] = $tt->komisi_bagi_pertama_value; $earn['komisi_bagi_pertama_date'] = date("F Y", strtotime($tt->komisi_bagi_pertama_date)); $earn['komisi_bagi_kedua_value'] = $tt->komisi_bagi_kedua_value; $earn['komisi_bagi_kedua_date'] = date("F Y", strtotime($tt->komisi_bagi_kedua_date)); $earn['total_komisi'] = $tt->komisi_value; $json['payout']['first'][] = $earn; } foreach ($arr['kedua'] as $tt) { $app = new AppAccount(); $app->getByID($tt->komisi_app_id); $acc = new Account(); $acc->getByID($tt->komisi_app_client_id); $paket = new Paket(); $paket->getByID($tt->komisi_paket_id); $earn = array(); $earn['order_id'] = $tt->komisi_order_id; $earn['komisi_app_date'] = $tt->komisi_app_date; $earn['app_name'] = $app->app_name; $earn['app_id'] = $app->app_id; $earn['client_name'] = $acc->admin_nama_depan; $earn['paket_id'] = $paket->paket_id; $earn['paket_name'] = $paket->paket_name; // $earn['komisi_tingtong'] = $tt->komisi_ting_tong; // $earn['komisi_tingtong_date'] = $tt->komisi_tingtong_date; $earn['komisi_bagi_pertama_value'] = $tt->komisi_bagi_pertama_value; $earn['komisi_bagi_pertama_date'] = date("F Y", strtotime($tt->komisi_bagi_pertama_date)); $earn['komisi_bagi_kedua_value'] = $tt->komisi_bagi_kedua_value; $earn['komisi_bagi_kedua_date'] = date("F Y", strtotime($tt->komisi_bagi_kedua_date)); $earn['total_komisi'] = $tt->komisi_value; $json['payout']['kedua'][] = $earn; } foreach ($arr['bonus'] as $tt) { $app = new BonusKomisi(); $app->getByID($tt->bagi_bk_id); $acc = new Account(); $acc->getByID($tt->bagi_acc_id); $earn = array(); $earn['bonus_name'] = "Bonus " . $tt->bagi_bk_id; $earn['bonus_date'] = $tt->bagi_date_acquire; $earn['bonus_value'] = $tt->bagi_value; $json['payout']['bonus'][] = $earn; } $json['payout_total'] = AppearSales::calculatePayout($agent_id, $mon, $y)['total']; $json['status_code'] = 1; $json['status_message'] = "Success"; echo json_encode($json); die; }
public static function log($app, $vpt) { if ($app->app_active != 1) { die("App harus active utk dapat komisi"); } $acc = new Account(); $acc->getByID($app->app_client_id); // AppAccount::checkOwnership($app); if ($acc->admin_marketer != "") { $arrAcc = $acc->getWhere("admin_username = '******' LIMIT 0,1"); if (count($arrAcc) > 0) { $marketer = $arrAcc[0]; } else { //set default marketer to 7 /elroy $marketer = new Account(); $marketer->getByID(Efiwebsetting::getData("Default_Agent_ID")); } } else { //set default marketer to 7 /elroy $marketer = new Account(); $marketer->getByID(Efiwebsetting::getData("Default_Agent_ID")); } $paket = new Paket(); $paket->getByID($app->app_paket_id); $komisi = new KomisiModel(); $komisi->komisi_acc_id = $marketer->admin_id; $komisi->komisi_app_client_id = $app->app_client_id; $komisi->komisi_app_date = leap_mysqldate(); $komisi->komisi_app_id = $app->app_id; $komisi->komisi_paket_id = $paket->paket_id; $komisi->komisi_value = $paket->paket_komisi; $komisi->komisi_status = 0; //blm dibayarkan $komisi->komisi_sisa = $paket->paket_komisi; $komisi->komisi_order_id = $vpt->order_id; $komisi->komisi_bagi_pertama_value = $paket->paket_komisi_satu; $komisi->komisi_bagi_kedua_value = $paket->paket_komisi_dua; //langsung save datenya saja sehingga gampang $pay1_date = getFirstDayOfNextMonth(date("n", strtotime($komisi->komisi_app_date)), date("Y", strtotime($komisi->komisi_app_date))); $pay2_date = getFirstDayOfNext4Month(date("n", strtotime($komisi->komisi_app_date)), date("Y", strtotime($komisi->komisi_app_date))); if ($paket->paket_id != 1) { $komisi->komisi_bagi_pertama_date = $pay1_date; $komisi->komisi_bagi_kedua_date = $pay2_date; } $succ = $komisi->save(); if ($succ) { $isPending = 0; if ($paket->paket_id == 1) { $isPending = 1; } //email dpt komisi $dpt = new DataEmail(); $dpt->dapatKomisi($marketer->admin_email, $paket->paket_komisi, $isPending, $acc->admin_nama_depan, $marketer->admin_isAgent); //tambah counter paket //atau ambil counter paket disini if ($paket->paket_id == 1) { //free //check sudah ada brp paid yang sudah dibayar dll //cek apa bisa tingtong self::checkTingTongFree($app, $marketer, $succ, $paket, $acc, "free"); $komisi = new KomisiModel(); $nr = $komisi->getJumlah("komisi_acc_id = '{$marketer->admin_id}' AND komisi_paket_id = 1"); $marketer->admin_total_free_sales = $nr; $marketer->load = 1; $marketer->save(); } else { //pakai BagiKomisi //cek apa bisa di tingtong self::checkTingTongFree($app, $marketer, $succ, $paket, $acc, "paid"); $komisi = new KomisiModel(); $nr = $komisi->getJumlah("komisi_acc_id = '{$marketer->admin_id}' AND (komisi_paket_id = 2 OR komisi_paket_id = 3)"); $marketer->admin_total_paid_sales = $nr; $marketer->load = 1; $marketer->save(); //cek sudah kena kelipatan 6 blom $bonus = new BonusKomisi(); $bonus->getByID($nr); if ($bonus->bk_bonus_paid != "" && $bonus->bk_bonus_paid > 0) { //masukan ke bonus $bagiKomisi = new BagiKomisi(); $bagiKomisi->bagi_id = $marketer->admin_id . "_" . $nr; $bagiKomisi->bagi_acc_id = $marketer->admin_id; $bagiKomisi->bagi_bk_id = $nr; $bagiKomisi->bagi_date_acquire = leap_mysqldate(); $bagiKomisi->bagi_status = 0; //unpaid $bagiKomisi->bagi_value = $bonus->bk_bonus_paid; $bagiKomisi->save(); } } } }
function appView() { $id = addslashes($_GET['id']); if (in_array("master_admin", Account::getMyRoles())) { // $acc = new AppAccount(); // $apps = $acc->getAll(); // $app = new AppAccount(); $app->getByID($id); } else { $acc = new App2Acc(); //AND app_active = 1 $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id AND ac_app_id = '{$id}' ", array("AppAccount")); // pr($apps); if (count($apps) < 1) { die("hacking attempt"); } else { $app = $apps[0]; } } $paket = new Paket(); $paket->getByID($app->app_paket_id); if (!$app->app_active) { header("Location:" . _SPPATH . "PaymentWeb/payfor?app_id=" . $app->app_id); die; } ?> <div class="container attop" > <div class="col-md-8 col-md-offset-2"> <small><a href="<?php echo _SPPATH; ?> mydashboard">back to dashboard</a> </small> <h1><?php echo $app->app_name; ?> <small><a href="">edit app</a></small></h1> <div class="paket">Paket : <b style="font-size: 18px;"><?php echo $paket->paket_name; ?> </b> <i>[<a href="">Edit Paket</a>]</i> </div> <div style="padding: 10px;"> <?php if (!$app->app_active) { ?> <a class="btn btn-success btn-lg" href="<?php echo _SPPATH; ?> PaymentWeb/payfor?app_id=<?php echo $app->app_id; ?> ">Payment</a> <?php } else { ?> <a class="btn btn-success btn-lg" href="<?php echo _SPPATH; ?> PushHome/setID?app_id=<?php echo $app->app_id; ?> ">Admin Panel</a> <?php } ?> </div> </div> </div> <?php // pr($app); }
function pay() { $app_id = addslashes($_GET['app_id']); $app = new AppAccount(); $app->getByID($app_id); AppAccount::checkOwnership($app); $paket_id = addslashes($_GET['paket']); $paket = new Paket(); $paket->getByID($paket_id); global $db; //create new order $vpt = new VpTransaction(); $vpt->order_id = mt_rand() . $app->app_id . Account::getMyID(); $vpt->order_acc_id = Account::getMyID(); $vpt->order_app_id = $app->app_id; $vpt->order_date = leap_mysqldate(); $vpt->order_paket_id = $paket->paket_id; $vpt->order_value = $paket->paket_price; $vpt->order_status = 0; $vpt->order_status_from = 0; //hapus yang blom ada action apa2 $q = "DELETE FROM {$vpt->table_name} WHERE order_app_id = '{$app->app_id}' AND order_status = '0' AND order_status_from = '0'"; $db->query($q, 0); $arrVpt = $vpt->getWhere("order_app_id = '{$app->app_id}' AND order_status = '0' AND order_status_from != '0' "); if (count($arrVpt) > 0) { die("Please wait for the payment response"); } if ($vpt->save()) { // pr($paket); // pr($app); try { // Set our server key //live // Veritrans_Config::$serverKey = 'VT-server-3UfrS7tn0EDT99S2B18TnUh_'; //sandbox Veritrans_Config::$serverKey = $this->getKeyUsed(); } catch (Exception $e) { echo $e->getMessage(); } if ($this->isProd) { // Uncomment for production environment Veritrans_Config::$isProduction = true; // Uncomment to enable sanitization Veritrans_Config::$isSanitized = true; // Uncomment to enable 3D-Secure Veritrans_Config::$is3ds = true; } $acc = Account::getAccountObject(); $exp = explode(" ", $acc->admin_nama_depan); $billing_address = array('first_name' => $exp[0], 'last_name' => $exp[1], 'phone' => $acc->admin_phone, 'country_code' => 'IDN'); $customer_details = array('first_name' => $exp[0], 'last_name' => $exp[1], 'email' => $acc->admin_email, 'phone' => $acc->admin_phone, 'billing_address' => $billing_address); $item1_details = array('id' => $app->app_id, 'price' => $paket->paket_price, 'quantity' => 1, 'name' => $app->app_name . " " . $paket->paket_name . " 1 year"); $item_details = array($item1_details); $transaction = array('transaction_details' => array('order_id' => $vpt->order_id, 'gross_amount' => $paket->paket_price), 'customer_details' => $customer_details, 'item_details' => $item_details); try { // Redirect to Veritrans VTWeb page header('Location: ' . Veritrans_VtWeb::getRedirectionUrl($transaction)); } catch (Exception $e) { echo $e->getMessage(); if (strpos($e->getMessage(), "Access denied due to unauthorized")) { echo "<code>"; echo "<h4>Please set real server key from sandbox</h4>"; echo "In file: " . __FILE__; echo "<br>"; echo "<br>"; echo htmlspecialchars('Veritrans_Config::$serverKey = \'<your server key>\';'); die; } } } else { //if save die("Please contact admin"); } }
function mydashboard() { $acc = Account::getAccountObject(); ?> <style> #attratas{ text-align: right; } </style> <div class="container attop" > <div class="col-md-10 col-md-offset-1"> <h1>Dashboard</h1> <div id="attratas"> <button onclick="document.location='<?php echo _SPPATH; ?> MyApp/newApp';" class="btn btn-success" style="margin: 0px;">Create New Apps</button> <button onclick="document.location='<?php echo _SPPATH; ?> editAcc';" class="btn btn-info" style=" margin: 0px;">Edit Account</button> <button onclick="document.location='<?php echo _SPPATH; ?> myOrders';" class="btn btn-warning" style=" margin: 0px;">Order History</button> </div> <?php if (in_array("master_admin", Account::getMyRoles())) { $acc = new AppAccount(); $apps = $acc->getAll(); // } else { $acc = new App2Acc(); //AND app_active = 1 $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id ", array("AppAccount")); } if (count($apps) > 0) { ?> <div class="table-responsive" style="margin-top: 20px;"> <table class="table table-striped table-bordered"> <thead> <tr> <th> No. </th> <th>App Name</th> <th>Package</th> <th>Status</th> <th>Expired Date</th> <th>Action</th> </tr> </thead> <tbody> <?php foreach ($apps as $num => $ap) { $paket = new Paket(); $paket->getByID($ap->app_paket_id); ?> <tr> <td><?php echo $num + 1; ?> </td> <td><?php echo $ap->app_name; ?> </td> <td><?php echo $paket->paket_name; ?> </td> <td><?php echo $ap->app_active; ?> </td> <td><?php if ($ap->app_active == 1) { echo indonesian_date($ap->app_contract_end); } ?> </td> <td> <!-- <a href='--><?php //=_SPPATH; ?> <!--MyApp/appView?id=--><?php //=$ap->app_id; ?> <!--' class="btn btn-info">Edit</a>--> <?php if ($ap->app_active == 1) { ?> <a href='<?php echo _SPPATH; ?> PushHome/setID?app_id=<?php echo $ap->app_id; ?> ' class="btn btn-success">Admin</a> <?php } else { if ($ap->app_active == 0) { ?> <a href='<?php echo _SPPATH; ?> MyApp/appView?id=<?php echo $ap->app_id; ?> ' class="btn btn-danger">Payment</a> <?php } else { ?> <button class="btn btn-info">Waiting for Approval</button> <?php } } ?> </td> </tr> <?php } ?> </tbody> </table> </div> <?php } else { ?> <h5 class="hype">You do not have any App yet..</h5> <button onclick="document.location='<?php echo _SPPATH; ?> MyApp/newApp';" class="btn btn-success" style="width: 100%; margin: 5px;">Create My Own App </button> <?php } ?> </div> <div class="clearfix"></div> </div> <?php }
public static function loadPaketForPay($app) { $paketBerlaku = Efiwebsetting::getData('PaketBerlaku'); if ($paketBerlaku != "1,2") { $paket1 = new Paket(); $paket1->getByID(3); //paket android iOS } $paket2 = new Paket(); $paket2->getByID(2); // paket android ?> <style> .paketmanagement{ padding: 20px; /*border-top:1px solid #CCCCCC;*/ background-color: #f6f6f6; } .paket_inside{ padding: 10px; } @media (max-width: 768px) { .monly { display: initial; } .donly { display: none; } .paketmanagement{ padding: 10px; } } @media (min-width: 768px) { .monly { display: none; } .donly { display: initial; } } </style> <div class="paketmanagement"> <div style="padding-bottom: 20px; font-weight: bold;">Select Package</div> <div class="clearfix"></div> <?php if ($paketBerlaku != "1,2") { ?> <div class="col-md-6 col-sm-6 col-xs-6"> <div class="paket_inside"> <img style="cursor: pointer;" id="paket1" onclick="setPaket(1);" src="<?php echo _SPPATH; ?> images/paket-android-ios.png" width="100%"> <small>what you get</small> </div> </div> <?php } ?> <div class="col-md-6 col-sm-6 col-xs-6 <?php if ($paketBerlaku == "1,2") { ?> col-md-offset-3 col-sm-offset-3 col-xs-offset-3<?php } ?> "> <div class="paket_inside"> <img style="cursor: pointer;" id="paket2" onclick="setPaket(2);" src="<?php echo _SPPATH; ?> images/paket-android-2.png" width="100%"> <small>what you get</small> </div> </div> <div class="clearfix"></div> <script> <?php if ($paketBerlaku != "1,2") { ?> var paket_selected = 3; $(document).ready(function(){ setPaket(1); }); <?php } else { ?> var paket_selected = 2; $(document).ready(function(){ setPaket(2); }); <?php } ?> function setPaket(x){ if(x == 1){ $('#paket2').attr("src","<?php echo _SPPATH; ?> images/paket-android-2.png"); $('#paket1').attr("src","<?php echo _SPPATH; ?> images/paket-android-ios.png"); $('#paketprice').html("IDR <?php echo idr($paket1->paket_price); ?> / year"); paket_selected = 3; $('#paybuttonpaket3').show(); $('#paybuttonpaket2').hide(); }else{ $('#paket2').attr("src","<?php echo _SPPATH; ?> images/paket-android.png"); $('#paket1').attr("src","<?php echo _SPPATH; ?> images/paket-android-ios-2.png"); $('#paketprice').html("IDR <?php echo idr($paket2->paket_price); ?> / year"); paket_selected = 2; $('#paybuttonpaket2').show(); $('#paybuttonpaket3').hide(); } } </script> <div class="clearfix"></div> </div> <div id="paketprice" style="background-color: #f6f6f6; padding: 5px; text-align: center; font-size: 30px;">IDR <?php echo idr($paket1->paket_price); ?> / year</div> <div style="padding: 20px;background-color: #f6f6f6;"> <a id="paybuttonpaket3" href="<?php echo _SPPATH; ?> Vp/pay?app_id=<?php echo $app->app_id; ?> &paket=3" class="btn btn-danger btn-lg">PAY NOW USING VERITRANS</a> <a id="paybuttonpaket2" style="display: none;" href="<?php echo _SPPATH; ?> Vp/pay?app_id=<?php echo $app->app_id; ?> &paket=2" class="btn btn-danger btn-lg">PAY NOW USING VERITRANS</a> <!-- <a href="--><?php //=_SPPATH; ?> <!--VeritransPay/pay?app_id=--><?php //=$app->app_id; ?> <!--" class="btn btn-danger btn-lg">PAY NOW USING VERITRANS</a>--> </div> <?php }
public function login() { IMBAuth::checkOAuth(); $username = addslashes($_POST['username']); $password = addslashes($_POST['password']); //untuk deviceModel $device_id = addslashes($_POST['device_id']); $type = addslashes($_POST['type']); $acc = new Account(); $arr = $acc->getWhere("admin_username = '******' OR admin_email ='{$username}'"); // pr($arr); if (count($arr) > 0) { $acc = $arr[0]; if ($password == $acc->admin_password) { $json['status_code'] = 1; $json['status_message'] = "Success"; $json_acc['acc_id'] = $acc->admin_id; $json_acc['username'] = $acc->admin_username; $json_acc['email'] = $acc->admin_email; $json_acc['user_token'] = md5($acc->admin_email . $acc->admin_password); $json['account'] = $json_acc; //dashboard $myid = $acc->admin_id; $kom = new KomisiModel(); $arrKom = $kom->getWhere("komisi_acc_id = '{$myid}' ORDER BY komisi_app_date ASC"); $paid = 0; $unpaid = 0; $total = 0; $free = 0; $android = 0; $androidios = 0; $totalpaketbayar = 0; $totalpaket = 0; foreach ($arrKom as $kom) { if ($kom->komisi_status == 1) { $paid += $kom->komisi_value; } else { $unpaid += $kom->komisi_value; } $total += $kom->komisi_value; if ($kom->komisi_paket_id == 1) { //free $free++; } if ($kom->komisi_paket_id == 2) { //free $android++; $totalpaketbayar++; } if ($kom->komisi_paket_id == 3) { //free $androidios++; $totalpaketbayar++; } $totalpaket++; } //get applied banner $bm = new BannerModel(); $arrBm = $bm->getWhere("banner_interval_begin <= {$totalpaketbayar} AND banner_interval_end >= {$totalpaketbayar} AND banner_active = 1"); if (count($arrBm) > 0) { $selBanner = $arrBm[0]; $json_banner['banner_img'] = _BPATH . _PHOTOURL . $selBanner->banner_img; $json_banner['banner_link_url'] = $selBanner->banner_link_url; } //get applied level $lv = new LevelModel(); $arrLvl = $lv->getWhere("level_start<={$totalpaketbayar} AND level_end>={$totalpaketbayar} AND level_active = 1"); if (count($arrLvl) > 0) { $selLvl = $arrLvl[0]; $json_lvl['level_name'] = $selLvl->level_name; $json_lvl['level_img'] = _BPATH . _PHOTOURL . $selLvl->level_img; } $dashboard['sales_total'] = $totalpaket; $dashboard['sales_paid'] = $totalpaketbayar; $dashboard['sales_fee'] = $free; $dashboard['sales_android'] = $android; $dashboard['sales_androidios'] = $androidios; $dashboard['money_total'] = $total; $dashboard['money_paid'] = $paid; $dashboard['money_unpaid'] = $unpaid; $dashboard['banner'] = $json_banner; $dashboard['level'] = $json_lvl; $json['dashboard'] = $dashboard; //myapps $app2acc = new App2Acc(); //AND app_active = 1 $apps = $app2acc->getWhereFromMultipleTable("ac_admin_id = '" . $acc->admin_id . "' AND ac_app_id = app_id ", array("AppAccount")); if (count($apps) > 0) { foreach ($apps as $ap) { $rr = array(); $rr['app_id'] = $ap->app_id; $rr['app_icon'] = $ap->app_icon; $rr['app_name'] = $ap->app_name; $rr['app_active'] = $ap->app_active; $rr['app_shortdes'] = $ap->app_shortdes; $rr['app_token'] = $ap->app_token; $rr['app_contract_end'] = $ap->app_contract_end; $rr['app_google_play_link'] = $ap->app_google_play_link; $rr['app_google_version'] = $ap->app_google_version; $rr['app_ios_link'] = $ap->app_ios_link; $rr['app_ios_version'] = $ap->app_ios_version; $paket = new Paket(); $paket->getByID($ap->app_paket_id); $rr['paket']['paket_id'] = $paket->paket_id; $rr['paket']['paket_name'] = $paket->paket_name; $json['apps'][] = $rr; } } else { $json['apps'] = array(); } //update the device id on deviceModelCaps $dn = new DeviceModelCapsule(); $dnquery = new DeviceModelCapsule(); // langkah 1 , device ID ada device type ada $arrs = $dnquery->getWhere("device_id = '{$device_id}' AND device_type = '{$type}'"); $dn = $arrs[0]; if ($dn->did == "") { $dn = new DeviceModelCapsule(); $dn->device_id = $device_id; $dn->device_type = $type; $dn->acc_id = $acc->admin_id; $dn->firstlogin = leap_mysqldate(); } else { //kalau device id ada, acc di update $dn->load = 1; $dn->acc_id = $acc->admin_id; } $dn->dev_lng = addslashes($_POST['lng']); $dn->dev_lat = addslashes($_POST['lat']); $dn->logindate = leap_mysqldate(); if ($dn->save()) { $json['save_device_status'] = 1; } $json['powered_by_link'] = Efiwebsetting::getData("Powered_By_Link_Caps"); echo json_encode($json); die; } else { $json['status_code'] = 0; $json['status_message'] = "Password Mismatched"; echo json_encode($json); die; } } else { $json['status_code'] = 0; $json['status_message'] = "User Not Found"; echo json_encode($json); die; } }
static function getMyApps() { $acc = Account::getAccountObject(); ?> <style> @media (max-width: 768px) { .monly { display: initial; } .donly { display: none; } .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9 { padding-left: 0px; padding-right: 0px; } .container { padding-right: 0px; padding-left: 0px; } .attop{ /*padding-top: 50px;*/ } #session{ margin-left: 15px; margin-right: 15px; } } @media (min-width: 768px) { .monly { display: none; } .donly { display: initial; } #attratas{ margin-top: 30px; } #agentbanner{ padding-right: 0px; } .stats{ /*min-height: 250px;*/ } .stats_text{ /*padding-top: 30px;*/ } .stats_number_big{ /*font-size: 40px;*/ } .stats_money{ font-weight: bold; /*font-size: 30px;*/ } .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9 { padding-left: 0px; padding-right: 0px; } } </style> <div class="container attop" > <div class="col-md-12"> <div class="appear_logo_pages"> <a href="<?php echo _SPPATH; ?> "> <img src="<?php echo _SPPATH; ?> images/appear-apps.png" > </a> </div> <div id="attratas"> <button id="list" onclick="$('#list').hide();$('#icons').show();$('#app_icons').hide();$('#app_lists').show();" class="btn btn-success btn-abu" style="margin: 0px;display: none;"><i class="glyphicon glyphicon-th-list"></i></button> <button id="icons" onclick="$('#list').show();$('#icons').hide();$('#app_icons').show();$('#app_lists').hide();" class="btn btn-success btn-abu" style="margin: 0px;"><i class="glyphicon glyphicon-th"></i></button> <button onclick="document.location='<?php echo _SPPATH; ?> mydashboard';" class="btn btn-success btn-abu" style="margin: 0px;">Dashboard</button> <button onclick="document.location='<?php echo _SPPATH; ?> apps/makenew';" class="btn btn-success btn-abu" style="margin: 0px;">Create New Apps</button> </div> <?php if (ZAppFeature::checkRemainingSession()) { $link = _SPPATH . "apps/make"; if ($_SESSION['ZAppFeature']['app_id'] > 0) { $link = _SPPATH . "apps/make?id=" . $_SESSION['ZAppFeature']['app_id']; } ?> <div id="session" class="alert alert-warning" role="alert" > You have unsaved edit Sessions. Click <a href="<?php echo $link; ?> ">here</a> to continue work on your app </div> <?php } ?> <?php if (in_array("master_admin", Account::getMyRoles())) { $acc = new AppAccount(); $apps = $acc->getAll(); //http://localhost:8888/appear/PushHome/home?st=Balance } else { $acc = new App2Acc(); //AND app_active = 1 $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id ", array("AppAccount")); } if (count($apps) > 0) { ?> <div id="app_icons" style="display: none;"> <?php foreach ($apps as $num => $ap) { ?> <div class="col-md-3 col-sm-12 col-xs-12 myapp"> <div id="detail_<?php echo $num; ?> " class="app_detail" style="display: none;" onclick="openDetails('<?php echo $num; ?> ');"> <div style="padding: 20px;"> <h3><?php echo $ap->app_name; ?> </h3> <?php $paket = new Paket(); if ($ap->app_paket_id > 0) { $paket->getByID($ap->app_paket_id); echo '<div class="app_paket">' . $paket->paket_name . '</div>'; } ?> <?php $status = $ap->app_active; echo '<div class="app_status">'; if ($status == 0) { echo "Not active"; } if ($status == 1) { if ($ap->app_type == 1) { echo "pending approval"; } else { echo "App is being created"; } } if ($status == 2) { echo "Up and running"; } echo "</div>"; ?> <?php if ($ap->app_active > 0 && $ap->app_type == 0) { echo '<div class="app_contract">contract ends : ' . date("d-m-Y", strtotime($ap->app_contract_end)); if ($ap->app_active == 2) { if ($ap->app_paket_id > 1) { ?> <br> <a href="<?php echo _SPPATH; ?> PaymentWeb/extend?app_id=<?php echo $ap->app_id; ?> ">extend</a> <?php } elseif ($ap->app_paket_id == 1) { //check if tinggal sebulan $diff = dateDifference(date("Y-m-d", strtotime($ap->app_contract_end)), date("Y-m-d"), "%a"); // echo "<br>".$diff; if ($diff <= 30) { ?> <br> <a href="<?php echo _SPPATH; ?> PaymentWeb/extend_paket_1?app_id=<?php echo $ap->app_id; ?> ">extend</a> <?php } } } echo '</div>'; } ?> <?php if ($ap->app_active == 2) { if ($ap->app_paket_id == 1 || $ap->app_paket_id == 2) { ?> <a href='<?php echo _SPPATH; ?> PaymentWeb/upgrade?app_id=<?php echo $ap->app_id; ?> ' class="btn btn-success">Upgrade</a> <?php } ?> <a href='<?php echo _SPPATH; ?> pushnotif?app_id=<?php echo $ap->app_id; ?> ' class="btn btn-success btn-abu">Push Notifications</a> <br> <?php } else { if ($ap->app_active == 0) { ?> <!-- <a href='--><?php //=_SPPATH; ?> <!--MyApp/appView?id=--><?php //=$ap->app_id; ?> <!--' class="btn btn-danger">Payment</a>--> <a href='<?php echo _SPPATH; ?> PaymentWeb/pay?app_id=<?php echo $ap->app_id; ?> ' class="btn btn-danger">Payment</a> <a href='<?php echo _SPPATH; ?> delete_app?app_id=<?php echo $ap->app_id; ?> ' onclick="return confirm('This will delete this App?')" class="btn btn-success btn-abu">Delete</a> <?php } } ?> <a href='<?php echo _SPPATH; ?> apps/edit?id=<?php echo $ap->app_id; ?> ' class="btn btn-success btn-abu">Edit</a> <a href='<?php echo _SPPATH; ?> preview?id=<?php echo $ap->app_id; ?> ' class="btn btn-success btn-abu">Preview</a> <a href='<?php echo _SPPATH; ?> uploads/json/<?php echo $ap->app_keywords; ?> .json' target="_blank" class="btn btn-success btn-abu">JSON</a> </div> </div> <div id="app_<?php echo $num; ?> " class="app_icon" onclick="openDetails('<?php echo $num; ?> ');"> <img width="100%" src="<?php echo $ap->app_icon; ?> "> <div style="display:none;position: absolute; background-color: rgba(0,0,0,0.5); border-radius: 0px; text-align: center; font-size: 18px; padding: 10px; margin-top: -53px; margin-left:10px; z-index:1; color: #ffffff;"> <?php echo $ap->app_name; ?> </div> </div> </div> <?php } ?> <script> function openDetails(n){ $('#detail_'+n).fadeToggle( "slow", "linear" ); console.log($('#app_'+n).width()); $('#detail_'+n).css("width",$('#app_'+n).width()+'px'); $('#detail_'+n).css("height",$('#app_'+n).height()+'px'); } </script> <style> .app_detail{ position: absolute; background-color: rgba(0,0,0,0.8); width: 100px; height: 200px; color: #ffffff; text-align: center; z-index: 10; } .myapp{ cursor: pointer; } .app_contract{ font-style: italic; font-size: 12px; } .myapp a{ color: #B2DFDB; text-decoration: underline; } .myapp a.btn{ text-decoration: none; margin: 5px; color: #ffffff; } .entry{ padding: 5px; background-color: #F7F7F7; margin: 5px; } .entry a.btn{ text-decoration: none; margin: 2px; color: #ffffff; } </style> </div> <div class="clearfix"></div> <div id="app_lists" > <?php foreach ($apps as $num => $ap) { // $paket = new Paket(); // $paket->getByID($ap->app_paket_id); ?> <div class=" col-md-6 col-sm-12 col-xs-12"> <div class="entry"> <div class="col-md-6 col-sm-6 col-xs-6"> <img width="100%" src="<?php echo $ap->app_icon; ?> "> </div> <div class="col-md-6 col-sm-6 col-xs-6" style="text-align: center;"> <h3><?php echo $ap->app_name; ?> </h3> <?php $paket = new Paket(); if ($ap->app_paket_id > 0) { $paket->getByID($ap->app_paket_id); echo '<div class="app_paket">' . $paket->paket_name . '</div>'; } ?> <?php $status = $ap->app_active; echo '<div class="app_status">'; if ($status == 0) { echo "Not active"; } if ($status == 1) { if ($ap->app_type == 1) { echo "pending approval"; } else { echo "App is being created"; } } if ($status == 2) { echo "Up and running"; } echo "</div>"; ?> <?php if ($ap->app_active > 0 && $ap->app_type == 0) { echo '<div class="app_contract">contract ends : ' . date("d-m-Y", strtotime($ap->app_contract_end)); if ($ap->app_active == 2) { if ($ap->app_paket_id > 1) { ?> <br> <a href="<?php echo _SPPATH; ?> PaymentWeb/extend?app_id=<?php echo $ap->app_id; ?> ">extend</a> <?php } elseif ($ap->app_paket_id == 1) { //check if tinggal sebulan $diff = dateDifference(date("Y-m-d", strtotime($ap->app_contract_end)), date("Y-m-d"), "%a"); // echo "<br>".$diff; if ($diff <= 30) { ?> <br> <a href="<?php echo _SPPATH; ?> PaymentWeb/extend_paket_1?app_id=<?php echo $ap->app_id; ?> ">extend</a> <?php } } } echo '</div>'; } ?> <?php if ($ap->app_active == 2) { if ($ap->app_paket_id == 1 || $ap->app_paket_id == 2) { ?> <a href='<?php echo _SPPATH; ?> PaymentWeb/upgrade?app_id=<?php echo $ap->app_id; ?> ' class="btn btn-success">Upgrade</a> <?php } ?> <a href='<?php echo _SPPATH; ?> pushnotif?app_id=<?php echo $ap->app_id; ?> ' class="btn btn-success btn-abu">Push Notifications</a> <br> <?php } else { if ($ap->app_active == 0) { ?> <!-- <a href='--><?php //=_SPPATH; ?> <!--MyApp/appView?id=--><?php //=$ap->app_id; ?> <!--' class="btn btn-danger">Payment</a>--> <a href='<?php echo _SPPATH; ?> PaymentWeb/pay?app_id=<?php echo $ap->app_id; ?> ' class="btn btn-danger">Payment</a> <a href='<?php echo _SPPATH; ?> delete_app?app_id=<?php echo $ap->app_id; ?> ' onclick="return confirm('This will delete this App?')" class="btn btn-success btn-abu">Delete</a> <?php } } ?> <a href='<?php echo _SPPATH; ?> apps/edit?id=<?php echo $ap->app_id; ?> ' class="btn btn-success btn-abu">Edit</a> <a href='<?php echo _SPPATH; ?> preview?id=<?php echo $ap->app_id; ?> ' class="btn btn-success btn-abu">Preview</a> <a href='<?php echo _SPPATH; ?> uploads/json/<?php echo $ap->app_keywords; ?> .json' target="_blank" class="btn btn-success btn-abu">JSON</a> </div> <div class="clearfix"></div> </div> </div> <?php } ?> </div> <style> .table{ background-color: white; } </style> <div id="app_table" class="table-responsive" style="margin-top: 20px; display: none;"> <table class="table table-striped table-bordered"> <thead> <tr> <th> No. </th> <th>App</th> <th>Action</th> <th>Paket</th> <th>Expired Date</th> <th>Status</th> </tr> </thead> <tbody> <?php foreach ($apps as $num => $ap) { // $paket = new Paket(); // $paket->getByID($ap->app_paket_id); ?> <tr> <td><?php echo $num + 1; ?> </td> <td style="text-align: center;"> <div class="foto100"> <img width="100px" src="<?php echo $ap->app_icon; ?> "> </div> <?php echo $ap->app_name; ?> </td> <td> <!-- <a href='--><?php //=_SPPATH; ?> <!--MyApp/appView?id=--><?php //=$ap->app_id; ?> <!--' class="btn btn-info">Edit</a>--> <?php if ($ap->app_active == 2) { if ($ap->app_paket_id == 1 || $ap->app_paket_id == 2) { ?> <a href='<?php echo _SPPATH; ?> PaymentWeb/upgrade?app_id=<?php echo $ap->app_id; ?> ' class="btn btn-success">Upgrade</a> <?php } ?> <a href='<?php echo _SPPATH; ?> pushnotif?app_id=<?php echo $ap->app_id; ?> ' class="btn btn-success">Push Notifications</a> <br> <?php } else { if ($ap->app_active == 0) { ?> <!-- <a href='--><?php //=_SPPATH; ?> <!--MyApp/appView?id=--><?php //=$ap->app_id; ?> <!--' class="btn btn-danger">Payment</a>--> <a href='<?php echo _SPPATH; ?> PaymentWeb/pay?app_id=<?php echo $ap->app_id; ?> ' class="btn btn-danger">Payment</a> <a href='<?php echo _SPPATH; ?> delete_app?app_id=<?php echo $ap->app_id; ?> ' onclick="return confirm('This will delete this App?')" class="btn btn-danger">Delete</a> <?php } } ?> <a href='<?php echo _SPPATH; ?> apps/edit?id=<?php echo $ap->app_id; ?> ' class="btn btn-danger">Edit</a> <a href='<?php echo _SPPATH; ?> preview?id=<?php echo $ap->app_id; ?> ' class="btn btn-danger">Preview</a> <a href='<?php echo _SPPATH; ?> uploads/json/<?php echo $ap->app_keywords; ?> .json' target="_blank" class="btn btn-danger">JSON</a> </td> <td> <?php $paket = new Paket(); if ($ap->app_paket_id > 0) { $paket->getByID($ap->app_paket_id); echo $paket->paket_name; } ?> </td> <td> <?php if ($ap->app_active > 0) { echo date("d-m-Y", strtotime($ap->app_contract_end)); if ($ap->app_active == 2) { if ($ap->app_paket_id > 1) { ?> <br> <a class="btn btn-default" href="<?php echo _SPPATH; ?> PaymentWeb/extend?app_id=<?php echo $ap->app_id; ?> ">extend</a> <?php } elseif ($ap->app_paket_id == 1) { //check if tinggal sebulan $diff = dateDifference(date("Y-m-d", strtotime($ap->app_contract_end)), date("Y-m-d"), "%a"); // echo "<br>".$diff; if ($diff <= 30) { ?> <br> <a class="btn btn-default" href="<?php echo _SPPATH; ?> PaymentWeb/extend_paket_1?app_id=<?php echo $ap->app_id; ?> ">extend</a> <?php } } } } ?> </td> <td><?php $status = $ap->app_active; if ($status == 0) { echo "Your App is not active"; } if ($status == 1) { echo "Your App is being created.<br>For Android App, it will take up to 2 working days.<br>For iOS, it will take up to 3 weeks."; } if ($status == 2) { echo "Your App is up and running"; } ?> </td> </tr> <?php } ?> </tbody> </table> </div> </div> <div class="clearfix" style="margin-bottom: 100px;"></div> </div> <?php } else { header("Location:" . _SPPATH . "apps/make"); exit; } }