/beta/AR/MemoInput.asp
ASP | 266 lines | 238 code | 17 blank | 11 comment | 22 complexity | 4fdc3f1208cfe3432e6b86be47c22564 MD5 | raw file
1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><% 2'AR (6) 3PageTitle="���� ���" 4SubmenuItem=2 5if not Auth(6 , 2) then NotAllowdToViewThisPage() 6 7%> 8<!--#include file="top.asp" --> 9<!--#include File="../include_farsiDateHandling.asp"--> 10<!--#include File="../include_JS_InputMasks.asp"--> 11<% 12function Link2Trace(OrderNo) 13 Link2Trace="<A HREF='../order/orderEdit.asp?e=n&radif="& OrderNo & "' target='_balnk'>"& OrderNo & "</A>" 14end function 15 16%> 17<HTML> 18<HEAD> 19<meta http-equiv="Content-Type" content="text/html; charset=windows-1256"> 20<meta http-equiv="Content-Language" content="fa"> 21<style> 22 .MmoTable { font-family:tahoma; font-size: 9pt; border:0; padding:0; direction: right-to-left;} 23 .MmoMainTable { font-family:tahoma; font-size: 9pt; border:0; padding:0; background-color: #558855; text-align:right; direction: RTL;} 24 .MmoMainTableTH { background-color: #C3C300;} 25 .MmoMainTableTR { background-color: #CCCC88; border: 0; } 26 .MmoRowInput { font-family:tahoma; font-size: 9pt; border: 1px solid black; background-color: #F0F0F0; text-align:right;} 27 .MmoRowInput2 { font-family:tahoma; font-size: 9pt; border: 1px solid black; background-color: #F0F0F0; text-align:right;} 28 .MmoHeadInput { font-family:tahoma; font-size: 9pt; border: none; background-color: #CCCC88; text-align:center;} 29 .MmoHeadInput2 { font-family:tahoma; font-size: 9pt; border: none; background-color: #AACC77; text-align:center;} 30 .MmoHeadInput3 { font-family:tahoma; font-size: 9pt; border: 1px solid black; background-color: #D0E0FF; text-align:right; direction: RTL;} 31 .MmoGenInput { font-family:tahoma; font-size: 9pt; border: none; text-align:right; direction: LTR;} 32 .GenButton { font-family:tahoma; font-size: 9pt; border: 1px solid black; } 33</style> 34<TITLE>���� ���</TITLE> 35</HEAD> 36<SCRIPT LANGUAGE="JavaScript"> 37<!-- 38var okToProceed=false; 39var currentRow=null; 40//--> 41</SCRIPT> 42<BODY bgcolor="#F0F0F0"> 43<font face="tahoma"> 44<% 45 46if request("act")="submitsearch" then 47 if request("CustomerNameSearchBox") <> "" then 48 SA_TitleOrName=request("CustomerNameSearchBox") 49 SA_Action="return true;" 50 SA_SearchAgainURL="MemoInput.asp" 51 SA_StepText="��� ��� : ������ ����" 52%> 53 <FORM METHOD=POST ACTION="MemoInput.asp?act=getMemo"> 54 <!--#include File="include_SelectAccount.asp"--> 55 </FORM> 56<% 57 end if 58elseif request("act")="selectOrder" then 59 if request("selectedCustomer") <> "" then 60 SO_Customer=request("selectedCustomer") 61 SO_Action="return true;" 62 SO_StepText="��� ��� :" 63%> 64 <FORM METHOD=POST ACTION="MemoInput.asp?act=getMemo"> 65 <!--#include File="include_SelectOrder.asp"--> 66 </FORM> 67<% 68 end if 69elseif request("act")="getMemo" then 70 customerID=request("selectedCustomer") 71 72 mySQL="SELECT * FROM Accounts WHERE (ID='"& CustomerID & "')" 73 Set RS1 = conn.Execute(mySQL) 74 AccountNo=RS1("ID") 75 customerName=RS1("AccountTitle") 76 77 creationDate=shamsiToday() 78 creationTime=time 79' creationTime=Hour(creationTime)&":"&Minute(creationTime) 80' if instr(creationTime,":")<3 then creationTime="0" & creationTime 81' if len(creationTime)<5 then creationTime=Left(creationTime,3) & "0" & Right(creationTime,1) 82 83%><BR><BR><BR> 84 <div align=center dir='rtl'><B>��� ����� : ���� ������� ���</B> 85 </div> 86<!-- ���� ������� ��� --> 87 <br> 88 <input type="hidden" Name='tmpDlgArg' value=''> 89 <table class="MmoMainTable" Cellspacing="1" Cellpadding="5" Width="500" align="center"> 90 <FORM METHOD=POST ACTION="MemoInput.asp?act=submitMemo" onsubmit="if (document.all.AccountTitle.value=='') return false;"> 91 <tr class="MmoMainTableTH"> 92 <TD colspan="10"><TABLE class="MmoTable" Border="0" Width="100%" Cellspacing="1" Cellpadding="0"><TR> 93 <TD align="left">����:</TD> 94 <TD align="right" width="5"> 95 <INPUT class="MmoGenInput" disabled TYPE="text" value="<%=customerID%>" maxlength="5" size="5" tabIndex="1"> 96 </TD> 97 <TD align="right"> 98 <INPUT TYPE="hidden" NAME="customerID" value="<%=customerID%>"><%=CustomerName%>. 99 </TD> 100 <TD align="left">�����:</TD> 101 <TD><TABLE class="MmoTable"> 102 <TR> 103 <TD dir="LTR"> 104 <INPUT class="MmoGenInput" style="text-align:left;" NAME="MemoDate" TYPE="text" maxlength="10" size="10" value="<%=CreationDate%>" onblur="acceptDate(this)"> 105 </TD> 106 <TD dir="RTL"><%=weekdayname(weekday(date))%></TD> 107 </TR> 108 </TABLE></TD> 109 </TR></TABLE></TD> 110 </tr> 111 <tr class="MmoMainTableTH" height="25"> 112 <TD> ��� ��� </TD> 113 <TD> ������/�������� </TD> 114 <TD> ��� </TD> 115 <TD> ����� </TD> 116 </tr> 117 <tr class="MmoMainTableTR"> 118 <TD valign="top"> 119 <SELECT class="MmoRowInput" NAME="MemoType"> 120 <% 121 mySQL="SELECT * FROM AXMemoTypes WHERE Display=1" 122 Set RS1=conn.execute(mySQL) 123 while not RS1.eof 124 %> 125 <OPTION Value="<%=RS1("ID")%>"><%=RS1("Name")%></OPTION> 126 <% 127 RS1.moveNext 128 wend 129 %> 130 </SELECT> 131 </TD> 132 <TD valign="top"> 133 <SELECT class="MmoRowInput" NAME="IsCredit"> 134 <OPTION Value="0">������</OPTION> 135 <OPTION Value="1" selected >��������</OPTION> 136 </SELECT> 137 </TD> 138 <TD valign="top"><TEXTAREA class="MmoRowInput" dir="RTL" NAME="Description" ROWS="3" COLS="30"></TEXTAREA></TD> 139 <TD valign="top"><INPUT class="MmoRowInput" Dir="LTR" NAME="Amount" TYPE="text" size="15" onblur="setPrice(this);" onKeyPress="return mask(this);"></TD> 140 </tr> 141 </table><br> 142 <TABLE class="MmoTable" align=center Border="0" Cellspacing="5" Cellpadding="1"> 143 <tr> 144 <td align='center' bgcolor="#000000"><INPUT class="MmoGenInput" style="text-align:center" TYPE="button" value="�����" onclick="submit();"></td> 145 <td align='center' bgcolor="#000000"><INPUT class="MmoGenInput" style="text-align:center" TYPE="button" value="������" onclick="window.location='MemoInput.asp';"></td> 146 </tr> 147 </TABLE> 148 </FORM> 149 <SCRIPT LANGUAGE="JavaScript"> 150 <!-- 151// document.all.CashAmount.focus(); 152 //--> 153 </SCRIPT> 154 155<%elseif request("act")="submitMemo" then 156 157 ON ERROR RESUME NEXT 158 MemoDate= sqlSafe(request.form("MemoDate")) 159 CustomerID= clng(request.form("CustomerID")) 160 Amount= cdbl(text2value(request.form("Amount"))) 161 Description=sqlSafe(request.form("Description")) 162 MemoType= cint(request.form("MemoType")) 163 164 IsCredit= cbool(request.form("IsCredit")) 165 if IsCredit then IsCredit=1 else IsCredit=0 end if 166 if Err.Number<>0 then 167 Err.clear 168 conn.close 169 response.redirect "top.asp?errMsg=" & Server.URLEncode("���!") 170 end if 171 ON ERROR GOTO 0 172 173 '---- Checking wether EffectiveDate is valid in current open GL 174 if (MemoDate < session("OpenGLStartDate")) OR (MemoDate > session("OpenGLEndDate")) then 175 Conn.close 176 response.redirect "?act=getMemo&selectedCustomer="& CustomerID & "&errMsg=" & Server.URLEncode("���!<br>����� ���� ��� �� ������ ��� ���� ���� ����.") 177 end if 178 '---- 179 '----- Check GL is closed 180 if (session("IsClosed")="True") then 181 Conn.close 182 response.redirect "?errMsg=" & Server.URLEncode("���! ��� ���� ���� ���� ��� � ��� ���� �� ����� �� �� ������.") 183 end if 184 '---- 185 if (trim(Description)="") then 186 Conn.close 187 response.redirect "?errMsg=" & Server.URLEncode("���!���� ��� ��� ��������.") 188 end if 189 creationDate= shamsiToday() 190 191 GLAccount= "91001" 'This must be changed... (Sales A) 192 firstGLAccount= "13003" 'This must be changed... (Business Debitors) 193 194 mySQL="INSERT INTO ARMemo (CreatedDate, CreatedBy, Account, Type, IsCredit, Description, Amount) VALUES (N'" &_ 195 MemoDate & "', '"& session("ID") & "', '"& CustomerID & "', '"& MemoType & "', '"& IsCredit & "', N'"& Description & "', '"& Amount & "');SELECT @@Identity AS NewMemo" 196 Set RS1 = conn.Execute(mySQL).NextRecordSet 197 MemoID=RS1("NewMemo") 198 RS1.close 199 200 '**************************** Creating ARItem for Memo **************** 201 '*** Type = 3 means ARItem is a Memo 202 203 mySQL="INSERT INTO ARItems (GLAccount, GL, FirstGLAccount, Account, EffectiveDate, IsCredit, Type, Link, AmountOriginal, CreatedDate, CreatedBy, RemainedAmount) VALUES ('" &_ 204 GLAccount & "', '"& OpenGL & "', '"& firstGLAccount & "', '"& CustomerID & "', N'"& MemoDate & "', '"& IsCredit & "', '3', '"& MemoID & "', '"& Amount & "', N'"& creationDate & "', '"& session("ID") & "', '"& Amount & "')" 205 conn.Execute(mySQL) 206 '***------------------------- Creating ARItem for Memo ---------------- 207 if IsCredit then 208 mySQL="UPDATE Accounts SET ARBalance = ARBalance + '"& Amount & "' WHERE (ID='"& CustomerID & "')" 209 else 210 mySQL="UPDATE Accounts SET ARBalance = ARBalance - '"& Amount & "' WHERE (ID='"& CustomerID & "')" 211 end if 212 conn.Execute(mySQL) 213 conn.close 214 response.redirect "AccountReport.asp?act=showMemo&sys=AR&memo=" & MemoID &"&msg=" & Server.URLEncode("������� ��� ��.") 215else%> 216<!-- ����� ���� ��� ���� --> 217 <FORM METHOD=POST ACTION="MemoInput.asp?act=submitsearch" onsubmit="if (document.all.CustomerNameSearchBox.value=='') return false;"><BR><BR> 218 <div dir='rtl'> <B>��� ��� : ����� ���� ��� ����</B> 219 <INPUT TYPE="text" NAME="CustomerNameSearchBox"> 220 <INPUT class="GenButton" TYPE="submit" value="�����"><br> 221 </div> 222 </FORM> 223 <SCRIPT LANGUAGE="JavaScript"> 224 <!-- 225 document.all.CustomerNameSearchBox.focus(); 226 //--> 227 </SCRIPT> 228<% 229end if 230conn.Close 231%> 232</font> 233</BODY> 234</HTML> 235<% if request("act")="getMemo" then %> 236<script language="JavaScript"> 237<!-- 238function delRow(rowNo){ 239 chqTable=document.getElementById("ChequeLines"); 240 theRow=chqTable.getElementsByTagName("tr")[rowNo]; 241 chqTable.removeChild(theRow); 242 243 for (rowNo=0; rowNo < document.getElementsByName("ChequeNos").length; rowNo++){ 244 chqTable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[0].innerText= rowNo+1; 245 } 246} 247 248function setPrice(src){ 249 if (echoNum(getNum($(src).val()))=="NaN") 250 $(src).val(0); 251 else 252 $(src).val(echoNum(getNum($(src).val()))); 253} 254 255function mask(src){ 256 var theKey=event.keyCode; 257 if (theKey==13){ 258 return true; 259 } 260 else if (theKey < 48 || theKey > 57) { // 0-9 are acceptible 261 return false; 262 } 263} 264//--> 265</script> 266<%end if%>