Thread: [Servsys-svn] SF.net SVN: servsys: [113] trunk/servsys
Brought to you by:
molnar_c
From: <mol...@us...> - 2006-05-21 02:16:53
|
Revision: 113 Author: molnar_c Date: 2006-05-20 19:16:40 -0700 (Sat, 20 May 2006) ViewCVS: http://svn.sourceforge.net/servsys/?rev=113&view=rev Log Message: ----------- We now have the customer request form added. Must also have a tech id of servsys and it will email to the company reports section. Modified Paths: -------------- trunk/servsys/TODO trunk/servsys/src/com/pandmservices/UniCustomer.java trunk/servsys/src/com/pandmservices/web/UniCash.java Modified: trunk/servsys/TODO =================================================================== --- trunk/servsys/TODO 2006-05-19 23:24:19 UTC (rev 112) +++ trunk/servsys/TODO 2006-05-21 02:16:40 UTC (rev 113) @@ -21,6 +21,7 @@ ================================================================= (N) Moved from localhost cvs to svn.sourceforge.net /svnroot/servsys re-imported and updated. This is test commit. +(N) Customer request form is now added Modified: trunk/servsys/src/com/pandmservices/UniCustomer.java =================================================================== --- trunk/servsys/src/com/pandmservices/UniCustomer.java 2006-05-19 23:24:19 UTC (rev 112) +++ trunk/servsys/src/com/pandmservices/UniCustomer.java 2006-05-21 02:16:40 UTC (rev 113) @@ -208,7 +208,21 @@ return V; } + public static Vector getAllItems(Connection c, String cname, String phone, String zip) + throws SQLException, TodoException + { + Vector V = new Vector(); + Statement stmt = c.createStatement(); + ResultSet rs = stmt.executeQuery("SELECT custnum, cname, address1, city FROM customers where cname ='"+cname+"' and homephone ='"+phone+"' and zip ='"+zip+"' order by cname"); + while(rs.next()) + { + UniCustomer t = new UniCustomer(c,rs.getInt("custnum")); + V.addElement(t); + } + return V; + } + public static Vector getAllItems(Connection c, String custstart, String custstop) throws SQLException, TodoException { @@ -227,15 +241,13 @@ throws SQLException, TodoException { Statement stmt = c.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT id FROM todo ORDER BY id;"); + ResultSet rs = stmt.executeQuery("SELECT max(custnum) as id FROM customers;"); int idlarge = 0; while(rs.next()) { idlarge = rs.getInt("id"); } - return idlarge; - } public static String getAccountID(Connection c, String TAName) Modified: trunk/servsys/src/com/pandmservices/web/UniCash.java =================================================================== --- trunk/servsys/src/com/pandmservices/web/UniCash.java 2006-05-19 23:24:19 UTC (rev 112) +++ trunk/servsys/src/com/pandmservices/web/UniCash.java 2006-05-21 02:16:40 UTC (rev 113) @@ -107,7 +107,19 @@ log("just got session information in doGet. User: "+username+""); if (action.equalsIgnoreCase("checklogin")) { doCheckUserLogin(req, res, out, session, username); - } else { + } else if (action.equalsIgnoreCase("customerrequest")) { + doCustomerRequest(req, res, out, session, username); + } else if (action.equalsIgnoreCase("checkcustomer")) { + doCheckCustomer(req, res, out, session, username); + } else if (action.equalsIgnoreCase("custaddform")) { + doCustAddForm(req, res, out, session, username); + } else if (action.equalsIgnoreCase("savecustaddform")) { + doSaveCustAddForm(req, res, out, session, username); + } else if (action.equalsIgnoreCase("addservicerequest")) { + doAddServiceRequest(req, res, out, session, username); + } else if (action.equalsIgnoreCase("savecustcallslip")) { + doSaveCustCallslip(req, res, out, session, username); + } else{ if (username==null) { doLoginUser(req, res, out, session, username); @@ -4796,6 +4808,437 @@ res.sendRedirect(""+classdir+"UniCash?action=checkadminuser&next_page="+next_page+""); } +private void doCustomerRequest(HttpServletRequest req, HttpServletResponse res, PrintWriter out, HttpSession session, String username) + throws Exception + { + doVersionInfo_VNumber(); + String action = req.getParameter("action"); + out.println("<html>"); + out.println("<head>"); + out.println("<title>Customer Service Request</title>"); + out.println("</head><table border=0><tr><td valign=\"top\" width=\"50%\">"); + out.println("<form method=\"post\" action=\""+classdir+"UniCash?action=checkcustomer\" name=\"addcust\">"); + out.println("<table><tr><td>"); + out.println("Last Name<br>Business Name:"); + out.println("</td><td>"); + out.println("<input type=\"text\" name=\"lname\" size=\"20\" >"); + out.println("</td></tr><tr><td>"); + out.println("First Name:"); + out.println("</td><td>"); + out.println("<input type=\"text\" name=\"fname\" size=\"20\" >"); + out.println("</td></tr><tr><td>"); + out.println("Phone Number (example: 508-555-1212) :"); + out.println("</td><td>"); + out.println("<input type=\"phone\" name=\"phonenumber\" size=\"20\" >"); + out.println("</td></tr><tr><td>"); + out.println("Zip Code (example: 06279) :"); + out.println("</td><td>"); + out.println("<input type=\"text\" name=\"zipcode\" size=\"5\" >"); + out.println("</td></tr><tr><td>"); + out.println("</td></tr></table>"); + out.println("<p> <CENTER>"); + out.println("<INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Login\">"); + out.println("<INPUT TYPE=\"reset\">"); +out.println("</CENTER>"); + out.println("</form></td><td>"); + + String imagename=null; + String imagewidth=null; + String imagehight=null; + String compname=null; + String complogo=null; + String compaddress=null; + String compphone=null; + + Vector v; + v = UniCompConfig.getAllItems(con); + int counter=0; + for (int i = 0 ; i < v.size(); i++) + { + UniCompConfig t = (UniCompConfig) v.elementAt(i); + imagename=t.getImage(); + imagewidth=t.getImageWidth(); + imagehight=t.getImageHight(); + compname=t.getCoName(); + complogo=t.getCoLogo(); + compaddress=t.getCoAddress(); + compphone=t.getCoPhone(); + } + + out.println("<HTML>"); +out.println("<HEAD>"); +out.println(" <META HTTP-EQUIV=\"CONTENT-TYPE\" CONTENT=\"text/html; charset=iso-8859-1\">"); + out.println(" <TITLE>Servsys Login</TITLE>"); +out.println("</HEAD>"); +out.println("<BODY TEXT=\"#000000\" LINK=\"#0000ff\" VLINK=\"#000080\" BGCOLOR=\"#ffffff\">"); + +out.println("<TABLE WIDTH=100% BORDER=0 CELLPADDING=4 CELLSPACING=0>"); + out.println("<THEAD>"); + out.println("<TR>"); + out.println("</TD>"); + out.println("<TD WIDTH=30% VALIGN=TOP>"); + out.println("<P><IMG SRC=\""+imagename+"\" NAME=\"Graphic1\" ALIGN=CENTER WIDTH="+imagewidth+" HEIGHT="+imagehight+" BORDER=0><BR CLEAR=LEFT><BR>"); + out.println("</P>"); + out.println("</TD>"); + out.println("<TD WIDTH=50% ALIGN=LEFT>"); + out.println("<h2><i>Service Entry and Reporting System</i></h2>"); + out.println("</TD>"); + out.println("</TR>"); + out.println("</THEAD>"); +out.println("</TABLE>"); +out.println("</BODY>"); +out.println("</HTML>"); +out.println("<br><br><br><br><CENTER>"); +out.println("(C) Copyright 2002-2006 - Our World Services, LLC<br>"); +out.println("<br>Version: "+doVersionInfo_VNumber()+" - Compiled: "+doFormatDate(getDate(doVersionInfo_VDate()))+"<br>"); +//out.println("<br>Software Expire Date: "+doFormatDate(getDate(doGetExpireDate()))+"<br>"); +//out.println("<br>Software Expire Date has been removed for GPL version.<br>"); +//out.println("<br>Source code per the GPL can be found on sourceforge.net or at servsys.org<br>"); +out.println("<br><br><br>For assistance with this product please contact:<br>Chris Molnar<br>860-798-7032<br>mo...@ma..."); +out.println("<br><br><br><P><IMG SRC=\""+Gwebhome+"MacOS_Pnthr_Vert_v1.gif\" NAME=\"Graphic1\" ALIGN=CENTER WIDTH=50 HEIGHT=60 BORDER=0><BR CLEAR=LEFT><BR>"); +out.println("Developed on Mac OS/X for all platforms<br>"); +/* #system("uptime"); */ + + out.println("</CENTER>"); + con.close(); + } + +private void doCheckCustomer(HttpServletRequest req, HttpServletResponse res, PrintWriter out, HttpSession session, String username) + throws Exception + { + + String action = req.getParameter("action"); + String lname = req.getParameter("lname"); + String fname = req.getParameter("fname"); + String phonenumber = req.getParameter("phonenumber"); + String zipcode=req.getParameter("zipcode"); + String cname1=null; + String address1=null; + String address2=null; + String city=null; + String state=null; + String zip=null; + String homephone=null; + String altphone=null; + String custsite=null; + String sitenum=null; + String crecnum=null; + + String cname = ""; + if (fname.length() > 1 ) { + cname = combinestring(cname, lname+", "); + cname = combinestring(cname, fname); + } else { + cname = combinestring(cname, lname); + } + + Vector v; + v = UniCustomer.getAllItems(con, cname, phonenumber, zipcode); + + if (v.size() == 0) { + // put form for no customer found - enter remainder of information + out.println("No Information found<br>"); + // send to a new customer form. + res.sendRedirect(""+classdir+"UniCash?action=custaddform"); + + } else { + + for (int i = 0 ; i < v.size(); i++) + { + UniCustomer t = (UniCustomer) v.elementAt(i); + address1=t.getAddress1(); + address2=t.getAddress2(); + crecnum=t.getCusNum(); + custsite=t.getCustSite(); + sitenum=t.getSiteNum(); + } + + // show customer information found - ask if correct + out.println("<html><body><h2>I believe we have serviced this location before.</h2><br><br>"); + out.println("<h2>I have your address as: "+address1+" "+address2+"<br><br></h2>"); + out.println("<h2>Is this correct?<h2><br>"); + out.println("<h2><a href="+classdir+"UniCash?action=addservicerequest&custsite="+custsite+"&sitenum="+sitenum+"&crecnum="+crecnum+">Yes</a></h2><br>"); + out.println("<h2><a href="+classdir+"UniCash?action=custaddform>No</a></h2><br>"); + } + + } + + private void doCustAddForm(HttpServletRequest req, HttpServletResponse res, PrintWriter out, HttpSession session, String username) + throws Exception + { + + out.println("<html>"); + out.println("<head>"); + out.println("<title>Add Customer</title>"); + out.println("</head>"); + out.println("<h2>Please complete the following form. Make sure the address and phone number are correct and then press save.</h2>"); + out.println("<form method=\"post\" action=\""+classdir+"UniCash?action=savecustaddform\" name=\"custform\">"); + out.println("<table><tr><td>"); + out.println("Customer Name<br> (Business or Last, First) :"); + out.println("</td><td>"); + out.println("<input type=\"text\" name=\"cname\" size=\"40\">"); + out.println("</td></tr><tr><td>"); + out.println("Address :"); + out.println("</td><td>"); + out.println("<input type=\"text\" name=\"address1\" size=\"40\">"); + out.println("</td></tr><tr><td>"); + out.println("Address :"); + out.println("</td><td>"); + out.println("<input type=\"text\" name=\"address2\" size=\"40\">"); + out.println("</td></tr><tr><td>"); + out.println("City :"); + out.println("</td><td>"); + out.println("<input type=\"text\" name=\"city\" size=\"40\">"); + out.println("</td></tr><tr><td>"); + out.println("State :"); + out.println("</td><td>"); + out.println("<input type=\"text\" name=\"state\" size=\"3\">"); + out.println("</td></tr><tr><td>"); + out.println("Zip Code :"); + out.println("</td><td>"); + out.println("<input type=\"text\" name=\"zip\" size=\"10\">"); + out.println("</td></tr><tr><td>"); + out.println("Primary Phone:"); + out.println("</td><td>"); + out.println("<input type=\"text\" name=\"homephone\" size=\"15\">"); + out.println("</td></tr><tr><td>"); + out.println("Alt Phone :"); + out.println("</td><td>"); + out.println("<input type=\"text\" name=\"altphone\" size=\"15\">"); + out.println("</td></tr><tr><td>"); + out.println("Email Address :"); + out.println("</td><td>"); + out.println("<input type=\"text\" name=\"cemail\" size=\"50\">"); + //out.println("</td></tr><tr><td>"); + //out.println("Customer Number :"); + //out.println("</td><td>"); + //out.println("<input type=\"text\" name=\"custsite\" size=\"15\">"); + //out.println("</td></tr><tr><td>"); + //out.println("Site Number :"); + //out.println("</td><td>"); + //out.println("<input type=\"text\" name=\"sitenum\" size=\"15\">"); + //out.println("</td></tr><tr><td>"); + //out.println("Customer Type (T=T/M, F=Full) :"); + //out.println("</td><td>"); + //out.println("<input type=\"text\" name=\"custtype\" size=\"15\">"); + //out.println("</td></tr><tr><td>"); + //out.println("Customer Notes :"); + //out.println("</td><td>"); + //out.println("<input type=\"text\" name=\"cust_notes\" size=\"80\">"); + out.println("</td></tr></table>"); + out.println("<p> <CENTER>"); + out.println("<INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Save\">"); + out.println("<INPUT TYPE=\"reset\">"); + out.println("</CENTER>"); + con.close(); + } + + +private void doSaveCustAddForm(HttpServletRequest req, HttpServletResponse res, PrintWriter out, HttpSession session, String username) + throws Exception + { + String custstart = req.getParameter("custstart"); + String custstop = req.getParameter("custstop"); + String cname = req.getParameter("cname"); + String address1 = req.getParameter("address1"); + String address2 = req.getParameter("address2"); + String city = req.getParameter("city"); + String custtype = req.getParameter("custtype"); + custtype="T"; + String state = req.getParameter("state"); + String zip = req.getParameter("zip"); + String homephone = req.getParameter("homephone"); + String altphone = req.getParameter("altphone"); + String cust_notes = req.getParameter("cust_notes"); + cust_notes="Added from a customer request"; + String cemail = req.getParameter("cemail"); + //String custsite = req.getParameter("custsite"); + //String sitenum = req.getParameter("sitenum"); + // get date in YYYYMMDD format + if ((cname.length()<=1)||(address1.length()<=1)||(homephone.length()<=7)) { + out.println("<h2>You either did not complete<br>1) Name<br>2) Address<br>3)Phone Number<br><br>Please use your back key on the browser and correct problem.<br>"); + } else { + Format formatter; + Calendar now = Calendar.getInstance(); + Date date = new Date(); + formatter = new SimpleDateFormat("yyyyMMdd"); + String s = formatter.format(date); + // get max customer number and add 1 + int highrecnum = UniCustomer.getMaxID(con); + highrecnum++; + // String combine the max customer number and date to get custsite + String custsite=combinestring(s,""+highrecnum+""); + String sitenum="001"; + out.println("Custsite: "+custsite+"<br>Sitenum: "+sitenum+"<br>"); + UniCustomer.addCustomer(con, cname, address1, address2, city, state, zip, homephone, altphone, cust_notes,cemail,custsite,sitenum,custtype); + // Now get new max customer record and this is crecnum + int newcustrec = UniCustomer.getMaxID(con); + out.println("Your item has been added to the database"); + con.close(); + res.sendRedirect(""+classdir+"UniCash?action=addservicerequest&custsite="+custsite+"&sitenum="+sitenum+"&crecnum="+newcustrec+""); + } + } + +private void doAddServiceRequest(HttpServletRequest req, HttpServletResponse res, PrintWriter out, HttpSession session, String username) + throws Exception + { + String custsite=req.getParameter("custsite"); + String sitenum=req.getParameter("sitenum"); + String tcustnum=req.getParameter("crecnum"); + Format formatter; + Calendar now = Calendar.getInstance(); + Date date = new Date(); + formatter = new SimpleDateFormat("MM-dd-yyyy"); + String s = formatter.format(date); + int hour = now.get(Calendar.HOUR_OF_DAY); + int second = now.get(Calendar.SECOND); + int year = now.get(Calendar.YEAR); + int month = now.get(Calendar.MONTH); + int minute = now.get(Calendar.MINUTE); + int millisecond = now.get(Calendar.MILLISECOND); + String collected="0.00"; + String charges="0.00"; + int custnum = Integer.parseInt(tcustnum); + int eenum=0; + int ecustnum=0; + String brand=null; + String modelnum=null; + String serialnum=null; + String filter=null; + String notes=null; + out.println("<html>"); + out.println("<head>"); + out.println("<title>Add Customer Request</title>"); + out.println("</head>"); + out.println("<form method=\"post\" action=\""+classdir+"UniCash?action=savecustcallslip&custnum="+custnum+"\" name=\"addcat\">"); + out.println("<table size=100% border=1>"); + out.println("<tr><td>Date</td><td>"+s+""); + out.println("<input type=\"hidden\" name=\"cdate\" value="+s+"></td>"); + out.println("</tr>"); + out.println("<tr><td>Please Enter Your Initials</td><td>"); + out.println("<input type=\"text\" name=\"custinits\" ></td>"); + out.println("</tr>"); + out.println("<tr><td>Reason</td><td>"); + out.println("<SELECT name=\"reason\">"); + out.println("<OPTION>Air Conditioning - System Down"); + out.println("<OPTION>Air Conditioning - Maintenance Needed"); + out.println("<OPTION>Heating - System Down"); + out.println("<OPTION>Heating - Maintenance Needed"); + out.println("<OPTION>Refrigeration - System Down"); + out.println("<OPTION>Refrigeration - Maintenance Needed"); + out.println("<OPTION>Sales Quote - New Equipment"); + out.println("<OPTION>Sales Quote - Equipment Replacement"); + out.println("<OPTION>Indoor Air Quality - Inspection"); + out.println("<OPTION>Indoor Air Quality - Problem"); + out.println("<OPTION>Other - Please call"); + out.println("</SELECT></td></tr>"); + out.println("<tr><td>Please describe problem or request with as much detail as possible:</td><td>"); + out.println("<textarea name=\"services\" cols=\"60\" rows=\"8\" wrap=\"VIRTUAL\" style=\"width: 500px\"></textarea></td></tr>"); + out.println("<input type=\"hidden\" name=\"custsite\" value=\""+custsite+"\">"); + out.println("<input type=\"hidden\" name=\"sitenum\" value=\""+sitenum+"\">"); + out.println("<input type=\"hidden\" name=\"custnum\" value=\""+custnum+"\">"); + out.println("</td></tr></table>"); + out.println("<p> <CENTER>"); + out.println("<INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Save\">"); + out.println("<INPUT TYPE=\"reset\">"); + out.println("</CENTER>"); + out.println("</form>"); + } + +private void doSaveCustCallslip(HttpServletRequest req, HttpServletResponse res, PrintWriter out, HttpSession session, String username) + throws Exception + { + String tcustnum = req.getParameter("custnum"); + String custsite = req.getParameter("custsite"); + String sitenum = req.getParameter("sitenum"); + int custnum = Integer.parseInt(tcustnum); + Format formatter; + Calendar now = Calendar.getInstance(); + Date date = new Date(); + formatter = new SimpleDateFormat("yyyyMMdd"); + String s = formatter.format(date); + String custinits=req.getParameter("custinits"); + String callslip =""; + callslip=combinestring(s,custinits); + String reason= req.getParameter("reason"); + String services= req.getParameter("services"); + String cdate= req.getParameter("cdate"); + String recommendations="Needs Attention - Entered by Customer Request"; + String rscheduled=""; + String charges="0.00"; + String collected= "0.00"; + String notes= "-"; + String equip1="0"; + String equip2="0"; + String equip3="0"; + String equip4="0"; + String crectype="C"; + String tfollowup= req.getParameter("followup"); + //int followup = Integer.parseInt(tfollowup); + String tservices = services.replaceAll("\n","<br>"); + String trecommendations = recommendations.replaceAll("\n","<br>"); + String parts="-"; + String address1=""; + String address2=""; + int followup=5; + String cname=""; + String city=""; + String homephone=""; + String altphone=""; + String crecnum=""; + String state=""; + String email=""; + String zip=""; + UniCallslip.AddItem(con, custnum, callslip, doFormatDateDb(getDateDb(cdate)), equip1, equip2,equip3, equip4, reason, services, recommendations, rscheduled, charges, collected, notes, followup, custsite, sitenum, crectype, username,parts); + String mbody=""; + mbody=combinestring(mbody,"A Call was just entered on the system by a customer. The information is as follows:<br>"); + Vector v; + v = UniCustomer.getCustNumSite(con, custsite, sitenum); + for (int i = 0 ; i < v.size(); i++) + { + UniCustomer t = (UniCustomer) v.elementAt(i); + address1=t.getAddress1(); + address2=t.getAddress2(); + crecnum=t.getCusNum(); + custsite=t.getCustSite(); + sitenum=t.getSiteNum(); + cname = t.getCustomerName(); + city=t.getCity(); + state=t.getState(); + homephone=t.getHomePhone(); + altphone=t.getAltPhone(); + email=t.getCEmail(); + zip=t.getZip(); + } + mbody=combinestring(mbody,"Customer Name: "+cname+"<br>"); + mbody=combinestring(mbody,"Address: "+address1+"<br>"); + mbody=combinestring(mbody,"Address: "+address2+"<br>"); + mbody=combinestring(mbody,"City, State Zip:"+city+", "+state+" "+zip+"<br>"); + mbody=combinestring(mbody,"<br>"); + mbody=combinestring(mbody,"Date:"+cdate+"<br>"); + mbody=combinestring(mbody,"Callslip Number: "+callslip+"<br>"); + mbody=combinestring(mbody,"Reason: "+reason+"<br>"); + mbody=combinestring(mbody,"<br>Description of Problem:<br>"+services+"<br>"+recommendations+"<br>"); + out.println("Your item has been added to the database.<br><br>"); + out.println("Your request was entered on: "+cdate+"<br>"); + out.println("Your record number is: "+callslip+"<br><br>"); + out.println("Your request has been emailed out to the appropriate technician who will confirm call with you<br>within 30 minutes<br>"); + out.println("Please print or write down this confirmation for your reference.<br>"); + out.println("Thank you for helping us save you money by using our automated system.<br><br><br>--------------------------------------<br>"+mbody+""); + + // put email routine in here + + String emailserver = doGetSmtpServer("servsys"); + //emailsendaddress=doGetIns_Email(username); + String emailsendaddress=doGetCompanyReportEmail(); + String techemailaddress=doGetTech_Email("servsys"); + String smtpuser = doGetSmtpUser("servsys"); + String smtppassword = doGetSmtpPassword("servsys"); + doMailSend(emailserver, emailsendaddress, techemailaddress, "Customer Service Request: Callslip: "+callslip+"" , mbody, smtpuser, smtppassword); + + con.close(); + } + private void doLoginUser(HttpServletRequest req, HttpServletResponse res, PrintWriter out, HttpSession session, String username) throws Exception { @@ -8991,7 +9434,7 @@ out.println("<br><br><br><a href="+classdir+"UniCash?action=addtimecat>Add a Category</a></body></html>"); String thismainserver=doGetThisMainServer(); - if (!thismainserver.equalsIgnoreCase("yes") { + if (!thismainserver.equalsIgnoreCase("yes")) { out.println("<br><br><br><a href="+classdir+"UniCash?action=uploadtimecat>Upload to Main Server (NEED INTERNET CONNECT)</a></body></html>"); } con.close(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mol...@us...> - 2006-05-23 17:35:40
|
Revision: 114 Author: molnar_c Date: 2006-05-23 10:35:00 -0700 (Tue, 23 May 2006) ViewCVS: http://svn.sourceforge.net/servsys/?rev=114&view=rev Log Message: ----------- Needed to fix some bugs that I found during documentation for Meachams. Modified Paths: -------------- trunk/servsys/TODO trunk/servsys/src/com/pandmservices/UniPhoneList.java trunk/servsys/src/com/pandmservices/UniPreventative.java trunk/servsys/src/com/pandmservices/web/UniCash.java Modified: trunk/servsys/TODO =================================================================== --- trunk/servsys/TODO 2006-05-21 02:16:40 UTC (rev 113) +++ trunk/servsys/TODO 2006-05-23 17:35:00 UTC (rev 114) @@ -1,30 +1,33 @@ - Need to figure out a way for master worksheets to update when pricing updates. 55. Identify email of callslips into system - 54. Read email from server - -136. Load calc entry form - -137. Load calc edit form - -138. Load calc report - 145. Add prompting for package selection - 146. Add color prompting for package selection - - Upload checkme - move all select statements into other classes and out of UniCash.java. - if running on master server allow update of server dates. -- Add customer interface: customer selects on "request service" from main screen prior to log in. - is prompted for customer number from bill. customer number is searched to match address and phone number. - customer is presented with a pre-filled form or requested for information. Customer is asked to complete - information and aknowladge billing and disclaimer. Customer is given a reciept and email is sent to the - appropriate people. +- Edit Planned Service Pricing need to be added/fixed. +- Need to add CSV file import for Inventory Data +================================================================= +RELEASE 2.30 +================================================================= + ================================================================= RELEASE 2.29 ================================================================= (N) Moved from localhost cvs to svn.sourceforge.net /svnroot/servsys re-imported and updated. This is test commit. (N) Customer request form is now added +(F) Fixed the return from adding a service proposal to go to the correct spot on the servsys grid. +(N) Add customer interface: customer selects on "request service" from main screen prior to log in. + is prompted for customer number from bill. customer number is searched to match address and phone number. + customer is presented with a pre-filled form or requested for information. Customer is asked to complete + information and aknowladge billing and disclaimer. Customer is given a reciept and email is sent to the + appropriate people. +(F) Fixed the add planned service price routine. Error found while working on documentation. - - ================================================================= RELEASE 2.28 ================================================================= @@ -62,6 +65,9 @@ (N) Now added SyncCustQuotes (N) Now added SyncCustWorksheet (N) Now Added SyncCustPagreement +136. Load calc entry form +137. Load calc edit form - +138. Load calc report - ================================================================= RELEASE 2.25 Modified: trunk/servsys/src/com/pandmservices/UniPhoneList.java =================================================================== --- trunk/servsys/src/com/pandmservices/UniPhoneList.java 2006-05-21 02:16:40 UTC (rev 113) +++ trunk/servsys/src/com/pandmservices/UniPhoneList.java 2006-05-23 17:35:00 UTC (rev 114) @@ -80,13 +80,13 @@ } - public static void UpdateItem(Connection con, int record_number, String name, String home_number, String cell_number, String direct_connect, String truck_number, String additional_number) + public static void UpdateItem(Connection con, int record_number, String name, String home_number, String cell_number, String direct_connect, String truck_number, String additional_number, String newdate) throws SQLException { Statement stmt = con.createStatement(); stmt.executeUpdate("Update phone_list Set name ='" +name + "', home_number='"+home_number +"', cell_number='"+cell_number +"', direct_connect='"+direct_connect +"', truck_number='"+truck_number +"', additional_number='"+additional_number +"' Where record_number=" + record_number + ";"); + stmt.executeUpdate("update phone_list_date set dateupdated='"+newdate+"';"); } - public static void AddItem(Connection con, String name, String home_number, String cell_number, String direct_connect, String truck_number, String additional_number) throws SQLException, NoSuchAlgorithmException, NoSuchProviderException { @@ -94,6 +94,14 @@ stmt.executeUpdate("INSERT INTO phone_list (name, home_number, cell_number, direct_connect, truck_number, additional_number) Values ('" + name + "','" +home_number+ "','"+ cell_number+ "','"+ direct_connect + "','" + truck_number + "','"+ additional_number + "')"); } + public static void AddItem(Connection con, String name, String home_number, String cell_number, String direct_connect, String truck_number, String additional_number, String newdate) + throws SQLException, NoSuchAlgorithmException, NoSuchProviderException + { + Statement stmt = con.createStatement(); + stmt.executeUpdate("INSERT INTO phone_list (name, home_number, cell_number, direct_connect, truck_number, additional_number) Values ('" + name + "','" +home_number+ "','"+ cell_number+ "','"+ direct_connect + "','" + truck_number + "','"+ additional_number + "')"); + stmt.executeUpdate("update phone_list_date set dateupdated='"+newdate+"';"); + } + public int getId() { return record_number; } public String getName() { return name; } Modified: trunk/servsys/src/com/pandmservices/UniPreventative.java =================================================================== --- trunk/servsys/src/com/pandmservices/UniPreventative.java 2006-05-21 02:16:40 UTC (rev 113) +++ trunk/servsys/src/com/pandmservices/UniPreventative.java 2006-05-23 17:35:00 UTC (rev 114) @@ -69,7 +69,16 @@ Statement stmt = con.createStatement(); stmt.executeUpdate("Update todo Set descript='" +desc+ "' Where ID=" + id + ";"); } - + +public static void addPreventative(Connection con, String description, String tm_est, String yr_1, String yr_2, String yr_3, String newdate) + throws SQLException + { + String tdescription = description.replaceAll("'","''"); + Statement stmt = con.createStatement(); + stmt.executeUpdate("INSERT INTO prevprices (descript, tm_est, yr1, yr2, yr3) Values ('" + tdescription + "','" +tm_est+ "','"+ yr_1 + "','"+ yr_2 + "','"+ yr_3 + "')"); + stmt.executeUpdate("update prevprices_date set dateupdated='"+newdate+"';"); + } + public static void addPreventative(Connection con, String description, String tm_est, String yr_1, String yr_2, String yr_3) throws SQLException { Modified: trunk/servsys/src/com/pandmservices/web/UniCash.java =================================================================== --- trunk/servsys/src/com/pandmservices/web/UniCash.java 2006-05-21 02:16:40 UTC (rev 113) +++ trunk/servsys/src/com/pandmservices/web/UniCash.java 2006-05-23 17:35:00 UTC (rev 114) @@ -4823,7 +4823,7 @@ out.println("</td><td>"); out.println("<input type=\"text\" name=\"lname\" size=\"20\" >"); out.println("</td></tr><tr><td>"); - out.println("First Name:"); + out.println("First Name:<br>(Leave blank if business)"); out.println("</td><td>"); out.println("<input type=\"text\" name=\"fname\" size=\"20\" >"); out.println("</td></tr><tr><td>"); @@ -4881,7 +4881,7 @@ out.println("</P>"); out.println("</TD>"); out.println("<TD WIDTH=50% ALIGN=LEFT>"); - out.println("<h2><i>Service Entry and Reporting System</i></h2>"); + //out.println("<h2><i>Service Entry and Reporting System</i></h2>"); out.println("</TD>"); out.println("</TR>"); out.println("</THEAD>"); @@ -4890,13 +4890,13 @@ out.println("</HTML>"); out.println("<br><br><br><br><CENTER>"); out.println("(C) Copyright 2002-2006 - Our World Services, LLC<br>"); -out.println("<br>Version: "+doVersionInfo_VNumber()+" - Compiled: "+doFormatDate(getDate(doVersionInfo_VDate()))+"<br>"); +//out.println("<br>Version: "+doVersionInfo_VNumber()+" - Compiled: "+doFormatDate(getDate(doVersionInfo_VDate()))+"<br>"); //out.println("<br>Software Expire Date: "+doFormatDate(getDate(doGetExpireDate()))+"<br>"); //out.println("<br>Software Expire Date has been removed for GPL version.<br>"); //out.println("<br>Source code per the GPL can be found on sourceforge.net or at servsys.org<br>"); out.println("<br><br><br>For assistance with this product please contact:<br>Chris Molnar<br>860-798-7032<br>mo...@ma..."); -out.println("<br><br><br><P><IMG SRC=\""+Gwebhome+"MacOS_Pnthr_Vert_v1.gif\" NAME=\"Graphic1\" ALIGN=CENTER WIDTH=50 HEIGHT=60 BORDER=0><BR CLEAR=LEFT><BR>"); -out.println("Developed on Mac OS/X for all platforms<br>"); +//out.println("<br><br><br><P><IMG SRC=\""+Gwebhome+"MacOS_Pnthr_Vert_v1.gif\" NAME=\"Graphic1\" ALIGN=CENTER WIDTH=50 HEIGHT=60 BORDER=0><BR CLEAR=LEFT><BR>"); +//out.println("Developed on Mac OS/X for all platforms<br>"); /* #system("uptime"); */ out.println("</CENTER>"); @@ -5213,6 +5213,8 @@ mbody=combinestring(mbody,"Customer Name: "+cname+"<br>"); mbody=combinestring(mbody,"Address: "+address1+"<br>"); mbody=combinestring(mbody,"Address: "+address2+"<br>"); + mbody=combinestring(mbody,"Phone: "+homephone+"<br>"); + mbody=combinestring(mbody,"Phone 2: "+altphone+"<br>"); mbody=combinestring(mbody,"City, State Zip:"+city+", "+state+" "+zip+"<br>"); mbody=combinestring(mbody,"<br>"); mbody=combinestring(mbody,"Date:"+cdate+"<br>"); @@ -10260,7 +10262,7 @@ out.println("<head>"); out.println("<title>Add Preventative Price</title>"); out.println("</head>"); - out.println("<form method=\"post\" action=\"href="+classdir+"UniCash?action=saveprevprice\" name=\"addcust\">"); + out.println("<form method=\"post\" action=\""+classdir+"UniCash?action=saveprevprice\" name=\"addcust\">"); out.println("<p>Description :"); out.println("<input type=\"text\" name=\"descript\" size=\"40\">"); out.println("</p>"); @@ -10280,8 +10282,7 @@ out.println("<INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Save\">"); out.println("<INPUT TYPE=\"reset\">"); out.println("</CENTER>"); - - con.close(); + con.close(); } private void doSavePrevPrice(HttpServletRequest req, HttpServletResponse res, PrintWriter out, HttpSession session, String username) @@ -10292,9 +10293,15 @@ String yr2 = req.getParameter("yr2"); String yr1 = req.getParameter("yr1"); String tm_est = req.getParameter("tm_est"); + Format formatter; + Calendar now = Calendar.getInstance(); + Date date = new Date(); + formatter = new SimpleDateFormat("yyyy-MM-dd"); + String s = formatter.format(date); - UniPreventative.addPreventative(con, descript, tm_est, yr1, yr2, yr3); + UniPreventative.addPreventative(con, descript, tm_est, yr1, yr2, yr3, s); out.println("Your item has been added to the database<br>"); + con.close(); res.sendRedirect(""+classdir+"UniCash?action=listprevprice"); } @@ -10367,11 +10374,11 @@ out.println("<title>Planned Service Prices</title>"); out.println("</head>"); out.println("<BODY TEXT=#000000 LINK=#0000ff VLINK=#000080 BGCOLOR=#ffffff> "); -out.println("<a href="+classdir+"UniCash?action=addprevetative>Add a Service Price</a>"); +out.println("<a href="+classdir+"UniCash?action=addprevprice>Add a Service Plan Price</a>"); out.println("<P><P>"); out.println("<table border=1 width=100%>"); -//out.println("<th>Description</th><th>T/M Cost</th><th>1 Year</th><th>2 Year</th><th>3 Year</th>"); -out.println("<th>Description</th><th>T/M Cost</th><th>2 Year</th><th>3 Year</th>"); +out.println("<th>Description</th><th>T/M Cost</th><th>1 Year</th><th>2 Year</th><th>3 Year</th>"); +//out.println("<th>Description</th><th>T/M Cost</th><th>2 Year</th><th>3 Year</th>"); Vector v; v = UniPreventative.getAllItems(con); int counter=0; @@ -10395,12 +10402,11 @@ counter=0; } -//out.println("<tr><td><a href=edprevprice.php?planrec="+planrec+">"+description+"</a></td><td>"+tm_est+"</td><td>"+yr_1+"</td><td>"+yr_2+"</td><td>"+yr_3+"</td></tr>"); - out.println("<tr><td><a href=edprevprice.php?planrec="+planrec+">"+description+"</a></td><td>"+tm_est+"</td><td>"+yr_2+"</td><td>"+yr_3+"</td></tr>"); +out.println("<tr><td><a href=edprevprice.php?planrec="+planrec+">"+description+"</a></td><td>"+tm_est+"</td><td>"+yr_1+"</td><td>"+yr_2+"</td><td>"+yr_3+"</td></tr>"); + //out.println("<tr><td><a href=edprevprice.php?planrec="+planrec+">"+description+"</a></td><td>"+tm_est+"</td><td>"+yr_2+"</td><td>"+yr_3+"</td></tr>"); } out.println("</table>"); -out.println("<P><P>"); -out.println("<a href="+classdir+"UniCash?action=addprevetative>Add a Service Price</a>"); +out.println("<P><P>");out.println("<a href="+classdir+"UniCash?action=addprevprice>Add a Service Plan Price</a>"); con.close(); } @@ -21235,7 +21241,13 @@ String dirconnect = req.getParameter("dirconnect"); String trucknum = req.getParameter("trucknum"); String addnum = req.getParameter("addnum"); - UniPhoneList.UpdateItem(con, recnum, ename, homenum, cellnum, dirconnect, trucknum, addnum); + Format formatter; + Calendar now = Calendar.getInstance(); + Date date = new Date(); + formatter = new SimpleDateFormat("yyyy-MM-dd"); + String s = formatter.format(date); + + UniPhoneList.UpdateItem(con, recnum, ename, homenum, cellnum, dirconnect, trucknum, addnum, s); con.close(); res.sendRedirect(""+classdir+"UniCash?action=listphonelist"); } @@ -21250,7 +21262,13 @@ String dirconnect = req.getParameter("dirconnect"); String trucknum = req.getParameter("trucknum"); String addnum = req.getParameter("addnum"); - UniPhoneList.AddItem(con, ename, homenum, cellnum, dirconnect, trucknum, addnum); + Format formatter; + Calendar now = Calendar.getInstance(); + Date date = new Date(); + formatter = new SimpleDateFormat("yyyy-MM-dd"); + String s = formatter.format(date); + + UniPhoneList.AddItem(con, ename, homenum, cellnum, dirconnect, trucknum, addnum, s); con.close(); res.sendRedirect(""+classdir+"UniCash?action=listphonelist"); } @@ -22357,7 +22375,7 @@ con.close(); out.println("Your item has been updated in the database<br>"); - res.sendRedirect(""+classdir+"UniCash?action=showcustdetail&csection=6&custnum="+custnum+"&custstart="+custstart+"&custstop="+custstop+""); + res.sendRedirect(""+classdir+"UniCash?action=showcustdetail&csection=5&custnum="+custnum+"&custstart="+custstart+"&custstop="+custstop+""); } private void doSavePrev(HttpServletRequest req, HttpServletResponse res, PrintWriter out, HttpSession session, String username) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mol...@us...> - 2006-05-25 01:12:00
|
Revision: 116 Author: molnar_c Date: 2006-05-24 18:11:36 -0700 (Wed, 24 May 2006) ViewCVS: http://svn.sourceforge.net/servsys/?rev=116&view=rev Log Message: ----------- Odometer readings are now added. Also found some problems with the changes that where done last night. Fixed them prior to distributing this morning. Modified Paths: -------------- trunk/servsys/TODO trunk/servsys/src/com/pandmservices/UniCompConfig.java trunk/servsys/src/com/pandmservices/UniTimeSheet.java trunk/servsys/src/com/pandmservices/dbserver/SyncTimeSheets.java trunk/servsys/src/com/pandmservices/web/UniCash.java Modified: trunk/servsys/TODO =================================================================== --- trunk/servsys/TODO 2006-05-23 17:49:32 UTC (rev 115) +++ trunk/servsys/TODO 2006-05-25 01:11:36 UTC (rev 116) @@ -12,6 +12,8 @@ ================================================================= RELEASE 2.30 ================================================================= +(N) Added odometer start and stop to time sheet entries and databases. +(N) Made sure that odometer readings are added to everything that is printed. ================================================================= Modified: trunk/servsys/src/com/pandmservices/UniCompConfig.java =================================================================== --- trunk/servsys/src/com/pandmservices/UniCompConfig.java 2006-05-23 17:49:32 UTC (rev 115) +++ trunk/servsys/src/com/pandmservices/UniCompConfig.java 2006-05-25 01:11:36 UTC (rev 116) @@ -81,8 +81,8 @@ { Statement stmt = con.createStatement(); stmt.executeUpdate("DROP TABLE IF EXISTS configcompany;"); - stmt.executeUpdate("create table configcompany (image text, imagewidth text, imagehight text, coname text, cologo text, coaddress text, cophone text, useletterhead text not null, yearenddate date default '2005-09-31', enabcustomer text not null, reportemail text not null);"); - stmt.executeUpdate("insert into configcompany (image,imagehight, imagewidth, coname, cologo,coaddress,cophone, useletterhead, enabcustomer, reportemail, yearenddate) values ('"+image+"','"+imagehight+"','"+imagewidth+"','"+coname+"','"+cologo+"','"+coaddress+"','"+cophone+"','"+useletterhead+"', '"+enabcustomer+"', '"+reportemail+"', '"+yearenddate+"');"); + stmt.executeUpdate("create table configcompany (image text, imagewidth text, imagehight text, coname text, cologo text, coaddress text, cophone text, useletterhead text not null, yearenddate date default '2005-09-31', enabcustomer text not null, nocustonlaptop text, laptopretentiontime int(11), reportemail text not null);"); + stmt.executeUpdate("insert into configcompany (image,imagehight, imagewidth, coname, cologo,coaddress,cophone, useletterhead, enabcustomer, reportemail, yearenddate, nocustonlaptop, laptopretentiontime) values ('"+image+"','"+imagehight+"','"+imagewidth+"','"+coname+"','"+cologo+"','"+coaddress+"','"+cophone+"','"+useletterhead+"', '"+enabcustomer+"', '"+reportemail+"', '"+yearenddate+"', 'yes', 4);"); } Modified: trunk/servsys/src/com/pandmservices/UniTimeSheet.java =================================================================== --- trunk/servsys/src/com/pandmservices/UniTimeSheet.java 2006-05-23 17:49:32 UTC (rev 115) +++ trunk/servsys/src/com/pandmservices/UniTimeSheet.java 2006-05-25 01:11:36 UTC (rev 116) @@ -8,6 +8,7 @@ import java.util.Vector; import java.util.Date; import java.security.*; +import java.lang.Integer.*; public class UniTimeSheet @@ -30,6 +31,8 @@ private String commision; private String ctype; private int tsid; + private String odostart; + private String odostop; private String dispatch_time; private int servsync; private String paytype; @@ -61,6 +64,8 @@ this.login = rs.getString("login"); this.paytype = rs.getString("paytype"); this.servsync=rs.getInt("servsync"); + this.odostart = rs.getString("odostart"); + this.odostop=rs.getString("odostop"); } @@ -174,25 +179,25 @@ stmt.executeUpdate("Update todo Set Done=true Where ID=" + id + ";"); } - public static void UpdateItem(Connection con, String tsid, String listdate, String callslip, String customer, String dispatch_time, String time_in, String time_out, String isold, String asold, String collected, String commision, String cisold, String casold, String ctype, String login, String paytype) + public static void UpdateItem(Connection con, String tsid, String listdate, String callslip, String customer, String dispatch_time, String time_in, String time_out, String isold, String asold, String collected, String commision, String cisold, String casold, String ctype, String login, String paytype, String odostart, String odostop) throws SQLException { Statement stmt = con.createStatement(); - stmt.executeUpdate("Update time_sheet Set tdate ='" +listdate + "', callslip='"+callslip +"', customer='"+customer +"', dispatch_time='"+dispatch_time +"', time_in='"+time_in +"', time_out='"+time_out +"', item_sold='"+isold +"', amount='"+asold +"', citem_sold='"+cisold +"', camount='"+casold +"',amount_collected='"+collected +"', commision='"+commision +"', ctype='"+ctype +"', login='"+login+"', paytype='"+paytype+"' Where tsid=" + tsid + ";"); + stmt.executeUpdate("Update time_sheet Set tdate ='" +listdate + "', callslip='"+callslip +"', customer='"+customer +"', dispatch_time='"+dispatch_time +"', time_in='"+time_in +"', time_out='"+time_out +"', item_sold='"+isold +"', amount='"+asold +"', citem_sold='"+cisold +"', camount='"+casold +"',amount_collected='"+collected +"', commision='"+commision +"', ctype='"+ctype +"', login='"+login+"', paytype='"+paytype+"', odostart='"+odostart+"', odostop='"+odostop+"' Where tsid=" + tsid + ";"); } - public static void addTimeSheetItem( Connection con, String listdate, String callslip, String customer, String dispatch_time, String time_in, String time_out, String isold, String asold, String collected, String commision, String cisold, String casold, String ctype, String login, String paytype) + public static void addTimeSheetItem( Connection con, String listdate, String callslip, String customer, String dispatch_time, String time_in, String time_out, String isold, String asold, String collected, String commision, String cisold, String casold, String ctype, String login, String paytype, String odostart, String odostop) throws SQLException, NoSuchAlgorithmException, NoSuchProviderException { Statement stmt = con.createStatement(); - stmt.executeUpdate("INSERT INTO time_sheet (tdate, callslip, customer, time_in, time_out, item_sold, amount, amount_collected, commision, dispatch_time, citem_sold, camount, ctype, login, paytype) Values ('" + listdate + "','" +callslip+ "','"+ customer + "','"+ time_in + "','" + time_out + "','"+ isold + "','"+ asold +"','"+collected+"','"+ commision+"','"+ dispatch_time + "', '"+ cisold + "','"+ casold +"','"+ctype+"', '"+login+"', '"+paytype+"')"); + stmt.executeUpdate("INSERT INTO time_sheet (tdate, callslip, customer, time_in, time_out, item_sold, amount, amount_collected, commision, dispatch_time, citem_sold, camount, ctype, login, paytype, odostart, odostop) Values ('" + listdate + "','" +callslip+ "','"+ customer + "','"+ time_in + "','" + time_out + "','"+ isold + "','"+ asold +"','"+collected+"','"+ commision+"','"+ dispatch_time + "', '"+ cisold + "','"+ casold +"','"+ctype+"', '"+login+"', '"+paytype+"', '"+odostart+"', '"+odostop+"')"); } - public static void addAdminTimeSheetItem( Connection con, String listdate, String callslip, String customer, String dispatch_time, String time_in, String time_out, String isold, String asold, String collected, String commision, String cisold, String casold, String ctype, String login, String paytype, String callcount) + public static void addAdminTimeSheetItem( Connection con, String listdate, String callslip, String customer, String dispatch_time, String time_in, String time_out, String isold, String asold, String collected, String commision, String cisold, String casold, String ctype, String login, String paytype, String callcount, String odostart, String odostop) throws SQLException, NoSuchAlgorithmException, NoSuchProviderException { Statement stmt = con.createStatement(); - stmt.executeUpdate("INSERT INTO time_sheet (tdate, callslip, customer, time_in, time_out, item_sold, amount, amount_collected, commision, dispatch_time, citem_sold, camount, ctype, login, paytype, callcount) Values ('" + listdate + "','" +callslip+ "','"+ customer + "','"+ time_in + "','" + time_out + "','"+ isold + "','"+ asold +"','"+collected+"','"+ commision+"','"+ dispatch_time + "', '"+ cisold + "','"+ casold +"','"+ctype+"', '"+login+"', '"+paytype+"', '"+callcount+"')"); + stmt.executeUpdate("INSERT INTO time_sheet (tdate, callslip, customer, time_in, time_out, item_sold, amount, amount_collected, commision, dispatch_time, citem_sold, camount, ctype, login, paytype, callcount, odostart, odostop) Values ('" + listdate + "','" +callslip+ "','"+ customer + "','"+ time_in + "','" + time_out + "','"+ isold + "','"+ asold +"','"+collected+"','"+ commision+"','"+ dispatch_time + "', '"+ cisold + "','"+ casold +"','"+ctype+"', '"+login+"', '"+paytype+"', '"+callcount+"','"+odostart+"','"+odostop+"')"); } public int getId() { return tsid; } @@ -213,6 +218,8 @@ public String TLogin() { return login; } public int getServSync() { return servsync; } public String TPayType() { return paytype; } + public String OdoStart() { return odostart; } + public String OdoStop() { return odostop; } public void setId(int id) { this.id = id; } } Modified: trunk/servsys/src/com/pandmservices/dbserver/SyncTimeSheets.java =================================================================== --- trunk/servsys/src/com/pandmservices/dbserver/SyncTimeSheets.java 2006-05-23 17:49:32 UTC (rev 115) +++ trunk/servsys/src/com/pandmservices/dbserver/SyncTimeSheets.java 2006-05-25 01:11:36 UTC (rev 116) @@ -32,6 +32,8 @@ private int tsid; private String dispatch_time; private String paytype; + private int odostart; + private int odostop; public SyncTimeSheets (Connection con, Connection conu) throws SQLException, TodoException @@ -59,6 +61,8 @@ this.camount = rs.getString("camount"); this.login = rs.getString("login"); this.paytype = rs.getString("paytype"); + this.odostart = rs.getInt("odostart"); + this.odostop = rs.getInt("odostop"); String tcustname=""; if (customer!=null) { tcustname = customer.replaceAll("'","''"); @@ -66,7 +70,7 @@ //System.out.println("INSERT INTO time_sheet (tdate, callslip, customer, time_in, time_out, item_sold, amount, amount_collected, commision, dispatch_time, citem_sold, camount, ctype, login) Values ('" + tdate + "','" +callslip+ "','"+ tcustname + "','"+ time_in + "','" + time_out + "','"+ isold + "','"+ amount +"','"+amount_collected+"','"+ commision+"','"+ dispatch_time + "', '"+ cisold + "','"+ camount +"','"+ctype+"', '"+login+"')\n"); - stmtu.executeUpdate("INSERT INTO time_sheet (tdate, callslip, customer, time_in, time_out, item_sold, amount, amount_collected, commision, dispatch_time, citem_sold, camount, ctype, login, paytype) Values ('" + tdate + "','" +callslip+ "','"+ tcustname + "','"+ time_in + "','" + time_out + "','"+ isold + "','"+ amount +"','"+amount_collected+"','"+ commision+"','"+ dispatch_time + "', '"+ cisold + "','"+ camount +"','"+ctype+"', '"+login+"', '"+paytype+"')"); + stmtu.executeUpdate("INSERT INTO time_sheet (tdate, callslip, customer, time_in, time_out, item_sold, amount, amount_collected, commision, dispatch_time, citem_sold, camount, ctype, login, paytype, odostart, odostop) Values ('" + tdate + "','" +callslip+ "','"+ tcustname + "','"+ time_in + "','" + time_out + "','"+ isold + "','"+ amount +"','"+amount_collected+"','"+ commision+"','"+ dispatch_time + "', '"+ cisold + "','"+ camount +"','"+ctype+"', '"+login+"', '"+paytype+"','"+odostart+"','"+odostop+"')"); stmt2.executeUpdate("update time_sheet set servsync=2 where tsid='"+tsid+"';"); } Modified: trunk/servsys/src/com/pandmservices/web/UniCash.java =================================================================== --- trunk/servsys/src/com/pandmservices/web/UniCash.java 2006-05-23 17:49:32 UTC (rev 115) +++ trunk/servsys/src/com/pandmservices/web/UniCash.java 2006-05-25 01:11:36 UTC (rev 116) @@ -1949,6 +1949,10 @@ { doAddPrevPrice(req, res, out, session, username); } + else if (action.equalsIgnoreCase("uploadinvcsvfile")) + { + doUploadInvCSVFile(req, res, out, session, username); + } else if (action.equalsIgnoreCase("saveprevprice")) { doSavePrevPrice(req, res, out, session, username); @@ -6389,7 +6393,14 @@ } //RELEASE_VERSION - vnumber = "2.29"; + vnumber = "2.30"; + if (dbvnumber.equalsIgnoreCase("2.29")) { + Statement stmtu2 = con.createStatement(); + int result230a = stmtu2.executeUpdate("alter table time_sheet add odostart int default 0 after callcount;"); + int result230b = stmtu2.executeUpdate("alter table time_sheet add odostop int default 0 after odostart;"); + int result230z = stmtu2.executeUpdate("UPDATE version set vnumber='2.30';"); + int result230x = stmtu2.executeUpdate("UPDATE version set vdate='2006-05-24';"); + } if (dbvnumber.equalsIgnoreCase("2.28")) { Statement stmtu2 = con.createStatement(); int result225z = stmtu2.executeUpdate("UPDATE version set vnumber='2.29';"); @@ -10260,6 +10271,25 @@ //res.sendRedirect(""+classdir+"UniCash?action=top"); } + private void doUploadInvCSVFile(HttpServletRequest req, HttpServletResponse res, PrintWriter out, HttpSession session, String username) + throws Exception + { + out.println("<html>"); + out.println("<head>"); + out.println("<title>Upload CSV File</title>"); + out.println("</head>"); + out.println("<form method=\"post\" action=\""+classdir+"UniCash?action=importinvcsv\" name=\"importcsv\">"); + out.println("<p>File :"); + out.println("<input type=\"file\" name=\"csvfile\" size=\"50\">"); + out.println("</p>"); + out.println("<p> <CENTER>"); + out.println("<INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Import\">"); + out.println("<INPUT TYPE=\"reset\">"); + out.println("</CENTER>"); + con.close(); + } + + private void doAddPrevPrice(HttpServletRequest req, HttpServletResponse res, PrintWriter out, HttpSession session, String username) throws Exception { @@ -11156,6 +11186,8 @@ String camount=null; String ctype=null; String paytype=null; + String odostart=null; + String odostop=null; int counter=0; for (int i = 0 ; i < v.size(); i++) @@ -11176,6 +11208,8 @@ camount = t.CAmount(); ctype=t.CType(); paytype=t.TPayType(); + odostart=t.OdoStart(); + odostop=t.OdoStop(); } @@ -11243,8 +11277,12 @@ out.println("<option value="+tc.Code()+">"+tc.Code()+" - "+tc.Category()+"</option>"); } out.println("</select></td></tr>"); -out.println("</table>"); -out.println("<input type=\"hidden\" name=\"timeadd\" value=1>"); +out.println("<tr><td>Odometer Start :</td>"); +out.println("<td><input type=\"text\" name=\"odostart\" value=\""+ odostart +"\"></td></tr>"); +out.println("<tr><td>Odometer Stop :</td>"); +out.println("<td><input type=\"text\" name=\"odostop\" value=\""+odostop +"\">"); + out.println("</table>"); +out.println("<input type=\"hidden\" name=\"timeadd\" value=1>"); out.println("<input type=\"hidden\" name=\"tsid\" value="+ttsid+">"); out.println("<p> <CENTER>"); out.println("<INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Save\">"); @@ -11310,20 +11348,13 @@ out.println("<option value="+tc.Code()+">"+tc.Code()+" - "+tc.Category()+"</option>"); } out.println("</select></td></tr>"); +out.println("<tr><td>Odometer Start :</td>"); +out.println("<td><input type=\"text\" name=\"odostart\" value=\"0\"></td></tr>"); +out.println("<tr><td>Odometer Stop :</td>"); +out.println("<td><input type=\"text\" name=\"odostop\" value=\"0\">"); out.println("<input type=\"hidden\" name=\"timeadd\" value=1>"); out.println("</table></td>"); out.println("<td><table>"); - /* Vector v; - v = TimeCat.getAllItems(con); - for (int i = 0 ; i < v.size(); i++) - { - TimeCat t = (TimeCat) v.elementAt(i); - int catnum = t.getCatnum(); - String category = t.Category(); - String code = t.Code(); - out.println("<tr><td>"+code+"</td><td>"+category+"</td></tr>"); - } - */ out.println("</table></td></tr></table>"); out.println("<p> <CENTER>"); out.println("<INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Save\">"); @@ -11469,12 +11500,14 @@ String casold = req.getParameter("casold"); String ctype = req.getParameter("ctype"); String paytype = req.getParameter("paytype"); + String odostart=req.getParameter("odostart"); + String odostop=req.getParameter("odostop"); if (callslip == null || callslip.length() < 1) { out.println("Callslip field blank please use back key and try again"); return; } else { - UniTimeSheet.UpdateItem(con, tsid, doFormatDateDb(getDateDb(listdate)), callslip, customer, dispatch_time, time_in, time_out, isold, asold, collected, commision, cisold, casold, ctype, username, paytype); + UniTimeSheet.UpdateItem(con, tsid, doFormatDateDb(getDateDb(listdate)), callslip, customer, dispatch_time, time_in, time_out, isold, asold, collected, commision, cisold, casold, ctype, username, paytype, odostart, odostop); out.println("Your item has been updated in the database<br>"); //doShowTimeSheet(req, res, out, session, username); con.close(); @@ -11501,12 +11534,14 @@ String paytype = req.getParameter("paytype"); String callcount = req.getParameter("callcount"); String techid=req.getParameter("techid"); + String odostart=req.getParameter("odostart"); + String odostop=req.getParameter("odostop"); if (callslip == null || callslip.length() < 1) { out.println("Callslip field blank please use back key and try again"); return; } else { - UniTimeSheet.addAdminTimeSheetItem(con, doFormatDateDb(getDateDb(listdate)), callslip, customer, dispatch_time, time_in, time_out, isold, asold, collected, commision, cisold, casold, ctype, techid, paytype, callcount); + UniTimeSheet.addAdminTimeSheetItem(con, doFormatDateDb(getDateDb(listdate)), callslip, customer, dispatch_time, time_in, time_out, isold, asold, collected, commision, cisold, casold, ctype, techid, paytype, callcount, odostart, odostop); out.println("Your item has been added to the database<br>"); //res.sendRedirect(""+classdir+"UniCash?action=showtimesheet"); @@ -11534,12 +11569,14 @@ String casold = req.getParameter("casold"); String ctype = req.getParameter("ctype"); String paytype = req.getParameter("paytype"); + String odostart=req.getParameter("odostart"); + String odostop=req.getParameter("odostop"); if (callslip == null || callslip.length() < 1) { out.println("Callslip field blank please use back key and try again"); return; } else { - UniTimeSheet.addTimeSheetItem(con, doFormatDateDb(getDateDb(listdate)), callslip, customer, dispatch_time, time_in, time_out, isold, asold, collected, commision, cisold, casold, ctype, username, paytype); + UniTimeSheet.addTimeSheetItem(con, doFormatDateDb(getDateDb(listdate)), callslip, customer, dispatch_time, time_in, time_out, isold, asold, collected, commision, cisold, casold, ctype, username, paytype, odostart, odostop); out.println("Your item has been added to the database<br>"); //res.sendRedirect(""+classdir+"UniCash?action=showtimesheet"); @@ -12555,8 +12592,10 @@ String TimeIn = ts.TimeIn(); String TimeOut = ts.TimeOut(); String DispatchTime = ts.DispatchTime(); + String odostart=ts.OdoStart(); + String odostop=ts.OdoStop(); - mbody=combinestring(mbody,"<br>Dispatched Time: "+DispatchTime+"<br>Time In: "+TimeIn+"<br>Time Out: "+TimeOut+"<br><br>"); + mbody=combinestring(mbody,"<br>Dispatched Time: "+DispatchTime+"<br>Time In: "+TimeIn+"<br>Time Out: "+TimeOut+"<br>Odometer Stop: "+odostop+"<br>Odometer Start: "+odostart+"<br><br>"); } @@ -13188,8 +13227,10 @@ String CAmount = ts.CAmount(); String ItemSold = ts.ItemSold(); String paytype = ts.TPayType(); + String odostart=ts.OdoStart(); + String odostop=ts.OdoStop(); - mbody=combinestring(mbody,"<br>Dispatched Time: "+DispatchTime+"<br>Time In: "+TimeIn+"<br>Time Out: "+TimeOut+"<br><br>"); + mbody=combinestring(mbody,"<br>Dispatched Time: "+DispatchTime+"<br>Time In: "+TimeIn+"<br>Time Out: "+TimeOut+"<br>Odometer Stop: "+odostop+"<br>Odometer Start: "+odostart+"<br><br>"); mbody=combinestring(mbody,"Item Sold: "+ItemSold+"<br>Amount Sold: "+Amount+"<br>Commision Item Sold: "+CItemSold+"<br>Commision Amount Sold: "+CAmount+"<br>Amount Collected: "+AmountCollected+"<br>Commision: "+Commision+"<br>Paid With: "+paytype+"<br>"); } @@ -13524,8 +13565,10 @@ String CAmount = ts.CAmount(); String ItemSold = ts.ItemSold(); String paytype = ts.TPayType(); + String odostop=ts.OdoStop(); + String odostart=ts.OdoStart(); - mbody=combinestring(mbody,"<br>Dispatched Time: "+DispatchTime+"<br>Time In: "+TimeIn+"<br>Time Out: "+TimeOut+"<br><br>"); + mbody=combinestring(mbody,"<br>Dispatched Time: "+DispatchTime+"<br>Time In: "+TimeIn+"<br>Time Out: "+TimeOut+"<br>Odometer Stop: "+odostop+"<br>Odometer Start: "+odostart+"<br><br>"); mbody=combinestring(mbody,"Item Sold: "+ItemSold+"<br>Amount Sold: "+Amount+"<br>Commision Item Sold: "+CItemSold+"<br>Commision Amount Sold: "+CAmount+"<br>Amount Collected: "+AmountCollected+"<br>Commision: "+Commision+"<br>Paid With: "+paytype+"<br>"); } @@ -16446,7 +16489,7 @@ out.println(timesheetdate+"<br>"); out.println("<table border=1 width=100%>"); - out.println("<th>Call Slip</th><th>Customer</th><th>Dispatched</th><th>Time In</th><th>Time Out</th><th>NC<br>Item Sold</th><th>NC<br>Amount</th><th>Com<br>Item Sold</th><th>Com<br>Amount</th><th>Amount Collected</th><th>Paid<br>With</th><th>Commision</th><th>Code</th><th>Delete</th>"); + out.println("<th>Call Slip</th><th>Customer</th><th>Dispatched</th><th>Time In</th><th>Time Out</th><th>NC<br>Item Sold</th><th>NC<br>Amount</th><th>Com<br>Item Sold</th><th>Com<br>Amount</th><th>Amount Collected</th><th>Paid<br>With</th><th>Commision</th><th>Code</th><th>Odometer<br>Start</th><th>Odometer<br>Stop</th><th>Delete</th>"); Vector v; @@ -16471,6 +16514,9 @@ String ctype = t.CType(); String paytype = t.TPayType(); int servsync = t.getServSync(); + String odostart=t.OdoStart(); + String odostop=t.OdoStop(); + counter++; if (counter==1) @@ -16483,9 +16529,9 @@ counter=0; } if (servsync==0) { - out.println("<td><a href="+classdir+"UniCash?action=edittimeentry&tsid="+tsid+"&tdate="+tdate+"&callslip="+callslip+"&customer="+customer+"&time_in="+time_in+"&time_out="+time_out+"&item_sold="+item_sold+"&amount="+amount+"&amount_collected="+amount_collected+"&paytype="+paytype+"&commision="+commision+"&action=timeupdate&tsid="+tsid+"&dispatch_time="+dispatch_time+">"+callslip+"</a></td><td>"+customer+"</td><td>"+dispatch_time+"</td><td>"+time_in+"</td><td>"+time_out+"</td><td>"+item_sold+"</td><td>"+amount+"</td><td>"+citem_sold+"</td><td>"+camount+"</td><td>"+amount_collected+"</td><td>"+paytype+"</td><td>"+commision+"</td><td>"+ctype+"</td><td><a href="+classdir+"UniCash?action=deletesingletime&tsid="+tsid+"&listdate="+timesheetdate+">Delete</a></td></tr>"); + out.println("<td><a href="+classdir+"UniCash?action=edittimeentry&tsid="+tsid+"&tdate="+tdate+"&callslip="+callslip+"&customer="+customer+"&time_in="+time_in+"&time_out="+time_out+"&item_sold="+item_sold+"&amount="+amount+"&amount_collected="+amount_collected+"&paytype="+paytype+"&commision="+commision+"&action=timeupdate&tsid="+tsid+"&dispatch_time="+dispatch_time+">"+callslip+"</a></td><td>"+customer+"</td><td>"+dispatch_time+"</td><td>"+time_in+"</td><td>"+time_out+"</td><td>"+item_sold+"</td><td>"+amount+"</td><td>"+citem_sold+"</td><td>"+camount+"</td><td>"+amount_collected+"</td><td>"+paytype+"</td><td>"+commision+"</td><td>"+ctype+"</td><td>"+odostart+"</td><td>"+odostop+"</td><td><a href="+classdir+"UniCash?action=deletesingletime&tsid="+tsid+"&listdate="+timesheetdate+">Delete</a></td></tr>"); } else { - out.println("<td><a href="+classdir+"UniCash?action=edittimeentry&tsid="+tsid+"&tdate="+tdate+"&callslip="+callslip+"&customer="+customer+"&time_in="+time_in+"&time_out="+time_out+"&item_sold="+item_sold+"&amount="+amount+"&amount_collected="+amount_collected+"&commision="+commision+"&action=timeupdate&tsid="+tsid+"&dispatch_time="+dispatch_time+">"+callslip+"</a></td><td>"+customer+"</td><td>"+dispatch_time+"</td><td>"+time_in+"</td><td>"+time_out+"</td><td>"+item_sold+"</td><td>"+amount+"</td><td>"+citem_sold+"</td><td>"+camount+"</td><td>"+amount_collected+"</td><td>"+paytype+"</td><td>"+commision+"</td><td>"+ctype+"</td><td>-</td></tr>"); + out.println("<td><a href="+classdir+"UniCash?action=edittimeentry&tsid="+tsid+"&tdate="+tdate+"&callslip="+callslip+"&customer="+customer+"&time_in="+time_in+"&time_out="+time_out+"&item_sold="+item_sold+"&amount="+amount+"&amount_collected="+amount_collected+"&commision="+commision+"&action=timeupdate&tsid="+tsid+"&dispatch_time="+dispatch_time+">"+callslip+"</a></td><td>"+customer+"</td><td>"+dispatch_time+"</td><td>"+time_in+"</td><td>"+time_out+"</td><td>"+item_sold+"</td><td>"+amount+"</td><td>"+citem_sold+"</td><td>"+camount+"</td><td>"+amount_collected+"</td><td>"+paytype+"</td><td>"+commision+"</td><td>"+ctype+"</td><td>"+odostart+"</td><td>"+odostop+"</td><td>-</td></tr>"); } } @@ -16538,7 +16584,7 @@ out.println("<BODY TEXT=#000000 LINK=#0000ff VLINK=#000080 BGCOLOR=#ffffff><p align=\"center\"> "); out.println("<table width=\"95%\" align=\"center\"><tr><td><h3>Date:"+ startdate+"<br>to<br>Date: "+enddate+"</h3></td><td><h3>Service Tech:"+ tech_name+"</h3></td></tr></table>"); out.println("<br><br><br><table align=\"center\" border=1 width=\"100%\" cellpadding=2>"); - out.println("<font=-2><th>Call Slip</th><th>Customer</th><th>Date</th><th>Item Sold</th><th>Amount</th><th>Amount<br>Collected</th><th>Commision</th>"); + out.println("<font=-2><th>Call Slip</th><th>Customer</th><th>Date</th><th>Item Sold</th><th>Amount</th><th>Amount<br>Collected</th><th>Commision</th><th>Odometer<br>Start</th><th>Odometer<br>Stop</th>"); } Vector v; v = UniTimeSheet.getAllItems(con,doFormatDateDb(getDateDb(startdate)),doFormatDateDb(getDateDb(enddate)), username ); @@ -16573,6 +16619,8 @@ String amount_collected = t.AmountCollected(); String commision = t.Commision(); String tdate = t.TDate(); + String odostart=t.OdoStart(); + String odostop=t.OdoStop(); counter++; double iamount = Double.parseDouble(amount); @@ -16595,10 +16643,10 @@ day_billed=day_billed+iamount; day_collected=day_collected+iamount_collected; if (subvalue.equalsIgnoreCase("email")) { -mbody=combinestring(mbody,"<tr><td>"+callslip+"</td><td>"+customer+"</td><td>"+tdate+"</td><td>"+item_sold+"</td><td>"+amount+"</td><td>"+amount_collected+"</td><td>"+commision+"</td></tr>"); +mbody=combinestring(mbody,"<tr><td>"+callslip+"</td><td>"+customer+"</td><td>"+tdate+"</td><td>"+item_sold+"</td><td>"+amount+"</td><td>"+amount_collected+"</td><td>"+commision+"</td><td>"+odostart+"</td><td>"+odostop+"</td></tr>"); } else { -out.println("<tr><td>"+callslip+"</td><td>"+customer+"</td><td>"+tdate+"</td><td>"+item_sold+"</td><td>"+amount+"</td><td>"+amount_collected+"</td><td>"+commision+"</td></tr>"); +out.println("<tr><td>"+callslip+"</td><td>"+customer+"</td><td>"+tdate+"</td><td>"+item_sold+"</td><td>"+amount+"</td><td>"+amount_collected+"</td><td>"+commision+"</td><td>"+odostart+"</td><td>"+odostop+"</td></tr>"); } } counter1++; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mol...@us...> - 2006-05-25 17:12:02
|
Revision: 117 Author: molnar_c Date: 2006-05-25 10:11:46 -0700 (Thu, 25 May 2006) ViewCVS: http://svn.sourceforge.net/servsys/?rev=117&view=rev Log Message: ----------- import inventory csv file is now complete. Modified Paths: -------------- trunk/servsys/TODO trunk/servsys/src/com/pandmservices/UniPreventative.java trunk/servsys/src/com/pandmservices/web/MainMenu.java trunk/servsys/src/com/pandmservices/web/UniCash.java Modified: trunk/servsys/TODO =================================================================== --- trunk/servsys/TODO 2006-05-25 01:11:36 UTC (rev 116) +++ trunk/servsys/TODO 2006-05-25 17:11:46 UTC (rev 117) @@ -6,16 +6,15 @@ - Upload checkme - move all select statements into other classes and out of UniCash.java. - if running on master server allow update of server dates. -- Edit Planned Service Pricing need to be added/fixed. -- Need to add CSV file import for Inventory Data ================================================================= RELEASE 2.30 ================================================================= (N) Added odometer start and stop to time sheet entries and databases. (N) Made sure that odometer readings are added to everything that is printed. +(N) Edit Planned Service Pricing has been added, tested and fixed. +(N) Need to add CSV file import for Inventory Data - ================================================================= RELEASE 2.29 ================================================================= Modified: trunk/servsys/src/com/pandmservices/UniPreventative.java =================================================================== --- trunk/servsys/src/com/pandmservices/UniPreventative.java 2006-05-25 01:11:36 UTC (rev 116) +++ trunk/servsys/src/com/pandmservices/UniPreventative.java 2006-05-25 17:11:46 UTC (rev 117) @@ -53,7 +53,22 @@ return V; } + public static Vector getAllItems(Connection c, String d) + throws SQLException, TodoException + { + Vector V = new Vector(); + Statement stmt = c.createStatement(); + ResultSet rs = stmt.executeQuery("SELECT * FROM prevprices where planrec='"+d+"' order by descript"); + while(rs.next()) + { + + UniPreventative t = new UniPreventative(c,rs.getInt("planrec")); + V.addElement(t); + } + return V; + } + public static void deleteItem(Connection con, String d) throws SQLException { @@ -87,6 +102,16 @@ stmt.executeUpdate("INSERT INTO prevprices (descript, tm_est, yr1, yr2, yr3) Values ('" + tdescription + "','" +tm_est+ "','"+ yr_1 + "','"+ yr_2 + "','"+ yr_3 + "')"); } +public static void UpdatePreventative(Connection con, String prevrec, String description, String tm_est, String yr_1, String yr_2, String yr_3, String newdate) + throws SQLException + { + String tdescription = description.replaceAll("'","''"); + Statement stmt = con.createStatement(); + stmt.executeUpdate("Update prevprices set descript='" + tdescription + "', tm_est='" +tm_est+ "', yr1='"+ yr_1 + "', yr2='"+ yr_2 + "', yr3='"+ yr_3 + "' where planrec='"+prevrec+"';"); + stmt.executeUpdate("update prevprices_date set dateupdated='"+newdate+"';"); + } + + public int getId() { return planrec; } public String getDescription() { return description; } Modified: trunk/servsys/src/com/pandmservices/web/MainMenu.java =================================================================== --- trunk/servsys/src/com/pandmservices/web/MainMenu.java 2006-05-25 01:11:36 UTC (rev 116) +++ trunk/servsys/src/com/pandmservices/web/MainMenu.java 2006-05-25 17:11:46 UTC (rev 117) @@ -177,6 +177,7 @@ mbody=combinestring(mbody," - <a href="+classdir+"UniCash?action=configforms target=phpmain>Forms</a><br>"); mbody=combinestring(mbody," - <a href="+classdir+"UniCash?action=edrespsform target=phpmain>Residential Planned Service Form</a><br>"); mbody=combinestring(mbody," - <a href="+classdir+"UniCash?action=editrateconfig target=phpmain>Rate Calculation Configuration</a><br>"); + mbody=combinestring(mbody," - <a href="+classdir+"UniCash?action=uploadinvcsvfile target=phpmain>Upload Inventory CSV File</a><br>"); } mbody=combinestring(mbody,"<br><a href="+classdir+"UniCash?action=menu&menu=reports target=nav>Reports</a><br>"); if (menu.equalsIgnoreCase("reports")) { Modified: trunk/servsys/src/com/pandmservices/web/UniCash.java =================================================================== --- trunk/servsys/src/com/pandmservices/web/UniCash.java 2006-05-25 01:11:36 UTC (rev 116) +++ trunk/servsys/src/com/pandmservices/web/UniCash.java 2006-05-25 17:11:46 UTC (rev 117) @@ -21,6 +21,21 @@ import java.sql.*; import javax.mail.*; import javax.mail.internet.*; +import org.apache.commons.fileupload.*; +import org.apache.commons.fileupload.disk.*; +import org.apache.commons.fileupload.servlet.*; +import java.io.File; +import java.io.IOException; +import java.util.Iterator; +import java.util.List; +import java.io.PrintWriter; +import javax.servlet.ServletInputStream; +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.FileUpload; +import org.apache.commons.fileupload.MultipartStream; +import org.apache.commons.io.*; +//import org.apache.commons.beanutils.*; +//import org.apache.commons.beanutils.MethodUtils; public class UniCash extends HttpServlet { @@ -1949,14 +1964,26 @@ { doAddPrevPrice(req, res, out, session, username); } + else if (action.equalsIgnoreCase("editprevprice")) + { + doAddPrevPrice(req, res, out, session, username); + } else if (action.equalsIgnoreCase("uploadinvcsvfile")) { doUploadInvCSVFile(req, res, out, session, username); } + else if (action.equalsIgnoreCase("importinvcsv")) + { + doImportInvCSVFile(req, res, out, session, username); + } else if (action.equalsIgnoreCase("saveprevprice")) { doSavePrevPrice(req, res, out, session, username); } + else if (action.equalsIgnoreCase("updateprevprice")) + { + doSavePrevPrice(req, res, out, session, username); + } else if (action.equalsIgnoreCase("listprevprice")) { doListPrevPrice(req, res, out, session, username); @@ -10274,14 +10301,18 @@ private void doUploadInvCSVFile(HttpServletRequest req, HttpServletResponse res, PrintWriter out, HttpSession session, String username) throws Exception { + out.println("<html>"); out.println("<head>"); out.println("<title>Upload CSV File</title>"); out.println("</head>"); - out.println("<form method=\"post\" action=\""+classdir+"UniCash?action=importinvcsv\" name=\"importcsv\">"); + out.println("<form method=\"post\" action=\""+classdir+"UniCash?action=importinvcsv\" name=\"importcsv\" enctype=\"multipart/form-data\">"); out.println("<p>File :"); - out.println("<input type=\"file\" name=\"csvfile\" size=\"50\">"); + out.println("<input type=\"file\" name=\"csvfile\">"); out.println("</p>"); + //out.println("<p>File Name:"); + out.println("<input type=\"hidden\" name=\"cvsfilename\" value=\"dsaa.csv\">"); + out.println("</p>"); out.println("<p> <CENTER>"); out.println("<INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Import\">"); out.println("<INPUT TYPE=\"reset\">"); @@ -10289,31 +10320,250 @@ con.close(); } + + private void doImportInvCSVFile(HttpServletRequest req, HttpServletResponse res, PrintWriter out, HttpSession session, String username) + throws Exception + { + Format formatter; + Calendar now = Calendar.getInstance(); + Date date = new Date(); + formatter = new SimpleDateFormat("yyyy-MM-dd"); + String s = formatter.format(date); + boolean isMultipart = FileUpload.isMultipartContent(req); + // Create a new file upload handler + DiskFileUpload upload = new DiskFileUpload(); + // parse this request by the handler + // this gives us a list of items from the request + List items = null; + + try { + items = upload.parseRequest(req); + } catch (FileUploadException e) { + // TODO Auto-generated catch block + //e.printStackTrace(); + out.println("Problem at Parse Request line 10326<br>"); + } + + Iterator itr = items.iterator(); + + while(itr.hasNext()) { + FileItem item = (FileItem) itr.next(); + + // check if the current item is a form field or an uploaded file + if(item.isFormField()) { + + // get the name of the field + String fieldName = item.getFieldName(); + + // if it is name, we can set it in request to thank the user + if(fieldName.equals("filename")) { + req.setAttribute("msg", "Thank You: " + item.getString()); + // later you can use it like this: + out.println(req.getAttribute("msg")+"<br>"); + } + + out.println(item.getFieldName() + " = " + item.getString() + "<br>"); + } + + else { + + // the item must be an uploaded file save it to disk. Note that there + // seems to be a bug in item.getName() as it returns the full path on + // the client's machine for the uploaded file name, instead of the file + // name only. To overcome that, I have used a workaround using + // fullFile.getName(). + File fullFile = new File(item.getName()); + //File savedFile = new File(getServletContext().getRealPath("/"), fullFile.getName()); + File savedFile = new File("/tmp/", fullFile.getName()); + try { + item.write(savedFile); + } catch (Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + out.println(e1+"<br>"); + //out.println("Exception in the file save portion of rountine<br>"); + } + out.println("<br>saved file = " + fullFile.getName()+"<br>"); + + // here is where we do the csv sql stuff. + try + { + // load the driver into memory + Class.forName("org.relique.jdbc.csv.CsvDriver"); + // create a connection. The first command line parameter is assumed to + // be the directory in which the .csv files are held + Connection conn = DriverManager.getConnection("jdbc:relique:csv:/tmp"); + // create a Statement object to execute the query with + Statement stmt = conn.createStatement(); + Statement stmt2 = con.createStatement(); + // Select the ID and NAME columns from sample.csv + ResultSet results = stmt.executeQuery("SELECT * FROM dsaa"); + // dump out the results + + int result1=stmt2.executeUpdate("DROP TABLE IF EXISTS inv_keycodes;"); + int result2=stmt2.executeUpdate("CREATE TABLE inv_keycodes (ID int(11) NOT NULL auto_increment,keycodep text,part_number text,sort_desc text,description text,manu text,location text,oh_qty double,qty_opt double,part_cost double,extended_cost double,sell_price text,stocknum text,orderuom text,conversion double,peak_oh text,off_peak_oh text,PRIMARY KEY (ID),UNIQUE ID (ID),KEY ID_2 (ID));"); + int counter=0; + while (results.next()) + { + + //---------------------------------------------------------- + + String keycodep=results.getString("Keycode"); + String part_number=results.getString("Part Number"); + String sort_desc=results.getString("Sort Description"); + String description=results.getString("Description"); + String manu=results.getString("Manufacturer"); + String location=results.getString("Location"); + String oh_qty=results.getString("Qty OH"); + String qty_opt=results.getString("Opt Qty"); + String part_cost=results.getString("ACTUAL COST"); + String extended_cost=results.getString("Extended Cost"); + String sell_price=results.getString("Sell Price"); + String stocknum=results.getString("Stock UOM"); + String orderuom=results.getString("Order UOM"); + String conversion=results.getString("Conversion"); + String peak_oh=results.getString("Peak Qty"); + String off_peak_oh=results.getString("Off-Peak Qty"); + if ((oh_qty==null)||(oh_qty.equalsIgnoreCase(""))) oh_qty="0"; + if ((qty_opt==null)||(qty_opt.equalsIgnoreCase(""))) qty_opt="0"; + if ((part_cost==null)||(part_cost.equalsIgnoreCase(""))) part_cost="0"; + if ((extended_cost==null)||(extended_cost.equalsIgnoreCase(""))) extended_cost="0"; + if ((sell_price==null)||(sell_price.equalsIgnoreCase(""))) sell_price="0"; + if ((conversion==null)||(conversion.equalsIgnoreCase(""))) conversion="0"; + + //if (oh_qty.length()<1) oh_qty="0"; + //if (qty_opt.length()<1) qty_opt="0"; + //if (part_cost.length()<1) part_cost="0"; + //if (extended_cost.length()<1) extended_cost="0"; + //if (sell_price.length()<1) sell_price="0"; + //if (conversion.length()<1) conversion="0"; + counter++; + //sort_desc=""; + if (!description.equalsIgnoreCase("DO NOT USE")) { + stmt2.executeUpdate("INSERT INTO inv_keycodes (keycodep, part_number, sort_desc, description, manu, location, oh_qty, qty_opt, part_cost, extended_cost, sell_price, stocknum, orderuom, conversion, peak_oh, off_peak_oh) Values ('"+keycodep+"','" +part_number+ "', '"+sort_desc+"','"+description+"','" +manu+ "', '"+location+"','"+oh_qty+"','" +qty_opt+ "', '"+part_cost+"','"+extended_cost+"','" +sell_price+ "', '"+stocknum+"','"+orderuom+"','" +conversion+ "', '"+peak_oh+"','"+off_peak_oh+"')"); + out.println("KEYCODE = " + results.getString("Keycode") + " PART NUMBER= " + results.getString("Part Number")+"<br>"); + } else { + + //---------------------------------------------------------- + + out.println("SKIP KEYCODE = " + results.getString("Keycode") + " PART NUMBER= " + results.getString("Part Number")+"<br>"); + } + } + + out.println("<br><H1>Records Imported = "+counter+"</h1><br>"); + + stmt2.executeUpdate("update inv_keycodes_date set dateupdated='"+s+"';"); + ResultSet rs = stmt2.executeQuery("SELECT * FROM inv_keycodes_date"); + while(rs.next()) + { + String nlocaldate=rs.getString("dateupdated"); + out.println("<br>New Local Date: "+ nlocaldate +"<br>"); + } + + + // clean up + results.close(); + stmt.close(); + conn.close(); + + } + catch(Exception e) + { + out.println("Oops-> " + e); + } + } + } + + con.close(); + } + + + private void OlddoImportInvCSVFile(HttpServletRequest req, HttpServletResponse res, PrintWriter out, HttpSession session, String username) + throws Exception + { + out.println("<html>"); + out.println("<head>"); + out.println("<title>Import Inventory CSV File</title>"); + out.println("</head>"); + + // Create a factory for disk-based file items + DiskFileItemFactory factory = new DiskFileItemFactory(); + +// Set factory constraints + //factory.setSizeThreshold(yourMaxMemorySize); + //factory.setRepositoryPath("upload1/"); + factory.setRepository(new File("/tmp")); + +// Create a new file upload handler + ServletFileUpload upload = new ServletFileUpload(factory); + + // Set overall request size constraint + //upload.setSizeMax(yourMaxRequestSize); + // Parse the request + List /* FileItem */ items = upload.parseRequest(req); + out.println("File Upload Complete"); + + + out.println("Import Complete<br>"); + con.close(); + } + private void doAddPrevPrice(HttpServletRequest req, HttpServletResponse res, PrintWriter out, HttpSession session, String username) throws Exception { + String action=req.getParameter("action"); + String descript=""; + String tm_est=""; + String yr1=""; + String yr2=""; + String yr3=""; + int tplanrec=0; + String planrec=""; + if (action.equalsIgnoreCase("editprevprice")) { + planrec= req.getParameter("planrec"); + Vector v; + v = UniPreventative.getAllItems(con, planrec); + int counter=0; + for (int i = 0 ; i < v.size(); i++) + { + UniPreventative t = (UniPreventative) v.elementAt(i); + tplanrec = t.getId(); + planrec=""+tplanrec+""; + descript= t.getDescription(); + tm_est = t.getTmEst(); + yr1 = t.getYr1(); + yr2 = t.getYr2(); + yr3 = t.getYr3(); + } + } out.println("<html>"); out.println("<head>"); - out.println("<title>Add Preventative Price</title>"); + out.println("<title>Add/Edit Preventative Price</title>"); out.println("</head>"); + if (action.equalsIgnoreCase("addprevprice")) { out.println("<form method=\"post\" action=\""+classdir+"UniCash?action=saveprevprice\" name=\"addcust\">"); + } + if (action.equalsIgnoreCase("editprevprice")) { + out.println("<form method=\"post\" action=\""+classdir+"UniCash?action=updateprevprice\" name=\"addcust\">"); + } out.println("<p>Description :"); - out.println("<input type=\"text\" name=\"descript\" size=\"40\">"); + out.println("<input type=\"text\" name=\"descript\" value=\""+descript+"\" size=\"40\">"); out.println("</p>"); out.println("<p>Time and Material Estimate :"); - out.println("<input type=\"text\" name=\"tm_est\" size=\"8\">"); + out.println("<input type=\"text\" name=\"tm_est\" value=\""+tm_est+"\" size=\"8\">"); out.println("</p>"); out.println("<p>1 Year :"); - out.println("<input type=\"text\" name=\"yr1\" size=\"8\">"); + out.println("<input type=\"text\" name=\"yr1\" value=\""+yr1+"\" size=\"8\">"); out.println("</p>"); out.println("<p>2 Year :"); - out.println("<input type=\"text\" name=\"yr2\" size=\"8\">"); + out.println("<input type=\"text\" name=\"yr2\" value=\""+yr2+"\" size=\"8\">"); out.println("</p>"); out.println("<p>3 Year :"); - out.println("<input type=\"text\" name=\"yr3\" size=\"8\">"); + out.println("<input type=\"text\" name=\"yr3\" value=\""+yr3+"\" size=\"8\">"); out.println("</p>"); out.println("<p> <CENTER>"); + out.println("<input type=\"hidden\" Name=\"planrec\" value=\""+planrec+"\">"); out.println("<INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Save\">"); out.println("<INPUT TYPE=\"reset\">"); out.println("</CENTER>"); @@ -10323,6 +10573,8 @@ private void doSavePrevPrice(HttpServletRequest req, HttpServletResponse res, PrintWriter out, HttpSession session, String username) throws Exception { + String action=req.getParameter("action"); + String planrec=req.getParameter("planrec"); String descript = req.getParameter("descript"); String yr3 = req.getParameter("yr3"); String yr2 = req.getParameter("yr2"); @@ -10333,15 +10585,18 @@ Date date = new Date(); formatter = new SimpleDateFormat("yyyy-MM-dd"); String s = formatter.format(date); - + if (action.equalsIgnoreCase("saveprevprice")) { UniPreventative.addPreventative(con, descript, tm_est, yr1, yr2, yr3, s); - out.println("Your item has been added to the database<br>"); - + } + if (action.equalsIgnoreCase("updateprevprice")) { + UniPreventative.UpdatePreventative(con, planrec, descript, tm_est, yr1, yr2, yr3, s); + } + out.println("Your item has been added to the database<br>"); con.close(); res.sendRedirect(""+classdir+"UniCash?action=listprevprice"); } - private void doListPhoneList(HttpServletRequest req, HttpServletResponse res, PrintWriter out, HttpSession session, String username) +private void doListPhoneList(HttpServletRequest req, HttpServletResponse res, PrintWriter out, HttpSession session, String username) throws Exception { int phonelistperm=Integer.parseInt(doGetEditCompPhoneList(username)); @@ -10437,7 +10692,7 @@ counter=0; } -out.println("<tr><td><a href=edprevprice.php?planrec="+planrec+">"+description+"</a></td><td>"+tm_est+"</td><td>"+yr_1+"</td><td>"+yr_2+"</td><td>"+yr_3+"</td></tr>"); +out.println("<tr><td><a href="+classdir+"UniCash?action=editprevprice&planrec="+planrec+">"+description+"</a></td><td>"+tm_est+"</td><td>"+yr_1+"</td><td>"+yr_2+"</td><td>"+yr_3+"</td></tr>"); //out.println("<tr><td><a href=edprevprice.php?planrec="+planrec+">"+description+"</a></td><td>"+tm_est+"</td><td>"+yr_2+"</td><td>"+yr_3+"</td></tr>"); } out.println("</table>"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |