PageRenderTime 23ms CodeModel.GetById 12ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/beta/shopfloor/default.asp

http://github.com/khaneh/Orders
ASP | 110 lines | 104 code | 5 blank | 1 comment | 13 complexity | 8a1e9ce6cbd7e133d869e4d1708f58de MD5 | raw file
  1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2'shopfloor (3)
  3PageTitle="���� �����"
  4SubmenuItem=1
  5if not Auth(3 , 1) then NotAllowdToViewThisPage()
  6orderID=0
  7if IsNumeric(Request("orderID")) then orderID = CDbl(Request("orderID"))
  8%>
  9<!--#include file="top.asp" -->
 10<!--#include File="../include_farsiDateHandling.asp"-->
 11<!--#include File="../include_JS_InputMasks.asp"-->
 12<style>
 13	span.stName{padding: 0 5px;font-family: "b zar";font-weight: bold;font-size: 12px;color: #b04444}
 14	.orderColor {background-color: black;color: yellow;}
 15	.quoteColor {background-color: #559;color: yellow;}
 16	.quoteColor td a:link{color: yellow;}
 17	.quoteColor td a:visited{color: #47FF00;}
 18	.quoteColor td a:hover{color: red;}
 19	.orderColor td a:link{color: yellow;}
 20	.orderColor td a:visited{color: #47FF00;}
 21	.orderColor td a:hover{color: red;}
 22</style>
 23
 24<div class="inPage">
 25	<span>����� �����: </span>
 26	<input id="orderID" size="6" class="boot" <%if orderID>0 then Response.write " value='" & orderID & "'"%>/>
 27	<select id="step" class="btn">
 28<%
 29	set RS=Conn.Execute ("SELECT * FROM OrderSteps WHERE (IsActive=1) order by ord")
 30	while not rs.eof
 31		Response.write "<OPTION value='" & RS("ID") & "'>" & RS("name") & "</option>"
 32		rs.MoveNext
 33	wend
 34%>		
 35	</select>
 36	<input id="submit" name="submit" type="button" value="�����" class="btn"/>
 37	<div id="message" class="well well-small"></div>
 38</div>
 39<div id="orderHeader" class="well"></div>
 40
 41<script type="text/javascript">
 42$(document).ready(function(){
 43	$("#submit").click(function(){
 44		$("#step").prop("disabled", true);
 45		$("#submit").prop("disabled", true);
 46		$.getJSON("/service/json_orderStatus.asp",
 47		{act:"set",orderID:Number($("#orderID").val()),step:$("#step option:selected").val()},
 48		function(json){
 49			if (json.status=='done')
 50				$("#message").html("����� ����� �� " + json.stepName + " ����� ���� ���!");
 51			else
 52				$("#message").html("����� �� ����! ����� ����� ����� ���� ����!");
 53		});
 54		$("#step").prop("disabled", false);
 55		$("#submit").prop("disabled", false);
 56	});
 57	$("#orderID").blur(function(){
 58		checkOrder();
 59	});
 60	if (parseInt($("#orderID").val())>0)
 61		checkOrder();
 62});
 63function checkOrder(){
 64	var orderID = Number($("#orderID").val());
 65	if (!isNaN(orderID) && orderID!='') {
 66		loadXMLDoc("/service/xml_getOrderProperty.asp?act=showHead&id=" + orderID, function(orderXML){
 67			
 68			var isOrder = $(orderXML).find("status isOrder").text();
 69			var isClosed = $(orderXML).find("status isClosed").text();
 70			var isApproved = $(orderXML).find("status isApproved").text();
 71			var step = $(orderXML).find("status step").text();
 72			if (isOrder=='0'){
 73				$("#message").html("<b>�������</b> ��� �������� �� ��� �� �ǁ ����� ����� ���� ���");
 74				$("#step option").prop("disabled", true);
 75				$("#step option[value=25]").prop("disabled", false);
 76				$("#step option[value=38]").prop("disabled", false);
 77			} else
 78			if (isClosed!='0'){
 79				$("#message").html("����� ���� ���!");
 80				$("#step").prop("disabled", true);
 81				$("#submit").prop("disabled", true);
 82			} else if (step=='40' && isApproved=='0'){
 83				$("#message").html("<B>����� �� ���� ����� ����� ���.</B> �� ����� ���� ��� ����� ���� ���! (�� ���� �������� ��� ����� �� �� ���� ���� ���.)");
 84				$("#step").prop("disabled", true);
 85				$("#submit").prop("disabled", true);
 86			} else {
 87				$("#step option").prop("disabled", false);
 88				$("#step").prop("disabled", false);
 89				$("#submit").prop("disabled", false);
 90				$("#step option[value=" + step + "]").prop("selected", true);
 91				if (isApproved=='0')
 92					$("#message").html("<b>����� ����� ����</b>");
 93			}	
 94			
 95			TransformXml(orderXML, "/xsl.<%=version%>/orderShowHeader.xsl", function(result){
 96				$("#orderHeader").html(result);	
 97				$('a#customerID').click(function(e){
 98					window.open('../CRM/AccountInfo.asp?act=show&selectedCustomer='+$('a#customerID').attr("myID"), 'showCustomer');
 99					e.preventDefault();
100				});
101			});
102		});
103	} else{
104		$("#step").prop("disabled", true);
105		$("#submit").prop("disabled", true);
106	}
107}
108</script>
109
110<!--#include file="tah.asp" -->