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

/beta/AP/voucherEdit.asp

http://github.com/khaneh/Orders
ASP | 489 lines | 390 code | 54 blank | 45 comment | 36 complexity | f6565c504c77732682513f7d58494225 MD5 | raw file
  1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2'AP (7)
  3PageTitle= " ������ ������ "
  4SubmenuItem=1
  5' ATTENTION: This is the permission for VERIFY not EDIT
  6if not Auth(7 , 2) then NotAllowdToViewThisPage() 
  7%>
  8<!--#include file="top.asp" -->
  9<!--#include File="../include_farsiDateHandling.asp"-->
 10<!--#include File="../include_JS_InputMasks.asp"-->
 11<%
 12if request("act")="editVoucher" and isnumeric(request("VoucherID")) then
 13
 14	VoucherID=clng(request("VoucherID"))
 15
 16	mySQL = "SELECT * FROM Vouchers WHERE (ID="& VoucherID & ")" 
 17	Set RS1=Conn.execute(mySQL)
 18	if RS1.eof then
 19		conn.close
 20		response.redirect "?errMsg=" & Server.URLEncode("����� ������ ���� ���.")
 21	else
 22		VendorID=		RS1("VendorID")
 23		Title=			RS1("Title")
 24		CreationDate=	RS1("CreationDate")
 25		CreationTime=	RS1("CreationTime")
 26		SavedFileName=	RS1("SavedFileName")
 27		Comment=		RS1("Comment")
 28		TotalPrice=		RS1("TotalPrice")
 29		Verified=		RS1("Verified")
 30		Paid=			RS1("Paid")
 31		EffectiveDate=	RS1("EffectiveDate")
 32		number =		RS1("Number")
 33		totalVat =		RS1("TotalVat")
 34	end if
 35
 36	RS1.close
 37
 38	if Verified then
 39		conn.close
 40		response.redirect "AccountReport.asp?act=showVoucher&voucher=" & VoucherID & "&errMsg=" & Server.URLEncode("��� ������ ���� ���� ����� ��� ���.<br>��� ����� ������ �� ���� �����.")
 41	end if
 42
 43%>
 44
 45<input type="hidden" Name='tmpDlgArg' value=''>
 46<input type="hidden" Name='tmpDlgTxt' value=''>
 47<SCRIPT LANGUAGE="JavaScript">
 48<!--
 49function selectVendor(button){
 50	document.all.tmpDlgArg.value="#"
 51	document.all.tmpDlgTxt.value="��� ����� �� �� �� ������ ����� ���� ���� ����:"
 52	window.showModalDialog('../dialog_GenInput.asp',document.all.tmpDlgTxt,'dialogHeight:200px; dialogWidth:440px; dialogTop:; dialogLeft:; edge:None; center:Yes; help:No; resizable:No; status:No;');
 53	if (document.all.tmpDlgTxt.value !="") {
 54		window.showModalDialog('../AP/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;');
 55		if (document.all.tmpDlgArg.value!="#"){
 56			Arguments=document.all.tmpDlgArg.value.split("#")
 57			button.parentNode.getElementsByTagName("input")[0].value=Arguments[0];
 58			button.parentNode.getElementsByTagName("input")[1].innerText=Arguments[1]+"["+Arguments[0]+"]";
 59		}
 60	}
 61}
 62
 63//-->
 64</SCRIPT>
 65<BR><BR>
 66<FORM METHOD=POST ACTION="?act=submitEdit">
 67<TABLE align=center>
 68	<TR height=30>
 69		<TD width=100 align=left>�������</td>
 70		<TD width=320>
 71			<% set RSV=Conn.Execute ("SELECT * FROM Accounts where ID = " & VendorID) 
 72			if RSV.eof then
 73				response.redirect "voucherInput.asp?act=search"
 74			end if
 75			%>
 76			<INPUT TYPE="hidden"  NAME="VendorID"  value="<%=VendorID%>">
 77			<INPUT TYPE="text" readonly size=50 NAME="vendorName" value="<%=RSV("AccountTitle")%>" style="height:20;border: 1 solid black;">
 78			<INPUT TYPE="Button" value="�����"style="width:40;height:20;border: 1 solid black;" onClick="selectVendor(this);">
 79			<%
 80			RSV.close
 81			%>
 82		</TD>
 83		<TD width=150>
 84			&nbsp; ����� ���� <INPUT TYPE="text" size=10 NAME="EffectiveDate" style="direction:LTR; text-align:right" onKeyPress="return maskDate(this);" onblur="acceptDate(this)" maxlength="10" value="<%=EffectiveDate%>">
 85		</TD>
 86	</TR>
 87	<TR height=40>
 88		<TD align=left>����� ������ </TD>
 89		<TD>
 90			<INPUT TYPE="text" size=60 NAME="title" style="direction:LTR; text-align:right" Value="<%=Title%>">
 91		</TD>
 92		<TD>
 93			&nbsp;����� :
 94			<%=VoucherID%>
 95			<INPUT TYPE="hidden"  NAME="VoucherID"  value="<%=VoucherID%>">
 96		</TD>
 97	</TR>
 98	<TR>
 99		<TD align='left'>����� �ǘ��� ����</TD>
