[go: up one dir, main page]

Menu

[r21]: / orders.php  Maximize  Restore  History

Download this file

169 lines (144 with data), 7.4 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?php
$pageRef='Stock';
include('includes/header.php');
?>
<script>
function reloadFrame(){
$('tableIframe').src="./ordersTable.php";
}
function orderReload(){
var pSup=$F('pSupplier');
var pNum=$F('pNumber');
var pSta=$F('pStatus');
var pPro=$F('pProduct');
document.getElementById('tableIframe').src='ordersTable.php?pSup='+pSup+'&pSta='+pSta+'&pPro='+pPro+'&pNum='+pNum;
}
function showOrderDetails(elem){
var args = elem.name.split("_");
var orderId = args[0];
var numOfOrderRows = args[1];
var orderRow = new Array();
for(var i = 0; i < numOfOrderRows; i++){
orderRow[i] = orderId+'_'+i;
if($(orderRow[i]).style.display == 'inline'){
$(orderRow[i]).style.display = 'none';
$(orderId).value=0;
}else{
$(orderRow[i]).style.display = 'inline'
$(orderId).value=1;
}
}
}
function successInDeletingOrderF(transport){
var args=transport.responseText.evalJSON();
//Success in delete request
//Operation result advice
$('qResult').style.display='block';
$('qResult').innerHTML=args.opText;
if(parseInt(args.opResult) == 0){
//Success in delete operation
OL_orderTableLoad($F('pSupplier'), $F('pNumber'), $F('pStatus'), $F('pProduct'), {elementToFill: 'orderTable', onSuccess: setOrderEventHandlers});
}else{
//Failure in delete operation
}
}
function failureInDeletingOrderF(){
//Failure in delete request
alert('<?php echo _T("NI_orders_"); ?>');
}
function deleteOrder(elem){
var args = elem.getAttribute("name").split("_");
var orderId = args[0];
result = confirm(<?php echo _T("NI_orders_") ?>);
if(result != 0){
OL_deleteOrder(orderId, {onSuccess: successInDeletingOrderF, onFailure: failureInDeletingOrderF});
}else{
}
}
function modifyOrder(elem){
var args = elem.name.split("_");
var orderId = args[0];
window.location.href='http://<?php echo $_SERVER['SERVER_ADDR']?>/Oreste/viewOrderDetailed.php?oid='+orderId;
}
function setOrderEventHandlers(){
setTimeout("$$('a.aOrderTitle').each(function(s){Event.observe(s,'click',function(){showOrderDetails(s);})})", 1);
setTimeout("$$('a.aOrderModify').each(function(s){Event.observe(s,'click',function(){modifyOrder(s);})})", 1);
setTimeout("$$('a.aOrderDelete').each(function(s){Event.observe(s,'click',function(){deleteOrder(s);})})", 1);
}
function goToStock(){
window.location.href = 'http://<?php echo $_SERVER['SERVER_ADDR']?>/Oreste/stock.php';
}
</script>
<div id="qResult" class="OpResult"></div>
<div class="Columns">
<div class="Column1">
<div class="Block"><div class="BlockBL"><div></div></div><div class="BlockBR"><div></div></div><div class="BlockTL"></div><div class="BlockTR"><div></div></div><div class="BlockT"></div><div class="BlockR"><div></div></div><div class="BlockB"><div></div></div><div class="BlockL"></div><div class="BlockC"></div><div class="BlockContent"><span class="BlockHeader"><span><?php echo _T("Actions") ?></span></span><div class="BlockContentBorder">
<ul>
<?php echo "<li><a href=\"javascript:goToStock();\">" . _T("Stock") . "</a></li>"; ?>
</ul>
</div>
</div>
</div>
<div class="Block"><div class="BlockBL"><div></div></div><div class="BlockBR"><div></div></div><div class="BlockTL"></div><div class="BlockTR"><div></div></div><div class="BlockT"></div><div class="BlockR"><div></div></div><div class="BlockB"><div></div></div><div class="BlockL"></div><div class="BlockC"></div><div class="BlockContent"><span class="BlockHeader"><span><?php echo _T("Search for product") ?></span></span><div class="BlockContentBorder">
<table width="100%" style="font-size:0.8em;">
<tr><td style="width:10%;" colspan="2"> <?php echo _T("Supplier") ?></td> <td align="center" style="width:90%;"><input style="width:80%;" name="pSupplier" id="pSupplier" type="text"/></td></tr>
<tr><td style="width:10%;" colspan="2"> <?php echo _T("Number") ?></td> <td align="center" style="width:90%;"><input style="width:80%;" name="pNumber" id="pNumber" type="text"/></td></tr>
<tr><td style="width:10%;" colspan="2"> <?php echo _T("Status") ?></td> <td align="center" style="width:90%;"><select style="width:80%;" name="pStatus" id="pStatus"><option value=""></option><option value="0"><?php echo _T("Aperto") ?></option><option value="1"><?php echo _T("Incomplete") ?></option><option value="2"><?php echo _T("Closed") ?></option></select></td></tr>
<tr><td style="width:10%;" colspan="2"> <?php echo _T("Product") ?></td> <td align="center" style="width:90%;">
<?php
echo "<select style=\"width:80%; font-size:0.8em;\" name=\"pProduct\" id=\"pProduct\">";
echo "<option value=\"\"></option>";
mysql_query("BEGIN");
$getProducts = mysql_query("SELECT * FROM products ORDER BY productName");
while($row = mysql_fetch_array($getProducts)) {
echo "<option value=\"" . $row[productID] . "\">" . $row[productName] . "</option>";
}
mysql_query("COMMIT");
echo "</select>";
?>
</td></tr>
</table>
</div>
</div>
</div>
</div>
<div class="MainColumn">
<div class="Block"><div class="BlockBL"><div></div></div><div class="BlockBR"><div></div></div><div class="BlockTL"></div><div class="BlockTR"><div></div></div><div class="BlockT"></div><div class="BlockR"><div></div></div><div class="BlockB"><div></div></div><div class="BlockL"></div><div class="BlockC"></div><div class="BlockContent"><span class="BlockHeader"><span><?php echo _T("Orders") ?></span></span><div class="BlockContentBorder" id="orderTable">
</div>
</div>
</div>
</div>
<?php
mysql_query("BEGIN");
$getOrders = mysql_query("SELECT * FROM orders ORDER BY orderStatus, orderTime DESC");
while($row = mysql_fetch_array($getOrders)) {
echo "<input type=\"text\" id=\"" . $row[orderID] . "\" style=\"display:none;\" value=\"0\">";
}
mysql_query("COMMIT");
?>
</div>
<script>
// ************************************************************
// * Observe window load event to call the init page function *
// ************************************************************
Event.observe(window, 'load', function(){
// *****************************************
// * Load clients table for the first time *
// *****************************************
OL_orderTableLoad('', '', '', '', {elementToFill: 'orderTable', onSuccess: setOrderEventHandlers});
// **************************
// * Install event handlers *
// **************************
Event.observe('pSupplier', 'keyup', function(){OL_orderTableLoad($F('pSupplier'), $F('pNumber'), $F('pStatus'), $F('pProduct'), {elementToFill: 'orderTable', onSuccess: setOrderEventHandlers});});
Event.observe('pNumber', 'keyup', function(){OL_orderTableLoad($F('pSupplier'), $F('pNumber'), $F('pStatus'), $F('pProduct'), {elementToFill: 'orderTable', onSuccess: setOrderEventHandlers});});
Event.observe('pStatus', 'change', function(){OL_orderTableLoad($F('pSupplier'), $F('pNumber'), $F('pStatus'), $F('pProduct'), {elementToFill: 'orderTable', onSuccess: setOrderEventHandlers});});
Event.observe('pProduct', 'change', function(){OL_orderTableLoad($F('pSupplier'), $F('pNumber'), $F('pStatus'), $F('pProduct'), {elementToFill: 'orderTable', onSuccess: setOrderEventHandlers});});
Event.observe('qResult', 'mouseover', function(){OL_makeThisElementInvisible('qResult');});
});
</script>
<!-- tags opened in the header -->
</div>
</div>
</div>
</body>
</html>