function showchart() { $chart = $_SESSION['chart']; // print_r($chart); if ($chart) { $items = explode(',', $chart); $contents = array(); foreach ($items as $item) { $contents[$item] = isset($contents[$item]) ? $contents[$item] + 1 : 1; } $output[] = "<table class=\"table table-striped \">"; $output[] = "<th><td>Nama</td><td> Harga</td><td>jumlah</td><td>subtotal</td><td>Aksi</td></th>"; $output[] = '<form action="index.php?mod=chart&pg=chart&action=update" method="post" id="chart">'; $no = 1; foreach ($contents as $id => $qty) { $sql = "SELECT produk.*,stok.harga_jual from produk,stok WHERE produk.idproduk = '{$id}' and stok.idproduk = '{$id}'"; $result = mysql_query($sql); $row = mysql_fetch_object($result); $output[] = '<tr><td>' . $no . '</td>'; $output[] = '<td><img src=\'upload/produk/' . $row->foto; $output[] = '\' width=\'128px\' height=\'128px\'><br> ' . $row->nama_produk . '</td><td>' . format_rupiah($row->harga_jual) . '</td>'; $output[] = '<td><input type="text" class="input-mini" name="qty' . $id . '" value="' . $qty . '" /></td>'; $output[] = '<td>' . format_rupiah($row->harga_jual * $qty) . '</td>'; $total += $row->harga_jual * $qty; $output[] = '<td><a href="index.php?mod=chart&pg=chart&action=delete&id=' . $id . '" class="btn btn-danger">Hapus</a></td></tr>'; $no++; } $output[] = "</table>"; $qty = getQty(); $output[] = '<h3>Total Transaksi : ' . format_rupiah($total) . '</h3>'; $_SESSION['totalbayar'] = $total; $output[] = '<button type="submit" class=\'btn btn-primary\'>Update cart</button>'; $output[] = '</form>'; $output[] = '<a href=\'chart/chart_action.php\' class=\'btn btn-primary\'>Check out</a>'; } else { $output[] = '<p>Keranjang belanja masih kosong.</p>'; } return join('', $output); }
include './config.php'; include './auth.php'; $id = $_GET['id']; $can_id = $_GET['can_id']; $ord_id = $_GET['ord_id']; $active_super_category = getSuperCategoryActive(); $editProductsName = editPdoructs($id); $editProducts = editPdoructsOrder($id,$ord_id); $active_category = getCategoryActive(); $ca_id = $editProducts[0]['category_id']; $super_id = $editProducts[0]['supercategory_id']; $active_sub_category = getSubCategoryActive($super_id,$ca_id); $qty = getQty($id,$ord_id); $price = getPriceE($id,$ord_id); ?> <!DOCTYPE html> <html> <head> <title>Edit Sub Category</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link href="style/style.css" rel="stylesheet" type="text/css" media="all" /> <script type="text/javascript" src="js/jquery.min.js"></script> </head> <body> <div id="popup_content"> <!--your content start--> <div id="msg" style="color:#007F2A; font-size: 13px;"></div> <form name="edit_products" id="edit_products" method="post" action="" >
session_start(); } if (!isset($_SESSION['inventory'][$worksheet])) { // if the session var for this mfr/worksheet is not set, create it now $_SESSION['inventory'][$worksheet]['inventory_array'] = $data; // grab all new values $_SESSION['inventory'][$worksheet]['timestamp'] = $rightnow; // set the timestamp } else { // else if it IS set, check the timestamp in it if ($_SESSION['inventory'][$worksheet]['timestamp'] + 600 < $rightnow) { // if the last timestamp is over 10 minutes less than the current "time()" $_SESSION['inventory'][$worksheet]['inventory_array'] = $data; // grab all new values $_SESSION['inventory'][$worksheet]['timestamp'] = $rightnow; // re-set the timestamp $the_session_id = session_id(); } } $qty = getQty($partnum, $_SESSION['inventory'][$worksheet]['inventory_array']); // hopefully this way gets it from the session if ($qty >= $qty_ordered) { $qtystyle = ' style="color:green;"'; } else { $qtystyle = ' style="color:red;"'; } if (is_numeric($qty)) { echo 'In stock: <b' . $qtystyle . '>' . $qty . '</b>'; } else { echo '???'; }