PageRenderTime 17ms CodeModel.GetById 2ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/beta/AR/include_JS_for_Invoices.asp

http://github.com/khaneh/Orders
ASP | 541 lines | 486 code | 55 blank | 0 comment | 88 complexity | be23170062a84cd51320930f44a97e8e MD5 | raw file
  1<script language="JavaScript">
  2<!--
  3function setCurrentRow(rowNo){
  4	if (rowNo == -1) rowNo=0;
  5	invTable=document.getElementById("InvoiceLines");
  6	theTD=invTable.getElementsByTagName("tr")[currentRow].getElementsByTagName("td")[0];
  7	theTD.setAttribute("bgColor", '#F0F0F0');
  8
  9	currentRow=rowNo;
 10	invTable=document.getElementById("InvoiceLines");
 11	theTD=invTable.getElementsByTagName("tr")[currentRow].getElementsByTagName("td")[0];
 12	theTD.setAttribute("bgColor", '#FFB0B0');
 13}
 14function delRow(rowNo){
 15	invTable=document.getElementById("InvoiceLines");
 16	theRow=invTable.getElementsByTagName("tr")[rowNo];
 17	invTable.removeChild(theRow);
 18
 19	rowsCount=document.getElementsByName("Items").length;
 20	for (rowNo=0; rowNo < rowsCount ; rowNo++){
 21		tempTD=invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[0]
 22		tempTD.bgColor= '#F0F0F0';
 23		tempTD.innerText= rowNo+1;
 24	}
 25}
 26function addRow(){
 27	rowNo = currentRow
 28	invTable=document.getElementById("InvoiceLines");
 29	theRow=invTable.getElementsByTagName("tr")[rowNo];
 30	newRow=document.createElement("tr");
 31	newRow.setAttribute("bgColor", '#f0f0f0');
 32	newRow.setAttribute("onclick", theRow.getAttribute("onclick"));
 33
 34	tempTD=document.createElement("td");
 35	tempTD.innerHTML=rowNo+1
 36	tempTD.setAttribute("align", 'center');
 37	tempTD.setAttribute("width", '25');
 38	newRow.appendChild(tempTD);
 39
 40	tempTD=document.createElement("td");
 41	tempTD.setAttribute("dir", 'LTR');
 42	tempTD.innerHTML="<INPUT class='InvRowInput' TYPE='text' NAME='Items' size='3' Maxlength='6' onKeyPress='return mask(this,event);' onChange='return check(this);' onfocus='setCurrentRow(this.parentNode.parentNode.rowIndex);'><INPUT TYPE='hidden' name='type' value=0><INPUT TYPE='hidden' name='fee' value=0><INPUT type='hidden' name='hasVat' value=0>"
 43
 44	newRow.appendChild(tempTD);
 45
 46	tempTD=document.createElement("td");
 47	tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='Descriptions' size='30'>"
 48	newRow.appendChild(tempTD);
 49
 50	tempTD=document.createElement("td");
 51	tempTD.setAttribute("dir", 'LTR');
 52	tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='Lengths' size='2' onBlur='setFeeQtty(this);'>"
 53	newRow.appendChild(tempTD);
 54
 55	tempTD=document.createElement("td");
 56	tempTD.setAttribute("dir", 'LTR');
 57	tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='Widths' size='2' onBlur='setFeeQtty(this);'>"
 58	newRow.appendChild(tempTD);
 59
 60	tempTD=document.createElement("td");
 61	tempTD.setAttribute("dir", 'LTR');
 62	tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='Qttys' size='3' onBlur='setFeeQtty(this);'>"
 63	newRow.appendChild(tempTD);
 64
 65	tempTD=document.createElement("td");
 66	tempTD.setAttribute("dir", 'LTR');
 67	tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='Sets' size='2' onBlur='setFeeQtty(this);'>"
 68	newRow.appendChild(tempTD);
 69
 70	tempTD=document.createElement("td");
 71	tempTD.setAttribute("dir", 'LTR');
 72	tempTD.innerHTML="<INPUT class='InvRowInput' TYPE='text' NAME='AppQttys' size='6' onBlur='setPrice(this);'>"
 73	newRow.appendChild(tempTD);
 74
 75	tempTD=document.createElement("td");
 76	tempTD.setAttribute("dir", 'LTR');
 77	tempTD.innerHTML="<INPUT class='InvRowInput' TYPE='text' NAME='Fees' readonly size='7' onBlur='setPrice(this);'>"	
 78	newRow.appendChild(tempTD);
 79
 80	tempTD=document.createElement("td");
 81	tempTD.setAttribute("dir", 'LTR');
 82	tempTD.innerHTML="<INPUT  tabIndex='9999' class='InvRowInput' TYPE='text' NAME='Prices' size='9'>"
 83	newRow.appendChild(tempTD);
 84
 85	tempTD=document.createElement("td");
 86	tempTD.setAttribute("dir", 'LTR');
 87	tempTD.innerHTML="<INPUT class='InvRowInput' TYPE='text' NAME='Discounts' size='7' onBlur='setPrice(this);'>"
 88	newRow.appendChild(tempTD);
 89
 90	tempTD=document.createElement("td");
 91	tempTD.setAttribute("dir", 'LTR');
 92	tempTD.innerHTML="<INPUT class='InvRowInput' TYPE='text' NAME='Reverses' size='5' onBlur='setPrice(this);' onfocus='setCurrentRow(this.parentNode.parentNode.rowIndex);'>"
 93	newRow.appendChild(tempTD);
 94
 95	// S A M
 96	tempTD=document.createElement("td");
 97	tempTD.setAttribute("dir", 'LTR');
 98	tempTD.innerHTML="<INPUT tabIndex='9998' class='InvRowInput4' TYPE='text' NAME='Vat' size='6' readonly>"
 99	//tempTD.appendChild(tempTD);
100	newRow.appendChild(tempTD);
101
102	tempTD=document.createElement("td");
103	tempTD.setAttribute("dir", 'LTR');
104	tempTD.innerHTML="<INPUT  tabIndex='9999' class='InvRowInput2' TYPE='text' NAME='AppPrices' size='9'>"
105	newRow.appendChild(tempTD);
106
107	invTable.insertBefore(newRow,theRow);
108	
109	rowsCount=document.getElementsByName("Items").length;
110	for (rowNo=0; rowNo < rowsCount ; rowNo++){
111		tempTD=invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[0]
112		tempTD.bgColor= '#F0F0F0';
113		tempTD.innerText= rowNo+1;
114	}
115
116	invTable.getElementsByTagName("tr")[currentRow].getElementsByTagName("td")[1].getElementsByTagName("Input")[0].focus();
117}
118//--------------------------------------------------------------------------------------------------------------------------------------------------
119function setPrice(src){
120//	alert(src.name);
121	if (src.name=="Discounts" || src.name=="Reverses"){
122		if (src.value.substr(src.value.length-1)=='%'){
123			src.value=val2txt(txt2val(src.value));
124			rowNo=src.parentNode.parentNode.rowIndex;
125			src.value=val2txt(parseInt(txt2val(document.getElementsByName("Prices")[rowNo].value) * txt2val(src.value) / 100))
126		}
127		else{
128			src.value=val2txt(txt2val(src.value));
129		}
130	}
131	else{
132		src.value=val2txt(txt2val(src.value));
133	}
134	isA = document.getElementsByName("IsA")[0].checked;
135	//alert(isA);
136	rowNo=src.parentNode.parentNode.rowIndex;
137	tmpFee=txt2val(document.getElementsByName("Fees")[rowNo].value);
138	tmpAppQtty=txt2val(document.getElementsByName("AppQttys")[rowNo].value);
139	tmpDiscount=txt2val(document.getElementsByName("Discounts")[rowNo].value);
140	tmpReverse=txt2val(document.getElementsByName("Reverses")[rowNo].value);
141	tmpPrice= tmpFee * tmpAppQtty;
142	tmpAppPrice=tmpPrice - tmpDiscount - tmpReverse;
143	// S A M
144	if (txt2val(document.getElementsByName("hasVat")[rowNo].value) == 1 && isA)
145		tmpVat = tmpAppPrice * txt2val(document.getElementById("VatRate").value)/100; //sam change this in 90
146	else 
147		tmpVat = 0;
148	tmpAppPrice += tmpVat;
149	document.getElementsByName("Prices")[rowNo].value = val2txt(parseInt(tmpPrice));
150	document.getElementsByName("AppPrices")[rowNo].value = val2txt(parseInt(tmpAppPrice));
151	document.getElementsByName("Vat")[rowNo].value = val2txt(parseInt(tmpVat));
152	
153	var totalPrice = 0;
154	var totalDiscount = 0;
155	var totalReverse = 0;
156	var totalAppPrice = 0;
157	var payable = 0;
158	var totalVat = 0;
159	for (rowNo=0; rowNo < document.getElementsByName("Fees").length; rowNo++){
160		totalPrice += parseInt(txt2val(document.getElementsByName("Prices")[rowNo].value));
161		totalDiscount += parseInt(txt2val(document.getElementsByName("Discounts")[rowNo].value));
162		totalReverse += parseInt(txt2val(document.getElementsByName("Reverses")[rowNo].value));
163		totalAppPrice += parseInt(txt2val(document.getElementsByName("AppPrices")[rowNo].value));
164		if (isA) {
165			totalVat += parseInt(txt2val(document.getElementsByName("Vat")[rowNo].value));}
166	}
167	payable = Math.floor(totalAppPrice/1000) * 1000;
168	document.all.TotalPrice.value = val2txt(totalPrice);
169	document.all.TotalDiscount.value = val2txt(totalDiscount);
170	document.all.TotalReverse.value = val2txt(totalReverse);
171	document.all.Payable.value = val2txt(payable);
172	document.all.TotalVat.value = val2txt(totalVat);
173
174	if (totalPrice==0){
175		document.all.TPDiscount.value = "- "+'%�����';
176		document.all.TPReverse.value = "- "+'%�ѐ��';
177	}
178	else{
179		document.all.TPDiscount.value = Math.round(totalDiscount/totalPrice * 100)+'%�����';
180		document.all.TPReverse.value = Math.round(totalReverse/totalPrice * 100)+'%�ѐ��';
181	}
182}
183function checkIsA(){
184	isA = document.getElementsByName("IsA")[0].checked;
185	var totalPrice = 0;
186	var totalDiscount = 0;
187	var totalReverse = 0;
188	var totalAppPrice = 0;
189	var payable = 0;
190	var totalVat = 0;
191	for (rowNo=0; rowNo < document.getElementsByName("Fees").length; rowNo++){
192		tmpFee=txt2val(document.getElementsByName("Fees")[rowNo].value);
193		tmpAppQtty=txt2val(document.getElementsByName("AppQttys")[rowNo].value);
194		tmpDiscount=txt2val(document.getElementsByName("Discounts")[rowNo].value);
195		tmpReverse=txt2val(document.getElementsByName("Reverses")[rowNo].value);
196		tmpPrice= tmpFee * tmpAppQtty;
197		tmpAppPrice=tmpPrice - tmpDiscount - tmpReverse;
198		// S A M
199		if (txt2val(document.getElementsByName("hasVat")[rowNo].value) == 1 && isA)
200			tmpVat = tmpAppPrice * txt2val(document.getElementById("VatRate").value)/100; //sam change this in 90
201		else 
202			tmpVat = 0;
203		tmpAppPrice += tmpVat;
204		document.getElementsByName("Prices")[rowNo].value = val2txt(parseInt(tmpPrice));
205		document.getElementsByName("AppPrices")[rowNo].value = val2txt(parseInt(tmpAppPrice));
206		document.getElementsByName("Vat")[rowNo].value = val2txt(parseInt(tmpVat));
207		
208		// ---------------------------------------------
209		totalPrice += parseInt(txt2val(document.getElementsByName("Prices")[rowNo].value));
210		totalDiscount += parseInt(txt2val(document.getElementsByName("Discounts")[rowNo].value));
211		totalReverse += parseInt(txt2val(document.getElementsByName("Reverses")[rowNo].value));
212		totalAppPrice += parseInt(txt2val(document.getElementsByName("AppPrices")[rowNo].value));
213		if (isA) {
214			totalVat += parseInt(txt2val(document.getElementsByName("Vat")[rowNo].value));}
215	}
216	payable = Math.floor(totalAppPrice/1000) * 1000;
217	document.all.TotalPrice.value = val2txt(totalPrice);
218	document.all.TotalDiscount.value = val2txt(totalDiscount);
219	document.all.TotalReverse.value = val2txt(totalReverse);
220	document.all.Payable.value = val2txt(payable);
221	document.all.TotalVat.value = val2txt(totalVat);
222
223	if (totalPrice==0){
224		document.all.TPDiscount.value = "- "+'%�����';
225		document.all.TPReverse.value = "- "+'%�ѐ��';
226	}
227	else{
228		document.all.TPDiscount.value = Math.round(totalDiscount/totalPrice * 100)+'%�����';
229		document.all.TPReverse.value = Math.round(totalReverse/totalPrice * 100)+'%�ѐ��';
230	}
231}
232//--------------------------------------------------------------------------------------------------------------------------------------------------
233
234var dialogActive=false;
235var badCode = false;
236
237var A				= 90		// DuplexFee Add-in
238var ProofSimplex	= 3000
239var ProofDuplex		= 4500
240			  Qtt	= Array (	0 ,	 		1,		50,		150,	300 )
241/*SimplexFee*/  SF	= Array (	ProofSimplex,	200,	144,	112,	100 )
242/*DuplexFee*/	DF	= Array (	ProofDuplex,	SF[1]+A,	SF[2]+A,	SF[3]+A,	SF[4]+A)
243
244//-----------------------------------------------------------------------------------------------------------------------------------------
245function setFeeQtty(src){
246	rowNo=src.parentNode.parentNode.rowIndex;
247	itemType=parseInt(txt2val(document.getElementsByName("type")[rowNo].value));
248	itemFee=document.getElementsByName("fee")[rowNo].value;
249	
250	if (!document.getElementsByName("Qttys")[rowNo].value == "")
251	document.getElementsByName("Qttys")[rowNo].value = parseInt(document.getElementsByName("Qttys")[rowNo].value);
252
253	if (!document.getElementsByName("Sets")[rowNo].value == "")
254	document.getElementsByName("Sets")[rowNo].value = parseInt(document.getElementsByName("Sets")[rowNo].value);
255
256	//////////////// Type =1  --->  General  //////////////////
257	if (itemType==1 || itemType==5){   
258		document.getElementsByName("AppQttys")[rowNo].value = parseInt(txt2val(document.getElementsByName("Qttys")[rowNo].value)) * parseInt(txt2val(document.getElementsByName("Sets")[rowNo].value)); 
259
260		document.getElementsByName("Fees")[rowNo].value =  parseInt(txt2val(itemFee)); 
261		if (parseInt(itemFee)>0){ //&& itemType<>0
262			document.getElementsByName("Fees")[rowNo].setAttribute("readonly",'readonly');
263		}
264		else {
265			document.getElementsByName("Fees")[rowNo].removeAttribute('readonly');
266			document.getElementsByName("Fees")[rowNo].readOnly=false;
267		}
268		if (''+document.getElementsByName("AppQttys")[rowNo].value=='NaN')
269			document.getElementsByName("AppQttys")[rowNo].value = 0;
270	}
271
272	//////////////// Type =2  --->  Digital  //////////////////
273	if (itemType==2 && itemFee!="0"){ 
274		document.getElementsByName("Fees")[rowNo].setAttribute("readonly",'readonly');  
275		PF		= parseInt(txt2val(itemFee.substr(1)));
276		tmp		= itemFee.substr(0,1);
277		if (tmp == "s" ) 
278			SoD = false 
279		else 
280			SoD = true
281		Tirag	= Math.round(parseInt(txt2val(document.getElementsByName("Qttys")[rowNo].value)));
282		h		= parseInt(txt2val(document.getElementsByName("Lengths")[rowNo].value));
283		Price	= 0
284		i		= 1
285		document.getElementsByName("Widths")[rowNo].value = 30	
286		if (h ==0 ) 
287			{
288			document.getElementsByName("Lengths")[rowNo].value=21
289			h=21
290			}
291
292		/*while ( Tirag >= Qtt[ i -1] ) 
293			{
294			a1 = Tirag - Qtt[ i - 1 ]
295			a2 = Tirag - Qtt[ i ]
296			if (a2>0)	
297				a3 = a1 - a2 
298			else 
299				a3 = a1
300			if ( SoD == false ) 
301				Price += ( SF[ i-1 ] + PF ) * a3
302			else
303				Price += ( DF[ i-1 ] + PF ) * a3
304
305			i++
306			}
307		*/
308		Price = ( 200 + PF ) * Tirag
309		if ( SoD == false ) 
310			Price = Price * 1
311		else
312			Price = Price * 2
313
314			
315		Price = Math.round(Price / 21 * h) 
316		unitPrice = Math.round(Price / Tirag) * 10
317		document.getElementsByName("Fees")[rowNo].value = unitPrice 
318		
319		document.getElementsByName("AppQttys")[rowNo].value = parseInt(txt2val(document.getElementsByName("Qttys")[rowNo].value)) * parseInt(txt2val(document.getElementsByName("Sets")[rowNo].value)); 
320	
321		if (''+document.getElementsByName("AppQttys")[rowNo].value=='NaN')
322			document.getElementsByName("AppQttys")[rowNo].value = 0
323		
324		if (''+document.getElementsByName("Fees")[rowNo].value=='NaN')
325			document.getElementsByName("Fees")[rowNo].value = 0
326	}
327
328	//////////////// Type =3  --->  Film  /////////////////////
329	if (itemType==3){   
330		h	= txt2val(document.getElementsByName("Lengths")[rowNo].value);
331		w	= txt2val(document.getElementsByName("Widths")[rowNo].value);
332		document.getElementsByName("Fees")[rowNo].value =  parseInt(txt2val(itemFee)) 
333		document.getElementsByName("AppQttys")[rowNo].value =  val2txt(txt2val(document.getElementsByName("Qttys")[rowNo].value) * txt2val(document.getElementsByName("Sets")[rowNo].value) * h * w);
334		if (parseInt(itemFee)>0){
335			document.getElementsByName("Fees")[rowNo].setAttribute("readonly",'readonly');
336		}
337		else {
338			document.getElementsByName("Fees")[rowNo].removeAttribute('readonly');
339			document.getElementsByName("Fees")[rowNo].readOnly=false;
340		}
341	}
342
343	//////////////// Type =4  --->  Piramon  //////////////////
344	if (itemType==4){   
345		document.getElementsByName("Fees")[rowNo].value =  parseInt(txt2val(itemFee)) 
346		//document.getElementsByName("AppQttys")[rowNo].focus();
347		//document.getElementsByName("AppQttys")[rowNo].select();
348		if (parseInt(itemFee)>0){
349			document.getElementsByName("Fees")[rowNo].setAttribute("readonly",'readonly');
350		}
351		else {
352			document.getElementsByName("Fees")[rowNo].removeAttribute('readonly');
353			document.getElementsByName("Fees")[rowNo].readOnly=false;
354		}
355	}
356
357	setPrice(document.getElementsByName("Fees")[rowNo]);
358}
359
360//--------------------------------------------------------------------------------------------------------------------------------------------------
361
362function mask(src,ev){ 
363	var theKey=event.keyCode;
364	//theKey = (ev.charCode) ? ev.charCode : event.keyCode;
365	//theKey = (ev.keyCode)? ev.keyCode: ((ev.charCode)? ev.charCode: ev.which);
366	
367	rowNo=src.parentNode.parentNode.rowIndex;
368	invTable=document.getElementById("InvoiceLines");
369	theRow=invTable.getElementsByTagName("tr")[rowNo];
370
371	if (src.name=="Items"){
372		if (theKey==13){
373			if (ev.which){
374				ev.which=9
375			} else {
376				event.keyCode=9
377			}
378			dialogActive=true
379			document.all.tmpDlgArg.value="#"
380			document.all.tmpDlgTxt.value="��� ����� �� �� �� ������ ����� ���� ���� ����:"
381			var myTinyWindow = window.showModalDialog('dialog_FindInvItem.asp',document.all.tmpDlgTxt,'dialogHeight:200px; dialogWidth:440px; dialogTop:; dialogLeft:; edge:None; center:Yes; help:No; resizable:No; status:No;');
382			if (document.all.tmpDlgTxt.value !="") {
383				var myTinyWindow = window.showModalDialog('dialog_invoiceItems.asp?act=select&name='+escape(document.all.tmpDlgTxt.value),document.all.tmpDlgArg,'dialogHeight:500px; dialogWidth:380px; dialogTop:; dialogLeft:; edge:Raised; center:Yes; help:No; resizable:Yes; status:No;');
384				if (document.all.tmpDlgArg.value!="#"){
385					Arguments=document.all.tmpDlgArg.value.split("#")
386					src.value=Arguments[0];
387					invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[2].getElementsByTagName("Input")[0].value=Arguments[1];
388					invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[1].getElementsByTagName("Input")[1].value=Arguments[2];
389					invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[1].getElementsByTagName("Input")[2].value=Arguments[3];
390					if (Arguments[4] == "����") // VAT
391						invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[1].getElementsByTagName("Input")[3].value = 1;
392					else 
393						invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[1].getElementsByTagName("Input")[3].value = 0;
394				}
395				if (parseInt(Arguments[1])=0) {
396					invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[7].getElementsByTagName("Input")[0].removeAttribute('readonly');
397					invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[7].getElementsByTagName("Input")[0].readOnly=false;
398				}
399				//setFeeQtty(invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[2].getElementsByTagName("Input")[0])
400
401				a=invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[2].getElementsByTagName("Input")[0];
402
403				if (a){
404					setFeeQtty(a)
405					a.focus();
406				}
407			}
408			dialogActive=false
409		}
410		else if (theKey >= 48 && theKey <= 57 ) { 
411			//alert(theKey)
412			//src.value=''
413			return true;
414		}
415		else { 
416			return false;
417		}
418	}
419}
420
421//--------------------------------------------------------------------------------------------------------------------------------------------------
422
423function check(src){ 
424	if (src.name=="Items"){
425		rowNo=src.parentNode.parentNode.rowIndex;
426		rowsCount=document.getElementsByName("Items").length;
427		if (!dialogActive){
428			if (src.value=='0'){
429				if (confirm("��� ����� ����� �� �� ������ ��� ��� �� ��� ���Ͽ")){
430					delRow(rowNo);
431					if (rowNo != rowsCount ){
432						invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[1].getElementsByTagName("Input")[0].focus();
433					}else{
434						invTable.getElementsByTagName("tr")[rowNo-1].getElementsByTagName("td")[1].getElementsByTagName("Input")[0].focus();
435					}
436					return false;
437				}
438				else{
439					src.focus();
440				}
441			}
442			else {
443				badCode = false;
444				if (window.XMLHttpRequest) {
445				var objHTTP=new XMLHttpRequest();
446			} else if (window.ActiveXObject) {
447				var objHTTP = new ActiveXObject("Microsoft.XMLHTTP");
448			}
449				objHTTP.open('GET','xml2.asp?id='+src.value,false)
450				objHTTP.send()
451				tmpStr = unescape( objHTTP.responseText)
452				//alert(tmpStr);
453				ar = tmpStr.split("#")
454
455				if (ar[0]=="�� ���� ��� ���")
456				{
457					//src.value="";
458					//src.focus();
459					alert("�� ���� ��� ���");
460					return false;
461				}
462				else{
463					//document.all['A1'].innerText= objHTTP.status
464					//document.all['A2'].innerText= objHTTP.statusText
465					//document.all['A3'].innerText= objHTTP.responseText
466					invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[2].getElementsByTagName("Input")[0].value = ar[0];
467					invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[1].getElementsByTagName("Input")[1].value = ar[1];
468					invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[1].getElementsByTagName("Input")[2].value = ar[2];
469					//invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[1].getElementsByTagName("Input")[2].readOnly="readonly";
470					//invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[1].getElementsByTagName("Input")[2].Attributes.Add("readonly","readonly");
471					//alert(invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[1].getElementsByTagName("Input")[2].value);
472					// VAT
473					if (ar[3] == "True")
474						invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[1].getElementsByTagName("Input")[3].value = 1;
475					else 
476						invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[1].getElementsByTagName("Input")[3].value = 0;
477
478					setFeeQtty(invTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[2].getElementsByTagName("Input")[0]);
479				}
480
481			}
482		}
483	}
484}
485
486
487function js_Link2Trace(num){
488	return "<A HREF='../order/orderEdit.asp?e=n&radif="+ num + "' target='_balnk'>"+ num + "</A>"
489}
490function selectOrder(){
491	theSpan=document.getElementById("orders");
492	document.all.tmpDlgArg.value="";
493	window.showModalDialog('Orders.asp?act=select&customer='+document.all.customerID.value,document.all.tmpDlgArg,'dialogHeight:500px; dialogWidth:380px; dialogTop:; dialogLeft:; edge:Raised; center:Yes; help:No; resizable:Yes; status:No;');
494	if (document.all.tmpDlgArg.value!="[Esc]"){
495		theSpan.innerHTML="";
496		Arguments=document.all.tmpDlgArg.value.split("#")
497		tempWriteAnd=""
498		for (i=1;i<=Arguments[0];i++){
499			theSpan.innerHTML += "<input type='hidden' name='selectedOrders' value='"+Arguments[i]+"'>" + tempWriteAnd + js_Link2Trace(Arguments[i])
500			tempWriteAnd=" � "
501		}
502	}
503}
504function selectCustomer(){
505	document.all.tmpDlgArg.value="#"
506	document.all.tmpDlgTxt.value="��� ����� �� �� �� ������ ����� ���� ���� ����:"
507	window.showModalDialog('../dialog_GenInput.asp',document.all.tmpDlgTxt,'dialogHeight:200px; dialogWidth:440px; dialogTop:; dialogLeft:; edge:None; center:Yes; help:No; resizable:No; status:No;');
508	if (document.all.tmpDlgTxt.value !="") {
509		window.showModalDialog('../AR/dialog_SelectAccount.asp?act=select&search='+escape(document.all.tmpDlgTxt.value), document.all.tmpDlgArg, 'dialogWidth:780px; dialogHeight:500px; dialogTop:; dialogLeft:; edge:Raised; center:Yes; help:No; resizable:Yes; status:No;');
510		if (document.all.tmpDlgArg.value!="#"){
511			Arguments=document.all.tmpDlgArg.value.split("#")
512			theSpan=document.getElementById("customer");
513			theSpan.getElementsByTagName("input")[0].value=Arguments[0];
514			theSpan.getElementsByTagName("span")[0].innerText=Arguments[1];
515		}
516	}
517}
518function submitOperations(){
519	setCurrentRow(0);
520	var okGo=true;
521	for (rowNo=0; rowNo < document.getElementsByName("Items").length; rowNo++){
522		if (document.getElementsByName('Items')[rowNo].value==''){
523			delRow(rowNo);			
524			rowNo=rowNo-1;
525			okGo=false;
526		}
527	}
528	if (okGo && document.getElementsByName('Items')[0]) {
529		checkIsA();
530		document.forms[0].submit();
531	}
532	else{
533		alert(".��� ��� ���� ���� ���� �� ��� ����\n\n .���� ����� ���� � ����� ���� ����� �� �����")
534		currentRow=0;
535		setCurrentRow(0);
536		if (document.getElementsByName('Items')[0])
537			document.getElementsByName('Items')[0].focus();
538	}
539}
540//-->
541</script>