⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 activitycalendar.jsp

📁 国外的一套开源CRM
💻 JSP
📖 第 1 页 / 共 3 页
字号:
  } catch (GenericEntityException e){ e.printStackTrace();
  }
  return returnCol;
}


public List findActivitiesByWeek(int month, int year, int day, GenericDelegator delegator){
  Date d = null;
  Calendar calendar = Calendar.getInstance();
  try{
    if(year <= 0) year = (calendar.get(Calendar.YEAR));
    if(month <= 0) month = (calendar.get(Calendar.MONTH) + 1);
    if(day <= 0) day = (calendar.get(Calendar.DAY_OF_MONTH));
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    d = df.parse(year + "-" + month + "-" + day);
    if(d != null){
      calendar.setTime(d);
    }
  }catch (Exception e){ e.printStackTrace();}

  BigInteger bigInt = new BigInteger(String.valueOf(calendar.get(Calendar.DAY_OF_WEEK)));
  calendar.add(Calendar.DAY_OF_MONTH, bigInt.negate().intValue());

  java.sql.Date startDate = new java.sql.Date(calendar.getTime().getTime());
  calendar.add(Calendar.DAY_OF_MONTH, 7);
  java.sql.Date endDate = new java.sql.Date(calendar.getTime().getTime());
  
  EntityCondition condition = new EntityConditionList( UtilMisc.toList( 
  		new EntityExpr( "openDate", EntityOperator.GREATER_THAN_EQUAL_TO, startDate),
  		new EntityExpr( "openDate", EntityOperator.LESS_THAN_EQUAL_TO, endDate)),
  		EntityOperator.AND );
  List returnCol = null;
  try {
    returnCol = delegator.findByCondition("Activity", condition, null, null);
  } catch (GenericEntityException e){ e.printStackTrace();
  }
  return returnCol;
}

public List findActivitiesByMonth(int month, int year, GenericDelegator delegator, String showUserPartyId){
	if(year <= 0) year = (Calendar.getInstance().get(Calendar.YEAR));
	if(month <= 0) month = (Calendar.getInstance().get(Calendar.MONTH) + 1);
	int nMonth = month - 1;
	Calendar cal = Calendar.getInstance();
	cal.set(Calendar.MONTH, nMonth);
	cal.set(Calendar.YEAR, year);

	ArrayList list = new ArrayList();
	cal.set(Calendar.DAY_OF_MONTH, 1);
	
	java.sql.Date startDate = new java.sql.Date(cal.getTime().getTime());
	cal.set(Calendar.DAY_OF_MONTH, daysInMonth[month]);
    java.sql.Date endDate = new java.sql.Date(cal.getTime().getTime());
	
    DynamicViewEntity dve = EntityHelper.createDynamicViewEntity( delegator, "Activity"); 
	dve.addMemberEntity("ActivityContact", "ActivityContact");
		dve.addViewLink("Activity", "ActivityContact", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("activityId", "activityId")));
		dve.addAlias("ActivityContact", "contactId", null, null, null, null, null);	
	
    EntityCondition condition = new EntityConditionList( UtilMisc.toList( 
  		new EntityExpr( "openDate", EntityOperator.GREATER_THAN_EQUAL_TO, startDate),
  		new EntityExpr( "openDate", EntityOperator.LESS_THAN_EQUAL_TO, endDate),
  		new EntityExpr( "contactId", EntityOperator.EQUALS, showUserPartyId),
  		new EntityExpr( "activityTypeId", EntityOperator.NOT_EQUAL, "todo")),
  		EntityOperator.AND );

	ArrayList orderBy = new ArrayList();
	orderBy.add("openDate");
	orderBy.add("openStartTime");
	List returnCol = null;
	try {
   	    returnCol =  EntityHelper.findByCondition( delegator, dve, condition, orderBy );
	} catch (GenericEntityException e){ e.printStackTrace();
	}
	return returnCol;
}

