Editing: payment.php
Kembali
<!DOCTYPE html> <html> <head> <title>Welcome to KwerSunSet</title> <?php echo $dependencies; $ido=$_REQUEST['id']; $idn=$_REQUEST['idn']; ?> <link rel="stylesheet" href="<?php echo base_url() . 'assets/css/validationEngine.jquery.css'; ?>" type="text/css"/> <style type="text/css"> #apDiv1 { position: absolute; width: 200px; height: auto; z-index: 1; left: 10px; top: 620px; } .letraselu { font-size:16px; font:Verdana, Geneva, sans-serif; background-color:#0F0; } </style> <script src="<?php echo base_url() . 'assets/js/jquery.validationEngine-en.js'; ?>" type="text/javascript" charset="utf-8"></script> <script src="<?php echo base_url() . 'assets/js/jquery.validationEngine.js'; ?>" type="text/javascript" charset="utf-8"></script> <script type="text/javascript"> $(document).ready(function(){ $('#paymentform').validationEngine(); itemsPaidFor = ""; taxRate = 0; totalPrice = <?php echo $values->total; ?>; taxAmount = <?php echo $values->tax; ?>; subTotal = <?php echo $values->subtotal; ?>; $('.itemordered').each(function(index){ if ($(this).attr('checked')){ if (itemsPaidFor == ""){ itemsPaidFor = itemsPaidFor + $(this).attr('orderid'); } else { itemsPaidFor = itemsPaidFor + "," + $(this).attr('orderid'); } } }); $('.itemordered').click(function(e){ itemsPaidFor = ""; subTotal = 0.00; totalPrice = 0.00; taxAmount = 0.00; //set the coupon used flag back to zero since all coupons redeemed would be reset $('input[name=couponused').val('0'); //remove any alerts about coupon codes $('#invalidcode').hide(); $('#codesuccess').hide(); $('.itemordered').each(function(index){ if ($(this).attr('checked')){ if (itemsPaidFor == ""){ itemsPaidFor = itemsPaidFor + $(this).attr('orderid'); subTotal = subTotal + parseFloat($(this).attr('price')); } else { itemsPaidFor = itemsPaidFor + "," + $(this).attr('orderid'); subTotal = subTotal + parseFloat($(this).attr('price')); } } }); //alert(itemsPaidFor); $('input[name=ordereditems]').val(itemsPaidFor); //alert($('input[name=ordereditems]').val()); taxAmount = (taxRate * subTotal).toFixed(2); totalPrice = (totalPrice + subTotal).toFixed(2); subTotal = subTotal.toFixed(2); //update subtotal $('#subtotalamount').html(subTotal); //update taxamount $('#taxamount').html(taxAmount); $('input[name=tax]').val(taxAmount); //update total $('input[name=total]').val(totalPrice); $('#totalamount').html(totalPrice); }); }); function redeemCode() { code = $('input[name=couponcode]').val(); if (code == '') return; $.ajax({ type: "POST", url: "<?php echo site_url('customer/payment/redeemcode'); ?>", data: "code=" + code, success: function(data, textstatus){ if (data == '1'){ //coupon code is valid $('#invalidcode').hide(); $('#codesuccess').slideDown('fast'); subTotal = subTotal * 0; subTotal = subTotal.toFixed(2); taxAmount = parseFloat(subTotal) * taxRate taxAmount = taxAmount.toFixed(2); totalPrice = parseFloat(subTotal) + parseFloat(taxAmount); totalprice = totalPrice.toFixed(2); //update values in DOM //update subtotal $('#subtotalamount').html(subTotal); //update taxamount $('#taxamount').html(taxAmount); $('input[name=tax]').val(taxAmount); //update total $('input[name=total]').val(totalPrice); $('#totalamount').html(totalPrice); //set the coupon used flag to 1 $('input[name=couponused]').val('1'); $('input[name=orderid]').val('1'); } else { //coupon code is invalid $('#codesuccess').hide(); $('#invalidcode').slideDown('fast'); } } }); } function sendCashNotification(event){ $.ajax({ }); } </script> </head> <body> <?php echo $paywaiter; ?> <div class="container-fluid" style="margin-top:120px;"> <div class="row-fluid"> <div class="span3 outer-frame rounded-6px"> <div class="rounded-4px paymentorder"> <div class="boxheading toprounded-4px"> Your Order </div> <div class="paymentordercontent"> <p class="contentbox">Please select the items you want to pay for.</p> <?php //foreach ($unpaid_items as $unpaid_item): //include('connector.inc'); //echo "<script>alert(ido)"; require dbfatin; $d1="Select menuitem.price, menuitem.id, menuitem.name AS name, orderitem.orderid, `order`.tablenumber From menuitem Inner Join orderitem ON orderitem.menuid = menuitem.id Inner Join `order` ON orderitem.orderid = `order`.id Where `order`.tablenumber = '$ido' AND orderitem.paymentid is null"; $d2=$conn->query($d1); $i=0; while ($row=$d2->fetch_array()){ $i++; ?> <div class="ordereditem"> <input price="<?php echo $row[0]; ?>" orderid="<?php echo $row[1]; ?>" class="itemordered pull-left" style="margin-right:15px;" type="checkbox" name="order" checked /> <div class="ordered pull-left" style=""><?php echo $row[2]; ?><br/><b>$<?php echo $row[0]; ?></b></div> </div> <?php } ?> </div> </div> </div> <div class="span6 outer-frame rounded-6px"> <div class="paymentmain rounded-4px" style=""> <div class="boxheading toprounded-4px"> Payment Details </div> <div class="paymentdetails"> <div class="alert alert-danger hide" id="invalidcode"></div> <form method="post" target="_blank" action="<?php echo site_url('customer/payment/success?id='.$ido.'&idn='.$idn); ?>" id="paymentform"> <table class="form"> <tr> <td width="177" class="formlabel">Subtotal</td> <td width="191" nowrap="nowrap">$ <input type="text" name="subt" id="subt" readonly value="<?php echo $values->subtotal; ?>" /> <input name="tipamount" value="0.00" type="hidden" class="span3" /></td> </tr> <tr> <td align="left" valign="top" bgcolor="#009900" class="letraselu">Discount</td> <td align="left" valign="top" bgcolor="#009900" class="letraselu" nowrap="nowrap"><span id="taxamount"> $ <input type="number" name="tax" id="tax" maxlength="5" placeholder="Discount" onchange="koaosan();" value="<?php echo $values->tax; ?>" /></span></td> </tr> <tr> <td class="formlabel">Total Paid</td> <td id="totlselu">$ <input readonly name="total" id="total" type="text" value="<?php echo $values->total; ?>" /></td> </tr> <tr> <td class="formlabel"> </td> <td> </td> </tr> <tr> <td valign="top" nowrap="nowrap" bgcolor="#009900" class="letraselu">Cash / Osan Simu<br/></td> <td valign="top" nowrap="nowrap" class="letraselu">$ <input name="osansimu" class="letraselu" type="text" id="osansimu" size="10" maxlength="10" onChange="suraosan();" /></td> </tr> <tr> <td valign="top" nowrap="nowrap" class="formlabel">Return / Osan Volta</td> <td valign="top" nowrap="nowrap" bgcolor="#009900" class="formlabel">$ <input name="osanvolta" type="text" id="osanvolta" size="10" readonly /></td> </tr> </table> <br/> <input type="hidden" value="<?php echo $unpaid_ids; ?>" name="ordereditems" /> <input type="hidden" value="0" name="couponused" /> </p> <a href="#" id="tobselu" class="btn btn-large" onclick="$('#paymentform').submit();window.history.back();" ><i class="icon-shopping-cart"></i> Make Payment</a> </form> </div> </div> </div> </div> <br/> </div> </body> <?php //echo $callwaiter; ?> <?php echo $cashpayment; ?> <?php //echo $game; ?> </html> <script> function removeo(){ var lin='<?php echo site_url()?>'; var lin1='/manager/pdf/recivo?id=<? echo $ido; ?>'; window.open(lin + lin1); } function suraosan(){ var totalselu= document.getElementById('total').value; var totalsimu= document.getElementById('osansimu').value; var disc= document.getElementById('tax').value; var totalvolta=totalsimu - totalselu; document.getElementById('osanvolta').value= Number(totalvolta).toFixed(2); if (totalvolta <= -1) { alert ("Attention !!! Please correct your amount $" + Number(totalsimu).toFixed(2) + ", it should be paid $" + Number(totalselu).toFixed(2) ); return false; } let person =confirm('Are you sure to print receipt now? Return Money / Osan Volta : $' + Number(totalvolta).toFixed(2)) let text; if (person == null || person == "") { //var si='<? echo site_url() ?>'; //window.history.back(); //window.open(si + '/waiter/orders','_self'); return false; }else{ document.getElementById('tobselu').click(); } } function koaosan(){ var subselu = document.getElementById('subt').value; var discselu = document.getElementById('tax').value; var totalpaid = subselu - discselu; document.getElementById('total').value= ""; document.getElementById('total').value= Number(totalpaid).toFixed(2); if (totalpaid <= -1) { alert ("Attention !!! Please correct your amount $" + Number(discselu).toFixed(2) + ", it should be paid $" + Number(totalpaid).toFixed(2) ); return false; }} </script>
SIMPAN PERUBAHAN