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

📄 forecast.jsp

📁 国外的一套开源CRM
💻 JSP
📖 第 1 页 / 共 3 页
字号:
<%
  if ( opportunityHasProducts )
  {
     for(int l=0;l<productCategoryValues.length;l++){
        productCategoryValue = productCategoryValues[l];
        %><td><%=productCategoryValue.getString("description")%></td>
<%
     }
%>
    <td>Non-Product Amounts</td>
<%
  }
%>
  </tr>
<%
  GenericValue dealStatusValues[] = (GenericValue[])dealStatus.toArray(new GenericValue[0]);
  GenericValue dealStatusValue = null;
  int row = 0;
  String rowClass = "";
  for(row=0;row<dealStatusValues.length;row++){
    dealStatusValue = dealStatusValues[row];
    String dealStatusId = dealStatusValue.getString("codeId");
    String dealStatusName = dealStatusValue.getString("codeValue");
    rowClass = (((row % 2) != 0) ? "tabularSectionField1" : "tabularSectionField2");
%>
  <tr ALIGN="right" class="<%=rowClass%>">
    <td ALIGN="left" ><%=dealStatusName%></td>
    <td><%=countDealsForStatus(dealList, dealStatusId)%></td>
<%
    dealTotal = 0.0;
    if ( opportunityHasProducts )
        dealTotal = sumAllDealAmountsForStatus(dealList, opportunityProductList, productsList, dealStatusId);
    else
        dealTotal = sumAllDealAmountsForStatus(dealList, dealStatusId);
%>
    <td>$<%=decimalFormat.format(dealTotal)%></td>
    <%
     if ( opportunityHasProducts )
     {
       for(int l=0;l<productCategoryValues.length;l++)
       {
         productCategoryValue = productCategoryValues[l];
    %>
        <td>$<%=decimalFormat.format(sumDealProductsForStatusAndProductCategory(dealList, opportunityProductList, productsList, dealStatusId, productCategoryValue.getString("productCategoryId")))%></td>
      <%}%>
    <td>$<%=decimalFormat.format(sumDealAmountsForStatusWithoutProducts(dealList, dealStatusId))%></td>
    <%}%>
  </tr>
<%
 }
 rowClass = (((row % 2) != 0) ? "tabularSectionField1" : "tabularSectionField2");
%>

    <tr align="right" class="<%=rowClass%>" style="font-weight: bold;">
    <td ALIGN="left">Total:</td>
    <td><%=dealList.size()%></td>
<%
    dealTotal = 0.0;
    if ( opportunityHasProducts )
       dealTotal = sumAllDeals(dealList, opportunityProductList, productsList);
    else
       dealTotal = sumAllDeals(dealList);
%>
    <td>$<%=decimalFormat.format(dealTotal)%></td>
    <% if ( opportunityHasProducts )
       {
         for(int l=0;l<productCategoryValues.length;l++)
         {
           productCategoryValue = productCategoryValues[l];%>
           <td>$<%=decimalFormat.format(sumDealProductsForProductCategory(dealList, opportunityProductList, productsList, productCategoryValue.getString("productCategoryId"))) %></td>
    <%   } %>
    <td>$<%=decimalFormat.format(sumDealAmountsWithoutProducts(dealList))%></td>
    <% } %>

  </tr>
  </table>


<%
  GenericValue dealValue = null;
try {
  if(view.equals("individual")) {%>

  <table width="100%" class="freeFormSectionTitleTable">
    <tr>
      <td>
       <%=userName%>'s
        <% if(view.equals("role")) { %>
          Rollup
        <% } else { %>
          Individual
        <% } %>
	   Quota for <%=quarterString%>-<%=year%>
      </td>
      </td>
    </tr>
  </table>

 <table width="*" border="0">
  <tr>
   <td>
    <table class="freeFormSectionDisplayTable" width="*">
     <tr>
<%
    int quotaNdx = 0;
    Iterator forecastI = forecastList.iterator();
    while (forecastI.hasNext()) {
        GenericValue forecastGV = (GenericValue) forecastI.next();
        long forecastMonth = forecastGV.getLong("month").longValue();
        double quotaAmount = forecastGV.getDouble("quotaAmount").doubleValue();
        String quotaAmountString = decimalFormat.format(quotaAmount);

%>
      <td class="freeFormSectionLabel">
       <%=quarterMonthNames[quotaNdx]%>:
      </td>
      <td>
       <input type="text" name="quota<%=String.valueOf(quotaNdx)%>" size="8" maxlength="8" value="<%=quotaAmountString%>" class="freeFormSectionInputBox">
      </td>

<%
        quotaNdx++;
    }
%>

      <td>
       <input type="submit" name="saveQuotaButton" class="button" value="Save">
      </td>
     </tr>
    </table>
   </td>
  </tr>
  <tr>
   <td width="*">
   </td>
  </tr>
 </table>
</form>

  <table width="100%" class="freeFormSectionTitleTable">
    <tr>
      <td>
       <%=userName%>'s Forecasted Active Opportunities
      </td>
    </tr>
  </table>
 <table class="tabularSectionDisplayTable" width="*">
  <tr class="tabularSectionLabel">
      <td>Quarter</td>
      <td>Opportunity Name</td>
      <td>Status</td>
      <td>Stage</td>
      <td>Account</td>
      <td>Projected Close Date</td>
      <td>Forecast Amount</td>
    </tr>
    <%
     rowClass = "";
     row=0;
     for(int iz=0;iz<dealValues.length;iz++) {
       dealValue = dealValues[iz];
       Calendar calendar = Calendar.getInstance();
       calendar.setTime(dealValue.getDate("projectedCloseDate"));
       int status = Integer.valueOf(dealValue.getString("dealStatusId")).intValue();
       if(status != 1) {
         row++;
         rowClass = (((row % 2) != 0) ? "tabularSectionField1" : "tabularSectionField2");
         
         String accountId = dealValue.getString("accountId");
         String accountName = "";
         String industry = "";
         
         GenericValue acctGV = getAccount( delegator, accountId, accountMap );
         if ( acctGV != null )
         {
         	accountName = acctGV.getString("accountName");
         	industry = acctGV.getString("industry");
         }

     %>
  <tr ALIGN="right" class="<%=rowClass%>">
      <td><%=quarterString%>-<%=year%></td>
      <td><a href="<ofbiz:url>/deals?dealId=<%=dealValue.getString("dealId")%></ofbiz:url>"><%=dealValue.getString("dealName")%></a></td>
      <td><%=getFieldValue(dealStatus, "codeId", dealValue.getString("stageId"), "codeValue")%></td>
      <td><%=getFieldValue(dealStage, "stageId", dealValue.getString("stageId"), "stageName")%></td>
      <td><%=accountName%></td>
      <td><%=dealValue.getDate("projectedCloseDate")%></td>
      <td align="right">$<%=decimalFormat.format(getAmountForDeal(dealList, dealValue.getString("dealId")))%>
    </tr>
     <% } %>
  <% } %>
  </table>
<%
}
}catch(Exception e1){ e1.printStackTrace(); }

try{
  if(view.equals("role")){
    for(int i=0;i<subRoles.size();i++){

      //Get contacts for a role.
      HashMap contactMap = new HashMap();
      contactMap.put("roleId", subRoles.get(i));
      List contactsList = delegator.findByAnd("Contact", contactMap, null);
      GenericValue contactsValues[] = (GenericValue[])contactsList.toArray(new GenericValue[0]);
      GenericValue contactsValue = null;
      for(int j=0;j<contactsValues.length;j++){
        contactsValue = contactsValues[j];


      DynamicViewEntity dveC = EntityHelper.createDynamicViewEntity( delegator, "Deal"); 
      dveC.addMemberEntity("EntityAccess", "EntityAccess");
      dveC.addViewLink("Deal", "EntityAccess", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("dealId", "entityId")));
      dveC.addMemberEntity("TeamMember", "TeamMember");
      dveC.addViewLink("EntityAccess", "TeamMember", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("partyId", "teamId")));

      dveC.addAlias("TeamMember", "teamOwner", null, null, null, null, null);
      dveC.addAlias("TeamMember", "partyId", null, null, null, null, null);
      dveC.addAlias("EntityAccess", "entity", null, null, null, null, null);
      dveC.addAlias("EntityAccess", "partyEntityType", null, null, null, null, null);
     
      ArrayList listC = new ArrayList();
      listC.add(new EntityExpr("teamOwner", EntityOperator.EQUALS, "Y"));
      listC.add(new EntityExpr("projectedCloseDate", EntityOperator.LESS_THAN_EQUAL_TO, new java.sql.Date( CalendarUtil.getMaximumQuarterDate(month, year, fyStartMonth).getTime())));
      listC.add(new EntityExpr("projectedCloseDate", EntityOperator.GREATER_THAN_EQUAL_TO, new java.sql.Date( CalendarUtil.getMinimumQuarterDate(month, year, fyStartMonth).getTime())));
      listC.add(new EntityExpr("isInForecast", EntityOperator.EQUALS, "Y"));
      listC.add(new EntityExpr("entity", EntityOperator.EQUALS, "Deal"));
      listC.add(new EntityExpr("partyEntityType", EntityOperator.EQUALS, "Team"));
      listC.add(new EntityExpr("partyId", EntityOperator.EQUALS, contactsValue.getString("contactId")));
      listC.add(new EntityExpr("ownerId", EntityOperator.EQUALS, contactsValue.getString("contactId")));

  
      EntityCondition conditionC = new EntityConditionList(listC, EntityOperator.AND);

      //Get opportunities for a contact
      dealList = EntityHelper.findByCondition(delegator, dveC, conditionC, null);
      if(dealList.size() > 0){
        dealValues = (GenericValue[])dealList.toArray(new GenericValue[0]);
%>


  <table width="100%" class="freeFormSectionTitleTable">
    <tr>
      <td>
        <%=contactsValue.getString("firstName")%>&nbsp;<%=contactsValue.getString("lastName")%>'s Forecasted Active Opportunities
      </td>
    </tr>
  </table>

 <table class="tabularSectionDisplayTable" width="*">
  <tr class="tabularSectionLabel">
      <td>Quarter</td>
      <td>Opportunity Name</td>
      <td>Status</td>
      <td>Stage</td>
      <td>Account</td>
      <td>Projected Close Date</td>
      <td>Forecast Amount</td>
    </tr>
    <%
     rowClass = "";
     row=0;
     for(int iz=0;iz<dealValues.length;iz++) {
       dealValue = dealValues[iz];
       Calendar calendar = Calendar.getInstance();
       calendar.setTime(dealValue.getDate("projectedCloseDate"));
       int status = Integer.valueOf(dealValue.getString("dealStatusId")).intValue();
       if(status != 1) {
         row++;
         rowClass = (((row % 2) != 0) ? "tabularSectionField1" : "tabularSectionField2");
         
         String accountId = dealValue.getString("accountId");
         String accountName = "";
         String industry = "";
         
         GenericValue acctGV = getAccount( delegator, accountId, accountMap );
         if ( acctGV != null )
         {
         	accountName = acctGV.getString("accountName");
         	industry = acctGV.getString("industry");
         	if ( industry == null )
         		industry = "";
         }
         
     %>
  <tr ALIGN="right" class="<%=rowClass%>">
      <td><%=quarterString%>-<%=year%></td>
      <td><a href="<ofbiz:url>/deals?dealId=<%=dealValue.getString("dealId")%></ofbiz:url>"><%=dealValue.getString("dealName")%></a></td>
      <td><%=getFieldValue(dealStatus, "codeId", dealValue.getString("dealStatusId"), "codeValue")%></td>
      <td><%=getFieldValue(dealStage, "stageId", dealValue.getString("stageId"), "stageName")%></td>
      <td><%=accountName%></td>
      <td><%=dealValue.getDate("projectedCloseDate")%></td>
      <td align="right">$<%=decimalFormat.format(getAmountForDeal(dealList, dealValue.getString("dealId")))%>
    </tr>
     <% } %>
  <% } %>
  </table>


<%      } //dealList size
      } //contactValue
    }  // subRoles
  }  //role

}catch(Exception e){ e.printStackTrace(); }


%>

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

⌨️ 快捷键说明

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