home *** CD-ROM | disk | FTP | other *** search
- <%@page import="com.pp.*"%>
- <%@page import="java.util.Date,java.io.*"%>
- <%@page import="java.util.*"%>
- <jsp:useBean id="database" class="com.gil.baanservice.Database" >
- </jsp:useBean>
- <%
- String comp="";
- String lUser = "";
- try{
- lUser = (String)session.getValue("username");
- }catch(Throwable e){}
- if (lUser == null) lUser = "GITL";
- try{
- comp =(String)session.getValue("company");
- }catch(Throwable e){}
- if (comp == null) comp = "309";
-
- String mode="";
- String sql = "";
- boolean val = false;
- boolean val1 = false;
- boolean val2 = false;
- boolean val3 = false;
- boolean val4 = false;
- boolean val5 = false;
- boolean val6 = false;
- boolean val7 = false;
- boolean val8 = false;
- boolean val9 = false;
- boolean val59 = false;
- %>
- <%
- String table1 = "";
-
- if (comp.equals("779"))
- {
- table1 = "dealers"+comp;
- }else
- {
- table1 = "dealers";
- }
-
- %>
-
- <%
-
- String deal = "";
- String dsca = "";
- String locn = "";
- String telp = "";
- String telx = "";
- String psts = "";
- %>
- <%
- String option = "";
- String updateparam = "";
- %>
- <%
- int i = 0;
- int len = 0;
- %>
-
-
- <%
- String temp = "";
- int sz = 0;
- %>
-
- <%
- String zoom = request.getParameter("zoom");
- if (zoom == null) zoom = "False";
- String zoomtarget = request.getParameter("zoomtarget");
- if (zoomtarget == null) zoomtarget = "";
- String cmd = request.getParameter("cmd");
- if (cmd == null) cmd = "";
- int ret = -1;
-
- Calendar calendar = Calendar.getInstance();
- String year = ""+calendar.get(Calendar.YEAR);
- String month = ""+(calendar.get(Calendar.MONTH)+1);
- if (month.length() < 2) month = "0"+month;
- String day = "" + calendar.get(Calendar.DAY_OF_MONTH);
- if (day.length() < 2) day= "0"+day;
- String currdate = day+"/"+month+"/"+year;
- String hour = ""+calendar.get(Calendar.HOUR_OF_DAY);
- if (hour.length() < 2) hour= "0"+hour;
- String mins = ""+calendar.get(Calendar.MINUTE);
- if (mins.length() < 2) mins= "0"+mins;
- String currtime = hour+mins;
- String yyyymmdd = year+""+month+""+day;
- %>
- <%
- //***************** Get Values From Form
- deal = request.getParameter("deal");
- if (deal == null) deal = "";
- dsca = request.getParameter("dsca");
- if (dsca == null) dsca = "";
- locn = request.getParameter("locn");
- if (locn == null) locn = "";
- telp = request.getParameter("telp");
- if (telp == null) telp = "";
- telx = request.getParameter("telx");
- if (telx == null) telx = "";
- psts = request.getParameter("psts");
- if (psts == null) psts = "";
-
- updateparam = request.getParameter("updateparam");
- if (updateparam == null) updateparam = "";
-
- option = request.getParameter("option");
- if (option == null) option = "";
- %>
- <%@ include file="include\Header.inc" %>
- <%
- if (option.equals("Update"))
- {
- try {
- sql = "";
-
- sql = "update "+table1+" set dsca='"+dsca.trim()+"', locn='"+locn.trim()+"', telp='"+telp.trim()+"',telx='"+telx.trim()+"', psts="+psts+" where ltrim(rtrim(deal))='"+deal.trim()+"'";
-
- // out.println(sql);
-
- val = database.execute(sql);
-
- } catch (Exception e){}
- option = "Show";
- if (val)
- {
- %>
- <table border="0" cellpadding="0" cellspacing="0" width="90%">
- <tr><td colspan="6" class=tdMessage> UPDATED SUCCESSFULLY</td></tr>
- </table>
- <%
- }
- else
- {
- %>
- <table border="0" cellpadding="0" cellspacing="0" width="90%">
- <tr>
- <td colspan="2" class=tdError> Error in Update
- </td>
- </tr>
- </table>
- <%
- }
- }
- %>
-
- <%
- if ( option.equals("Show")) {
- try {
-
- Hashtable[] rs1 = database.fetch("select top 1 * from "+table1+" where ltrim(rtrim(deal)) = '" +updateparam.trim()+"'");
-
- if(rs1 == null)
- {
- %>
- <table width='90%'><tr><td class=tdError>No Rows Found.</td></tr></table>
- <%}
- else
- {
- deal = rs1[0].get("deal").toString().trim();
- dsca = rs1[0].get("dsca").toString().trim();
- locn = rs1[0].get("locn").toString().trim();
- telp = rs1[0].get("telp").toString().trim();
- telx = rs1[0].get("telx").toString().trim();
- psts = rs1[0].get("psts").toString().trim();
- }
- } catch (Exception e)
- {
- %>
- <table width='90%'><tr><td class=tdError><%=e%></td></tr></table>
- <%
- }
- }
- %>
-
- <table border="0" cellpadding="0" cellspacing="0" width="780">
- <script>
- function isSpace(strCheck) {
- var isBlank = true;
- var ch = "";
- if (strCheck.length != 0) {
- // alert(strCheck.length);
- for (var i = 0; i < strCheck.length ; i++) {
- ch = strCheck.substring(i,i+1);
- if (ch != " ") isBlank = false;
- }
- }
- return isBlank;
- }
- function isNull(){
- if(eval(document.addform.cinsf.value=="")) {
- alert("Enter Installation")
- return false;
- }
- return true;
- }
-
- function OpenLook() {
- if (isNull())
- {
- var isCalled ="Y";
- zoomWindowx = window.open("updateSsma1123b.jsp?cinsf="+document.addform.cinsf.value+"&isCalled="+isCalled,"zoomWindowx","toolbar=no,scrollbars=yes");
- zoomWindowx.focus();
- }
-
- }
- function OpenLookUp(fieldName, programName) {
- if (programName == 'updateSsma1102b.jsp'){
- zoomWin = window.open(""+programName+"?updateparam="+fieldName,"zoomWin","toolbar=no,scrollbars=yes");
- zoomWin.focus();
- } else if (fieldName == "cloc") {
- zoomWindowy = window.open(""+programName+"?elementName="+fieldName+"&calledFrom=1102&locVal="+document.addform.cloc.value,"zoomWindowy","toolbar=no,scrollbars=yes");
- zoomWindowy.focus();
- } else {
- zoomWindowy = window.open(""+programName+"?elementName="+fieldName,"zoomWindowy","toolbar=no,scrollbars=yes");
- zoomWindowy.focus();
- }
- }
-
-
- function OpenLookUp1(fieldName,programName) {
-
- zoomWindow = window.open(""+programName+"?elementName="+fieldName,"zoomWindow","toolbar=no,scrollbars=yes");
- zoomWindow.focus();
-
- }
-
- function OpenLookUp2(fieldName,programName) {
-
- zoomWindow = window.open(""+programName+"?option=show&elementName=cins&clocf="+document.addform.cloc.value,"zoomWindow","toolbar=no,scrollbars=yes");
- zoomWindow.focus();
-
- }
-
-
- function OpenLookUp4(fieldName,programName) {
-
- zoomWindow = window.open(""+programName+"?elementName="+fieldName+"&calledFrom=dealers","zoomWindow","toolbar=no,scrollbars=yes");
- zoomWindow.focus();
-
- }
-
- function isdigit()
- {
- if(isNaN(document.addform.pstc.value))
- {
- alert("Digit Expected");document.addform.pstc.focus();
- return
- }
- getordertype()
- }
-
- function toUpper()
- {
- document.addform.updateparam.value = document.addform.updateparam.value.toUpperCase();
- }
-
- function toUpper1()
- {
- document.addform.dsca.value = document.addform.dsca.value.toUpperCase();
- document.addform.locn.value = document.addform.locn.value.toUpperCase();
- }
-
- function calldelete()
- {
- temp = window.confirm("Delete Installation "+addform.deal.value+", Are You Sure ?")
- if (temp){
- addform.option.value='Delete'
- addform.submit()
- }
- }
-
- function callupdate()
- {
- // if(!errfound) {
- document.addform.option.value='Update';
- document.addform.submit()
- // }
- }
-
- function callshow()
- {
- addform.option.value='Show'
- addform.submit()
- }
-
- function validdates()
- {
- if (isDate(document.addform.ddt2_dd.value,document.addform.ddt2_mm.value,document.addform.ddt2_yy.value)) {
- document.addform.ddt2_dd.value = document.addform.tempdate.value.substring(0,2)
- document.addform.ddt2_mm.value = document.addform.tempdate.value.substring(3,5)
- document.addform.ddt2_yy.value = document.addform.tempdate.value.substring(6,10)
- document.addform.ddt2.value = document.addform.tempdate.value
- } else {
- alert("Invalid Appointment Date")
- document.addform.ddt2_dd.focus()
- return false;
- }
-
- return true;
- }
-
- function isDate(dd , mm, yy)
- {
- document.addform.tempdate.value="" ;
- if (dd=="" && mm=="" && yy=="") return true;
- var day = parseInt(dd, 10);
- var month = parseInt(mm, 10);
- /*******************/
- //var year1 = yy.substring(2,4);
- /*******************/
- var year = parseInt(yy, 10);
- var date = new Date();
- if ((yy.length != 2)&&(yy.length != 4)) return false;
- if (((isNaN(day))||(isNaN(month)))||(isNaN(year))) return false;
- if ((day < 1)||(day > 31)) return false;
- if ((month < 1)||(month > 12)) return false;
- if (((((month == 4)||(month == 6))||(month == 9))||(month == 11))&&(day > 30)) return false;
- if (year < 100){
- if (year < 61) year = 2000 + year
- else year = 1900 + year
- }
- date.setDate(day); date.setMonth(month); date.setYear(year);
- if (month == 2) {
- if (((year % 4 == 0)&&(year % 100 != 0))||(year % 400 == 0))
- {if (day > 29) return false;}
- else
- {if (day > 28) return false;}
- }
- if (dd.length < 2) dd="0"+dd
- if (mm.length < 2) mm="0"+mm
- document.addform.tempdate.value = dd+"/"+mm+"/"+year
- //document.addform.tempdate.value = dd+mm+year
- //alert(document.addform.tempdate.value);
- return true;
- }
-
- </script>
-
- <form method="post" action="updateDealers.jsp" name="addform">
- <input type="hidden" name="option" value="">
- <input type="hidden" name="cmd" value="">
- <input type="hidden" name="tempdate">
- <tr>
- <td valign="middle" align="center">
- <table border="0" cellpadding="0" cellspacing="1" width="100%">
- <tr><td class=tdHeading>Dealer</td>
- <td class=tdInput colspan='5'>
- <input class=Inputs type='text' name='updateparam' size=10 maxlength=6 value="<%=updateparam%>" onblur="toUpper()" tabindex=1 ></input>
-
- <a href="javascript:OpenLookUp4('updateparam','listDealers.jsp');" tabindex=2>
- <img border='0' src='gif/arrow.gif' width='14' height='14' valign='middle'></a>
-
- <a href="javascript:callshow();" tabindex=3 >
- <img border="0" src="gif/go.gif" width="30" height="24"></a>
- </td></tr>
- <tr>
- <td class=tableHeading colspan="6">
- UPDATE DEALERS
- <br>
- </td>
- </tr>
- <%
- if (!deal.equals("") && option.equals("Show")) {
- %>
-
- <tr>
- <td class=tdHeading>Dealer</td>
- <td class=tdInput>
- <%=updateparam%>
- <input type="hidden" name='deal' value='<%=deal%>'>
- </td>
- </tr>
- <tr>
- <td class=tdHeading>Dealer Name</td>
- <td class=tdInput>
- <input class=Inputs type='text' name='dsca' size=30 maxlength=30 tabindex=4 value="<%=dsca%>" onblur="toUpper1()"></input>
- </td>
- </tr>
- <tr>
- <td class=tdHeading>Location Desc.</td>
- <td class=tdInput>
- <input class=Inputs type='text' name='locn' size=30 maxlength=30 tabindex=5 value="<%=locn%>" onblur="toUpper1()"></input>
- </td>
- </tr>
- <tr>
- <td class=tdHeading>Telephone </td>
- <td class=tdInput>
- <input class=Inputs type='text' name='telp' size=10 maxlength=8 tabindex=6 value="<%=telp%>"></input>
- </td>
- </tr>
- <tr>
- <td class=tdHeading>Mobile</td>
- <td class=tdInput>
- <input class=Inputs type='text' name='telx' size=15 maxlength=10 tabindex=7 value="<%=telx%>"></input>
- </td>
- </tr>
- <tr>
- <td class=tdHeading>Dealer Status</td>
- <td class=tdInput>
- <select name='psts' size='1' tabindex=8>
- <option value='1'>Active</option>
- <option value='2'>Inactive</option>
- </select>
- </td>
- </tr>
- <script>
- document.addform.psts.value = '<%=psts%>'
- </script>
- <script>
- if(document.addform.psts.value == '')
- document.addform.psts.value = '1'
- </script>
- <tr>
-
- <td bgcolor="#FFFFFF" valign="bottom" align="center" colspan="2">
- <a href = "javascript:callupdate()" tabindex=9 >
- <img border="0" src="gif/save.gif" width="46" height="25"></img>
- </a>
- </td>
- <td>
- <a href = "javascript:calldelete()" tabindex=10>
- Delete
- </a>
- </td>
- </tr>
-
- <%
- }
- else
- {
- if (option.equals("Show")) {
- %>
- <table width='90%'><tr><td class=tdError>Dealer Not Found</td></tr></table>
- <%
- }
- }
- %>
- </table>
- </td>
- </tr>
- </table>
- </form>
- </html>
-