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 table1 = "";
-
- if (comp.equals("779"))
- {
- table1 = "dealers"+comp;
- }else
- {
- table1 = "dealers";
- }
-
- %>
- <%
-
- String deal = "";
- String dsca = "";
- String locn = "";
- String telp = "";
- String telx = "";
- String psts = "";
-
- String updateparam = "";
- String updateflag = "";
- String option = "";
-
- String sql = "";
-
- 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;
-
- %>
- <%
- //***************** 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" %>
-
- <%
- /* code start for text field */
- String lflname = "" + lUser;
- /* code end for text field */
- %>
- <table border="0" cellpadding="0" cellspacing="0" width="780">
- <script>
- function calladd()
- {
- document.addform.option.value='Add';
- document.addform.submit()
- }
-
-
- function toUpper()
- {
- document.addform.deal.value = document.addform.deal.value.toUpperCase();
- document.addform.dsca.value = document.addform.dsca.value.toUpperCase();
- document.addform.locn.value = document.addform.locn.value.toUpperCase();
- }
-
-
- 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="addDealers.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="90%">
- <tr>
- <td class=tableHeading colspan="4">
- Maintain Dealers
- <br>
- </td>
- </tr>
- <tr>
- <td class=tdHeading>Dealer</td>
- <td class=tdInput>
- <input class=Inputs type='text' name='deal' size=10 maxlength=6 tabindex=1 value="<%=deal%>" onblur="toUpper()"></input>
- </td>
- </tr>
- <tr>
- <td class=tdHeading>Dealer Name</td>
- <td class=tdInput>
- <input class=Inputs type='text' name='dsca' size=30 maxlength=30 tabindex=2 value="<%=dsca%>" onblur="toUpper()"></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=3 value="<%=locn%>" onblur="toUpper()"></input>
- </td>
- </tr>
- <tr>
- <td class=tdHeading>Telephone </td>
- <td class=tdInput>
- <input class=Inputs type='text' name='telp' size=10 maxlength=8 tabindex=4 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=5 value="<%=telx%>"></input>
- </td>
- </tr>
- <tr>
- <td class=tdHeading>Project Status</td>
- <td class=tdInput>
- <select name='psts' size='1' tabindex=6>
- <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:calladd();" tabindex = 7>
- <img border="0" src="gif/save.gif" width="46" height="25"></img>
- </a>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
-
- <%
- option = request.getParameter("option");
- if (option == null) option = "";
- if (option!=null && option.equals("Add"))
- {
- boolean val=false;
- boolean val1=false;
-
- try {
-
- sql = "";
-
- sql = "insert into "+table1+" values ('"+deal+"','"+dsca+"','"+locn+"','"+telp+"','"+telx+"', '"+psts+"')";
-
- val = database.execute(sql);
-
- } catch (Exception e){}
- if (val)
- {
- %>
- <table border="0" cellpadding="0" cellspacing="0" width="90%">
- <tr><td colspan="6" class=tdMessage> ADDED SUCCESSFULLY</td></tr>
- </table>
- <%
- }
- else
- {
- %>
- <table border="0" cellpadding="0" cellspacing="0" width="90%">
- <tr>
- <td colspan="2" class=tdError> Error in Add </b>
- </td>
- </tr>
- </table>
- <%
- }
- }
-
-
- %>
-
- </html>
-