/beta/AO/Payroll.asp.tmp
http://github.com/khaneh/Orders · Unknown · 677 lines · 610 code · 67 blank · 0 comment · 0 complexity · bb2067b1e6c37528b696d9255336528f MD5 · raw file
- <%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
- 'A0 (11 [=B])
- PageTitle= "ÍŢćŢ - ćÇă ć ŰíŃĺ"
- SubmenuItem=6
- if not Auth("B" , 8) then NotAllowdToViewThisPage()
-
- %>
- <!--#include file="top.asp" -->
- <!--#include File="../include_farsiDateHandling.asp"-->
- <!--#include File="../include_JS_InputMasks.asp"-->
-
- <%
- '---------------------------------------------
- '---------------------------- ShowErrorMessage
- '---------------------------------------------
- function ShowErrorMessage(msg)
- response.write "<table align='center' cellpadding='5'><tr><td bgcolor='#FFCCCC' dir='rtl' align='center'> ÎŘÇ ! <br>"& msg & "<br></td></tr></table><br>"
- end function
-
- %>
- <style>
- Table { font-size: 9pt;}
- .InvHeadInput { font-family:tahoma; font-size: 9pt; border: none; background-color: #CCCC88; text-align:center;}
- .InvRowInput { font-family:tahoma; font-size: 9pt; border: none; background-color: #F0F0F0; text-align:right; width:100%;}
- .InvRowInput2 { font-family:tahoma; font-size: 9pt; border: none; background-color: #F0F0F0; direction:RTL; width:100%;}
- .InvHeadInput2 { font-family:tahoma; font-size: 9pt; border: none; background-color: #AACC77; text-align:center;}
- .InvHeadInput3 { font-family:tahoma; font-size: 9pt; border: none; background-color: #F0F0F0; text-align:right; direction: right-to-left;}
- .InvGenInput { font-family:tahoma; font-size: 9pt; border: none; }
- .InvGenButton { font-family:tahoma; font-size: 9pt; border: 1px solid black; }
- .GLInput1 { font-family:tahoma; font-size: 9pt; border: 1px solid black; direction:RTL;}
- .GLInput2 { font-family:tahoma; font-size: 9pt; border: 1px solid black; direction:LTR;}
- .GLTable1 { border: none; direction:RTL; border:1px dashed red ;}
- .GLTable1 tr {height:20; background-color: #CCCC88; }
- .GLTable2 { border: none; direction:RTL;}
- .GLTable2 tr {height:20; text-align:center; background-color: #C3C300; }
- .GLTable2 td {border-bottom: 1px solid black; border-right: 1px solid black;}
- .GLTable3 tr {background-color: #F0F0F0}
- .GLTR1 { font-family:tahoma; font-size: 9pt; height:30; text-align:center; vertical-align:top; background-color: #C3C300; }
- ' .GLTR2 { height:20; text-align:center; background-color: #C3C300; }
- .GLTD1 { font-family:tahoma; font-size: 9pt; height:20; text-align:center; }
- </style>
- <SCRIPT LANGUAGE="JavaScript">
- <!--
- var okToProceed=false;
- var currentRow=0;
- var IsTaraz = false
- //-->
- </SCRIPT>
- <%
- '-----------------------------------------------------------------------------------------------------
- '--------------------------------------------------------------------------------- Input a new AO MEMO
- '-----------------------------------------------------------------------------------------------------
- if request("act")="" then
-
- mySQL="SELECT GLRows.*, Accounts.AccountTitle, GLAccounts.Name AS GLAccountTitle FROM GLRows INNER JOIN GLAccounts ON GLRows.GLAccount = GLAccounts.ID LEFT OUTER JOIN Accounts ON GLRows.Tafsil = Accounts.ID WHERE (GLRows.deleted = 0) AND (GLRows.GLDoc = 30 ) AND (GLAccounts.GL = 84 )"
- set RS2=conn.execute(mySQL)
-
- %>
- <!-- ćŃćĎ ÇŘáÇÚÇĘ ÓäĎ -->
- <br>
- <input type="hidden" Name='tmpDlgArg' value=''>
- <input type="hidden" Name='tmpDlgTxt' value=''>
- <FORM METHOD=POST ACTION="GLMemoInput.asp?act=submitEditMemo" onsubmit="return checkValidation()">
- <table class="GLTable1" align="center" Cellspacing="0" Cellpadding="0">
- <tr class="GLTR1" align="center" Cellspacing="1" Cellpadding="0">
- <TD colspan="10"><TABLE Border="0" Width="100%" Cellspacing="1" Cellpadding="2" Dir="RTL">
- <TR>
- <TD align="left" >ĎÝĘŃ :</TD>
- <TD> <%=OpenGLName%>
- </TD>
- <TD align="left">ĘÇŃíÎ ÓäĎ :</TD>
- <TD>
- <INPUT class="GLInput2" style="text-align:left;" NAME="GLMemoDate" TYPE="text" maxlength="10" size="10" value="<%=GLDocDate%>" onblur="acceptDate(this)">
- </TD>
- <TD align="left">ÔăÇŃĺ ÓäĎ :</TD>
- <TD>
- <INPUT class="GLInput2" NAME="GLMemoNo" TYPE="text" maxlength="10" size="10" value="<%=id%>" readonly>
- </TD>
- </TR></TABLE></TD>
- </tr>
- <tr class="GLTR2">
- <TD colspan="10"><div>
- <TABLE class="GLTable2" Cellspacing="0" Cellpadding="0" >
- <tbody id="GLcols">
- <tr>
- <td style="width:26; border-right:none;"> # </td>
- <td style="width:60;">ĘÝŐíáí</td>
- <td style="width:40;">ăÚíä</td>
- <td style="width:250;">ÔŃÍ</td>
- <td style="width:80;">ČĎĺßÇŃ</td>
- <td style="width:80;">ČÓĘÇäßÇŃ</td>
- <td style="width:50;">ÔăÇŃĺ ß</td>
- <td style="width:70;">ĘÇŃíÎ ß</td>
- </tr>
- </tbody>
- </TABLE></div></TD>
- </tr>
- <tr>
- <TD colspan="10"><div style="overflow:auto; height:250px; width:*;">
- <TABLE Border="0" Cellspacing="1" Cellpadding="0" Dir="RTL" bgcolor="#558855" class="GLTable3" onclick='setCurrentCell()'>
- <Tbody id="GLrows">
- <%
- i = 0
- Do while not RS2.eof
- i = i + 1
- GLAccount = RS2("GLAccount")
- GLAccTitle = RS2("GLAccountTitle")
- Tafsil = RS2("Tafsil")
- AccTitle = RS2("AccountTitle")
- Description = RS2("Description")
- Ref1 = RS2("Ref1")
- Ref2 = RS2("Ref2")
- Amount = RS2("Amount")
- IsCredit = RS2("IsCredit")
-
- credit = ""
- debit = ""
- if IsCredit then
- credit = Amount
- totalCredit = totalCredit + cdbl(Amount)
- else
- debit = Amount
- totalDebit = totalDebit + cdbl(Amount)
- end if
- %>
- <tr bgcolor='#F0F0F0'>
- <td style="width:25; border-right:none;" align=center> <%=i%> </td>
- <td width="60">
- <INPUT class='InvRowInput' TYPE='text' NAME='Accounts' maxlength=6 value="<%=Tafsil%>" title="<%=AccTitle%>" onKeyPress='return mask(this);' onBlur='check(this);'></td>
- <td width="40">
- <INPUT class='InvRowInput2' TYPE='text' NAME='GLAccounts' maxlength=5 value="<%=GLAccount%>" title="<%=GLAccTitle%>" onKeyPress='return mask(this);' onBlur='check(this);'></td>
- <td width="250">
- <INPUT class='InvRowInput2' TYPE='text' NAME='Descriptions' value="<%=Description%>" onKeyPress='return mask(this);'></td>
- <td width="80">
- <INPUT class='InvRowInput2' TYPE='text' NAME='debits' value="<%=Separate(debit)%>" onKeyPress='return mask(this);' onBlur='check(this);'></td>
- <td width="80">
- <INPUT class='InvRowInput2' TYPE='text' NAME='credits' value="<%=Separate(credit)%>" onKeyPress='return mask(this);' onBlur='check(this);'></td>
- <td width="50">
- <INPUT class='InvRowInput2' TYPE='text' NAME='Refs1' maxlength=20 value="<%=Ref1%>" onKeyPress='return mask(this);'> </td>
- <td width="70">
- <INPUT class='InvRowInput' TYPE='text' NAME='Refs2' maxlength=20 value="<%=Ref2%>" onKeyPress='return mask(this);' onBlur='acceptDate(this);'> </td>
- </tr>
-
- <%
- RS2.movenext
- Loop
- %>
- <tr bgcolor='#F0F0F0'>
- <td colspan="15">
- <INPUT class="InvGenButton" TYPE="button" value="ÇÖÇÝĺ" onClick="addRow();">
- </td>
- </tr>
- </Tbody>
- </TABLE></div>
- </TD>
- </tr>
- <tr class="GLTR2">
- <TD colspan="10"><div>
- <TABLE class="GLTable2" Cellspacing="0" Cellpadding="0" style="border-top:1 solid red;">
- <tr>
- <td colspan=3 style="width:256;">
- <span id="tarazDiv" style="font-weight:bold;"><%if totalCredit=totalDebit then response.write "<FONT COLOR='#008833'>ÓäĎ ĘŃÇŇ ÇÓĘ</FONT>" else response.write "<FONT COLOR='#FF3300'>ÓäĎ ĘŃÇŇ äíÓĘ</FONT>" end if%></span> </td>
- <td style="width:122; text-align:left;">ĚăÚ ČĎĺßÇŃ:</td>
- <td style="width:80;"><input type=text name="totalDebit" id="totalDebit" style="width:80;border:none; background:none;" value=<%=Separate(totalCredit)%>></td>
- <td style="width:80;"><input type=text name="totalCredit" id="totalCredit" style="width:80;border:none; background:none;" value=<%=Separate(totalDebit)%>></td>
- <td colspan=2 style="width:122; text-align:right;">:ĚăÚ ČÓĘÇäßÇŃ</td>
- </tr>
- </TABLE></div></TD>
- </tr>
- </table><br>
- <TABLE Border="0" Cellspacing="5" Cellpadding="0" Dir="RTL" align='left'>
- <tr>
- <td align='center'>
- <INPUT TYPE="hidden" name="GLDoc" value="<%=GLDoc%>">
- <INPUT class="InvGenButton" TYPE="submit" name="submit" value="ĐÎíŃĺ Čĺ ŐćŃĘ íÇĎĎÇÔĘ" onclick="saveDraft()">
- <INPUT class="InvGenButton" TYPE="submit" value="ĐÎíŃĺ "></td>
- <td align='center'><INPUT class="InvGenButton" TYPE="button" value="ÇäŐŃÇÝ" onclick="history.back()"></td>
- </tr>
- </TABLE>
- </FORM>
- <script language="JavaScript">
- <!--
- var dialogActive=false;
-
- function mask(src){
- var theKey=event.keyCode;
- /*
- rowNo=src.parentNode.parentNode.rowIndex;
- RTable=document.getElementById("GLrows");
- theRow=RTable.getElementsByTagName("tr")[rowNo];
- */
-
- if (src.name=="Accounts"){
- if (theKey==13){
- event.keyCode=0;
- dialogActive=true;
- document.all.tmpDlgArg.value="#"
- document.all.tmpDlgTxt.value="ĚÓĘĚć ĎŃ äÇă ÍÓÇČ ĺÇí ĘÝŐíáí:"
- var myTinyWindow = window.showModalDialog('../dialog_GenInput.asp',document.all.tmpDlgTxt,'dialogHeight:200px; dialogWidth:440px; dialogTop:; dialogLeft:; edge:None; center:Yes; help:No; resizable:No; status:No;');
- dialogActive=false;
- if (document.all.tmpDlgTxt.value !="") {
- var myTinyWindow = window.showModalDialog('../ar/dialog_selectAccount.asp?act=select&search='+escape(document.all.tmpDlgTxt.value),document.all.tmpDlgArg,'dialogHeight:300px; dialogWidth:600px; dialogTop:; dialogLeft:; edge:Raised; center:Yes; help:No; resizable:Yes; status:No;');
- if (document.all.tmpDlgArg.value!="#"){
- Arguments=document.all.tmpDlgArg.value.split("#")
- src.value=Arguments[0];
- src.title=Arguments[1];
- }
- }
- // src.parentNode.nextSibling.getElementsByTagName("INPUT")[0].focus();
- }
- else if (theKey >= 48 && theKey <= 57 )
- return true;
- else
- return false;
- }
- else if (src.name=="GLAccounts"){
- if (theKey==13){
- event.keyCode=0;
- dialogActive=true;
- document.all.tmpDlgArg.value="#"
- document.all.tmpDlgTxt.value="ĚÓĘĚć ĎŃ äÇă ÍÓÇČ ĺÇí ĎÝĘŃ ßá:"
- var myTinyWindow = window.showModalDialog('../dialog_GenInput.asp',document.all.tmpDlgTxt,'dialogHeight:200px; dialogWidth:440px; dialogTop:; dialogLeft:; edge:None; center:Yes; help:No; resizable:No; status:No;');
- dialogActive=false;
- if (document.all.tmpDlgTxt.value !="") {
- var myTinyWindow = window.showModalDialog('dialog_selectGL.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;');
- if (document.all.tmpDlgArg.value!="#"){
- Arguments=document.all.tmpDlgArg.value.split("#")
- src.value=Arguments[0];
- src.title=Arguments[1];
- }
- }
- // src.parentNode.nextSibling.getElementsByTagName("INPUT")[0].focus();
- }
- else if (theKey >= 48 && theKey <= 57 ) // [0]-[9] are acceptible
- return true;
- else
- return false;
- }
- else if (src.name=="debits" || src.name=="credits" || src.name=="Refs1"){
- if (theKey < 48 || theKey > 57) { // [0]-[9] are acceptible
- return false;
- }
- return true;
- }
- else if (src.name=="Descriptions" || src.name=="Refs2"){
- if (theKey==13){ // [Enter]
- return false;
- }
- return true;
- }
- }
-
- function check(src){
- if (src.name=="Accounts"){
- if (!dialogActive){
- var objHTTP = new ActiveXObject("Microsoft.XMLHTTP")
- objHTTP.Open('GET','xml_CustomerAccount.asp?id='+src.value,false)
- objHTTP.Send()
- tmpStr = unescape( objHTTP.responseText)
- src.title=tmpStr;
- if (tmpStr=="äíä ÍÓÇČí ćĚćĎ äĎÇŃĎ"){
- src.value="";
- }
- }
- }
- else if(src.name=="GLAccounts"){
- if (!dialogActive){
- var objHTTP = new ActiveXObject("Microsoft.XMLHTTP")
- objHTTP.Open('GET','xml_GLAccount.asp?id='+src.value,false)
- objHTTP.Send()
- tmpStr = unescape( objHTTP.responseText)
- src.title=tmpStr;
- if (tmpStr=="äíä ÍÓÇČí ćĚćĎ äĎÇŃĎ"){
- src.value="";
- }
- }
- }
- else if(src.name=="debits" || src.name=="credits"){
- src.value=val2txt(txt2val(src.value));
- if (''+src.value=="NaN" || src.value=="0") src.value = ""
- rowNo=src.parentNode.parentNode.rowIndex;
-
- if (src.value!=""){
- if (src.name=="credits")
- document.getElementsByName("debits")[rowNo].value = "";
- else
- document.getElementsByName("credits")[rowNo].value = "";
- }
-
- memoIsTaraz();
-
- }
- }
-
- function checkValidation(){
- emptySlot=-1;
- for (rowNo=0; rowNo < lastRow; rowNo++){
- if(document.getElementsByName("GLAccounts")[rowNo].value==''){
- emptySlot=rowNo;
- }
- }
- if (emptySlot != -1){
- errObj=document.getElementsByName("GLAccounts")[emptySlot];
- errObj.style.backgroundColor="red";
- document.getElementsByName("GLAccounts")[emptySlot].focus();
- alert('Çíä ÓŘŃ Čí ăÚäí ÇÓĘ\n\nÇŃ ăí ÎćÇĺíĎ Âä ŃÇ ÍĐÝ ßäíĎ\n[Ctrl]+[Del]\nČŇäíĎ.');
- errObj.style.backgroundColor="";
- return false;
- }
-
- if (IsTaraz==true)
- return true
- else{
- alert("ÎŘÇ! ÓäĎ ĘŃÇŇ äíÓĘ")
- return false
- }
- }
-
- function saveDraft(){
- if (document.all.totalDebit.value != 0 || document.all.totalCredit.value != 0)
- IsTaraz = true
- }
-
- function memoIsTaraz(){
- var totalCredit = 0;
- var totalDebit = 0;
- for (rowNo=0; rowNo < lastRow; rowNo++){
- totalCredit += parseInt(txt2val(document.getElementsByName("credits")[rowNo].value));
- totalDebit += parseInt(txt2val(document.getElementsByName("debits")[rowNo].value));
- }
- document.all.totalCredit.value = val2txt(totalCredit);
- document.all.totalDebit.value = val2txt(totalDebit);
- if (totalDebit == totalCredit && totalCredit != 0){
- IsTaraz = true
- document.all.tarazDiv.innerHTML = "<FONT COLOR='#008833'>ÓäĎ ĘŃÇŇ ÇÓĘ</FONT>"
- }
- else{
- IsTaraz = false
- document.all.tarazDiv.innerHTML = "<FONT COLOR='#FF3300'>ÓäĎ ĘŃÇŇ äíÓĘ</FONT>"
- }
- }
-
- var currentRow=0;
- var lastRow=<%=i%>;
- var currentCol=1;
- var lastCol=7;
-
- function documentKeyDown() {
- var theKey = event.keyCode;
- /*
- Arrow Keys' Codes:
- < 37 (Left)
- ^ 38 (Up)
- > 39 (Right)
- v 40 (Down)
- */
- if (event.ctrlKey && !event.shiftKey)
- Ctrl=true;
- else
- Ctrl=false;
-
- if (theKey==9){
- Ctrl=true;
- if (event.shiftKey){
- theKey = 39;
- }
- else
- theKey = 37;
- }
- else if ((theKey == 45) && Ctrl){ // [Ins] Key + [ctrl]
- event.keyCode=36; // [Home] Key
- addRow();
- }
- else if ((theKey == 46) && Ctrl){ // [Del] Key + [ctrl]
- event.keyCode=36; // [Home] Key
- delRow()
- }
-
- if (((theKey == 37 || theKey == 39) && Ctrl) || theKey == 38 || theKey == 40){
-
- deactivateCurrentCell();
-
- switch (theKey){
- case 37:
- if (currentCol < lastCol)
- currentCol++;
- else{
- currentCol=1;
- if(currentRow<lastRow)
- currentRow++;
- }
- break;
- case 38:
- if (currentRow > 0)
- currentRow--;
- else
- currentRow=lastRow;
- break;
- case 39:
- if (currentCol > 1)
- currentCol--;
- else{
- currentCol=lastCol;
- if(currentRow>0)
- currentRow--;
- }
- break;
- case 40:
- if (currentRow < lastRow)
- currentRow++;
- else
- currentRow=0;
- break;
- default:
- break;
- }
-
- activateCurrentCell();
-
- event.keyCode=36; // [Home] Key
- }
- }
-
- function deactivateCurrentCell(){
- Rtable=document.getElementById("GLrows");
- Ctable=document.getElementById("GLcols");
-
- Rtable.getElementsByTagName("tr")[currentRow].getElementsByTagName("td")[0].setAttribute("bgColor", '#F0F0F0');
- Ctable.getElementsByTagName("tr")[0].getElementsByTagName("td")[currentCol].setAttribute("bgColor", '#F0F0F0');
-
- tmpCell=Rtable.getElementsByTagName("tr")[currentRow].getElementsByTagName("td")[currentCol];
- if (tmpCell){
- tmpCell.setAttribute("bgColor", '');
- }
- }
-
- function activateCurrentCell(){
- Rtable=document.getElementById("GLrows");
- Ctable=document.getElementById("GLcols");
-
- Rtable.getElementsByTagName("tr")[currentRow].getElementsByTagName("td")[0].setAttribute("bgColor", '#FFB0B0');
- Ctable.getElementsByTagName("tr")[0].getElementsByTagName("td")[currentCol].setAttribute("bgColor", '#FFB0B0');
-
- tmpCell=Rtable.getElementsByTagName("tr")[currentRow].getElementsByTagName("td")[currentCol];
- if (tmpCell){
- tmpCell.setAttribute("bgColor", '#FF0000');
- tmpCell.getElementsByTagName("input")[0].focus();
- }
- if(currentRow==lastRow){
- document.getElementById("GLrows").getElementsByTagName("tr")[currentRow].getElementsByTagName("INPUT")[0].focus();
- }
- }
-
- function setCurrentCell(){
- tmpRow=event.srcElement.parentNode.parentNode.rowIndex;
- tmpCol=event.srcElement.parentNode.cellIndex;
- if(tmpCol>0 && tmpRow>=0){
- deactivateCurrentCell();
-
- currentRow =tmpRow;
- currentCol=tmpCol;
-
- activateCurrentCell();
- }
- else if(event.srcElement.parentNode.rowIndex){
- deactivateCurrentCell();
-
- currentRow =event.srcElement.parentNode.rowIndex;
- currentCol=1;
-
- activateCurrentCell();
- }
- }
-
- function delRow(){
- if (currentRow==lastRow)
- return;
- deactivateCurrentCell();
- rowNo = currentRow
- Rtable=document.getElementById("GLrows");
- theRow=Rtable.getElementsByTagName("tr")[rowNo];
- Rtable.removeChild(theRow);
-
- lastRow--;
-
- for (rowNo=0; rowNo < lastRow ; rowNo++){
- tempTD=Rtable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[0]
- tempTD.bgColor= '#F0F0F0';
- tempTD.innerText= rowNo+1;
- }
- activateCurrentCell();
- }
- function addRow(){
-
- deactivateCurrentCell();
- rowNo = currentRow
- Rtable=document.getElementById("GLrows");
- theRow=Rtable.getElementsByTagName("tr")[rowNo];
- newRow=document.createElement("tr");
- newRow.setAttribute("bgColor", '#f0f0f0');
-
- tempTD=document.createElement("td");
- tempTD.innerHTML=rowNo+1
- tempTD.setAttribute("align", 'center');
- tempTD.setAttribute("width", '25');
- newRow.appendChild(tempTD);
-
- tempTD=document.createElement("td");
- tempTD.setAttribute("width", '60');
- tempTD.innerHTML="<INPUT class='InvRowInput' TYPE='text' NAME='Accounts' maxlength=6 onKeyPress='return mask(this);' onBlur='check(this);'>"
- newRow.appendChild(tempTD);
-
- tempTD=document.createElement("td");
- tempTD.setAttribute("width", '40');
- tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='GLAccounts' maxlength=5 onKeyPress='return mask(this);' onBlur='check(this);'>"
- newRow.appendChild(tempTD);
-
- tempTD=document.createElement("td");
- tempTD.setAttribute("width", '250');
- tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='Descriptions' onKeyPress='return mask(this);'>"
- newRow.appendChild(tempTD);
-
- tempTD=document.createElement("td");
- tempTD.setAttribute("width", '80');
- tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='debits' onKeyPress='return mask(this);' onBlur='check(this);'>"
- newRow.appendChild(tempTD);
-
- tempTD=document.createElement("td");
- tempTD.setAttribute("width", '80');
- tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='credits' onKeyPress='return mask(this);' onBlur='check(this);'>"
- newRow.appendChild(tempTD);
-
- tempTD=document.createElement("td");
- tempTD.setAttribute("width", '50');
- tempTD.innerHTML="<INPUT class='InvRowInput2' TYPE='text' NAME='Refs1' maxlength=20 onKeyPress='return mask(this);'>"
- newRow.appendChild(tempTD);
-
- tempTD=document.createElement("td");
- tempTD.setAttribute("width", '70');
- tempTD.innerHTML="<INPUT class='InvRowInput' TYPE='text' NAME='Refs2' maxlength=20 onKeyPress='return mask(this);' onBlur='acceptDate(this);'>"
- newRow.appendChild(tempTD);
-
-
- Rtable.insertBefore(newRow,theRow);
-
- lastRow++;
-
- for (rowNo=0; rowNo < lastRow ; rowNo++){
- tempTD=Rtable.getElementsByTagName("tr")[rowNo].getElementsByTagName("td")[0]
- tempTD.bgColor= '#F0F0F0';
- tempTD.innerText= rowNo+1;
- }
-
- activateCurrentCell();
-
- }
-
- document.onkeydown = documentKeyDown;
- activateCurrentCell();
- memoIsTaraz();
- //-->
- </script>
-
- <%
- '-----------------------------------------------------------------------------------------------------
- '---------------------------------------------------------------------------------- Submit new AO MEMO
- '-----------------------------------------------------------------------------------------------------
- elseif request("act")="submit" then
-
- response.write "ok"
- response.end
-
- creationDate=shamsiToday()
-
- successCount=0
- for i=1 to request.form("Accounts").count
- errorFound=false
- ON ERROR RESUME NEXT
- Account = clng(text2value(request.form("Accounts")(i)))
- firstGLAccount= clng(text2value(request.form("firstGLAccounts")(i)))
- GLAccount = clng(text2value(request.form("GLAccounts")(i)))
- Amount = cdbl(text2value(request.form("Amounts")(i)))
- Description= sqlSafe(request.form("Descriptions")(i))
- EffectiveDate = sqlSafe(request.form("EffectiveDates")(i))
-
- if request.form("isCredits")(i) then
- isCredit = 1
- else
- isCredit = 0
- end if
- if Err.Number<>0 then
- Err.clear
- errorFound=True
- end if
- if NOT errorFound then
- ' checking firstGLAccount is valid
- mySQL = "SELECT ID FROM GLAccounts WHERE (HasAppendix = 1) AND (GL = "& openGL & ") AND (ID = "& firstGLAccount & ")"
- Set RS1=Conn.execute(mySQL)
- if RS1.eof then
- errorFound=True
- end if
- RS1.close
-
- mySQL = "SELECT ItemReason FROM AXItemReasonGLAccountRelations WHERE (GL = "& openGL & ") AND (GLAccount = "& firstGLAccount & ")"
- Set RS1=Conn.execute(mySQL)
- if RS1.eof then
- 'Using default reason (sys: AO, reason: Misc.)
- Reason=6
- else
- Reason= cint(RS1("ItemReason"))
- end if
- RS1.close
-
- mySQL="SELECT * FROM AXItemReasons WHERE (ID="& Reason & ")"
- Set RS1=Conn.execute(mySQL)
- sys= RS1("Acron")
- ReasonName = RS1("Name")
- RS1.close
- ' ---------
-
- '---- Checking wether EffectiveDate is valid in current open GL
- if (effectiveDate < session("OpenGLStartDate")) OR (effectiveDate > session("OpenGLEndDate")) then
- errorFound=True
- end if
- '----
- end if
- ON ERROR GOTO 0
-
- if errorFound then
- response.write "<br>"
- errMsg="ÎŘÇ!<br>ÎŘ ČÇ ăÔÎŐÇĘ ŃíŇ ÇÖÇÝĺ äÔĎ:<br>"
- errMsg=errMsg& "ÍÓÇČ:" & firstGLAccount & "-" & Account & "<br>"
- errMsg=errMsg& "ăČáŰ:" & Amount & "<br>"
- errMsg=errMsg& "ÔŃÍ:" & Description & "<br>"
- errMsg=errMsg& "ŘŃÝ ăÚíä:" & GLAccount & "<br>"
- errMsg=errMsg& "ĘÇŃíÎ :" & effectiveDate & "<br>"
- call showAlert (errMsg,CONST_MSG_ERROR)
- else
- '**************************** Creating Memo ****************
- 'MemoType = 1 means Misc. Memo
- mySQL="INSERT INTO "& sys & "Memo (CreatedDate, CreatedBy, Type, Account, IsCredit, Amount, Description) VALUES (N'"& effectiveDate & "' , "& session("id") & ", 1, "& Account & ", "& IsCredit & ", "& Amount & ", N'"& Description & "');SELECT @@Identity AS NewMemo"
- Set RS1 = conn.Execute(mySQL).NextRecordSet
- MemoID=RS1("NewMemo")
- RS1.close
-
- '**************************** Creating an Item for Memo ****************
- '*** Type = 3 means Item is a Memo
-
- mySQL="INSERT INTO "& sys & "Items (GLAccount, GL, FirstGLAccount, Account, EffectiveDate, Link, Reason, CreatedDate, CreatedBy, Type, IsCredit, AmountOriginal, RemainedAmount) VALUES ("&_
- GLAccount & ", "& OpenGL & ", "& firstGLAccount & ", "& Account & ", N'"& effectiveDate & "', "& MemoID & ", "& Reason & ", N'"& creationDate & "' , "& session("id") & ", 3, "& IsCredit & ", "& Amount & ","& Amount & ")"
- conn.Execute(mySQL)
-
- if IsCredit then
- mySQL="UPDATE Accounts SET "& sys & "Balance = "& sys & "Balance + '"& Amount & "' WHERE (ID='"& Account & "')"
- else
- mySQL="UPDATE Accounts SET "& sys & "Balance = "& sys & "Balance - '"& Amount & "' WHERE (ID='"& Account & "')"
- end if
- conn.Execute(mySQL)
- '***------------------------- Creating an Item for Memo ----------------
- successCount = successCount + 1
- msg="ÇÚáÇăíĺ <A Href='../"& sys & "/AccountReport.asp?act=showMemo&sys="& sys & "&memo=" & MemoID &"' target='_blank'>"& MemoID & "</a> ËČĘ ÔĎ."
- response.write "<br>"
- call showAlert (msg,CONST_MSG_INFORM)
- end if
- next
- response.write "<br>"
- response.write "<hr width='70%'>"
- response.write "<br>"
- call showAlert (successCount & " ÇÚáÇăíĺ ČÇ ăćÝŢíĘ ÇíĚÇĎ ÔĎ.",CONST_MSG_INFORM)
- '-----------------------------------------------------------------------------------------------------
- '-----------------------------------------------------------------------------------------------------
- '-----------------------------------------------------------------------------------------------------
- end if
- conn.Close
- %>
- </font>
- <!--#include file="tah.asp" -->