<?php if ($_POST) { session_start(); include_once $_SERVER['DOCUMENT_ROOT'] . '/config/database.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/objects/orders.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/objects/orderdetail.php'; $database = new database(); $db = $database->getConnection(); $orders = new orders($db); $orderdetail = new orderdetail($db); $orders->order_id = $_POST['order_id']; $orders->order_date = $_POST['order_date']; $orders->cust_kode = $_POST['cust_kode']; $orders->username = $_POST['username']; $orderdetail->username = $orders->username; $_SESSION['bayar'] = $_POST['bayar']; $_SESSION['kembali'] = $_POST['kembali']; // echo $_SESSION['bayar']; if ($orders->Insert()) { if ($orderdetail->InsertData()) { $orderdetail->clearTemp(); echo "Berhasil di proses"; } else { echo "anak cacat"; } } else { echo "gagal di proses"; } // if($orderdetail->Delete()){ echo "Kategori berhasil dihapus."; } // else {echo "Gagal menghapus Kategori."; }
<?php session_start(); $page_title = "Tambah Order"; include_once $_SERVER['DOCUMENT_ROOT'] . '/pages/header.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/config/database.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/objects/orders.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/objects/orderdetail.php'; echo "\t\t\t\t<div class='col-md-3'>"; include_once $_SERVER['DOCUMENT_ROOT'] . '/pages/sidebarmenu.php'; echo "\t\t\t\t</div>"; $database = new database(); $db = $database->getConnection(); $orders = new orders($db); $orderdetail = new orderdetail($db); $orders->order_id = $orders->AutoNumber(); include_once $_SERVER['DOCUMENT_ROOT'] . '/objects/customer.php'; $custoer = new customer($db); $customer = new customer($db); $orders->cust_kode = ""; $statement = $orderdetail->ShowTemp($orders->order_id); $bayar = isset($bayar) ? $bayar : 0; $kembali = isset($kembali) ? $kembali : 0; echo "\t\t\t\t<div class='col-md-9'>"; //echo "<div class='container'>"; echo "<div class='panel panel-default'>"; echo "<div class='panel-body'>"; echo "\t\t\t<div class='row' style='border-bottom: none;'>"; echo "\t\t\t\t<div class='col-md-2'>"; echo "\t\t\t\t\t<label>Order No</label>"; echo "\t\t\t\t</div>";
document.body.innerHTML = printcontent; window.print(); document.body.innerHTML = restorepage; } </script> <?php session_start(); $page_title = "Struk Order"; include_once $_SERVER['DOCUMENT_ROOT'] . '/config/database.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/objects/orders.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/objects/orderdetail.php'; $database = new database(); $db = $database->getConnection(); $orders = new orders($db); $orderdetail = new orderdetail($db); $struk_orderid = !empty($struk_orderid) ? $struk_orderid : $_GET['id']; $row = $orders->ShowOrder($struk_orderid); echo "<div id='Print'>"; //division untuk di print echo "<p>SALON & SPA KECANTIKA</p>"; // echo"-------------------------------------------------------------------"; echo "_______________________________________"; echo "<p>Order ID : {$row['order_id']} </p>"; echo "<p>Date : {$row['order_date']} </p>"; echo "<p>Customer : {$row['cust_nama']} </p>"; echo "\t\t\t\t<table class='table table-hover table-responsive table-bordered' style='border-top: 1px solid black'>"; echo "\t\t\t\t\t<tr>"; echo "\t\t\t\t\t\t<th style='border-bottom: 1px solid black'>No </th>"; echo "\t\t\t\t\t\t<th style='border-bottom: 1px solid black'>Nama Item </th>"; echo "\t\t\t\t\t\t<th style='border-bottom: 1px solid black'>Qty</th>";
<?php if ($_POST) { include_once $_SERVER['DOCUMENT_ROOT'] . '/config/database.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/objects/orderdetail.php'; $database = new database(); $db = $database->getConnection(); $orderdetail = new orderdetail($db); $orderdetail->kode = $_POST['object_id']; if ($orderdetail->delete()) { echo "Items berhasil dihapus."; } else { echo "Gagal menghapus Items."; } }
function store_new_order($cart, $ship) { if (count($cart) == 0) { return; } // $db =& JFactory::getDBO(); //get statuses $cfg = new sc_configuration(); $statuses = explode("\n", trim($cfg->get("ostatus"))); // get the first status from the list $status = isset($statuses[0]) ? trim($statuses[0]) : JText::_('SC_NO_STATUS'); $juser = JFactory::getUser(); //create order info from the details page $o = new order(); $o->bind($_POST); $o->id = null; // ensure a new order is created here $o->j_user_id = $juser->id; // add the user id $o->orderdt = mktime(); $o->status = $status; $o->customfields = serialize($_REQUEST); if ($ship['enabled']) { $o->shipCost = $ship['cost']; $o->shipRegion = $ship['region']; } $o->store(); $orderid = $o->_db->insertid(); $gtotal = 0; //create order details from cookie foreach ($cart as $key => $product) { unset($odet); $odet = new orderdetail(); $odet->id = null; $odet->orderid = $orderid; $odet->prodcode = $product->prodcode; $odet->qty = $product->quantity; $odet->unitprice = $product->finalprice; $odet->total = $product->quantity * $product->finalprice; $odet->shorttext = $product->prodname; $odet->option = $product->option; $odet->store(); $gtotal = $gtotal + $odet->total; //$db->insertObject("#__sc_odetails", $odet); } // get taxes based on shipping region (if any) $ctax = new taxes(); $taxrate = $ctax->getTax(@$ship['region']); $o = new order(); $o->load($orderid); $o->total = $gtotal; $o->tax = $gtotal * $taxrate; // $o->id=$orderid; $o->store(); // $db->updateObject("#__sc_orders", $o, "id"); // echo $db->getErrorMsg(); return $orderid; }
<?php if ($_POST) { include_once $_SERVER['DOCUMENT_ROOT'] . '/config/database.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/objects/orderdetail.php'; $database = new database(); $db = $database->getConnection(); $orderdetail = new orderdetail($db); $orderdetail->kode = $_POST['object_id']; if ($orderdetail->Delete()) { echo "Kategori berhasil dihapus."; } else { echo "Gagal menghapus Kategori."; } }
<?php if ($_POST) { include_once $_SERVER['DOCUMENT_ROOT'] . '/config/database.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/objects/orderdetail.php'; $database = new database(); $db = $database->getConnection(); $orderdetail = new orderdetail($db); $orderdetail->order_id = $_POST['orderid']; $orderdetail->item_kode = $_POST['itemid']; if ($orderdetail->deleteTemp()) { echo "Items berhasil dihapus."; } else { echo "Gagal menghapus Items."; } }
function checkout($orderid, $ship = null) { // it uses the simple way to upload a cart with contents to paypal as explained here: // https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_cart_upload#id08A3F700OYK // data available December 28, 2009. //get PayPal configuration $cfg = new sc_configuration(); $reselleremail = $cfg->get("reselleremail"); $ppcurrency = $cfg->get("paypalcurrency"); $environment = $cfg->get("ppenvironment"); // live or sandbox $ctax = new taxes(); $taxrate = $ctax->getTax(@$ship['region']); if (!$reselleremail) { echo "Reseller email is not entered, please add this to the configuration first. PayPal cannot be used!"; return; } // add the details to the order $gtotal = 0; //define the grand total $pptax = 0; // define the tax for paypal if ($environment == 0) { // live $html = "<form action='https://www.paypal.com/cgi-bin/webscr' method='post' name ='ppform' target='paypal'>"; } else { // sandbox $html = "<form action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post' name ='ppform' target='paypal'>"; } $html .= "<input type=\"{$this->debugshow}\" name=\"cmd\" value=\"_cart\">"; $html .= "<input type=\"{$this->debugshow}\" name=\"upload\" value=\"1\">"; $html .= "<input type=\"{$this->debugshow}\" name=\"business\" value=\"{$reselleremail}\">"; $html .= "<input type=\"{$this->debugshow}\" name=\"currency_code\" value=\"{$ppcurrency}\">"; $html .= "<input type=\"{$this->debugshow}\" name=\"rm\" value=\"2\">"; $fieldnumber = 0; // PayPal field numbering variable $odetails = new orderdetail(); $lst = $odetails->getDetailsByOrderId($orderid); foreach ($lst as $product) { // create a post field and field value for PayPal if ($product->total > 0) { // price positive, so standard product to be paid for $fieldnumber = $fieldnumber + 1; //increment the field number (could also be done with $fieldnumber++) $html .= "<input type='{$this->debugshow}' name='item_name_" . $fieldnumber . "' value='" . $product->shorttext . " (" . $product->prodcode . ") " . $product->option . "'>"; $html .= "<input type='{$this->debugshow}' name='amount_" . $fieldnumber . "' value='" . $product->unitprice . "'>"; $html .= "<input type='{$this->debugshow}' name='quantity_" . $fieldnumber . "' value='" . $product->qty . "'>"; } else { $html .= "<input type='{$this->debugshow}' name='discount_amount_cart' value='" . abs($product->total) . "'>"; } $gtotal += $product->total; } if ($taxrate > 0) { // taxes to be applied! // check if taxes should be paid on shipping $taxonshipping = $cfg->get("taxonshipping"); if ($taxonshipping == 1) { // tax is calculated on shipping cost $pptax = $gtotal * $taxrate + $ship['cost'] * $taxrate; } else { $pptax = $gtotal * $taxrate; } } if ($pptax > 0) { //either one or both of the taxes have to be applied, so we add the tax field for PP $html .= "<input type=\"{$this->debugshow}\" name=\"tax_cart\" value=\"" . number_format($pptax, 2, ".", "") . '">'; // } if ($ship['enabled']) { $html .= "<input type=\"{$this->debugshow}\" name=\"shipping_1\" value=\"" . $ship['cost'] . "\">"; } $html .= "<input type=\"{$this->debugshow}\" name=\"custom\" value=\"{$orderid}\">"; // these are the return urls to go to when coming back from paypal $successurl = JURI::base(false) . "index.php?option=com_caddy&action=paysuccess"; $failurl = JURI::base(false) . "index.php?option=com_caddy&action=payfail"; $html .= "<input type=\"{$this->debugshow}\" name=\"cancel_return\" value=\"{$failurl}\">"; $html .= "<input type=\"{$this->debugshow}\" name=\"return\" value=\"{$successurl}\">"; $html .= JText::_('SC_WE_USE_PAYPAL'); // PayPal requires you use their logo to check out. Check the PayPal site for other button types // look here for more buttons from PayPal https://www.paypal.com/newlogobuttons // look here for the rules of usage of the paypal logos and pay buttons: //https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/pdf/merchant_graphic_guidelines.pdf /** customizers, do your stuff here! You may add all kinds of fields now to the paypal "cart" to customize your heading in PayPal and so on. None of these novelties have been added here, but if you want to customize the appearance of your presence in Paypal, Here is the place. */ $html .= '<p> <input type="image" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" align="left" style="margin-right:7px;"> <span style="font-size:11px; font-family: Arial, Verdana;">The safer, easier way to pay.</span> <p>'; // additional PayPal info // be careful to 'escape' any " with \ ! /** $html .="<p> <!-- PayPal Logo --><table border=\"0\" cellpadding=\"10\" cellspacing=\"0\" align=\"center\"><tr><td align=\"center\"></td></tr> <tr><td align=\"center\"><a href=\"#\" onclick=\"javascript:window.open('https://www.paypal.com/cgi-bin/webscr?cmd=xpt/Marketing/popup/OLCWhatIsPayPal-outside','olcwhatispaypal','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=400, height=350');\"> <img src=\"https://www.paypal.com/en_US/i/bnr/vertical_solution_PPeCheck.gif\" border=\"0\" alt=\"Solution Graphics\"></a></td></tr></table><!-- PayPal Logo --> </p>"; */ // otherwise we could use a simple submit button: //$html .='<input type="submit" value="PayPal"> '; $html .= "</form>"; // if you want to add more text here // add it here like this: // $html .= "Your text here"; // *before* the line below echo $html; // display the html. }