<%
Dim strDeletedRec, strExpDeletedRec
Dim strIssueNo,strIssueDate,strDelDetails
Dim intWarehouse,intport,intWtUnit,wtUnit,intCurrency,intPrepBy,intAuthBy
Dim rsGIN, rsGINDetails, rsGINExpenses
Dim rsCont, rsContDetails,rssum, strCTSerialNo, intContTrackID ' Added By Rajesh
Dim strDetails, strItemsID, strDesc, strQty, strAmt,strItemsName
Dim strExpenses, strExpHeadID, strPartyID, strValue
Dim intMatOutID
Dim decSumQty, decSumAmt
Dim rsACExpenses, rsJVTypeID, rsJVTypeItemID, rsSubAccCash, rsSubAccYard, rsSubAccPort, rsPeriodID, rsPL
Dim strMonth, strYear, strDate
Dim intEmptyWt, intGrossWt, intNetWt, intDeclWt
Dim intItemArray()
'-- Reading Company ID
intCompID=Session("CompID")
'-- Reading the SaveMode
If Trim(Request.QueryString("SaveMode")) <> "" Then
strSaveMode = Trim(Request.QueryString("SaveMode"))
End If
'-- Reading the field values to variables
'-- Issue No.
if Trim(Request.Form("txtIssueNo")) <> "" then
strIssueNo = Request.Form("txtIssueNo")
else
strIssueNo = ""
end if
'-- Reading the field values to variables
'-- GIN No.
if Trim(Request.Form("txtGINNo")) <> "" then
strGINNo = Request.Form("txtGINNo")
else
strGINNo = ""
end if
'-- Issue Date
if Trim(Request.Form("txtIssueDate")) <> "" then
strIssueDate = Request.Form("txtIssueDate")
else
strIssueDate = Null
end if
'-- Payment Type
if Trim(Request.Form("intPdThru")) <> "" And Trim(Request.Form("intPdThru")) <> "0" Then
intPmtType = Request.Form("intPdThru")
else
intPmtType = Null
end if
'--cheque no.
intChkNo = Trim(Request.Form("intChkNo"))
'--cheque date
if Trim(Request.Form("intChkDate"))<>"" then
intChkDate=Trim(Request.Form("intChkDate"))
else
intChkDate=null
end if
'-- Warehouse
if Trim(Request.Form("cmbWarehouse")) <> "" And Trim(Request.Form("cmbWarehouse")) <> "0" Then
intWarehouse = Request.Form("cmbWarehouse")
else
intWarehouse = Null
end if
if Trim(Request.Form("cmbtowarehouse")) <> "" And Trim(Request.Form("cmbtowarehouse")) <> "0" Then
intport = Request.Form("cmbtowarehouse")
else
intport = Null
end if
'-- Trailer Number
if Trim(Request.Form("txtTrailerNo")) <> "" then
strTrailerNo = Request.Form("txtTrailerNo")
else
strTrailerNo = Null
end if
'-- Seal Number
if Trim(Request.Form("txtSealNo")) <> "" then
strSealNo = Request.Form("txtSealNo")
else
strSealNo = Null
end if
'-- Grand Total
if Trim(Request.Form("txtGrandTotAmt")) <> "" And Trim(Request.Form("txtGrandTotAmt")) <> "0" Then
intGrandTotAmt = Request.Form("txtGrandTotAmt")
else
intGrandTotAmt = Null
end if
'-- Container Number
if Trim(Request.Form("cmbcontainerno")) <> "" then
strContainerNo = Request.Form("cmbcontainerno")
else
strContainerNo = Null
end if
'-- Container Type
if Trim(Request.Form("cmbContType")) <> "" then
strContainerType = Request.Form("cmbContType")
else
strContainerType = Null
end if
'-- Unit
if Trim(Request.Form("cmbWtUnit")) <> "" And Trim(Request.Form("cmbWtUnit")) <> "0" Then
intWtUnit = Request.Form("cmbWtUnit")
else
intWtUnit = Null
end if
'------------------------------------
'-- Unit
if Trim(Request.Form("WtUnit")) <> "" Then
wtUnit = Request.Form("WtUnit")
else
wtUnit = Null
end if
'------------------------------------
'-- Currency
if Trim(Request.Form("cmbCurrency")) <> "" And Trim(Request.Form("cmbCurrency")) <> "0" Then
intCurrency = Request.Form("cmbCurrency")
else
intCurrency = Null
end if
intCurrency=Session("CurrID")
'-- Delivery Details
if Trim(Request.Form("txtDetails")) <> "" then
strDelDetails = Request.Form("txtDetails")
else
strDelDetails = Null
end if
'-- Prepared By
if Trim(Request.Form("cmbPrepBy")) <> "" And Trim(Request.Form("cmbPrepBy")) <> "0" Then
intPrepBy = Request.Form("cmbPrepBy")
else
intPrepBy = Null
end if
'-- Authorised By
if Trim(Request.Form("cmbAuthBy")) <> "" And Trim(Request.Form("cmbAuthBy")) <> "0" Then
intAuthBy = Request.Form("cmbAuthBy")
else
intAuthBy = Null
end if
'-- Empty Wt
if Trim(Request.Form("txtEmptyWt")) <> "" then
intEmptyWt = Request.Form("txtEmptyWt")
else
intEmptyWt = 0
end if
'-- Gross Wt
if Trim(Request.Form("txtGrossWt")) <> "" then
intGrossWt = Request.Form("txtGrossWt")
else
intGrossWt = 0
end if
'-- Nett Wt
if Trim(Request.Form("txtNetWt")) <> "" then
intNetWt = Request.Form("txtNetWt")
else
intNetWt = 0
end if
'-- Decl Wt
if Trim(Request.Form("txtDeclWt")) <> "" then
intDeclWt = Request.Form("txtDeclWt")
else
intDeclWt = 0
end if
if Trim(Request.Form("txtTotAmt")) <> "" then
intTotAmt = Request.Form("txtTotAmt")
else
intTotAmt = 0
end if
if Trim(Request.Form("txtTotValue")) <> "" then
intTotValue = Request.Form("txtTotValue")
else
intTotValue = 0
end if
'-- Declare Recordsets
Set rsShipLine = Server.CreateObject("ADODB.Recordset")
Set rsGIN = Server.CreateObject("ADODB.Recordset")
Set rsGINDetails = Server.CreateObject("ADODB.Recordset")
Set rsGINExpenses = Server.CreateObject("ADODB.Recordset")
Set rsACExpenses = Server.CreateObject("ADODB.Recordset")
Set rsJVTypeID = Server.CreateObject("ADODB.Recordset")
Set rsJVTypeItemID = Server.CreateObject("ADODB.Recordset")
Set rsSubAccCash = Server.CreateObject("ADODB.Recordset")
Set rsSubAccYard = Server.CreateObject("ADODB.Recordset")
Set rsSubAccPort = Server.CreateObject("ADODB.Recordset")
Set rsPeriodID = Server.CreateObject("ADODB.Recordset")
Set rsPL = Server.CreateObject("ADODB.Recordset")
Set rsPayments = Server.CreateObject("ADODB.Recordset")
'-- Added by Rajesh [Start]
Set rsCont = Server.CreateObject("ADODB.Recordset")
Set rsContDetails = Server.CreateObject("ADODB.Recordset")
Set rsinwards = Server.CreateObject("ADODB.Recordset")
Set rsoutwards = Server.CreateObject("ADODB.Recordset")
Set rsopbal= Server.CreateObject("ADODB.Recordset")
rsinwards.cursorlocation=3
rsoutwards.cursorlocation=3
rsopbal.cursorlocation=3
rsGIN.cursorlocation=3
rsCont.cursorlocation=3
rsContDetails.cursorlocation=3
rsGINDetails.cursorlocation=3
rsGINExpenses.cursorlocation=3
rsACExpenses.cursorlocation=3
rsJVTypeID.cursorlocation=3
rsJVTypeItemID.cursorlocation=3
rsSubAccCash.cursorlocation=3
rsSubAccYard.cursorlocation=3
rsSubAccPort.cursorlocation=3
rsPeriodID.cursorlocation=3
rsPL.cursorlocation=3
rsPayments.cursorlocation=3
rsShipLine.cursorlocation=3
rsShipLine.open "select [sh-shiplines].shiplineid from [sh-shiplines] inner join "&_
"[sh-contarrivals] on [sh-shiplines].shiplineid=[sh-contarrivals].shiplineid inner join "&_
"[sh-containerinfo] on [sh-containerinfo].contarrivalid=[sh-contarrivals].contarrivalid "&_
"where [sh-containerinfo].containerno='"&strContainerNo&"' and [sh-shiplines].compid="&intcompID&"",conn,1,3
conn.commandtimeout=0
if not (rsShipLine.EOF and rsShipLine.BOF) then
intshipid=rsShipLine("ShipLineid")
else
intshipid=0
end if
'response.Write(intshipid)
'-- Added by Rajesh [End]
'-- Get IDs and Values of the Sub-Form
'Row ID
strDetails = split(Request.Form("txtRowID"),"|")
'ListBoxes
'Response.Write Request.Form("txtHItemsName")
'Response.end
strItemsName = split(Request.Form("txtHItemsName"),"|")
strItemsID = split(Request.Form("txtHItems"),"|")
strDesc = split(Request.Form("txtHDesc"),"|")
strQty = split(Request.Form("txtHQty"),"|")
strAmt = split(Request.Form("txtHAmt"),"|")
'-- Get IDs and Values of the Sub-Form for Expenses
'Row ID
strExpenses = split(Request.Form("txtExpRowID"),"|")
'ListBoxes
strExpHeadID = split(Request.Form("txtHExpHead"),"|")
strPartyID = split(Request.Form("txtHParty"),"|")
strValue = split(Request.Form("txtHValue"),"|")
'-- Adding the record
If Trim(strSaveMode) = "A" Then
rsGIN.Open "Select Top 1 * from [IN-MatOut]",conn,1,3
rsGINDetails.Open "Select Top 1 * from [IN-MatOutDetails]",conn,1,3
rsGINExpenses.Open "Select Top 1 * from [IN-MatOutExpense]",conn,1,3
'-- Added by Rajesh [Start]
rsCont.Open "Select Top 1 * from [SH-ContTrackings]",conn,1,3
rsContDetails.Open "Select Top 1 * from [SH-ContTrackDetails]",conn,1,3
'-- Added by Rajesh [End]
'-- Modifying the record
ElseIf Trim(strSaveMode) = "E" Then
'-- Reading the Main ID
intMatOutID = Clng(Request.QueryString("MatOutID"))
rsGIN.Open "Select * from [IN-MatOut] Where MatOutID = " & intMatOutID, conn, 1, 3
rsGINDetails.Open "Select * from [IN-MatOutDetails] Where MatOutID = " & intMatOutID, conn, 1, 3
rsGINExpenses.Open "Select * from [IN-MatOutExpense] Where MatOutID = " & intMatOutID, conn, 1, 3
'-- Added by Rajesh [Start]
rsCont.Open "Select * from [SH-ContTrackings] Where MatOutID = " & intMatOutID,conn,1,3
rsContDetails.Open "Select * from [SH-ContTrackDetails] " & _
" where [SH-ContTrackDetails].ContTrackID=" & rscont.fields("ContTrackID") & " And [SH-ContTrackDetails].ContStatusID=1" , conn, 1, 3
'-- Added by Rajesh [End]
'-- Get the deleted records from the Database.
If Trim(Request.Form("txtDeleted")) <> "" then
strDeletedRec = Request.Form("txtDeleted")
Else
strDeletedRec = ""
End if
If strDeletedRec <> "" Then
strDeletedRec = Left(strDeletedRec,Len(strDeletedRec)-1)
End If
'-- Get the deleted records from the Database forExpenses.
If Trim(Request.Form("txtExpDeleted")) <> "" then
strExpDeletedRec = Request.Form("txtExpDeleted")
Else
strExpDeletedRec = ""
End if
If strExpDeletedRec <> "" Then
strExpDeletedRec = Left(strExpDeletedRec,Len(strExpDeletedRec)-1)
End If
'-- Posting the record
ElseIf Trim(strSaveMode) = "P" Then
'-- Reading the Main ID
intMatOutID = Clng(Request.QueryString("MatOutID"))
rsGIN.Open "Select * from [IN-MatOut] Where MatOutID = " & intMatOutID, conn, 1, 3
if rsGIN("Posted") = True then
rsGIN.Close
Response.Write "
"
Response.End
end if
'--Check whether Quantity Entered Is Greater Stock in Hand( Added By Sheetal)
dim retval
dim showerrmsg
j=0
redim preserve intItemArray(ubound(strItemsID))
For i = 0 to Ubound(strItemsID) - 1
intQty=strQty(i)
intProductid=strItemsID(i)
retval=CheckBeforeUpdate(conn,"StockInHand",intQty,intProductid,intWarehouse,"frmGIN")
if retval="false" then
showerrmsg=true
intItemArray(j)=strItemsName(i)
j=j+1
end if
next
if showerrmsg=true then
Response.Write "
"
Response.Write " Quantiy for "
for j=0 to ubound(intItemArray)-1
if j>0 and (j <> ubound(intItemArray)-1) then
Response.Write " , "
end if
Response.Write intItemArray(j)
next
Response.Write " exceeds its Stock In Hand. "
Response.Write " Hence record cannot be posted successfully. "
Response.Write " Click here to update the entered record"
Response.Write "
"
Response.end
end if
'----------upto here---------
'-- Call Function to check if the Item List has been added to the Stock in yard in COA
chkCOAItemsYard = CheckCOAItems("Stock in yard",Request.Form("txtHItems"),"")
'-- Call Function to check if the Item List has been added to the respective Purchase Account in COA
chkCOAItemsPort = CheckCOAItems("Stock at port",Request.Form("txtHItems"),"")
if chkCOAItemsYard <> "" then
chkCOAItemsYard = left(chkCOAItemsYard,len(chkCOAItemsYard)-1)
With Response
.Write "
"
.Write"The following Items have not been added to the 'Stock in yard' AccountHead of the COA : "
.Write " " & chkCOAItemsYard & "
"
.End
End With
end if
'----------Added By Sheetal ------------------
'------- GINExpenses Accounting Entries made in [AC-Transactions] table -------------
'-- Debit and Credit Entries are made for each GINExpenseHead in [AC-Transactions] table
'-- Document Type
DocTypeID = 7
'-- JVType for GIN i.e. Material outward Note
rsJVTypeID.Open "Select JVTypeID from [AC-JVTypes] where JVType = 'MON-Exp'",conn,1,3
rsJVTypeItemID.Open "Select JVTypeID from [AC-JVTypes] where JVType = 'MON'",conn,1,3
'-- SubAccountID for Cash Account
rsSubAccCash.Open "Select SubAccountID from [AC-SubAccounts] where SubAccountName='Cash account' and CompID="&intCompID&"",conn,1,3
'-- SubAccountID for Profit and Loss Account
rsPL.Open "Select SubAccountID from [AC-SubAccounts] where SubAccountName='Profit and Loss Account' and CompID="&intCompID&"",conn,1,3
'-- Fetching the PeriodID
strMonth = Month(strIssueDate)
strYear = Year(strIssueDate)
strDate = strMonth & "/01/" & strYear
rsPeriodID.Open "Select PeriodID from MstPeriods where acYear = '" & strYear & "'",conn,1,3
'-- Add records in [AC-Transactions] table
rsACExpenses.Open "Select top 1 * from [AC-Transactions]",conn,1,3
rsPayments.Open "Select top 1 * from [AC-Payments]",conn,1,3
'on error resume next
conn.BeginTrans
Dim intTotexpamt, decCostPerTon, decStock, decQty, decCost
Dim intItmAmt, intItmExpAmt, intGINItmAmt, intStockAmt, intTotalStock, decNewcostperton
intTotexpamt = 0
'-- Calculating Total Expense Value intTotexpamt & converting in Local currency
For i = 0 to Ubound(strValue)-1
'Response.write("strValue(i)" & CDbl(strValue(i))) & " "
intTotexpamt = intTotexpamt + CDbl(strValue(i))
Next
'-- No Need of below statement bcos gin is assumed to be prepared in local currency only.
'intTotexpamt = CurrencyValue(USDValue(CDbl(intTotexpamt),intCurrency),Session("CurrID"))
intTotexpamt = cdbl(formatnumber(intTotexpamt,2))
'----------Code Added By Sheetal Ends Here------------------
'-- Updating the stock level for all the products received
For i = 0 to Ubound(strItemsID)-1
Call UpdateStock(strItemsID(i),intWarehouse,CDBl(strQty(i)),"S")
Next
'Added by rashmi[start]
'-- Adding GIN Item Details in [AC-Transactions] on posting -------
'-- Entry ONE [start]
'Stock at port(Item) - DR
'Stock in yard(Item) - CR
For i = 0 to Ubound(strItemsID)-1
'-- SubAccount for Stock in yard
rsSubAccYard.Open "Select [AC-SubAccounts].SubAccountID,[AC-SubAccounts].SubAccountname from [AC-SubAccounts] INNER JOIN "&_
"[AC-AccountHeads] ON [AC-AccountHeads].AccountHeadID = [AC-SubAccounts].AccountHeadID AND "&_
"[AC-AccountHeads].CompID = [AC-SubAccounts].CompID INNER JOIN "&_
"[IN-ProdCOALinkDet] ON [IN-ProdCOALinkDet].SubAccountID = [AC-SubAccounts].SubAccountID AND "&_
"[IN-ProdCOALinkDet].CompID = [AC-SubAccounts].CompID INNER JOIN "&_
"[IN-Products] ON [IN-Products].ProductID = [IN-ProdCOALinkDet].ProductID "&_
"where AccountHeadName='Stock in yard' and [IN-Products].ProductID = "&strItemsID(i)&" and [AC-SubAccounts].CompID="&intCompID&"",conn,1,3
'-- SubAccountID for Stock at port
rsSubAccPort.Open "Select [AC-SubAccounts].SubAccountID from [AC-SubAccounts] INNER JOIN "&_
"[AC-AccountHeads] ON [AC-AccountHeads].AccountHeadID = [AC-SubAccounts].AccountHeadID AND "&_
"[AC-AccountHeads].CompID = [AC-SubAccounts].CompID INNER JOIN "&_
"[IN-ProdCOALinkDet] ON [IN-ProdCOALinkDet].SubAccountID = [AC-SubAccounts].SubAccountID AND "&_
"[IN-ProdCOALinkDet].CompID = [AC-SubAccounts].CompID INNER JOIN "&_
"[IN-Products] ON [IN-Products].ProductID = [IN-ProdCOALinkDet].ProductID "&_
"where AccountHeadName='Stock at port' and [IN-Products].ProductID = "&strItemsID(i)&" and [AC-SubAccounts].CompID="&intCompID&"",conn,1,3
rsinwards.open"select isnull(sum(qty),0) as inqty,isnull(sum(qty*puramt),0) as inamount from [in-matindetails] inner join [in-matin] on [in-matin].matinid=[in-matindetails].matinid and [in-matin].warehouseid ="&intWarehouse&" where [in-matin].compid="&intCompID&" and productid="&strItemsID(i)&" and [in-matin].indate<='"&strIssueDate&"' and [in-matin].posted=1",conn,1,3
rsoutwards.open"select isnull(sum(qty),0) as outqty,isnull(sum(qty*estamt),0) as outamount from [in-matoutdetails] inner join [in-matout] on [in-matout].matoutid=[in-matoutdetails].matoutid and [in-matout].warehouseid ="&intWarehouse&" where [in-matout].compid="&intCompID&" and productid="&strItemsID(i)&" and [in-matout].outdate<='"&strIssueDate&"' and [in-matout].posted=1",conn,1,3
rsopbal.open"select opstock,opvalue from [in-opstock] where compid="&intCompID&" and warehouseid ="&intWarehouse&" and productid="&strItemsID(i)&"",conn,1,3
if not (rsopbal.eof or rsopbal.bof ) then
tottalqty=cdbl(rsinwards("inqty"))+cdbl(rsopbal("opstock"))-cdbl(rsoutwards("outqty"))
tottalamount=cdbl(rsinwards("inamount"))+cdbl(rsopbal("opvalue"))-cdbl(rsoutwards("outamount"))
else
Response.Write(tottalamount)
tottalqty=cdbl(rsinwards("inqty"))-cdbl(rsoutwards("outqty"))
tottalamount=cdbl(rsinwards("inamount"))-cdbl(rsoutwards("outamount"))
end if
Response.Write("
")
Response.Write(tottalamount)
if (tottalamount=0 and tottalqty=0) then
response.Write("Out date for the product : ")
set rsprod=server.CreateObject("adodb.recordset")
set rspr=server.CreateObject("adodb.recordset")
rspr.open"select productid,product from [in-products] where productid="&strItemsID(i)&"",conn,1,3
'response.Write(rspr("product"))
response.Write(rspr("productid"))
rspr.close
response.Write(" is greater then purhcase date!")
response.End()
conn.rollbackTrans
else
pricepermt=tottalamount/tottalqty
end if
'pricepermt=tottalamount/tottalqty
finalamount=pricepermt*strQty(i)
rsACExpenses.AddNew
rsACExpenses.Fields("DocTypeID") = DocTypeID
rsACExpenses.Fields("JVTypeID") = rsJVTypeItemID("JVTypeID")
rsACExpenses.Fields("JVNo") = intMatOutID
rsACExpenses.Fields("JVNumber") = strIssueNo
rsACExpenses.Fields("SubAccountID") = rsSubAccPort("SubAccountID") 'Stock at port(Party)
rsACExpenses.Fields("TransactionDate") = strIssueDate
rsACExpenses.Fields("CurrID") = Session("CurrID")
rsACExpenses.Fields("DebitAmount") = CDbl(finalamount)
rsACExpenses.Fields("DebitAmountUE") = CompExchRateValue(CDbl(finalamount))
rsACExpenses.Fields("PeriodID") = rsPeriodID("PeriodID")
rsACExpenses.Fields("Posted") = 1
rsACExpenses.Fields("CompID") = intCompID
rsACExpenses.Fields("AddedOn") = Now()
rsACExpenses.Update
rsACExpenses.AddNew
rsACExpenses.Fields("DocTypeID") = DocTypeID
rsACExpenses.Fields("JVTypeID") = rsJVTypeItemID("JVTypeID")
rsACExpenses.Fields("JVNo") = intMatOutID
rsACExpenses.Fields("JVNumber") = strIssueNo
rsACExpenses.Fields("SubAccountID") = rsSubAccYard("SubAccountID") 'Stock in yard(Item)
rsACExpenses.Fields("TransactionDate") = strIssueDate
rsACExpenses.Fields("CurrID") = Session("CurrID")
rsACExpenses.Fields("CreditAmount") = CDbl(finalamount)
rsACExpenses.Fields("CreditAmountUE") = CompExchRateValue(CDbl(finalamount))
rsACExpenses.Fields("PeriodID") = rsPeriodID("PeriodID")
rsACExpenses.Fields("Posted") = 1
rsACExpenses.Fields("CompID") = intCompID
rsACExpenses.Fields("AddedOn") = Now()
rsACExpenses.Update
' ENTRY IN [AC-INVENTORY] IN CASE OF STOCK IN YARD
set rsInventory=server.CreateObject("ADODB.RECORDSET")
rsInventory.cursorlocation=3
rsInventory.open "select top 1 * from [ac-Inventory]",conn,1,3
rsInventory.AddNew
rsInventory.Fields("DocTypeID") = DocTypeID
rsInventory.Fields("JVTypeID") = rsJVTypeItemID("JVTypeID")
rsInventory.Fields("JVNo") = intMatOutID
rsInventory.Fields("JVNumber") = strIssueNo
rsInventory.Fields("SubAccountID") = rsSubAccYard("SubAccountID") 'Stock in yard(Item)
rsInventory.Fields("TransactionDate") = strIssueDate
rsInventory.Fields("productid") = strItemsID(i)
rsInventory.Fields("DebitQty") =CDBl(strQty(i))
rsInventory.Fields("CreditAmount") = CDbl(finalamount)
rsInventory.Fields("CreditAmountUE") = CompExchRateValue(CDbl(finalamount))
rsInventory.Fields("CompID") = intCompID
rsInventory.Fields("AddedOn") = Now()
rsInventory.Update
'------------END OF ------[AC-INVENORY]-------
rsSubAccYard.Close
rsSubAccPort.Close
rsopbal.close
rsinwards.close
rsoutwards.close
Next
'-- Entry ONE [end]
'-------------------------------------------------------------
'-- Adding GIN Expense Details in [AC-Transactions] on posting -------
'-- Entry TWO [start]
'Expenses (e.g.Travelling Exp) - DR
'Cash A/C - CR
If Ubound(strPartyID) > 0 then
For i = 0 to Ubound(strPartyID)-1
rsACExpenses.AddNew
rsACExpenses.Fields("DocTypeID") = DocTypeID
rsACExpenses.Fields("JVTypeID") = rsJVTypeID("JVTypeID")
rsACExpenses.Fields("JVNo") = intMatOutID
rsACExpenses.Fields("JVNumber") = strIssueNo
rsACExpenses.Fields("SubAccountID") = strPartyID(i) 'Party SubAccountID
rsACExpenses.Fields("TransactionDate") = strIssueDate
rsACExpenses.Fields("CurrID") = Session("CurrID")
rsACExpenses.Fields("DebitAmount") = CDbl(strValue(i))
rsACExpenses.Fields("DebitAmountUE") = CompExchRateValue(CDbl(strValue(i)))
rsACExpenses.Fields("PeriodID") = rsPeriodID("PeriodID")
rsACExpenses.Fields("Posted") = 1
rsACExpenses.Fields("CompID") = intCompID
rsACExpenses.Fields("AddedOn") = Now()
rsACExpenses.Update
'entry in ac-payments
'rsPayments.AddNew
'rsPayments.Fields("PaymentNo") =strIssueNo
'rsPayments.Fields("PaymentDate") =strIssueDate
'rsPayments.Fields("JVTypeID") = rsJVTypeID("JVTypeID")
'rsPayments.Fields("acPeriod") = rsPeriodID("PeriodID")
'rsPayments.Fields("fromSubAccountID") = strPartyID(i) 'Party SubAccountID (For Expenses)
'rsPayments.Fields("ToSubAccountID") = (strExpHeadID(i))
'rsPayments.Fields("CompID") = intCompID
'rsPayments.Fields("CurrID") = Session("CurrID")
'rsPayments.Fields("ChequeNo") = intChkNo
'rsPayments.Fields("ChequeDate") = intChkDate
'rsPayments.Fields("BankName") = (strExpHeadID(i))
'rsPayments.Fields("Amount") = CDbl(intTotValue)
'rsPayments.Fields("AmountUE") = CompExchRateValue(CDbl(intTotValue))
'rsPayments.Fields("Remarks") = strIssueDate
'rsPayments.Fields("Posted") = 1
'rsPayments.Fields("AddedOn") = Now()
'rsPayments.Update
Next
For i = 0 to Ubound(strPartyID)-1
'-- Credit Amount Entry credited to the Cash Account
rsACExpenses.AddNew
rsACExpenses.Fields("DocTypeID") = DocTypeID
rsACExpenses.Fields("JVTypeID") = rsJVTypeID("JVTypeID")
rsACExpenses.Fields("JVNo") = intMatOutID
rsACExpenses.Fields("JVNumber") = strIssueNo
rsACExpenses.Fields("SubAccountID") = strPartyID(i) 'rsSubAccCash("SubAccountID") 'Cash SubAccountID
rsACExpenses.Fields("TransactionDate") = strIssueDate
rsACExpenses.Fields("CurrID") = Session("CurrID")
rsACExpenses.Fields("CreditAmount") = CDbl(intTotValue)
rsACExpenses.Fields("CreditAmountUE") = CompExchRateValue(CDbl(intTotValue))
rsACExpenses.Fields("PeriodID") = rsPeriodID("PeriodID")
rsACExpenses.Fields("Posted") = 1
rsACExpenses.Fields("CompID") = intCompID
rsACExpenses.Fields("AddedOn") = Now()
rsACExpenses.Update
next
End If
'-- Entry TWO [end]
'-------------------------------------------------------------
'-- Entry THREE [start]
'Profit and Loss A/C - DR
'Expense (Travelling Exp) - CR
'If Ubound(strPartyID) > 0 then
' rsACExpenses.AddNew
' rsACExpenses.Fields("DocTypeID") = DocTypeID
' rsACExpenses.Fields("JVTypeID") = rsJVTypeID("JVTypeID")
' rsACExpenses.Fields("JVNo") = intMatOutID
' rsACExpenses.Fields("JVNumber") = strIssueNo
' rsACExpenses.Fields("SubAccountID") = rsPL("SubAccountID") 'Profit and Loss Account
' rsACExpenses.Fields("TransactionDate") = strIssueDate
' rsACExpenses.Fields("CurrID") = Session("CurrID")
' rsACExpenses.Fields("DebitAmount") = CDbl(intTotValue)
' rsACExpenses.Fields("DebitAmountUE") = CompExchRateValue(CDbl(intTotValue))
' rsACExpenses.Fields("PeriodID") = rsPeriodID("PeriodID")
' rsACExpenses.Fields("Posted") = 1
' rsACExpenses.Fields("CompID") = intCompID
' rsACExpenses.Fields("AddedOn") = Now()
' rsACExpenses.Update
' For i = 0 to Ubound(strPartyID)-1
' rsACExpenses.AddNew
' rsACExpenses.Fields("DocTypeID") = DocTypeID
' rsACExpenses.Fields("JVTypeID") = rsJVTypeID("JVTypeID")
' rsACExpenses.Fields("JVNo") = intMatOutID
' rsACExpenses.Fields("JVNumber") = strIssueNo
' rsACExpenses.Fields("SubAccountID") = strPartyID(i) 'Party SubAccountID (For Expenses)
' rsACExpenses.Fields("TransactionDate") = strIssueDate
' rsACExpenses.Fields("CurrID") = Session("CurrID")
' rsACExpenses.Fields("CreditAmount") = CDbl(strValue(i))
' rsACExpenses.Fields("CreditAmountUE") = CompExchRateValue(CDbl(strValue(i)))
' rsACExpenses.Fields("PeriodID") = rsPeriodID("PeriodID")
' rsACExpenses.Fields("Posted") = 1
' rsACExpenses.Fields("CompID") = intCompID
' rsACExpenses.Fields("AddedOn") = Now()
' rsACExpenses.Update
' Next
'End If
'-- Entry THREE [end]
'-------------------------------------------------------------
'-- Entry FOUR [start]
'Stock at port (Expenses - Item-Wise) A/C - DR
'Profit and Loss Account - CR
If Ubound(strPartyID) > 0 then
For i = 0 to Ubound(strItemsID)-1
intTotValueSplit = CDbl(formatnumber(intTotValue/intTotAmt * strAmt(i),2))
'-- SubAccountID for Stock at port
rsSubAccPort.Open "Select [AC-SubAccounts].SubAccountID from [AC-SubAccounts] INNER JOIN "&_
"[AC-AccountHeads] ON [AC-AccountHeads].AccountHeadID = [AC-SubAccounts].AccountHeadID AND "&_
"[AC-AccountHeads].CompID = [AC-SubAccounts].CompID INNER JOIN "&_
"[IN-ProdCOALinkDet] ON [IN-ProdCOALinkDet].SubAccountID = [AC-SubAccounts].SubAccountID AND "&_
"[IN-ProdCOALinkDet].CompID = [AC-SubAccounts].CompID INNER JOIN "&_
"[IN-Products] ON [IN-Products].ProductID = [IN-ProdCOALinkDet].ProductID "&_
"where AccountHeadName='Stock at port' and [IN-Products].ProductID = "&strItemsID(i)&" and [AC-SubAccounts].CompID="&intCompID&"",conn,1,3
rsACExpenses.AddNew
rsACExpenses.Fields("DocTypeID") = DocTypeID
rsACExpenses.Fields("JVTypeID") = rsJVTypeItemID("JVTypeID")
rsACExpenses.Fields("JVNo") = intMatOutID
rsACExpenses.Fields("JVNumber") = strIssueNo
rsACExpenses.Fields("SubAccountID") = rsSubAccPort("SubAccountID") 'Stock at port(Party)
rsACExpenses.Fields("TransactionDate") = strIssueDate
rsACExpenses.Fields("CurrID") = Session("CurrID")
rsACExpenses.Fields("DebitAmount") = CDbl(intTotValueSplit)
rsACExpenses.Fields("DebitAmountUE") = CompExchRateValue(CDbl(intTotValueSplit))
rsACExpenses.Fields("PeriodID") = rsPeriodID("PeriodID")
rsACExpenses.Fields("Posted") = 1
rsACExpenses.Fields("CompID") = intCompID
rsACExpenses.Fields("AddedOn") = Now()
rsACExpenses.Update
rsSubAccPort.Close
Next
rsACExpenses.AddNew
rsACExpenses.Fields("DocTypeID") = DocTypeID
rsACExpenses.Fields("JVTypeID") = rsJVTypeItemID("JVTypeID")
rsACExpenses.Fields("JVNo") = intMatOutID
rsACExpenses.Fields("JVNumber") = strIssueNo
rsACExpenses.Fields("SubAccountID") = rsPL("SubAccountID") 'Profit and Loss Account
rsACExpenses.Fields("TransactionDate") = strIssueDate
rsACExpenses.Fields("CurrID") = Session("CurrID")
rsACExpenses.Fields("CreditAmount") = CDbl(intTotValue)
rsACExpenses.Fields("CreditAmountUE") = CompExchRateValue(CDbl(intTotValue))
rsACExpenses.Fields("PeriodID") = rsPeriodID("PeriodID")
rsACExpenses.Fields("Posted") = 1
rsACExpenses.Fields("CompID") = intCompID
rsACExpenses.Fields("AddedOn") = Now()
rsACExpenses.Update
End If
'-- Entry FOUR [end]
'-------------------------------------------------------------
'----------- Code to add records in [AC-Transactions] ends here -----------
If Trim(intMatOutID)<>"" Then
conn.execute("Update [IN-MatOut] Set Posted = 1 Where MatOutID=" & intMatOutID)
End If
Response.Write "
"
if err.number=0 then
conn.commitTrans
Response.Write "Record Posted Successfully
"
Response.End
'-- Delete the entire record
ElseIf Trim(strSaveMode) = "D" Then
'-- Reading the Main ID
intMatOutID = Request.QueryString("MatOutID")
'on error resume next
conn.BeginTrans
If Trim(intMatOutID)<>"" Then
conn.execute("Delete From [IN-MatOutDetails] Where MatOutID = " & intMatOutID)
conn.execute("Delete From [IN-MatOut] Where MatOutID = " & intMatOutID)
'-- Added by Rajesh [Start]
conn.execute("Delete From [SH-ContTrackDetails] Where ContTrackID in (Select ConttrackID from [SH-ContTrackings] Where MatOutID = " & intMatOutID & ")")
conn.execute("Delete From [SH-ContTrackings] Where MatOutID = " & intMatOutID)
'-- Added by Rajesh [End]
End If
Response.Write "
"
if err.number=0 then
conn.commitTrans
else
conn.rollbackTrans
Response.write ("Could not delete the Record as the following error has occured. " & err.Description)
end if
Response.End
End if
'-- DATABASE UPDATION
'-- Add the record if the SaveMode is 'A' else Update the record if SaveMode is 'E'
'' resume next
conn.BeginTrans
If strSaveMode = "A" Then
rsGIN.AddNew
rsGIN.Fields("CompID") = Session("CompID")
rsGIN.Fields("AddedOn") = Now()
'-- Get the Autogenerated GIN Number Again to Compare if same.
strIssueNoAgain = GetAutoNumber("[IN-MatOut]", Session("CompID"),"OutNo","GI")
If Trim(strIssueNoAgain)<>Trim(strIssueNo) Then
strIssueNo = strIssueNoAgain
Response.Write "
"
Response.Write "NOTE : New Issue No. has been generated due to database concurrency problem - " & strIssueNoAgain
Response.Write "
"
End If
'-- Added by Rajesh [Start]
rsCont.Addnew
rsContDetails.Addnew
rsCont.Fields("CompID") = Session("CompID")
rsCont.Fields("AddedOn") = Now()
rsContDetails.Fields("CompID") = Session("CompID")
rsContDetails.Fields("AddedOn") = Now()
strCTSerialNo=GetAutoNumber("[SH-ContTrackings]", Session("CompID"),"SerialNo","CT")
'-- Added by Rajesh [End]
End If
If strSaveMode = "E" Then
rsGIN.Fields("LastModified") = Now()
'-- Added by Rajesh [Start]
rsCont.Fields("LastModified") = Now()
rsContDetails.Fields("LastModified") = Now()
'-- Added by Rajesh [End]
End If
rsGIN.Fields("OutNo") = strIssueNo
rsGIN.Fields("OutDate") = strIssueDate
rsGIN.Fields("WarehouseID") = intWarehouse
rsGIN.Fields("portid") = intport
rsGIN.Fields("ContainerNo") = strContainerNo
rsGIN.Fields("TrailerNo") = strTrailerNo
rsGIN.Fields("SealNo") = strSealNo
rsGIN.Fields("conttype") = strContainerType
'rsGIN.Fields("UnitID") = intWtUnit
rsGIN.Fields("BankName") = (intPmtType)
rsGIN.Fields("ChequeNo") = intChkNo
rsGIN.Fields("ChequeDate") = intChkDate
rsGIN.Fields("UnitID") = wtUnit
rsGIN.Fields("EmptyWt") = intEmptyWt
rsGIN.Fields("GrossWt") = intGrossWt
rsGIN.Fields("NettWt") = intNetWt
rsGIN.Fields("DeclWt") = intDeclWt
rsGIN.Fields("ShipName") = intShipid
rsGIN.Fields("DelDetails") = strDelDetails
rsGIN.Fields("PreparedBy") = intPrepBy
rsGIN.Fields("AuthorisedBy") = intAuthBy
rsGIN.Fields("Posted") = 0
rsGIN.Update
'-- Get the Added Number
intMatOutID = rsGIN.Fields("MatOutID")
'-- Adding Details Part
If Trim(strSaveMode) = "A" Then
For i = 0 to ubound(strItemsID)-1
declqty=strQty(i)*intDeclWt/intNetWt
rsinwards.open"select isnull(sum(qty),0) as inqty,isnull(sum(qty*puramt),0) as inamount from [in-matindetails] inner join [in-matin] on [in-matin].matinid=[in-matindetails].matinid and [in-matin].warehouseid ="&intWarehouse&" where [in-matin].compid="&intCompID&" and productid="&strItemsID(i)&" and [in-matin].indate<='"&strIssueDate&"' and [in-matin].posted=1",conn,1,3
rsoutwards.open"select isnull(sum(qty),0) as outqty,isnull(sum(qty*estamt),0) as outamount from [in-matoutdetails] inner join [in-matout] on [in-matout].matoutid=[in-matoutdetails].matoutid and [in-matout].warehouseid ="&intWarehouse&" where [in-matout].compid="&intCompID&" and productid="&strItemsID(i)&" and [in-matout].outdate<='"&strIssueDate&"' and [in-matout].posted=1",conn,1,3
rsopbal.open"select isnull(opstock,0) as opstock,isnull(opvalue,0) as opvalue from [in-opstock] where compid="&intCompID&" and warehouseid ="&intWarehouse&" and productid="&strItemsID(i)&"",conn,1,3
Response.Write(strItemsID(i))
if not (rsopbal.EOF and rsopbal.BOF) then
tottalqty=cdbl(rsinwards("inqty"))+cdbl(rsopbal("opstock"))-cdbl(rsoutwards("outqty"))
tottalamount=cdbl(rsinwards("inamount"))+cdbl(rsopbal("opvalue"))-cdbl(rsoutwards("outamount"))
else
Response.Write("else")
tottalqty=cdbl(rsinwards("inqty"))-cdbl(rsoutwards("outqty"))
tottalamount=cdbl(rsinwards("inamount"))-cdbl(rsoutwards("outamount"))
end if
Response.Write("product=>")
Response.Write(strItemsID(i))
Response.Write(" Total qty::")
Response.Write(tottalqty)
Response.Write(" Amount::")
Response.Write(tottalamount)
if (tottalamount=0 and tottalqty=0) then
'Response.Write(" Total Amount::")
'Response.Write(totalamount)
response.Write("
Out date for the product ")
set rspr=server.CreateObject("adodb.recordset")
rspr.open"select productid,product from [in-products] where productid="&strItemsID(i)&"",conn,1,3
response.Write(rspr("product"))
Response.Write(": ")
'response.Write(rspr("productid"))
rspr.close
response.Write(" is greater then purhcase date!")
response.End()
conn.rollbackTrans
else
pricepermt=tottalamount/tottalqty
end if
'pricepermt=tottalamount/tottalqty
finalamount=pricepermt*strQty(i)
rsGINDetails.AddNew
rsGINDetails.Fields("MatOutID") = intMatOutID
rsGINDetails.Fields("ProductID") = strItemsID(i)
rsGINDetails.Fields("Qty") = CDBl(strQty(i))
rsGINDetails.Fields("DeclQty") = declqty
rsGINDetails.Fields("Description") = strDesc(i)
rsGINDetails.Fields("EstAmt") = CDbl(pricepermt)
'added by sheetal [start]
'rsGINDetails.Fields("EstAmtUE") = USDValue(CDbl(strAmt(i)),intCurrency)
rsGINDetails.Fields("EstAmtUE") = CompExchRateValue(CDbl(pricepermt))
'[end]
'rsGINDetails.Fields("UnitID") = intWtUnit
rsGINDetails.Fields("UnitID") = wtUnit
rsGINDetails.Fields("CurrID") = intCurrency
rsGINDetails.Fields("CompID") = Session("CompID")
rsGINDetails.Fields("AddedOn") = Now()
rsGINDetails.Update
rsopbal.close
rsinwards.close
rsoutwards.close
Next
ElseIf Trim(strSaveMode) = "E" Then
For i = 0 to Ubound(strItemsID) - 1
rsinwards.open"select isnull(sum(qty),0) as inqty,isnull(sum(qty*puramt),0) as inamount from [in-matindetails] inner join [in-matin] on [in-matin].matinid=[in-matindetails].matinid and [in-matin].warehouseid ="&intWarehouse&" where [in-matin].compid="&intCompID&" and productid="&strItemsID(i)&" and [in-matin].indate<='"&strIssueDate&"' and [in-matin].posted=1",conn,1,3
rsoutwards.open"select isnull(sum(qty),0) as outqty,isnull(sum(qty*estamt),0) as outamount from [in-matoutdetails] inner join [in-matout] on [in-matout].matoutid=[in-matoutdetails].matoutid and [in-matout].warehouseid ="&intWarehouse&" where [in-matout].compid="&intCompID&" and productid="&strItemsID(i)&" and [in-matout].outdate<='"&strIssueDate&"' and [in-matout].posted=1",conn,1,3
rsopbal.open"select ISNULL(opstock,0) AS opstock,isnull(opvalue,0) as opvalue from [in-opstock] where compid="&intCompID&" and warehouseid ="&intWarehouse&" and productid="&strItemsID(i)&"",conn,1,3
tottalqty=cdbl(rsinwards("inqty"))+cdbl(rsopbal("opstock"))-cdbl(rsoutwards("outqty"))
tottalamount=cdbl(rsinwards("inamount"))+cdbl(rsopbal("opvalue"))-cdbl(rsoutwards("outamount"))
if (tottalamount=0 and tottalqty=0) then
response.Write("out date for the product ")
set rsprod=server.CreateObject("adodb.recordset")
rspr.open"select product from [in-products] where productid="&strItemsID(i)&"",conn,1,3
response.Write(rspr("product"))
rspr.close
response.Write(" is greater then purhcase date!")
response.End()
conn.rollbackTrans
else
pricepermt=tottalamount/tottalqty
end if
finalamount=pricepermt*strQty(i)
'-- If 0 then, Add the record
If strDetails(i) = 0 then
rsGINDetails.AddNew
Else
'-- Find the Details ID and Update the found record
rsGINDetails.Find "MatOutDetID=" & strDetails(i)
rsGINDetails.Fields("AddedOn") = Now()
End If
declqty=strQty(i)*intDeclWt/intNetWt
rsGINDetails.Fields("MatOutID") = rsGIN.Fields("MatOutID")
rsGINDetails.Fields("ProductID") = Trim(strItemsID(i))
rsGINDetails.Fields("Qty") = CDbl(strQty(i))
rsGINDetails.Fields("DeclQty") = declqty
rsGINDetails.Fields("Description") = strDesc(i)
rsGINDetails.Fields("EstAmt") = CDbl(pricepermt)
'added by sheetal [start]
'rsGINDetails.Fields("EstAmtUE") = USDValue(CDbl(strAmt(i)),intCurrency)
rsGINDetails.Fields("EstAmtUE") = CompExchRateValue(CDbl(pricepermt))
'[end]
'rsGINDetails.Fields("UnitID") = intWtUnit
rsGINDetails.Fields("UnitID") = wtUnit
rsGINDetails.Fields("CurrID") = intCurrency
rsGINDetails.Fields("CompID") = Session("CompID")
If Trim(strSaveMode) = "E" Then
rsGINDetails.Fields("LastModified") = Now()
End If
rsGINDetails.Update
rsopbal.close
rsinwards.close
rsoutwards.close
Next
'-- Delete records from Details table
If Trim(strDeletedRec) <> "" Then
conn.execute ("Delete From [IN-MatOutDetails] Where MatOutDetID In (" & strDeletedRec & ")")
if err.number<>0 then
conn.RollBackTrans
Response.Write "
"
Response.Write err.Description
Response.Write "
"
Response.End
end if
End If
end if
'-- Adding Expenses Part
If Trim(strSaveMode) = "A" Then
For i = 0 to ubound(strExpHeadID)-1
rsGINExpenses.AddNew
rsGINExpenses.Fields("MatOutID") = intMatOutID
rsGINExpenses.Fields("ExpAccHeadID") = strExpHeadID(i)
rsGINExpenses.Fields("PartySubAccID") = strPartyID(i)
rsGINExpenses.Fields("Amount") = CDbl(strValue(i))
'Added Sheetal[Start]
'rsGINExpenses.Fields("AmountUE") = USDValue(CDbl(strValue(i)),intCurrency)
rsGINExpenses.Fields("AmountUE") = CompExchRateValue(CDbl(strValue(i)))
'[End]
rsGINExpenses.Fields("CurrID") = Session("CurrID")
rsGINExpenses.Fields("CompID") = Session("CompID")
rsGINExpenses.Fields("AddedOn") = Now()
rsGINExpenses.Update
Next
ElseIf Trim(strSaveMode) = "E" Then
For i = 0 to Ubound(strExpHeadID) - 1
'-- If 0 then, Add the record
If strExpenses(i) = 0 then
rsGINExpenses.AddNew
Else
'-- Find the Expenses ID and Update the found record
rsGINExpenses.Find "MatOutExpID=" & strExpenses(i)
'rsGINExpenses.Fields("AddedOn") = Now()
End If
rsGINExpenses.Fields("MatOutID") = rsGIN.Fields("MatOutID")
rsGINExpenses.Fields("ExpAccHeadID") = strExpHeadID(i)
rsGINExpenses.Fields("PartySubAccID") = Trim(strPartyID(i))
rsGINExpenses.Fields("Amount") = CDbl(strValue(i))
'Added Sheetal[Start]
'rsGINExpenses.Fields("AmountUE") = USDValue(CDbl(strValue(i)),intCurrency)
rsGINExpenses.Fields("AmountUE") = CompExchRateValue(CDbl(strValue(i)))
'[End]
rsGINExpenses.Fields("CurrID") = Session("CurrID")
rsGINExpenses.Fields("CompID") = Session("CompID")
rsGINExpenses.Fields("AddedOn") = Now()
If Trim(strSaveMode) = "E" Then
rsGINExpenses.Fields("LastModified") = Now()
End If
rsGINExpenses.Update
Next
'-- Delete records from Details table
If Trim(strExpDeletedRec) <> "" Then
conn.execute ("Delete From [IN-MatOutExpense] Where MatOutExpID In (" & strExpDeletedRec & ")")
if err.number<>0 then
conn.RollBackTrans
Response.Write "
"
Response.Write err.Description
Response.Write "
"
Response.End
end if
End If
End If
'-- Added by Rajesh [Start]
rsCont.Fields("MatOutID") = intMatOutID
If Trim(strSaveMode) = "A" Then
rsCont.Fields("SerialNo") = strCTSerialNo
End If
rsCont.Fields("CurrID") = intCurrency
rsCont.Fields("ContainerNo") = strContainerNo
rsCont.Fields("TrailerNo") = strTrailerNo
rsCont.Fields("PreparedBy") = intPrepBy
rsCont.Fields("AuthorisedBy") = intAuthBy
rsCont.Fields("ContStatusID") = 1
rsCont.Fields("StatusDate") = strIssueDate
Set rsSum = Server.CreateObject("ADODB.Recordset")
rsSum.Open "Select Count(MatoutID) AS Noofitems, Sum(EstAmt) as TotalEstAmt, Sum(EstAmtUE) as TotalEstAmtUE " & _
" from [IN-MatOutDetails] where MatOutID=" & intMatOutID & " group by MatoutID",conn,1,3
If rsSum.Fields("Noofitems") <> 0 then
rsCont.Fields("NoOfProds") = rsSum.Fields("Noofitems")
rsCont.Fields("ProductCost") = rsSum.Fields("TotalEstAmt")
rsCont.Fields("ProductCostUE") = rsSum.Fields("TotalEstAmtUE")
Else
rsCont.Fields("NoOfProds") = 0
rsCont.Fields("ProductCost") = 0
rsCont.Fields("ProductCostUE") = 0
End if
rsSum.Close
rsCont.Update
intContTrackID = rsCont.Fields("ContTrackID")
'-- Adding Conttracking Details Part
rsContDetails.Fields("ContTrackID") = intContTrackID
rsContDetails.Fields("ContStatusID") = 1
rsContDetails.Fields("StatusDate") = strIssueDate
rsContDetails.Update
rsCont.Close
rsContDetails.Close
'-- Added by Rajesh [End]
rsGIN.Close
rsGINDetails.Close
Response.Write "
"
if err.number = 0 then
on error resume next
conn.BeginTrans
conn.commitTrans
If Request.QueryString("SaveMode") = "A" Then
Response.Write "Record Added Successfully" & "
"
set rssupp=server.CreateObject("adodb.recordset")
rssupp.open"select outno,outdate,containerno,warehouse,product,qty,estamt/qty as price,estamt,portname,shiplinename,MstContTypes.conttype,measurement from [IN-MAToutDETAILS] INNER JOIN [IN-MATout] on [in-matoutdetails].matoutid=[in-matout].matoutid inner join mstwarehouses on [in-matout].warehouseid=mstwarehouses.warehouseid inner join [in-products] on [in-matoutdetails].productid=[in-products].productid inner join mstports on [in-matout].portid=mstports.portid inner join [sh-shiplines] on [in-matout].shipname=[sh-shiplines].shiplineid inner join MstContTypes on MstContTypes.conttypeid=[in-matout].conttype where [in-matout].matoutid="&intMatOutID&"",conn,1,3
response.write("after qry")
if not (rssupp.EOF or rssupp.BOF) then
do until rssupp.EOF
response.Write("
"+cstr(rsSupp("qty"))+" MT "+rsSupp("product")+ " issued from " +rsSupp("warehouse")+" at the rate of "+cstr(rsSupp("price"))+" "+session("currency")+" amounting "+cstr(rsSupp("estamt"))+" "+session("currency")+" to the port "+rsSupp("portname")+"