/beta/admin/AccountInfo.asp
ASP | 336 lines | 292 code | 31 blank | 13 comment | 31 complexity | d6cd707b1f9d1e7c411c1122e155f3ae MD5 | raw file
1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><% 2' Admin 3PageTitle= "������ ���� ��" 4SubmenuItem=9 5 6%> 7<!--#include file="top.asp" --> 8<!--#include File="../include_farsiDateHandling.asp"--> 9<!--#include File="../include_JS_InputMasks.asp"--> 10 11<% 12dateStr = "�� ����� <span dir=rtl>" & fiscalYear & "/1/1</span> �� <span dir=rtl>" & shamsiToday() & "</span>" 13 14function Separate2(inputTxt) 15myMinus="" 16input=inputTxt 17if left(input,1)="-" then 18 myMinus="-" 19 input=right(input,len(input)-1) 20end if 21if len(input) > 3 then 22 tmpr=right(input ,3) 23 tmpl=left(input , len(input) - 3 ) 24 result = tmpr 25 while len(tmpl) > 3 26 tmpr=right(tmpl,3) 27 result = tmpr & "," & result 28 tmpl=left(tmpl , len(tmpl) - 3 ) 29 wend 30 if len(tmpl) > 0 then 31 result = tmpl & "," & result 32 end if 33else 34 result = input 35end if 36 Separate2=myMinus & result 37end function 38 39 40'----------------------------------------------------------------------------------------------------- 41'-------------------------------------------------------------------------------- List GL Super Groups 42'----------------------------------------------------------------------------------------------------- 43if request("act")="" then 44%><BR><BR> 45<CENTER> 46<FORM METHOD=POST ACTION="AccountInfo.asp"> 47<INPUT TYPE="button" onclick="window.location='manageGL.asp?act=showLog'" class="GenButton" value="<%=OpenGLName%>" readonly style="width:276px; background-color: white "> 48<!--INPUT TYPE="button" onclick="window.location='balance.asp'" class="GenButton" value="����" style="width:90px; "> 49<INPUT TYPE="button" onclick="window.location='sood.asp'" class="GenButton" value="��� � ����" style="width:90px; "--><br><br> 50<INPUT TYPE="button" onclick="window.location='manageGL.asp?act=select'" class="GenButton" value="�����" style="width:90px; background-color: #FFFFBB "> 51<INPUT TYPE="button" onclick="window.location='manageGL.asp?act=new'" class="GenButton" value="����" style="width:90px; background-color: #FFFFBB "> 52<INPUT TYPE="button" onclick="window.location='manageGL.asp?act=close'" class="GenButton" value="����" style="width:90px; background-color: #FFFFBB "> 53</FORM> 54</CENTER> 55<% 56Conn.CommandTimeout = 300 57set RSS=Conn.Execute ("SELECT GLAccountSuperGroups.Name, ISNULL(DERIVEDTBL.totalCredit, 0) AS totalCredit, ISNULL(DERIVEDTBL.totalDebit, 0) AS totalDebit, totalDebit-totalCredit as totalRemained, GLAccountSuperGroups.ID, GLAccountSuperGroups.Type, ISNULL(DERIVEDTBL.GroupsCount,0) as GroupsCount, ISNULL(DERIVEDTBL.accountsCount,0) as accountsCount FROM (SELECT SUM(DERIVEDTBL.totalCredit) AS totalCredit, SUM(DERIVEDTBL.totalDebit) AS totalDebit, GLAccountGroups.GLSuperGroup, SUM(accountsCount) AS accountsCount, COUNT(GLAccountGroups.ID) AS GroupsCount FROM (SELECT SUM(DERIVEDTBL.totalCredit) AS totalCredit, SUM(DERIVEDTBL.totalDebit) AS totalDebit, GLAccounts.GLGroup, ISNULL(COUNT(GLAccounts.ID),0) AS accountsCount FROM (SELECT SUM(IsCredit * Amount) AS totalCredit, SUM((convert(tinyint,IsCredit)-1) * -1 * Amount) AS totalDebit, GLAccount FROM EffectiveGlRows WHERE (GL = "& OpenGL&") GROUP BY GLAccount) DERIVEDTBL RIGHT OUTER JOIN GLAccounts ON DERIVEDTBL.GLAccount = GLAccounts.ID WHERE (GLAccounts.GL = "& OpenGL&") GROUP BY GLAccounts.GLGroup) DERIVEDTBL RIGHT OUTER JOIN GLAccountGroups ON DERIVEDTBL.GLGroup = GLAccountGroups.ID WHERE (GLAccountGroups.GL = "& OpenGL&") GROUP BY GLAccountGroups.GLSuperGroup) DERIVEDTBL RIGHT OUTER JOIN GLAccountSuperGroups ON DERIVEDTBL.GLSuperGroup = GLAccountSuperGroups.ID WHERE (GLAccountSuperGroups.GL = "& OpenGL&") ") 58%> 59 60<TABLE dir=rtl align=center width=600> 61<TR > 62 <TD colspan=5> 63 <%=OpenGLName%> <%=dateStr%><BR><hR> 64 </TD> 65</TR> 66<TR bgcolor="eeeeee" > 67 <TD><!A HREF="default.asp?s=1"><SMALL>��</SMALL></A></TD> 68 <TD><!A HREF="default.asp?s=2"><SMALL>��� �ѐ���</SMALL></A></TD> 69 <TD><!A HREF="default.asp?s=3"><SMALL>����� ���� ��</SMALL></A></TD> 70 <TD><!A HREF="default.asp?s=4"><SMALL>����� ������</SMALL></A></TD> 71 <TD><!A HREF="default.asp?s=4"><SMALL>��� �������� (����)</SMALL></A></TD> 72 <TD><!A HREF="default.asp?s=4"><SMALL>��� ������ (����)</SMALL></A></TD> 73 <TD><!A HREF="default.asp?s=4"><SMALL>����� (����)</SMALL></A></TD> 74 <TD><!A HREF="default.asp?s=5"><SMALL>������</SMALL></A></TD> 75</TR> 76<% 77tmpCounter=0 78Do while not RSS.eof 79 tmpCounter = tmpCounter + 1 80 if tmpCounter mod 2 = 1 then 81 tmpColor="#FFFFFF" 82 tmpColor2="#FFFFBB" 83 Else 84 tmpColor="#DDDDDD" 85 tmpColor2="#EEEEBB" 86 End if 87 88%> 89<TR bgcolor="<%=tmpColor%>" height=30> 90 <FORM METHOD=POST ACTION="editGL.asp?act=editAccountSuperGroupForms&SuperGroupID=<%=RSS("ID")%>"> 91 <TD><A HREF="AccountInfo.asp?act=groups&SuperGroupID=<%=RSS("ID")%>"><%=RSS("ID")%></A></TD> 92 <TD><A HREF="AccountInfo.asp?act=groups&SuperGroupID=<%=RSS("ID")%>"><%=RSS("Name")%></A></TD> 93 <TD><%=RSS("GroupsCount")%></TD> 94 <TD><%=RSS("accountsCount")%></TD> 95 <TD dir=ltr align=right><span dir=ltr><%=Separate2(RSS("totalCredit"))%></span></TD> 96 <TD dir=ltr align=right><span dir=ltr><%=Separate2(RSS("totalDebit"))%></span></TD> 97 <TD dir=ltr align=right><span dir=ltr><%=Separate2(RSS("totalRemained"))%></span></TD> 98 <TD dir=ltr align=center><INPUT style="font-size:7pt" TYPE="submit" value="���" NAME="submit" onclick="return confirm('��� ������ �� ������ ��� �ѐ��� �� ��� ���Ͽ')"> 99 <INPUT TYPE="submit" value="������" NAME="submit" style="font-size:7pt"> 100 </TD> 101 </form> 102</TR> 103 104<% 105RSS.moveNext 106Loop 107%> 108</TABLE><br> 109<FORM METHOD=POST ACTION="editGL.asp?act=editAccountSuperGroupForms"> 110<CENTER><INPUT TYPE="submit" value="������ �ѐ���" NAME="submit"></CENTER><br> 111</FORM> 112<% 113 114'----------------------------------------------------------------------------------------------------- 115'------------------------------------------------------------------ List GL Groups under a super group 116'----------------------------------------------------------------------------------------------------- 117elseif request("act")="groups" then 118SuperGroupID = request("SuperGroupID") 119 120set RSS=Conn.Execute ("SELECT SUM(ISNULL(DERIVEDTBL.totalCredit, 0)) AS totalCredit, SUM(ISNULL(DERIVEDTBL.totalDebit, 0)) AS totalDebit, GLAccountGroups.GLSuperGroup, SUM(ISNULL(DERIVEDTBL.accountsCount, 0)) AS accountsCount, GLAccountGroups.Name, GLAccountGroups.ID FROM (SELECT SUM(DERIVEDTBL.totalCredit) AS totalCredit, SUM(DERIVEDTBL.totalDebit) AS totalDebit, GLAccounts.GLGroup, COUNT(GLAccounts.ID) AS accountsCount FROM (SELECT SUM(IsCredit * Amount) AS totalCredit, SUM((convert(tinyint,IsCredit)-1) * -1 * Amount) AS totalDebit, GLAccount FROM EffectiveGLRows Where (GL = "& OpenGL & ") GROUP BY GLAccount) DERIVEDTBL RIGHT OUTER JOIN GLAccounts ON DERIVEDTBL.GLAccount = GLAccounts.ID WHERE (GLAccounts.GL = "& OpenGL & ") GROUP BY GLAccounts.GLGroup) DERIVEDTBL RIGHT OUTER JOIN GLAccountGroups ON DERIVEDTBL.GLGroup = GLAccountGroups.ID WHERE (GLAccountGroups.GL = "& OpenGL & ") AND (GLAccountGroups.GLSuperGroup = "& SuperGroupID & ") GROUP BY GLAccountGroups.GLSuperGroup, GLAccountGroups.Name, GLAccountGroups.ID ORDER BY GLAccountGroups.ID") 121 122%><BR><BR> 123<TABLE dir=rtl align=center width=600> 124<TR > 125 <TD colspan=4> 126 <% 127 set RSS2=Conn.Execute ("SELECT *, GLs.ID AS GLID ,GLs.Name AS GLname FROM GLs INNER JOIN GLAccountSuperGroups ON GLs.ID = GLAccountSuperGroups.GL WHERE (GLAccountSuperGroups.GL = "& OpenGL & ") AND (GLAccountSuperGroups.ID = "& SuperGroupID & ")") 128 %><A HREF="AccountInfo.asp?OpenGL=<%=RSS2("GLID")%>"><%=RSS2("GLname")%></A> > <%=RSS2("name")%> 129 <BR><hR> 130 </TD> 131</TR> 132<TR bgcolor="eeeeee" > 133 <TD><!A HREF="default.asp?s=1"><SMALL>��</SMALL></A></TD> 134 <TD><!A HREF="default.asp?s=2"><SMALL>��� ����</SMALL></A></TD> 135 <TD><!A HREF="default.asp?s=4"><SMALL>����� ������</SMALL></A></TD> 136 <TD><!A HREF="default.asp?s=4"><SMALL>��� �������� (����)</SMALL></A></TD> 137 <TD><!A HREF="default.asp?s=4"><SMALL>��� ������ (����)</SMALL></A></TD> 138 <TD><!A HREF="default.asp?s=5"><SMALL>������</SMALL></A></TD> 139</TR> 140<% 141tmpCounter=0 142Do while not RSS.eof 143 tmpCounter = tmpCounter + 1 144 if tmpCounter mod 2 = 1 then 145 tmpColor="#FFFFFF" 146 tmpColor2="#FFFFBB" 147 Else 148 tmpColor="#DDDDDD" 149 tmpColor2="#EEEEBB" 150 End if 151 152%> 153<TR bgcolor="<%=tmpColor%>" > 154 <FORM METHOD=POST ACTION="editGL.asp?act=editAccountGroupForms&SuperGroupID=<%=SuperGroupID%>&GroupID=<%=RSS("id")%>"> 155 <TD><A HREF="AccountInfo.asp?act=account&GroupID=<%=RSS("id")%>"><%=RSS("id")%></A></TD> 156 <TD><A HREF="AccountInfo.asp?act=account&GroupID=<%=RSS("id")%>"><%=RSS("Name")%></A></TD> 157 <TD><%=RSS("accountsCount")%></TD> 158 <TD><span dir=ltr><%=RSS("totalCredit")%></span></TD> 159 <TD><span dir=ltr><%=RSS("totalDebit")%></span></TD> 160 <TD align=center><INPUT TYPE="submit" value="���" NAME="submit" onclick="return confirm('��� ������ �� ������ ��� ���� �� ��� ���Ͽ')"> 161 <INPUT TYPE="submit" value="������" NAME="submit"> 162 </TD> 163 </form> 164</TR> 165 166<% 167RSS.moveNext 168Loop 169%> 170</TABLE><br> 171<FORM METHOD=POST ACTION="editGL.asp?act=editAccountGroupForms&SuperGroupID=<%=SuperGroupID%>"> 172<CENTER><INPUT TYPE="submit" value="������ ����" NAME="submit"></CENTER><br> 173</FORM> 174<% 175 176'----------------------------------------------------------------------------------------------------- 177'---------------------------------------------------------------------- List GL Accounts under a group 178'----------------------------------------------------------------------------------------------------- 179elseif request("act")="account" then 180GroupID = request("GroupID") 181 182set RSS=Conn.Execute ("SELECT GLs.Name AS GLName, GLs.ID AS GLID, GLAccountSuperGroups.ID AS SuperGroupID, GLAccountSuperGroups.Name AS SuperGroupName, GLAccountGroups.ID AS GroupID, GLAccountGroups.Name AS GroupName FROM GLAccountGroups INNER JOIN GLAccountSuperGroups ON GLAccountGroups.GLSuperGroup = GLAccountSuperGroups.ID INNER JOIN GLs ON GLAccountSuperGroups.GL = GLs.ID WHERE (GLAccountSuperGroups.GL = "& OpenGL & ") AND (GLAccountGroups.GL = "& OpenGL & ") AND (GLAccountGroups.ID = "& GroupID & ")") 183%><BR><BR> 184<TABLE dir=rtl align=center width=800> 185<TR > 186 <TD colspan=5> 187 <% 188 set RSS2=Conn.Execute ("SELECT GLAccounts.Name, glAccountTypes.name as accountTypeName, DERIVEDTBL.totalDebit AS totalDebit, DERIVEDTBL.totalCredit AS totalCredit, GLAccounts.ID, GLAccounts.HasAppendix FROM (SELECT SUM(CONVERT(tinyint, IsCredit) * Amount) AS totalCredit, SUM((CONVERT(tinyint, IsCredit) - 1) * (- 1) * Amount) AS totalDebit, GLAccount FROM EffectiveGLRows where (GL = "& OpenGL & ") GROUP BY GLAccount) DERIVEDTBL RIGHT OUTER JOIN GLAccounts ON DERIVEDTBL.GLAccount = GLAccounts.ID left outer join glAccountTypes on glAccounts.accountType = glAccountTypes.id WHERE (GLAccounts.GL = "& OpenGL & ") AND (GLAccounts.GLGroup = "& GroupID & ") order by GLAccounts.ID") 189 190 %><A HREF="AccountInfo.asp?OpenGL=<%=RSS("GLID")%>"><%=RSS("GLname")%></A> > <A HREF="AccountInfo.asp?act=groups&SuperGroupID=<%=RSS("SuperGroupID")%>"><%=RSS("SuperGroupName")%></a> > <%=RSS("GroupName")%> 191 <BR><hR> 192 </TD> 193</TR> 194<TR bgcolor="eeeeee" > 195 <TD><!A HREF="default.asp?s=1"><SMALL>��</SMALL></A></TD> 196 <TD><!A HREF="default.asp?s=2"><SMALL>����� ����</SMALL></A></TD> 197 <TD><!A HREF="default.asp?s=2"><SMALL>��� ����</SMALL></A></TD> 198 <TD><!A HREF="default.asp?s=2"><SMALL>��� ��������</SMALL></A></TD> 199 <TD><!A HREF="default.asp?s=2"><SMALL>��� ������</SMALL></A></TD> 200 <td><small>�����</small></td> 201 <TD><!A HREF="default.asp?s=5"><SMALL>������</SMALL></A></TD> 202</TR> 203<% 204tmpCounter=0 205Do while not RSS2.eof 206 tmpCounter = tmpCounter + 1 207 if tmpCounter mod 2 = 1 then 208 tmpColor="#FFFFFF" 209 tmpColor2="#FFFFBB" 210 Else 211 tmpColor="#DDDDDD" 212 tmpColor2="#EEEEBB" 213 End if 214 215%> 216<TR bgcolor="<%=tmpColor%>" > 217 <FORM METHOD=POST ACTION="editGL.asp?act=editAccountForms&GroupID=<%=GroupID%>&ACCID=<%=RSS2("id")%>"> 218 <TD><A HREF="AccountInfo.asp?act=accountRows&accountID=<%=RSS2("id")%>"><%=RSS2("id")%></A></TD> 219 <TD><A HREF="AccountInfo.asp?act=accountRows&accountID=<%=RSS2("id")%>"><%=RSS2("Name")%></A></TD> 220 <td><small><%=rss2("accountTypeName")%></small></td> 221 <TD><span dir=ltr><%=RSS2("totalCredit")%></span></TD> 222 <TD><span dir=ltr><%=RSS2("totalDebit")%></span></TD> 223 <td><span dir=rtl><% If Cbool(RSS2("HasAppendix")) then response.write "����" Else response.write "�����" End If %></span></td> 224 <TD align=center><INPUT TYPE="submit" value="���" NAME="submit" onclick="return confirm('��� ������ �� ������ ��� ���� �� ��� ���Ͽ')"> 225 <INPUT TYPE="submit" value="������" NAME="submit"> 226 </TD> 227 </FORM> 228</TR> 229 230<% 231RSS2.moveNext 232Loop 233%> 234</TABLE><br> 235<FORM METHOD=POST ACTION="editGL.asp?act=editAccountForms&GroupID=<%=GroupID%>"> 236<CENTER><INPUT TYPE="submit" value="������ ����" NAME="submit"></CENTER><br> 237</FORM> 238<SCRIPT LANGUAGE="JavaScript"> 239<!-- 240 var submits=document.getElementsByName("submit"); 241 submits[submits.length -1].focus(); 242//--> 243</SCRIPT> 244<% 245 246'----------------------------------------------------------------------------------------------------- 247'-------------------------------------------------------------------------- List Rows of a GL Accounts 248'----------------------------------------------------------------------------------------------------- 249elseif request("act")="accountRows" then 250account = request("accountID") 251 252DateFrom = request.form("DateFrom") 253if DateFrom = "" then DateFrom = shamsiToday() 254 255DateTo = request.form("DateTo") 256if DateTo = "" then DateTo = shamsiToday() 257 258set RSS=Conn.Execute ("SELECT *, GLDocs.id as GLDoc, GLRows.id as GLRowsID FROM GLRows inner join GLDocs on GLDocs.id=GLRows.GLDoc where ((GLDocs.IsTemporary=1 or GLDocs.IsChecked=1 or GLDocs.IsFinalized=1) and GLDocs.deleted=0 and GLDocs.IsRemoved=0) and ((GLDocs.GL = "& OpenGL & ") AND (GLRows.GLaccount = "& account & ") and (GLDocs.GLDocDate <= N'"& DateTo & "') and (GLDocs.GLDocDate >= N'"& DateFrom & "'))") 259%><BR><BR> 260<TABLE dir=rtl align=center width=640 cellspacing=1 cellpadding=3> 261<TR > 262 <TD colspan=7> 263 <% 264 set RSS2=Conn.Execute ("SELECT *, GLAccountGroups.ID AS GroupID, GLAccountGroups.Name AS GroupName, GLAccountSuperGroups.ID AS SuperGroupID, GLAccountSuperGroups.Name AS SuperGroupName, GLs.ID AS GLID, GLs.Name AS GLname, GLAccounts.Name AS name FROM GLs INNER JOIN GLAccountSuperGroups ON GLs.ID = GLAccountSuperGroups.GL INNER JOIN GLAccountGroups ON GLs.ID = GLAccountGroups.GL AND GLAccountSuperGroups.ID = GLAccountGroups.GLSuperGroup INNER JOIN GLAccounts ON GLs.ID = GLAccounts.GL AND GLAccountGroups.ID = GLAccounts.GLGroup WHERE (GLAccounts.GL = "& OpenGL & ") AND (GLAccounts.ID = "& account & ")") 265 266 %><A HREF="AccountInfo.asp?OpenGL=<%=RSS2("GLID")%>"><%=RSS2("GLname")%></A> > <A HREF="AccountInfo.asp?act=groups&SuperGroupID=<%=RSS2("SuperGroupID")%>"><%=RSS2("SuperGroupName")%></a> > <A HREF="AccountInfo.asp?act=account&GroupID=<%=RSS2("GroupID")%>"><%=RSS2("GroupName")%></a> > <%=RSS2("Name")%> 267 <BR><hR> 268 </TD> 269</TR> 270<TR > 271 <TD colspan=7 align=center> 272 <FORM METHOD=POST ACTION="AccountInfo.asp?act=accountRows&accountID=<%=account%>"> 273 �� ����� <INPUT dir="LTR" TYPE="text" NAME="DateFrom" maxlength="10" size="10" onblur="acceptDate(this)" onKeyPress="return maskDate(this);" value="<%=DateFrom%>"> 274 �� ����� <INPUT dir="LTR" TYPE="text" NAME="DateTo" maxlength="10" size="10" onblur="acceptDate(this)" onKeyPress="return maskDate(this);" value="<%=DateTo%>"> 275 <INPUT TYPE="submit" NAME="submit" value="�����"> 276 </FORM> 277 </TD> 278</TR> 279<% if request("submit")="�����" then %> 280<TR bgcolor="eeeeee" > 281 <TD align=center><!A HREF="default.asp?s=2"><SMALL>���</SMALL></A></TD> 282 <TD align=center><!A HREF="default.asp?s=2"><SMALL>����� ���</SMALL></A></TD> 283 <TD align=center width=100><!A HREF="default.asp?s=2"><SMALL>���</SMALL></A></TD> 284 <TD align=center><!A HREF="default.asp?s=5"><SMALL>������</SMALL></A></TD> 285 <TD align=center><!A HREF="default.asp?s=5"><SMALL>��������</SMALL></A></TD> 286 <TD align=center><!A HREF="default.asp?s=5"><SMALL>-</SMALL></A></TD> 287 <TD align=center><!A HREF="default.asp?s=5"><SMALL>�����</SMALL></A></TD> 288</TR> 289<% 290tmpCounter=0 291remainedAmount = 0 292Do while not RSS.eof 293 tmpCounter = tmpCounter + 1 294 if tmpCounter mod 2 = 1 then 295 tmpColor="#FFFFFF" 296 tmpColor2="#FFFFBB" 297 Else 298 tmpColor="#DDDDDD" 299 tmpColor2="#EEEEBB" 300 End if 301 302 debit = 0 303 credit = 0 304 if RSS("IsCredit") then 305 credit = RSS("Amount") 306 else 307 debit = RSS("Amount") 308 end if 309 remainedAmount = remainedAmount - cdbl(credit) + cdbl(debit) 310 311%> 312<TR bgcolor="<%=tmpColor%>" > 313 <TD><A HREF="GLMemoDocShow.asp?id=<%=RSS("GLDoc")%>"><%=RSS("GLDocID")%></A></TD> 314 <TD align=center dir=ltr><%=RSS("GLDocDate")%></TD> 315 <TD width=100><!A HREF="AccountInfo.asp?act=accountRows&accountID=<%=RSS("id")%>"><INPUT TYPE="text" value="<%=RSS("Description")%>" style="width=200pt; border:solid 0pt; font-size:8pt; background-color:transparent"></A></TD> 316 317 318 <TD dir=ltr align=right><% if debit<>"0" then %> <%=Separate2(debit)%><% end if %></TD> 319 <TD dir=ltr align=right><% if credit<>"0" then %> <%=Separate2(credit)%><% end if %></TD> 320 <TD dir=ltr align=center><% if remainedAmount > 0 then %>�<% else %>�<% end if %></TD> 321 <TD dir=ltr align=right><%=Separate2(remainedAmount)%></TD> 322</TR> 323 324<% 325RSS.moveNext 326Loop 327%> 328<% end if %> 329</TABLE><br> 330<% 331end if 332 333 334%> 335 336<!--#include file="tah.asp" -->