<%@Language=VBScript %>
<!-- #include file = "connectOracle.asp" -->
<%if trim(session("UserName"))<>"" then%>
<%
Response.Buffer = true
SET con = server.CreateObject("adodb.connection")
con.open "DSN=VTSDSN;UID=vtsplop;PWD=vts@123"
set rs = server.CreateObject("adodb.recordset")
set rsdest=server.CreateObject("adodb.recordset")
rs.ActiveConnection = con
Set ORACON = server.CreateObject("adodb.connection")
ORACON.Open "Provider=MSDAORA.1;User ID=SAPVTS;password=VTSSAP;Data Source=prd;Persist Security Info=False"
tdate = date()
fdate = date()-1
VEHMOV=trim(request("VEHMOV"))
trans_code = session("UserName")
fail_reason=trim(Request("failreason"))
'Response.Write deldate
var_bussArea=trim(Session("Buss_Area"))
'Response.Write var_bussArea
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<title> Update Delivery Information </title>
</HEAD>
<BODY background="../Gifs/background.jpg">
<script language="javascript" src="date-picker1.js"></script>
<script language="javascript">
function svalidate()
{
if(document.frmupd_inv.CmdShow.value=="Enter")
{
//alert("HELLO")
window.location.href="invoiceDelvConfDate.asp?fdate="+document.frmupd_inv.txtFromDate.value+"&tdate="+document.frmupd_inv.txtToDate.value+"&VEHMOV="+document.frmupd_inv.VEHMOV.value+"&action="+document.frmupd_inv.CmdShow.value+"&finvdate="+document.frmupd_inv.txtFrominvDate.value+"&tinvdate="+document.frmupd_inv.txtToinvDate.value;
}
}
/*
function enable()
{
document.frminvoice.fail_reason.readonly = false ;
document.frminvoice.fail_reason.select();
document.frminvoice.fail_reason.focus();
} */
function cvalidate()
{
if (document.frminvoice.deldate.value=="")
{
alert("Invoice Date should not be blank...");
document.frminvoice.deldate.focus();
return false;
}
var pdate=document.frminvoice.pdate.value;
var ddate=document.frminvoice.deldate.value;
//var plandate = new Date(pdate);
//var deldate = new Date(ddate);
// alert(ddate);
//alert("pdate");
// alert(ddate);
// return false;
//(document.getElementById("fail_reason") ="")
//&& (document.frminvoice.fail_reason.value == "")
var fail_reason=document.getElementById("fail_reason");
if ((ddate > pdate) && (fail_reason.value == "") )
{
//alert("fail_reason")
fail_reason.disabled = false;
alert("Delivery Date Should not be Greater Than Plan Delivery Date \n If Greater Than Plan Delivery Date \n Enter the Failure Reason");
//document.frminvoice.fail_reason.readonly = false ;
//document.frminvoice.fail_reason.select();
//document.frminvoice.fail_reason.focus();
fail_reason.style.background ="#DDD";
fail_reason.focus();
return false;
}
return true;
}
function navigate()
{if (document.frmupd_inv.invno.value=="")
{
alert("Invoice Number should not be blank...");
document.frmupd_inv.invno.focus();
return false;
}
if (document.frmupd_inv.invno.value!="")
{
var invno
invno=document.frmupd_inv.invno.value;
if ((invno.indexOf("-",0)>0)||(invno.indexOf("/",0)>0)||(invno.indexOf("_",0)>0)||(invno.indexOf(",",0)>0))
{
alert("Special Cahracters like [ @, - ,_ ,/ ,\, & ] are not allowed..");
document.frmupd_inv.invno.focus();
document.frmupd_inv.invno.select();
return false;
}
}
window.location.href='invoiceDelvConf.asp';
return true;
}
function back()
{
window.location.href='http://eismis.tatasteel.co.in/webplop/vts/Entry Screen/TransEntry.asp'
return true;
}
</script>
<img src="../Gifs/vtslogo.jpg" width="100%">
<center>
<br>
<font size=4 color="brown" face="verdana"><b>Update Delivery Information</b></font>
<%
'Response.End
if request("Add")="" then %>
<br><br>
<form name="frmupd_inv" method="post" action="invoiceDelvConf.asp">
<TABLE Width="45%" border=0 ALIGN='CENTER'>
<TR><TD>
<TABLE border=0 width="70%" cellspacing=0 cellpadding=0 ALIGN='CENTER'>
<TH Colspan=4 Bgcolor="#6699ff"><font color = "white">
<font face="verdana" size=2 color = "white">Enter Invoice Number</font></TH>
<TR><TD align="left" width="50%" nowrap><b>
<font face="verdana" size=2 color = "brown"> Invoice Number </font></b></TD>
<TD><INPUT type="text" name="invno" maxlength=11></TD>
<TD align="right"><input type=submit name="Add" value="Enter" onclick="return navigate()" STYLE ='WIDTH:80PX'></TD>
</TR>
</TABLE><BR><BR>
<TABLE>
<TH Colspan=4 Bgcolor="#6699ff"><font color = "white">
<font face="verdana" size=2 color = "white">OR</font></TH>
<TR><TD align="left" width="50%" nowrap><b>
<font face="verdana" size=2 color = "brown"> Vechile Exit Date : </font></b></TD>
<td nowrap ><input type=text name = txtFromDate size=10 value=" ">
<a href="javascript:show_calendar('frmupd_inv.txtFromDate');">
<img src="show_calendar.gif" width=24 height=20 border=0></a>
<font face="verdana" size=2 color = "brown"><b> To </b></font></td>
<td nowrap><input type=text name = txtToDate size=10 value=" ">
<a href="javascript:show_calendar('frmupd_inv.txtToDate');">
<img src="show_calendar.gif" width=24 height=20 border=0></a>
<font face="verdana" size=2 color = "brown"><b>[YYYY-MM-DD]</b></font>
</TD>
</TR>
<TR><TD align="left" width="50%" nowrap><b>
<font face="verdana" size=2 color = "brown"> Invoice Date From: </font></b></TD>
<td nowrap ><input type=text name = txtFrominvDate size=10 value="<%Response.Write(fdate)%>">
<a href="javascript:show_calendar('frmupd_inv.txtFrominvDate');">
<img src="show_calendar.gif" width=24 height=20 border=0></a>
<font face="verdana" size=2 color = "brown"><b> To </b></font></td>
<td nowrap><input type=text name = txtToinvDate size=10 value="<%Response.Write(tdate)%>">
<a href="javascript:show_calendar('frmupd_inv.txtToinvDate');">
<img src="show_calendar.gif" width=24 height=20 border=0></a>
<font face="verdana" size=2 color = "brown"><b>[YYYY-MM-DD]</b></font>
</TD>
</TR>
<TR><TD align=left ><font face="verdana" size=2 color = "brown"><b> Vehicle Movement :</b></font></TD>
<td colspan='3'>
<select name="VEHMOV">
<option value="ALL">ALL</option>
<option value="INT">IN-TRANSIT</option>
</select>
<input type=button name="CmdShow" value="Enter" onclick="return svalidate()" STYLE ='WIDTH:80PX'>
<input type="button" name=cmdBack value="BACK" STYLE ='WIDTH:80PX' onclick="return back();">
</td>
</table>
<center><BR><BR>
<FONT face="Verdana" size=3 Color="brown"><b>
<% MSG=Request.QueryString("Msg1")
Response.Write(MSG)
%>
</b></Font></center>
</form>
<br><br><br><br>
</BODY>
</HTML>
<%
end if
if request("Add")="Enter" then
dim invno
invno=ucase(trim(request("invno")))
Sqltag = " select tsi_inside_tag from t_truck_sap_info where TSI_Invoice_no='" & invno & "'"
rs.open Sqltag,con
if not rs.eof then
tag=trim(rs("tsi_inside_tag"))
end if
rs.close
if trans_code="13136" then
sqlstr = " SELECT DISTINCT(TSI_Vehicle_reg_no),TSI_Entry_Time,TSI_Invoice_no,TSI_ZDO_STO_NO,TSI_INV_DATE,"
sqlstr = sqlstr & " UPPER(TSI_TRANS_NAME) TSI_TRANS_NAME,TSI_Cust_Name,TSI_Destination,TSI_PLANT_CD,"
sqlstr = sqlstr & " tsi_cust_delv_date,tsi_cust_delv_dt,tsi_destn_cd,TSI_TRANS_CD,TSI_GST_NO FROM t_truck_sap_info"
sqlstr = sqlstr & " WHERE tsi_trans_cd='0000013136'"
sqlstr = sqlstr & " and TSI_Invoice_no='" & invno & "'"
elseif tag = "N" then
sqlstr ="select distinct(TSI_Vehicle_reg_no),TSI_Entry_Time,TSI_Invoice_no,TSI_INV_DATE,"
sqlstr = sqlstr & "TRI_Exit_date,UPPER(TSI_TRANS_NAME) TSI_TRANS_NAME,TSI_Cust_Name,TSI_Destination,TSI_PLANT_CD,"
sqlstr = sqlstr & " tsi_cust_delv_date,tsi_cust_delv_dt,tsi_destn_cd,tri_vehicle_type,tri_buss_area,TSI_TRANS_CD,TSI_ZDO_STO_NO,TSI_GST_NO from t_truck_info,t_truck_sap_info"
sqlstr = sqlstr & " where tri_vehicle_reg_no = tsi_vehicle_reg_no "
sqlstr = sqlstr & " and TRI_Entry_Time = TSI_entry_time "
'sqlstr = sqlstr & " and TRI_ZDO_SDO_NO = TSI_ZDO_STO_NO "
sqlstr = sqlstr & " and tsi_inside_tag = 'N' and tri_inside_tag = 'N' "
sqlstr = sqlstr & " and isnull(tsi_frt_ind,'')<> 'T' "
sqlstr = sqlstr & " and TSI_Invoice_no='" & invno & "'"
sqlstr = sqlstr & " and right(rtrim(ltrim(tsi_trans_cd)),'" & len(trim(trans_code)) & "') = '"& trans_code &"'"
else
sqlstr ="select distinct(TSI_Vehicle_reg_no),TSI_Entry_Time,TSI_Invoice_no,TSI_INV_DATE,"
sqlstr = sqlstr & " UPPER(TSI_TRANS_NAME) TSI_TRANS_NAME,TSI_Cust_Name,TSI_Destination,TSI_PLANT_CD,"
sqlstr = sqlstr & " tsi_cust_delv_date,tsi_cust_delv_dt,tsi_destn_cd,TSI_TRANS_CD,TSI_ZDO_STO_NO,TSI_GST_NO from t_truck_sap_info"
sqlstr = sqlstr & " where TSI_Invoice_no='" & invno & "'"
sqlstr = sqlstr & " and isnull(tsi_frt_ind,'') <> 'T' "
sqlstr = sqlstr & " and right(rtrim(ltrim(tsi_trans_cd)),'" & len(trim(trans_code)) & "') = '"& trans_code &"'"
END IF
'Response.Write sqlstr
'Response.End
const abopenforwardonly = 0
const ablockreadonly = 1
const abuseclient =3
const abcmdtext =1
rs.CursorLocation = abuseclient
rs.open sqlstr,con,abopenforwardonly,ablockreadonly,abcmdtext
if rs.eof then
Response.Write "<br><br><br><br><br><br><br><br><br><center>" & "<font size=2 face=verdana color=red><B>"
Response.Write "Invoice Information Not Found Against Transporter Code - " &trans_code & "</B></font>"
Response.Write "</center><br><br>"
Response.Write "<center><input type=submit name=CmdBack value=Back onclick=history.go(-1);></center><br><br><br><br><br><br><br>"
else
%>
<%set RsPlant=con.Execute("Select distinct t_plant_desc from t_plant_info where t_plant_cd='" & trim(rs("TSI_PLANT_CD")) & "' ")
if not RsPlant.eof then
Plant_Desc=RsPlant(0)
else
Plant_Desc ="--"
end if
%>
<br><br>
<center>
<table border=1 width="100%" cellspacing=0 cellpadding=0>
<tr BGCOLOR="#6699ff" STYLE="COLOR:WHITE">
<th>Vehicle Number</th><th>Works Entry Date</th>
<th>Works Exit Date</th><th>Invoice No.</th>
<th>Invoice Date</th><th>Plan Delivery Date</th><th>Plant</th>
<th>Transporter Name</th>
<th>Customer Name</th><th>Destination</th><th>Unique GST-No</th>
<% while not rs.EOF
if tag = "N" then
PLAN_DEL_DT = rs("TRI_Exit_date")
else
PLAN_DEL_DT =rs("Tsi_inv_date")
end if
dest_desc = trim(rs("TSI_Destination"))
if trans_code<> "13136" then
'***************** Change By Abhishek Priyadarshi checking data found in truck info start (3-feb-2010)
IF tag = "N" then '***************** checking data found in truck info start
VEHICLE_type= trim(rs.Fields("tri_vehicle_type"))
if VEHICLE_type = "Trailor" then
veh_type ="CATA"
else
veh_type ="CATB"
end if
ELSE
veh_type ="CATB"
END IF'***************** checking data found in truck info End
'***************** Change By Abhishek Priyadarshi checking data found in truck info End3-feb-2010)
'Response.Write veh_type
'***************** Change By Abhishek Priyadarshi checking data found in truck info start (3-feb-2010)
IF tag = "N" then '***************** checking data found in truck info start
if trim(rs("tri_buss_area")) ="TATASTEEL" then
SQL = " SELECT MAXDAYS "
SQL = SQL & "FROM YMT_ROAD_FREIGHT t "
SQL = SQL & "WHERE WERKS='9000' "
SQL = SQL & "AND CITYC='" & trim(rs.Fields("tsi_destn_cd")) & "' "
if trans_code<>"13136" then
SQL = SQL & "AND TRATY='" & veh_type & "' "
end if
SQL = SQL & "AND DOCDATE= "
SQL = SQL & "(SELECT MAX(DOCDATE) FROM YMT_ROAD_FREIGHT "
SQL = SQL & "WHERE WERKS = t.WERKS "
SQL = SQL & "AND CITYC=t.CITYC "
SQL = SQL & "AND TRATY=t.TRATY) "
ELSE
SQL_d = " SELECT DISTINCT b.CITYC,MCOD3 "
SQL_d = SQL_d & " FROM sapr3.vbpa a,SAPR3.KNA1 b"
SQL_d = SQL_d & " WHERE a.mandt = '600'"
SQL_d = SQL_d & " AND b.mandt = '600'"
SQL_d = SQL_d & " AND a.vbeln = '" & trim(rs("TSI_ZDO_STO_NO")) & "'"
SQL_d = SQL_d & " AND a.PARVW = 'WE'"
SQL_d = SQL_d & " AND a.kunnr = b.kunnr"
rsdest.Open SQL_d,ORACON
'Response.Write SQL_d
'Response.End
if not rsdest.EOF then
dest_cd = trim(rsdest(0))
dest_desc = trim(rsdest(1))
else
SQL = " select distinct c.cityc, D.BEZEI "
SQL = SQL & " from sapr3.lips a, "
SQL = SQL & " SAPR3.LIKP b, "
SQL = SQL & " sapr3.kna1 c, "
SQL = SQL & " SAPR3.T005H d "
SQL = SQL & " where a.mandt = '600' "
SQL = SQL & " and b.mandt = '600' "
SQL = SQL & " and c.mandt = '600' "
SQL = SQL & " and d.mandt = '600' "
SQL = SQL & " and A.VBELN = b.vbeln "
SQL = SQL & " and b.kunnr = c.kunnr "
SQL = SQL & " and d.cityc = c.cityc "
SQL = SQL & " and a.vgbel = '" & trim(rs("TSI_ZDO_STO_NO")) & "'"
set rs_sto = ORACON.Execute(SQL)
if not rs_sto.eof then
dest_cd = trim(rs_sto(0))
dest_desc = trim(rs_sto(1))
end if
rs_sto.close
end if
rsdest.close
if trim(rs("tsi_plant_cd")) = "3486" then
plant_cd = "2220"
elseif trim(rs("tsi_plant_cd")) = "1404" then
plant_cd = "4124"
elseif trim(rs("tsi_plant_cd")) = "3647" then
plant_cd = "1210"
elseif trim(rs("tsi_plant_cd")) = "3966" then
plant_cd = "4310"
elseif trim(rs("tsi_plant_cd")) = "0819" then
plant_cd = "4210"
elseif trim(rs("tsi_plant_cd")) = "2251" then
plant_cd = "3120"
elseif trim(rs("tsi_plant_cd")) = "3962" then
plant_cd = "2110"
else
plant_cd = trim(rs("tsi_plant_cd"))
end if
SQL = " SELECT MAXDAYS "
SQL = SQL & "FROM YMT_ROAD_FREIGHT t "
SQL = SQL & "WHERE WERKS='" & plant_cd & "' "
SQL = SQL & "AND CITYC='" & trim(rs.Fields("tsi_destn_cd")) & "' "
SQL = SQL & "AND TRATY='" & veh_type & "' "
SQL = SQL & "AND DOCDATE= "
SQL = SQL & "(SELECT MAX(DOCDATE) FROM YMT_ROAD_FREIGHT "
SQL = SQL & "WHERE WERKS = t.WERKS "
SQL = SQL & "AND CITYC=t.CITYC "
SQL = SQL & "AND TRATY=t.TRATY) "
END IF
ELSE
SQL = " SELECT MAXDAYS "
SQL = SQL & "FROM YMT_ROAD_FREIGHT t "
SQL = SQL & "WHERE WERKS='9000' "
SQL = SQL & "AND CITYC='" & trim(rs.Fields("tsi_destn_cd")) & "' "
SQL = SQL & "AND TRATY='" & veh_type & "' "
SQL = SQL & "AND DOCDATE= "
SQL = SQL & "(SELECT MAX(DOCDATE) FROM YMT_ROAD_FREIGHT "
SQL = SQL & "WHERE WERKS = t.WERKS "
SQL = SQL & "AND CITYC=t.CITYC "
SQL = SQL & "AND TRATY=t.TRATY) "
END IF'***************** checking data found in truck info End
'***************** Change By Abhishek Priyadarshi checking data found in truck info End (3-feb-2010)
set rs1=conOra.execute (SQL)
if not rs1.eof then
TRANSIT_DAY = TRIM(RS1(0))
end if
end if
if trans_code = "13136" then
TRANSIT_DAY =7
end if
'Response.Write SQL
PLAN_DELIVERY_DATE = dateadd("d",cint(TRANSIT_DAY),cdate(PLAN_DEL_DT))
%>
<TR><TD NOWRAP align="middle"><font color="red"><tt><%=rs("TSI_Vehicle_reg_no")%></tt></font></TD>
<%if trans_code="13136" then%>
<TD NOWRAP align="LEFT"><tt><%=rs("Tsi_inv_date")%></tt></td>
<%elseif tag = "N" then%>
<TD NOWRAP align="middle"><tt><%=mid(rs("TSI_Entry_Time"),1,10)%></tt></TD>
<%else%>
<TD NOWRAP align="middle"><tt>Not Entered</tt></TD>
<%end if%>
<%if trans_code="13136" then%>
<TD NOWRAP align="LEFT"><tt><%=rs("Tsi_inv_date")%></tt></td>
<%elseif tag = "N" then%>
<TD NOWRAP align="LEFT"><tt><%=rs("TRI_Exit_date")%></tt></td>
<%else%>
<TD NOWRAP align="LEFT"><tt>Not Exited</tt></td>
<%end if%>
<TD NOWRAP align="middle"><tt><%=rs("TSI_Invoice_no")%></tt></TD>
<TD NOWRAP align="middle"><tt><%=rs("TSI_INV_DATE")%></tt></TD>
<TD NOWRAP align="middle"><tt><%=PLAN_DELIVERY_DATE%></tt></TD>
<TD NOWRAP align="middle"><tt><%=Plant_Desc%></tt></TD>
<TD NOWRAP align="middle"><tt><%=rs("TSI_TRANS_NAME")%></tt></TD>
<TD NOWRAP align="middle"><tt><%=rs("TSI_Cust_Name")%></tt></TD>
<TD NOWRAP align="middle"><tt><%=dest_desc%></tt></TD>
<TD NOWRAP align="middle"><tt><%=rs("TSI_GST_NO")%></tt></TD>
</TR>
<TR><TD>
<INPUT type="hidden" size=12 name="invno" value=<%=rs("TSI_Invoice_no")%>></td>
<%if trans_code="13136" then%>
<td><INPUT type="hidden" size=12 name="exitdt" value=<%=rs("Tsi_inv_date")%>>
<%elseif tag = "N" then%>
<td><INPUT type="hidden" size=12 name="exitdt" value=<%=rs("TRI_Exit_date")%>>
<%else%>
<td><INPUT type="hidden" size=12 name="exitdt" value=<%=rs("Tsi_inv_date")%>>
<%end if%>
</TD>
</TR>
<%invno=trim(rs("TSI_Invoice_no"))%>
<%if trans_code="13136" then
exitdate=rs("Tsi_inv_date")
elseif tag = "N" then
exitdate=rs("TRI_Exit_date")
else
exitdate =rs("Tsi_inv_date")
end if %>
<%plandt = rs("tsi_cust_delv_dt")
tmpdt=trim(rs("tsi_cust_delv_date"))
trans_nm = trim(rs("TSI_TRANS_NAME"))
trans_cd = trim(rs("TSI_TRANS_CD"))
'Response.Write trans_nm
rs.MoveNext
'Response.Write trans_nm
'Response.end
wend
%>
</table>
<br>
<form name="frminvoice" method="post" action="invoiceDelvConf.asp">
<%fail_reason = trim(Request.Form("fail_reason"))
SQL = " select TDD_Delay_Reason from TRANS_DELIVERY_DETAIL "
SQL = SQL & " where TDD_Invoice_no ='" & invno & "' "
SQL = SQL & " and TDD_Transporter_Code ='" & trans_cd & "' "
'Response.Write SQL
SET RS_REA = con.Execute (SQL)
IF NOT RS_REA.EOF THEN
fail_reason= TRIM(RS_REA("TDD_DELAY_REASON"))
END IF
' Response.Write fail_reason
RS_REA.CLOSE%>
<tr>
<td colspan=30% align=right><font face="verdana" color=brown size=3><b>Failure Reason :</b></td>
<td colspan=70%>
<TEXTAREA style="WIDTH: 400px; HEIGHT: 40px" name="fail_reason" id="fail_reason" value="<%=fail_reason%>" cols=39 disabled><%=fail_reason%></TEXTAREA></td>
</tr>
<br><br>
<TABLE Width="45%" border=0>
<TR><TD>
<TABLE border=1 width="70%" cellspacing=0 cellpadding=0 align='center'>
<TH Colspan=2 Bgcolor="#6699ff"><font color = "white">
<font face="verdana" size=2 color = "white">Enter Delivery Date to Customer</font></TH>
<TR><TD align="left" width="50%" nowrap><b>
<font face="verdana" size=2 color = "brown"> Delivery Date to Customer </font></b></TD>
<% 'if not IsNull(rs("tsi_cust_delv_date")) then
if not IsNull(tmpdt) then%>
<%
'tmpdt=cdate(trim(rs("tsi_cust_delv_date")))
mnth=month(tmpdt)
yr=year(tmpdt)
dat=day(tmpdt)
if cint(mnth) < 10 then mnth="0" & mnth
if cint(yr) < 10 then yr="0" & yr
if cint(dat) < 10 then dat="0" & dat
%>
<TD nowrap><INPUT type="text" size=12 name="deldate" value=<%=yr & "-" & mnth & "-" & dat%>>
<a href="javascript:show_calendar('frminvoice.deldate');">
<img src="show_calendar.gif" width=24 height=20 border=0></a>
<font face="verdana" size=2 color = "brown"><b>MM/DD/YYYY</b></font>
</td>
<%
else
'tmpdt=cdate(trim(rs("tsi_cust_delv_date")))
mnth=month(date)
yr=year(date)
dat=day(date)
if cint(mnth) < 10 then mnth="0" & mnth
if cint(yr) < 10 then yr="0" & yr
if cint(dat) < 10 then dat="0" & dat
%>
<TD nowrap>
<INPUT type="text" size=12 name="deldate" value=<%=yr & "-" & mnth & "-" & dat%>>
<a href="javascript:show_calendar('frminvoice.deldate');">
<img src="show_calendar.gif" width=24 height=20 border=0></a>
<font face="verdana" size=1 color = "brown"><b>YYYY-MM-DD</b> </font>
</TD>
<%end if%>
</TR>
<TR><TD><INPUT type="hidden" size=12 name="invno" value=<%=Invno%>></td>
<td><INPUT type="hidden" size=12 name="exitdt" value=<%=exitdate%>></TD>
<td><INPUT type="hidden" size=12 name="pdate" value=<%=PLAN_DELIVERY_DATE%>></td>
<td><INPUT type="hidden" name="trans_nm" value="<%=trans_nm%>" /></td>
<td><INPUT type="hidden" name="trans_cd" value="<%=trans_cd%>" /></td>
</TR>
</table>
</tr></td>
</table><br>
<% 'if not IsNull(rs("tsi_cust_delv_date")) then
if not IsNull(tmpdt) then
Response.Write "<center>" & "<font size=2 face=verdana color=red><B>"
Response.Write "Delivery Date was Already Updated, Do You Want to update ?" & "</B></font>"
Response.Write "</center>"
else
Response.Write "<center>" & "<font size=2 face=verdana color=GREEN><B>"
Response.Write "Delivery Date has not been updated yet Do You Want to update ?" & "</B></font>"
Response.Write "</center>"
end if
%>
<table border=0 width="30%">
<tr><td><br></td></tr>
<tr>
<td><input type=submit name="confirm" value="Confirm" onclick="return cvalidate()" STYLE ='WIDTH:80PX'></td>
<td align=middle><input type=button name="cancel" value="Cancel" onclick="history.go(-1);" STYLE ='WIDTH:80PX'></td>
</tr>
</table>
</FORM><br><br>
</center>
<%
end if
rs.Close
end if
if request("confirm")="Confirm" then
invno=ucase(trim(request("invno")))
tdate=cdate(trim(request("exitdt")))
fdate=cdate(trim(request("deldate")))
pdate = CDATE(trim(request("pdate")))
fail_reason = trim(Request("fail_reason"))
trans_nm = trim(Request("trans_nm"))
trans_cd = trim(Request("trans_cd"))
'Response.Write fdate
'Response.End
if fdate<tdate then Response.Redirect "invoiceDelvConf.asp?flag=7"
if (cdate(request("deldate"))<=date) and (cdate(request("deldate"))>=cdate(REQUEST("exitdt"))) then
if ( cdate(request("deldate")) > CDATE(request("pdate")) ) THEN
if fail_reason ="" then
Response.Write("<script>alert('Pls Enter Failure Reason for "& invno &"');")
Response.Write ("history.back(-1);</script>")
Response.End
'fail_reason ="Not filled up by transporter"
end if
sql_insert = "insert into TRANS_DELIVERY_DETAIL values ('" & trans_cd &"','" & trans_nm &"','" & invno &"' , '" & pdate &"','" &request("deldate")& "' ,'" & fail_reason & "')"
'Response.Write sql_insert
'Response.end
con.Execute sql_insert
end if
sqlstr="update t_truck_sap_info set tsi_cust_delv_date='" & request("deldate") & "',"
sqlstr= sqlstr & " tsi_cust_delv_entry_time='" & date() & "',TSI_USERID='" & session("UserName")&"', TSI_IP_ADD='" & trim(session("ipaddress")) & "' where TSI_Invoice_no='" & invno &"'"
'Response.Write sqlstr
'Response.End
dim recs
recs=0
con.Execute sqlstr,recs
if recs >= 1 then
Response.Redirect "invoiceDelvConf.asp?flag=1"
else
Response.Redirect "invoiceDelvConf.asp?flag=5"
end if
else
Response.Write "<script>"
Response.Write "alert('Please check the Customer delivery date it is \n either greater than current date \n or less than invoice date.')"
Response.Write "</script>"
end if
end if
if trim(request("flag")) = "1" then
Response.Write "<script>"
Response.Write "alert('Delivey Date Updated')"
Response.Write "</script>"
end if
if trim(request("flag")) = "5" then
Response.Write "<script>"
Response.Write "alert('Delivey Date Not Updated')"
Response.Write "</script>"
end if
if trim(request("flag")) = "7" then
Response.Write "<script>"
Response.Write "alert('Delivey Date Should be Greater than Plant Exit Date')"
Response.Write "</script>"
end if
%>
<%else
Response.Redirect("sessionErr.htm")%>
<%end if%>
sraj44 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.