public List findToDoActivities(GenericDelegator delegator){
	// Show only "to-do" type activities on the to-do list.
	ArrayList orderBy = new ArrayList();
	orderBy.add("openDate");
	orderBy.add("openStartTime");
	List returnCol = null;
	try {
  	    returnCol = delegator.findByAnd("Activity", UtilMisc.toMap("activityTypeId", "todo"), orderBy);
	} catch (GenericEntityException e){ e.printStackTrace();
	}
	return returnCol;
}


public HashMap convertCollectonToMap(List l, String keyFieldName){
  Iterator i = l.iterator();
  GenericValue genericEntity = null;
  HashMap returnMap = new HashMap();
  while(i.hasNext()){
    genericEntity = (GenericValue)i.next();
    returnMap.put(genericEntity.get(keyFieldName), genericEntity);
  }
  return returnMap;
}

// End of declaration section.
%>

<%
// Begin main JSP section.
try {
	int month = (request.getParameter("month") == null ? currentMonth : Integer.parseInt(request.getParameter("month")));
	int day = (request.getParameter("day") == null ? currentDay : Integer.parseInt(request.getParameter("day")));
	int year = (request.getParameter("year") == null ? currentYear : Integer.parseInt(request.getParameter("year")));
	String action = (request.getParameter("action") == null ? "month" : request.getParameter("action"));

	String showUserPartyId = userInfo.getPartyId();
	if (request.getParameter("showUserPartyId")!=null) {
		showUserPartyId = request.getParameter("showUserPartyId");
	}

	Calendar cal = Calendar.getInstance();
	cal.set(Calendar.MONTH, month);
	cal.set(Calendar.DAY_OF_MONTH, day);
	cal.set(Calendar.YEAR, year);

	out.write("<TABLE WIDTH=\"100%\" BORDER=\"0\">\n");
	out.write(" <TR>\n");
	out.write("  <TD WIDTH=\"75%\">\n");
	if(action.equals("month")) {
		out.write(makeMonth(month, year, delegator, userInfo, showUserPartyId));
	} else if (action.equals("week")) {
		out.write(makeWeek(month, year, day, delegator));
	} else if (action.equals("day")) {
		out.write(makeDay(month, year, day, delegator));
	}
	out.write("  </TD>\n");
	out.write("  <TD WIDTH=\"25%\" VALIGN=\"top\">\n");
	out.write("");
	out.write("");
	out.write("");
	out.write("");
	out.write("");
	out.write("");
	out.write("");
	out.write("");
	out.write("");
	out.write("");
	out.write("");
	out.write("");
	out.write("");
	out.write("");
	out.write("");
%>


<%if(action.equals("day")){%>
<table width="100%" border="1" style="border: 0.02cm solid black; border-collapse: collapse; table-layout: fixed; ">
<tr valign="top"><td height='75%'>To-do List for the Day</td></tr>
<tr valign="top">
  <td height='75%'>
    <%
      List acts = findActivitiesByDate(month, day, year, delegator);
      if(acts != null && acts.size() >= 1){
       GenericValue activitiesGV[] = (GenericValue[])acts.toArray(new GenericValue[0]);
       GenericValue activityGV = null;
       for(int i=0; i < activitiesGV.length;i++){
       activityGV = activitiesGV[i];
    %>
      <a href="<ofbiz:url>/activityPopup</ofbiz:url>?activityId=<%=activityGV.getString("activityId")%>&action=search"><%=activityGV.getString("activityName")%></a> - <%=activityGV.getString("openDate")%><br>
    <% }
      } else {%>
  No activities found for <%=monthLabel[month]%>, <%=year%>
    <%} %>
  </td>
</tr>
<tr valign="top">
 <td height='25%'>
  <button onclick='window.open( "<ofbiz:url>/activityAdd</ofbiz:url>", "", "menubar=no,scrollbars=no,toolbar=no,directories=no,height=200,width=300", "");'>Quick Create</button>
 </td></tr>
</table>
<%}%>

<!--jmn-->
<Table>
<TR><TD CLASS="moduleLine"><IMG SRC="/sfaimages/woman.jpg"></td></tr>
</Table>
<table  CLASS="calendarTable" width="100%">
<tr valign="top"><td height='75%'>To-do List</td></tr>
<tr valign="top" CLASS="calendarDay">
  <td CLASS="calendarWeekday">
    <%
      List acts = findToDoActivities(delegator);
      if(acts != null && acts.size() >= 1){
       GenericValue activitiesGV[] = (GenericValue[])acts.toArray(new GenericValue[0]);
       GenericValue activityGV = null;
       for(int i=0; i < activitiesGV.length;i++){
        activityGV = activitiesGV[i];
		String activityId = activityGV.getString("activityId");
		String activityName = activityGV.getString("activityName");
//         out.write("<A HREF=\"/sfa/control/activity/activityPopup?activityId=" + activityId +
//		 	"&action=search\">" + activityName + "</A><BR>\n");
		out.write("<A HREF='javascript:var dummy=window.open(\"/sfa/control/activityPopup?action=" +
			UIScreenSection.ACTION_SHOW + "&activityId=" + activityId +
			"\", \"activityPopup\", " +
			"\"menubar=no,scrollbars=no,toolbar=no,directories=no,top=100," +
			"left=100,height=600,width=1024\", \"\")'>" +
			 activityName + "</A><BR>\n");
		}
      } else {%>
  No Tasks Found
    <%} %>
  </td>
</tr>
<!--<tr valign="top">
 <td height='25%'>
  <button onclick='window.open( "<ofbiz:url>/activityAdd</ofbiz:url>", "", "menubar=no,scrollbars=no,toolbar=no,directories=no,height=200,width=300", "");'>Quick Create</button>
 </td></tr>-->
<!--<tr valign="top"><td height='25%'><button onclick='window.open( "<ofbiz:url>/activityAdd</ofbiz:url>", "", "menubar=no,scrollbars=no,toolbar=no,directories=no,height=200,width=300", "");'>window</button></td></tr>-->
</table>


<%} catch (Exception e){ e.printStackTrace(); }%>
</td>
</tr>
</table>

