All pastes #357024 Raw Edit

Something

public text v1 · immutable
·published 2007-02-15 12:21 UTC
rendered paste body
<?php 
function header_cb() { 
	$my_header  = '		
	<link href="/mrp/styles/global.css" rel="stylesheet" type="text/css"/>
	<link href="/mrp/styles/icons.css" rel="stylesheet" type="text/css"/>
	<link href="/mrp/styles/tabs.css" rel="stylesheet" type="text/css"/>';	
	$my_header .= '<script type="text/javascript">

		$(document).ready(function(){
			$("#mainContents2").tabs({remote: true});
		});
		</script>';

	return $my_header;

}

require_once($_SERVER['DOCUMENT_ROOT']."/mrp/functions/views.php");
$MM_authorizedUsers = "1,2,3,10,11";
echo ( page_header('', $MM_authorizedUsers) ) ;
//echo ( ViewMenu($_SESSION['MM_Username']) );

?>



<div id="mainContents2">
	<ul class="anchors">
	 <li><a href="/mrp/orders/parts/list.php">Current Orders</a></li>
	 <li><a href="/mrp/orders/parts/list.php?w=unconfirmed">Unconfirmed Orders</a></li>
	 <li><a href="/mrp/orders/parts/list.php?w=closed">Closed Orders</a></li>
	 <li><a href="/mrp/orders/parts/list.php?w=packed">Packed Orders</a></li>
	 <li><a href="/mrp/orders/parts/list.php?w=shipped">Shipped Orders</a></li>
   </ul

</div>
----
/* list.php */
<?php

require_once($_SERVER['DOCUMENT_ROOT']."/mrp/orders/class.order.php");
require_once($_SERVER['DOCUMENT_ROOT']."/mrp/functions/utils.php");


/* @param string $what
 *			$what => 'all', 'current'=default, 'unconfirmed', 'packed', 'shipped', 'closed'
 */

$offset = 0; 			if (isset($_GET['o'])) { $offset 	= $_GET['o']; } 
$numrec = 30;			if (isset($_GET['n'])) { $numrec 	= $_GET['n']; } 
$what = "current";	if (isset($_GET['w'])) { $what 		= $_GET['w']; } 
$orient = "ASC";		if (isset($_GET['a'])) { $orient 	= $_GET['a']; } 
$orderby = "ID"; 		if (isset($_GET['r'])) { $orderby 	= $_GET['r']; } 

$orient = ($orient == "ASC") ? "DESC" : "ASC";

$res = Order::list_orders($what, $offset, $numrec, $orderby, $orient);

if (isset($res['success'])) { 
	$table_script = '
	<link href="/mrp/styles/global.css" rel="stylesheet" type="text/css"/>
	<script language="javascript" src="/mrp/styles/jquery.js"></script>
	<script language="javascript" src="/mrp/styles/thickbox.js"></script>
	<script language="javascript" src="/mrp/styles/jqModal.js"></script>
	<script language="javascript" src="/mrp/styles/jquery.getParams.js"></script>
	<script type="text/javascript">

		$(document).ready(function(){
			w = "'.$what.'";
			o = '.$offset.' ;

			n = '.$numrec.' ;
			r = "'.$orderby.'";
			a = "'.$orient.'";	
			
			$("a.morelnk").click(function(){$("#mo"+this.id).toggleClass("more");return false;});
			$("#edit_window").jqm({	
				ajax: "/mrp/orders/parts/edit.php?id="+"@name", /*  */
				trigger: ".editlnk"
			});
			
			$("a.orderby").click(function(){
				$.get( "/mrp/orders/parts/list.php", 
					{ "w": w, "o": o, "n": n, "r": this.id, "a": a },
					function(data) {
						$("#listing").empty().append(data);
					}
				);
			});
			$("#listing").corner("top");
		});
		</script>
		';
	$table  = '<div id="edit_window" class="jqmWindow">
		Please wait... <img src="/mrp/images/loading_indicator.gif" alt="loading" />
		</div>';
	$table .= '<div id="listing">
		<table id="listing_table" width="100%" border="0" cellpadding="0" cellspacing="0" class="tablePadding border smallText">';
	$table .= '<thead>
		<tr class="th1 center bold lineBottom">
			<th class="lineRight"><a href="#" id="ID" class="orderby">Order ID</a></th>
			<th class="lineRight"><a href="#" id="CompanyName" class="orderby">Customer</a></th>
			<th><a href="#" id="WeightPercentageComplete" class="orderby">% Complete [ W ]</a></th>
			<th><a href="#" id="PercentageComplete" class="orderby">% Complete [PCS]</a></th>
			<th colspan=3>Actions</th>
		</tr>
		<tr class="th2 bgGray center bold lineBottom">
			<th class="lineRight">Ordered Qty</th>
			<th class="lineRight">Ordered Weight [KG]</th>
			<th>Remaining Weight [KG]</th>
			<th>In Date</th>
			<th>Due Date</th> 

			<th>Ship By Date</th>
			<th>Notes</th>		
		</tr>
		</thead>';
	$row_num = 1; 
	foreach ($res['list_orders'] as $order) { 
		$row = $order;
		if ( $row_num % 2 == 0 ) { 
				$table .= '<tr class="lineBottom" class="even" id="row_'.$row_num.'">';
			} else { 
				$table .= '<tr class="lineBottom" id="row_'.$row_num.'">';
			}
		$table .= '<td><a href="/mrp/orders/order.php?id='.$row['ID'].'" class="linkout">'.$row['ID'].'</a></td>';
		$table .= '<td class="lineRight boldText">'.$row['CompanyName'].'</td>';
		$table .= '<td class="lineRight numPercent">'.format_percent( $row['WeightPercentageComplete'] ).'</td>';
		$table .= '<td class="lineRight numPercent">'.format_percent( $row['PercentageComplete'] ).'</td>';
		$table .= '<td  colspan=3 class="actions">';
		$table .= '<a href="#" class="editlnk jqModal" id="it_'.$row_num.'" name="'.$row['ID'].'" >Edit</a> | ';
		$table .= '<a href="/mrp/orders/parts/links.php?id='.$row['ID']
			.'&height=300&width=500" title="Order No: '
			.$row['ID'].'" class="thickbox" name="'.$row['ID'].'">Items</a> | ';
		$table .= '<a href="#">BoM</a> | ';
		$table .= '<a href="#" class="morelnk" id="re_'.$row_num.'" >...</a>';
		$table .= '</td>';
		$table .= '</tr>';
		$table .= '<tr class="more lineBottom bgGreen" id="more_'.$row_num.'">'; 
		$table .= '<td class="lineRight numPercent">'.format_qty( $row['OrderedQty'] ).'</td>';
		$table .= '<td class="lineRight numPercent">'.$row['OrderedWeightKG'].'</td>';
		$table .= '<td class="lineRight numPercent">'.$row['LeftWeightKG'].'</td>';
		$table .= '<td class="lineRight">'.$row['InDate'].'</td>';
		$table .= '<td class="lineRight">'.$row['DueDate'].'</td>';				
		$table .= '<td class="lineRight">'.$row['ShipByDate'].'</td>';
		$table .= '<td>'.$row['Notes'].'</td>';
		$table .= '</tr>';
		//$table .= '<tr class="edit_pane lineBottom more bgLightRed" id="tredit_'.$row_num.'"><td colspan=7><div id="edit_'.$row_num.'"></div></td></tr>';
		$row_num += 1;
	}
	echo $table_script;
	echo $table;
	
} else { 
	echo '<pre>'.print_r($res['error']).'</pre>';
}
?>