100		<TD><input type='text' size='14' name='Number' value='<%=Number%>'></TD>
101	</TR>
102	<TR>
103		<TD align=left VALIGN=TOP>����� ��� ����� </TD>
104		<TD colspan=2 VALIGN=TOP>
105		<%
106		if VendorID="-1" then 
107			response.write "<hr><br><br>"
108		else
109			set RSS=Conn.Execute ("SELECT * FROM purchaseOrders WHERE (Status <> 'CANCEL' and  HasVoucher = 0 and Vendor_ID="& VendorID& ") order by OrdDate" )
110			%>			
111			<TABLE dir=rtl style="border:2 solid #333399;">
112			<TR bgcolor="eeeeee" >
113				<TD></TD>
114				<TD><SMALL>�����</SMALL></TD>
115				<TD><SMALL>���� �� ������</SMALL></TD>
116				<TD><SMALL>���� (����)</SMALL></TD>
117				<TD><SMALL>�����</SMALL></TD>
118				<TD>����� �����</SMALL></TD>
119			</TR>
120			<TR bgcolor="#5555BB" height="2">
121				<TD colspan=7></TD>
122			</TR>
123			<%
124			tmpCounter=0
125			Do while not RSS.eof
126				tmpCounter = tmpCounter + 1
127				if tmpCounter mod 2 = 1 then
128					tmpColor="#FFFFFF"
129					tmpColor2="#FFFFBB"
130				Else
131					tmpColor="#DDDDDD"
132					tmpColor2="#EEEEBB"
133				End if 
134
135				%>
136				<TR bgcolor="<%=tmpColor%>" >
137					<TD><INPUT TYPE="hidden" name=color1 value="<%=tmpColor%>"><INPUT TYPE="hidden" name=color2 value="<%=tmpColor2%>"><INPUT TYPE="checkbox" onclick="setPrice(this)"  name="pcheck" id="<%=tmpCounter-1%>" value="<%=RSS("id")%>" ><!checked></TD>
138					<TD><INPUT TYPE="hidden" name="purchaseOrderID" value="0"><A HREF="../purchase/outServiceTrace.asp?od=<%=RSS("id")%>"><%=RSS("id")%></A></TD>
139					<TD><INPUT TYPE="text" NAME="TypeName" style="border:none; background: transparent" size=40 value="<%=RSS("TypeName")%>"></TD>
140					<TD><INPUT TYPE="text" NAME="price"  style="border:none; background: transparent "  onblur="setPrice(this)" onKeyPress="return maskNumber(this);" size=8 value="<%=Separate(RSS("price"))%>"></TD>
141					<TD><INPUT TYPE="text" NAME="qtty"   style="border:none; background: transparent "  onKeyPress="return maskNumber(this);" size=3 value="<%=RSS("qtty")%>"></TD>
142					<TD  align=left><span dir=ltr><%=RSS("OrdDate")%></span></TD>
143				</TR>
144					  
145				<% 
146				RSS.moveNext
147			Loop
148
149			set RS1=Conn.Execute ("SELECT VoucherLines.*, PurchaseOrders.OrdDate FROM VoucherLines INNER JOIN PurchaseOrders ON VoucherLines.RelatedPurchaseOrderID = PurchaseOrders.ID WHERE (Voucher_ID = "& VoucherID & ")" )
150
151		'---	Already Selected Orders
152			totalprice=0
153			Do while not RS1.eof
154				totalprice = totalprice + cdbl(RS1("price"))
155				tmpCounter = tmpCounter + 1
156				if tmpCounter mod 2 = 1 then
157					tmpColor="#FFFFFF"
158					tmpColor2="#FFFFBB"
159				Else
160					tmpColor="#DDDDDD"
161					tmpColor2="#EEEEBB"
162				End if 
163
164				RelatedPurchaseOrderID = RS1("RelatedPurchaseOrderID")
165				%>
166				<TR bgcolor="<%=tmpColor2%>" >
167					<TD><INPUT TYPE="hidden" name=color1 value="<%=tmpColor%>"><INPUT TYPE="hidden" name=color2 value="<%=tmpColor2%>"><INPUT TYPE="checkbox" onclick="setPrice(this)"  name="pcheck" id="<%=tmpCounter-1%>" value="<%=RelatedPurchaseOrderID%>" checked></TD>
168					<TD><INPUT TYPE="hidden" name="purchaseOrderID" value="<%=RelatedPurchaseOrderID%>"><A HREF="../purchase/outServiceTrace.asp?od=<%=RelatedPurchaseOrderID%>"><%=RelatedPurchaseOrderID%></A></TD>
169					<TD><INPUT TYPE="text" NAME="TypeName" style="border:none; background: transparent" size=40 value="<%=RS1("LineTitle")%>"></TD>
170					<TD><INPUT TYPE="text" NAME="price"  style="border:none; background: transparent "  onblur="setPrice(this)" onKeyPress="return maskNumber(this);" size=8 value="<%=Separate(RS1("price"))%>"></TD>
171					<TD><INPUT TYPE="text" NAME="qtty"   style="border:none; background: transparent "  onKeyPress="return maskNumber(this);" size=3 value="<%=RS1("qtty")%>"></TD>
172					<TD  align=left><span dir=ltr><%=RS1("OrdDate")%></span></TD>
173				</TR>
174<% 
175				RS1.moveNext
176			Loop
177		'---
178%>
179			<TR bgcolor="#5555BB" height="2">
180				<TD colspan=7></TD>
181			</TR>
182			<TR bgcolor="#eeeeee" height="2">
183				<TD colspan='3' align='left'>������ �� ���� ������: </TD>
184				<TD colspan=4><INPUT style="border:none; background:transparent;" TYPE="text" NAME="totalVat"  size=16 value="<%=totalVat%>" onchange='setPrice(this)'>  ����</td>
185			</TR>
186			<TR bgcolor="#eeeeee" height="2">
187				<TD colspan=3 align=left>��� ��</TD>
188				<TD colspan=3><INPUT  style="border:none; background:transparent;"  TYPE="text" NAME="totalPrice" readonly size=16 value="<%=Separate(cdbl(totalPrice) + cdbl(totalVat))%>">  ����</td>
189			</TR>
190			</TABLE><br>
191<%
192		end if
193%>
194		</TD>
195	</TR>
196	<TR disabled>
197		<TD  align=left VALIGN=TOP>���� ����� ������ </TD>
198		<TD colspan=2 VALIGN=TOP>
199			<INPUT TYPE="Text" size=62 NAME="ImageFile" Value="<%=SavedFileName%>"><BR><BR>
200		</TD>
201	</TR>
202	<TR>
203		<TD  align=left VALIGN=TOP>�������</TD>
204		<TD colspan=2 VALIGN=TOP>
205			<TEXTAREA NAME="comment" ROWS="7" COLS="48"><%=Comment%></TEXTAREA>
206		</TD>
207	</TR>
208	<TR>
209		<TD colspan=3 align=center VALIGN=TOP>
210			<br>
211			<INPUT class=inputBut TYPE="submit" Name="Submit" Value=" ����� ������� " style="width:125px;" <%if VendorID="-1" then response.write " disabled " %>>
212		</TD>
213	</TR>
214</TABLE>
215
216</FORM>
217<SCRIPT LANGUAGE="JavaScript">
218<!--
219
220function setPrice(obj)
221{
222	a= obj.type
223	if (a=="text")
224		obj.value=val2txt(txt2val(obj.value))
225	else
226		{
227		ii=parseInt(obj.id) 
228		if(obj.checked)
229			{
230			document.getElementsByName("purchaseOrderID")[ii].value = obj.value
231			theTR = obj.parentNode.parentNode
232			theTR.setAttribute("bgColor",document.getElementsByName("color2")[ii].value)
233			}
234		else
235			{
236			document.getElementsByName("purchaseOrderID")[ii].value = 0
237			theTR = obj.parentNode.parentNode
238			theTR.setAttribute("bgColor",document.getElementsByName("color1")[ii].value)
239			}
240		}
241	totalPrice = 0;
242	checkBoxList = document.getElementsByName("pcheck")
243	for(i=0;i<document.getElementsByName("price").length;i++) {
244			if(checkBoxList[i].checked)
245			totalPrice = totalPrice + txt2val(document.getElementsByName("price")[i].value);
246		}
247	totalPrice = totalPrice + txt2val(document.getElementsByName("totalVat")[0].value);
248	document.all.totalPrice.value = val2txt(totalPrice) ;
249
250}
251//-->
252</SCRIPT>
253<% 
254'-----------------------------------------------------------------------------------------------------
255'------------------------------------------------------------ Submit an Inventory Item request For Buy
256'-----------------------------------------------------------------------------------------------------
257elseif request("act") = "submitEdit" then
258	VoucherID		=	clng(request.Form("VoucherID"))
259	VendorID		=	clng(request.Form("VendorID"))
260	Title			=	sqlSafe(request.Form("title"))
261	Totalprice		=	text2value(request.Form("Totalprice"))
262	Comment			=	sqlSafe(request.Form("Comment"))
263	EffectiveDate	=	sqlSafe(request.Form("EffectiveDate"))
264	number			=	sqlSafe(request.form("number"))
265	totalVat		=	text2value(request.form("totalVat"))
266
267	EditDate		=	shamsiToday()
268	EditBy			=	session("id")
269
270	if title = "" then title = "-"
271	if comment = "" then comment = "-"
272
273	'---- Checking wether EffectiveDate is valid in current open GL
274	if (EffectiveDate < session("OpenGLStartDate")) OR (EffectiveDate > session("OpenGLEndDate")) then
275		Conn.close
276		response.redirect "?act=editVoucher&VoucherID="& VoucherID & "&errMsg=" & Server.URLEncode("���!<br>����� ���� ��� �� ������ ��� ���� ���� ����.")
277	end if 
278	'----
279	'----- Check GL is closed
280	if (session("IsClosed")="True") then
281		Conn.close
282		response.redirect "?errMsg=" & Server.URLEncode("���! ��� ���� ���� ���� ��� � ��� ���� �� ����� �� �� ������.")
283	end if 
284	'----
285	mySQL = "SELECT * FROM Accounts WHERE (ID="& VendorID & ")" 
286	Set RS1=Conn.execute(mySQL)
287	if RS1.eof then
288		conn.close
289		response.redirect "?errMsg=" & Server.URLEncode("������� ������� ���� �����.")
290	end if
291	RS1.close
292
293	mySQL = "SELECT * FROM Vouchers WHERE (ID="& VoucherID & ")" 
294	Set RS1=Conn.execute(mySQL)
295	if RS1.eof then
296		conn.close
297		response.redirect "?errMsg=" & Server.URLEncode("����� ������ ���� ���.")
298	else
299		OldVendorID=	RS1("VendorID")
300		Verified=		RS1("Verified")
301	end if
302	RS1.close
303
304	if Verified then
305		conn.close
306		response.redirect "AccountReport.asp?act=showVoucher&voucher=" & VoucherID & "&errMsg=" & Server.URLEncode("��� ������ ���� ���� ����� ��� ���.<br>��� ����� ������ �� ���� �����.")
307	end if
308
309
310	mysql = "UPDATE Vouchers SET VendorID='" & VendorID & "', Title=N'"& Title & "', TotalPrice='"& Totalprice & "', comment=N'"& Comment & "', LastEditDate=N'"& EditDate & "', LastEditBy='"& EditBy & "', EffectiveDate=N'"& EffectiveDate & "', Number=N'" & number &"', TotalVat=N'" & totalVat & "' WHERE (ID='"& VoucherID & "')"
311	Conn.Execute (mysql)
312
313	'===================================================
314	'	Removing old voucherLines AND releasing Purchase Orders 
315	'===================================================
316		mysql = "UPDATE PurchaseOrders SET HasVoucher=0 WHERE (ID IN (SELECT RelatedPurchaseOrderID FROM VoucherLines WHERE (Voucher_ID = "& VoucherID & ")))"
317		Conn.Execute (mysql)
318
319		mySQL = "DELETE FROM VoucherLines WHERE (Voucher_ID = "& VoucherID & ")"
320		Conn.Execute (mysql)
321
322	'===================================================
323	'	Adding new voucherLines 
324	'===================================================
325	for i=1 to request.Form("purchaseOrderID").count
326		POrderID	=	request.Form("purchaseOrderID")(i)
327
328		OTypeName	=	sqlSafe(request.Form("TypeName")(i))
329		price		=	text2value(request.Form("price")(i))
330		qtty		=	request.Form("qtty")(i)
331
332		if POrderID <>"0" then
333			mysql = "INSERT INTO VoucherLines(Voucher_ID, RelatedPurchaseOrderID, LineTitle, price, qtty) VALUES ("& VoucherID & ", "& POrderID & ",N'"& OTypeName & "',"& price & ","& qtty & ")"
334			Conn.Execute (mysql)
335
336			mysql = "UPDATE PurchaseOrders SET HasVoucher = 1 WHERE (ID = "& POrderID & ")"
337			Conn.Execute (mysql)
338		end if
339	next
340
341	'===================================================
342	response.redirect "AccountReport.asp?act=showVoucher&voucher=" & VoucherID & "&msg=" &Server.URLEncode("������ ��� ��")
343
344elseif request("act") = "delVoucher" and isnumeric(request("VoucherID")) then
345
346	VoucherID=clng(request("VoucherID"))
347
348	mySQL = "SELECT * FROM Vouchers WHERE (ID="& VoucherID & ")" 
349	Set RS1=Conn.execute(mySQL)
350	if RS1.eof then
351		conn.close
352		response.redirect "?errMsg=" & Server.URLEncode("����� ������ ���� ���.")
353	else
354		VendorID=		RS1("VendorID")
355		Title=			RS1("Title")
356
357		CreationDate=	RS1("CreationDate")
358		CreationTime=	RS1("CreationTime")
359		SavedFileName=	RS1("SavedFileName")
360		Comment=		RS1("Comment")
361		TotalPrice=		RS1("TotalPrice")
362		Verified=		RS1("Verified")
363		Paid=			RS1("Paid")
364	end if
365
366	RS1.close
367
368	if Verified then
369		conn.close
370		response.redirect "AccountReport.asp?act=showVoucher&voucher=" & VoucherID & "&errMsg=" & Server.URLEncode("��� ������ ���� ���� ����� ��� ���.<br>��� ����� ��� �� ���� �����.")
371	end if
372
373	'===================================================
374	'	Removing voucherLines AND releasing Purchase Orders 
375	'===================================================
376		mysql = "UPDATE PurchaseOrders SET HasVoucher=0 WHERE (ID IN (SELECT RelatedPurchaseOrderID FROM VoucherLines WHERE (Voucher_ID = "& VoucherID & ")))"
377		Conn.Execute (mysql)
378
379		mySQL = "DELETE FROM VoucherLines WHERE (Voucher_ID = "& VoucherID & ")"
380		Conn.Execute (mysql)
381
382	'===================================================
383	'	Deleting Voucher
384	'===================================================
385		'mySQL = "DELETE FROM Vouchers WHERE (ID = "& VoucherID & ")"
386		'Changed By Kid 830929 
387		mySQL = "UPDATE Vouchers SET Voided=1 WHERE (ID = "& VoucherID & ")"
388		Conn.Execute (mysql)
389
390	'===================================================
391
392	conn.close
393	response.redirect "top.asp?msg=" & Server.URLEncode("������ ���� ���� ��� ��� ��.")
394elseif request("act") = "voidVoucher" then
395	if NOT Auth(7 , 9) then 
396		'Doesn't have the Priviledge to APPROVE the Voucher
397		response.write "<br>" 
398		call showAlert ("��� ���� �� ����� ������ ���� ������",CONST_MSG_ERROR) 
399		response.end
400	end if
401
402	ON ERROR RESUME NEXT
403		VoucherID = clng(request("VoucherID"))
404		if Err.Number<>0 then
405			Err.clear
406			conn.close
407			response.redirect "top.asp?errMsg=" & Server.URLEncode("����� ������ ���� ����� ����.")
408		end if
409	ON ERROR GOTO 0
410
411	mySQL = "SELECT * FROM Vouchers WHERE (ID="& VoucherID & ")" 
412	Set RS1=Conn.execute(mySQL)
413	if RS1.eof then
414		conn.close
415		response.redirect "?errMsg=" & Server.URLEncode("����� ������ ���� ���.")
416	else
417		VendorID=		RS1("VendorID")
418		Title=			RS1("Title")
419		CreationDate=	RS1("CreationDate")
420		CreationTime=	RS1("CreationTime")
421		SavedFileName=	RS1("SavedFileName")
422		Comment=		RS1("Comment")
423		TotalPrice=		RS1("TotalPrice")
424		Verified=		RS1("Verified")
425		Paid=			RS1("Paid")
426		if RS1("Voided") then
427			response.redirect "AccountReport.asp?act=showVoucher&voucher=" & VoucherID & "&errMsg=" & Server.URLEncode("��� ������ ���� �� ����� <span dir='LTR'>"& RS1("VoidedDate") & "</span> ���� ��� ���.")
428		end if
429	end if
430
431	RS1.close
432
433	if NOT Verified then
434		conn.close
435		response.redirect "AccountReport.asp?act=showVoucher&voucher=" & VoucherID & "&errMsg=" & Server.URLEncode("��� ������ ���� ���� ����� ���� ���.<br>��� ����� ����� �� ���� �����.")
436	end if
437
438	'===================================================
439	'	Voiding Voucher
440	'===================================================
441	mySQL="UPDATE Vouchers SET Voided=1, VoidedDate=N'"& shamsiToday() & "', VoidedBy='"& session("ID") & "' WHERE (ID = "& VoucherID & ")"
442	conn.Execute(mySQL)
443
444	'===================================================
445	'	releasing Purchase Orders 
446	'===================================================
447	mysql = "UPDATE PurchaseOrders SET HasVoucher=0 WHERE (ID IN (SELECT RelatedPurchaseOrderID FROM VoucherLines WHERE (Voucher_ID = "& VoucherID & ")))"
448	Conn.Execute (mysql)
449
450  '**********************************	 Voiding APItem of Voucher  **************************
451  '*** Type = 6 means APItem is a Voucher
452  '***
453	'*********  Finding the APItem of Voucher
454	mySQL="SELECT ID FROM APItems WHERE (Type = 6) AND (Link='"& VoucherID & "')"
455	Set RS1=conn.Execute(mySQL)
456	voidedAPItem=RS1("ID")
457
458	'*********  Finding other APItems related to this Item
459	mySQL="SELECT ID AS RelationID, DebitAPItem, Amount FROM APItemsRelations WHERE (CreditAPItem = '"& voidedAPItem & "')"
460	Set RS1=conn.Execute(mySQL)
461	Do While not (RS1.eof)
462		'*********  Adding back the amount in the relation, to the debit APItem ...
463		conn.Execute("UPDATE APItems SET RemainedAmount=RemainedAmount+ '"& RS1("Amount") & "', FullyApplied=0 WHERE (ID = '"& RS1("DebitAPItem") & "')")
464
465		'*********  Deleting the relation
466		conn.Execute("DELETE FROM APItemsRelations WHERE ID='"& RS1("RelationID") & "'")
467		
468		RS1.movenext
469	Loop
470	RS1.close
471
472	'*********  Voiding APItem 
473	mySQL="UPDATE APItems SET RemainedAmount=0, FullyApplied=0, Voided=1 WHERE (ID = '"& voidedAPItem & "')"
474	conn.Execute(mySQL)
475
476	'*********  Affecting Account's AP Balance  
477	mySQL="UPDATE Accounts SET APBalance = APBalance - "& TotalPrice & "  WHERE (ID = "& VendorID & ")"
478	conn.Execute(mySQL)
479	
480  '***
481  '***----------------------------- End of Voiding APItem of Voucher  ------------------------
482
483	response.redirect "AccountReport.asp?act=showVoucher&voucher=" & VoucherID
484else
485	response.write "<br><br>"
486	call showAlert (" ��� ! ",CONST_MSG_ERROR) 
487end if
488%>
489<!--#include file="tah.asp" -->