<%@ include file="/includes/footer.jsp" %>


<%
/*  from makeWeek
    results = getGenericValue(dealDateColl, "projectedCloseDate", (year + "-" + month + "-" + firstDay ));
    if(results.size() > 0){
      for(int j=0;j<results.size();j++){
        genericValue = (GenericValue)results.get(j);
        returnString.append("<b>Deal Projected Close</b><br>");
        returnString.append("Deal Name:&nbsp;<a href=\"/sfa/control/dealDetail?dealId=");
        returnString.append(genericValue.get("dealId"));
        returnString.append("\" >");
        returnString.append(genericValue.get("dealName") + "</a><br>");
        returnString.append("Amount:&nbsp;$" + genericValue.get("amount") + "<br>");
        returnString.append("Probability:&nbsp;" + genericValue.get("probability") + "<br>");
        returnString.append("<br>");
        }
      }

    results = getGenericValue(activityDateColl, "openDate", (year + "-" + month + "-" + firstDay ));
    if(results.size() > 0){
      for(int j=0;j<results.size();j++){
        genericValue = (GenericValue)results.get(j);
        returnString.append("<b>Activity</b><br>");
        returnString.append("Activity Name:&nbsp;<a href=\"/sfa/control/activityDetail?activityId=");
        returnString.append(getFieldValue(activityDateColl, "activityName", genericValue.getString("activityName"), "activityId"));
        returnString.append(" \" >");
        returnString.append(genericValue.get("activityName"));
        returnString.append("</a><br>");
        returnString.append("Activity Description:");
        returnString.append(genericValue.get("activityDescription"));
        returnString.append("<br>");
      }
    }

    results = getDateTimeGenericValue(alertsColl, "alertDateTime", (year + "-" + month + "-" + firstDay ), "yyyy-MM-dd");
    if(results.size() > 0){
      for(int j=0;j<results.size();j++){
        genericValue = (GenericValue)results.get(j);
        returnString.append("<b>Alert:</b><br>");
        returnString.append("Alert Description:&nbsp;");
        returnString.append(genericValue.get("alertDescription"));
        returnString.append("<br>");
      }
    }
*/

%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -