Edit C:\galaxie\deploy\Tomcat6\webapps\galaxie\sales\opportunity_\edit.jsp
<% /****************************************************************************** * Copyright (c) 2000-2011 E-DEAL * * E-DEAL S.A. * 41, rue Périer * 92120 Montrouge * France * * T: +33 (0)1 73 03 29 80 * F: +33 (0)1 73 01 69 77 * http://www.e-deal.com * * La diffusion de ce code source sous quelque forme que ce soit sans * l'autorisation de E-DEAL est interdite. * * Vous êtes autorisés à modifier ce code source uniquement pour votre usage * propre et sous réserve que les mentions de copyright demeurent intactes. * * Ce code est fourni en l'état. Aucune garantie d'aucune sorte, explicite ou * implicite n'est donnée. En aucun cas E-DEAL ne pourra être tenu pour * responsable des dommages pouvant résulter de l'utilisation de ce code * source. ******************************************************************************/ %> <%@ page session="true"%> <%@ page import="com.edeal.frontline.navigation.EdealBigTabsNavigation"%> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@ page import="com.edeal.frontline.FlContext" %> <%@ page import="com.edeal.frontline.Utils" %> <%@ page import="com.edeal.frontline.FieldNotInitializedException" %> <%@ page import="com.edeal.frontline.DataDictionary" %> <%@ page import="com.edeal.frontline.SalesInvestBean" %> <%@ page import="java.util.Date" %> <%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %> <jsp:useBean class="com.edeal.frontline.OpportunityBean" id="Opportunity" scope="request"/> <% final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(getClass()); FlRequest flRequest = new FlRequest(request); FlContext context = flRequest.getContext(); DataDictionary dico = context.getDataDictionary(); String strActID = (String)session.getAttribute("actorID"); String id = null; boolean isCreate = false; try { id = Opportunity.getID(); } catch (FieldNotInitializedException fnie) { isCreate = true; } String salesModel = context.getContextParameter("SalesModel"); boolean isB2C = "B2C".equalsIgnoreCase(salesModel); String oppPerID = null; try { oppPerID = Opportunity.getOppPerID(); } catch (Exception e) { } String oppStoID = null; try { oppStoID = Opportunity.getOppStoID(); } catch (FieldNotInitializedException e) { oppStoID =""; } double oppNetApayer_ = 0; try{ oppNetApayer_ = (Double)Opportunity.getCustomProperty("OppNetApayer_"); }catch(FieldNotInitializedException fe){ } double oppTotalHT_ = 0; try{ oppTotalHT_ = (Double)Opportunity.getCustomProperty("OppTotalHT_"); }catch(FieldNotInitializedException fe){ } double oppTotalTVA_ = 0; try{ oppTotalTVA_ = (Double)Opportunity.getCustomProperty("OppTotalTVA_"); }catch(FieldNotInitializedException fe){ } double oppTotalTTC_ = 0; try{ oppTotalTTC_ = (Double)Opportunity.getCustomProperty("OppTotalTTC_"); }catch(FieldNotInitializedException fe){ } double oppTotalTPF_ = 0; try{ oppTotalTPF_ = (Double)Opportunity.getCustomProperty("OppTotalTPF_"); }catch(FieldNotInitializedException fe){ } double oppAcompte_ = 0; try{ oppAcompte_ = (Double)Opportunity.getCustomProperty("OppAcompte_"); }catch(FieldNotInitializedException fe){ } String oppAffiliationCtID_ = null; try { oppAffiliationCtID_ = (String)Opportunity.getCustomProperty("OppAffiliationCtID_"); } catch (FieldNotInitializedException e) { } String oppCmdTypoID = null; try { oppCmdTypoID = (String)Opportunity.getCustomProperty("OppCmdTypo_"); } catch (FieldNotInitializedException e) { } String devConc = null; try { devConc = (String)Opportunity.getCustomProperty("OppNumDev_"); } catch (FieldNotInitializedException e) { } String titreOnglet = ""; String titrePage = ""; // Détecter statut de l'opportunité String statutID = null;; try { statutID = Opportunity.getOppStoID(); } catch (FieldNotInitializedException e) { statutID = ""; } // Date de la commande Date dateCmd = null;; try { dateCmd = (Date) Opportunity.getCustomProperty("OppDatComm_"); } catch (FieldNotInitializedException e) { // Date du jour : Date dateDuJour = new Date(); Opportunity.setCustomProperty("OppDatComm_", dateDuJour); } //date devis Date datedevis = null;; try { datedevis = (Date) Opportunity.getCustomProperty("OppDatDev_"); } catch (FieldNotInitializedException e) { // Date du jour : Date dateDuJour = new Date(); Opportunity.setCustomProperty("OppDatDev_", dateDuJour); } //date facture Date datefact = null; try { datefact = (Date) Opportunity.getCustomProperty("OppDatFact_"); } catch (FieldNotInitializedException e) { // Date du jour : datefact = new Date(); Opportunity.setCustomProperty("OppDatFact_", datefact); } // ramener les ids des 5 statuts de l'opportunité String devisStateID = null; String devrefStateID = null; String commandeStateID = null; String factureStateID = null; String besoinStateID = null; String avoirStateID = null; try { devisStateID = dico.getRefIdByCode("Sto", "Te1", "DEV"); devrefStateID = dico.getRefIdByCode("Sto", "Te1", "DEVREF"); commandeStateID = dico.getRefIdByCode("Sto", "Te1", "ORD"); factureStateID = dico.getRefIdByCode("Sto", "Te1", "FAC"); besoinStateID = dico.getRefIdByCode("Sto", "Te1", "NEED"); avoirStateID = dico.getRefIdByCode("Sto", "Te1", "AVO"); } catch (Exception e) { devisStateID = ""; devrefStateID = ""; commandeStateID = ""; factureStateID = ""; besoinStateID = ""; avoirStateID = ""; } // si on a aun Avoir cad une nouvelle Opp dans l'état facture //si on est dans le cas de l'avoir les quantités doivent être toutes négatives String typeFact = flRequest.getParameter("typeFact"); Boolean QteProdNegFlag = null; if(typeFact != null && statutID.equalsIgnoreCase(factureStateID)) { QteProdNegFlag = true; } String oppFactAvoir_ = null; if (statutID.equalsIgnoreCase(factureStateID)) { oppFactAvoir_ = "false"; } try { oppFactAvoir_ = (String)Opportunity.getCustomProperty("OppFactAvoir_"); } catch (Exception e) { } String oppRefFact_= null; try { oppRefFact_ = (String)Opportunity.getCustomProperty("OppReferFact_"); } catch (Exception e) { } // on envoie une famille de produits bien définie dans le cas où l'on vient du contrat String prdFamilleProduit_ = null; try { prdFamilleProduit_ = (String)flRequest.getAttribute("initPrdFamilleProduit_"); } catch (Exception e) { } if(prdFamilleProduit_ == null){ String oppCmdTypo_= null; try { oppCmdTypo_ = (String)Opportunity.getCustomProperty("OppCmdTypo_"); } catch (Exception e) { } if(oppCmdTypo_!=null){ String refIDStaci = null; try{ refIDStaci = dico.getRefIdByCode("Tc_", "Te1", "STASI"); }catch(Exception e){ } if(refIDStaci!=null){ if(oppCmdTypo_.equals(refIDStaci)) prdFamilleProduit_ = "STACI"; } } } /* evo ne plus imposer STACI pour les affiliés if (prdFamilleProduit_ == null && oppAffiliationCtID_ != null) { try { prdFamilleProduit_ = "STACI"; } catch (Exception e) { } } */ if(statutID.equalsIgnoreCase(devisStateID)) { titreOnglet = Utils.getMessage(session, "LF078", "Détail devis"); titrePage = Utils.getMessage(session, "L653F", "Devis"); } else if(statutID.equalsIgnoreCase(commandeStateID)) { titreOnglet = Utils.getMessage(session, "LF077", "Détail commande"); titrePage = Utils.getMessage(session, "LF035", "Commande"); } else if((statutID.equalsIgnoreCase(factureStateID)) || (statutID.equalsIgnoreCase(avoirStateID))) { //changer "LF074" par "L820B" http://u-project2.umanis.com/view.php?id=36849 titreOnglet = Utils.getMessage(session, "L820B", "Détail facture"); titrePage = Utils.getMessage(session, "F60D4", "Facture"); } else { titreOnglet = Utils.getMessage(session, "LF079", "Détail opportunité"); titrePage = Utils.getMessage(session, "L3025", "Opportunité"); } // compte client String contratID = null; try { contratID = (String) Opportunity.getCustomProperty("OppCompteClient_"); } catch (FieldNotInitializedException e) { } %> <script> function doOnLoad(){ doRefreshPros(); } function doRefreshPros() { doAjax('<fl:webapp/>/refresh_prodOpp_ajax.fl?listOnly=true&OppID=<%= id %>'); } function refreshPros() { setTimeout("doRefreshPros();", 20); } var strURL; function clearEntreprisePersonne() { document.forms[0].elements["OppPerID"].value = ''; document.forms[0].elements["lblOppPerID"].value = ''; } function doSelectEntry(){ var fenetreChoix; fenetreChoix = window.open('<fl:webapp/>/select_entry.fl?typ=Person&EntID='+encodeURIComponent(document.forms[0].OppEntID.value)+'&PerID='+encodeURIComponent(document.forms[0].OppPerID.value), 'ChoixEntreprisePersonne' , 'menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=770,height=360'); } function doOppEntIDChange(){ clearEntreprisePersonne(); } function verifPresenceArticles() { var f = document.forms[0]; presence = false; presenceClient = true; if(f.presenceArticles.value == 'true') { presence = true; } if (!checkField(f.OppEntID.value, 'text', true, '', '') && !checkField(f.OppPerID.value, 'text', true, '', '')) { presenceClient = false; } if(presence && presenceClient) { needToConfirm = false; submit(); } else if(presence && !presenceClient) { alert("<fl:getMessage code="MF096" alt="Veuillez sélectionner un client." js="true"/>"); } else if(!presence && presenceClient) { alert("<fl:getMessage code="MF0E5" alt="Vous devez choisir au moins un produit." js="true"/>"); } else if(!presence && !presenceClient) { alert("<fl:getMessage code="MF0E6" alt="Veuillez sélectionner un client. \n Vous devez choisir au moins un produit." js="true"/>"); } } <% if(isCreate){ %> var needToConfirm = true; window.onbeforeunload = confirmExit; function confirmExit() { if (needToConfirm){ var urldelete = ''; <% if((statutID != null) && (statutID.equalsIgnoreCase(devisStateID))) {%> urldelete = '<fl:webapp/>/delete_devis.fl?&id='; <%} else if((statutID != null) && (statutID.equalsIgnoreCase(commandeStateID))) {%> urldelete = '<fl:webapp/>/delete_commande.fl?&id='; <%} else if(((statutID != null) && (statutID.equalsIgnoreCase(factureStateID))) || ((statutID != null) && (statutID.equalsIgnoreCase(avoirStateID)))) {%> urldelete = '<fl:webapp/>/delete_facture.fl?&id='; <%}%> try{ if($('input[name$="id"]').val().length == 16){ urldelete = urldelete + $('input[name$="id"]').val(); jQuery.ajax({ url: urldelete, type:"GET", async:false, success:function(data){ } }) } }catch(err){} return; } } <% } %> </script> <script type="text/javascript" language="javascript" src="<fl:link url="/sales/opportunity/opportunity_edit_js.jsp"/>?salesModel=<%= salesModel %>"></script> <fl:form action="/save_opportunity.fl" bean="Opportunity"> <fl:bigTabs objectTitle="<%=titrePage%>" ou="<%= \"/edit_opportunity.fl\" + (id != null ? \"?id=\" + id : \"\") %>"> <input type="hidden" name="presenceArticles" value="false"> <input type="hidden" name="OppNetApayer_" value="<%=oppNetApayer_%>"> <input type="hidden" name="OppTotalHT_" value="<%=oppTotalHT_%>"> <input type="hidden" name="OppTotalTVA_" value="<%=oppTotalTVA_%>"> <input type="hidden" name="OppTotalTTC_" value="<%=oppTotalTTC_%>"> <input type="hidden" name="OppTotalTPF_" value="<%=oppTotalTPF_%>"> <% try{ java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("dd/MM/yyyy"); String oppdatfactAv = formatter.format(datefact); %> <input type="hidden" name="OppDatFact_" value="<%=oppdatfactAv%>"> <% }catch(Exception e){ e.printStackTrace(); } %> <% if(contratID != null) {%> <input type="hidden" name="OppCompteClient_" value="<%=contratID%>"> <%} %> <input type="hidden" name="strURL" value=""> <input type="hidden" name="OppStoID" value="<%=oppStoID%>"> <% if(prdFamilleProduit_ != null) {%> <input type="hidden" name="prdfamilleproduit_id" value="<%=prdFamilleProduit_%>"> <%} %> <% if(oppFactAvoir_ != null) {%> <input type="hidden" name="OppFactAvoir_" value="<%=oppFactAvoir_%>"> <%} %> <% if(oppAffiliationCtID_ != null) {%> <input type="hidden" name="OppAffiliationCtID_" value="<%=oppAffiliationCtID_%>"> <%} %> <% if(oppCmdTypoID != null) {%> <input type="hidden" name="OppCmdTypo_" value="<%=oppCmdTypoID%>"> <%} %> <% if(oppRefFact_ != null) {%> <input type="hidden" name="OppReferFact_" value="<%=oppRefFact_%>"> <%} %> <table class="container" cellpadding="0"> <tbody> <tr> <td colspan="5" class="width: 100%; margin: 0px; padding: 0px;"> <table class="container" cellpadding="0"> <tr class="fieldline"> <td><fl:label field="OppTitle" labelClassName="labelTitreFiche" code="F2016"/></td> <td class="fieldTitreFiche"><fl:input property="OppTitle"/></td> <% if (id != null && devConc != null) { %> <td class="fieldTitreFiche"> <div> <span style="font-size: larger;">Devis concerné : <fl:getProperty name="Opportunity" property="OppNumDev_" alt=" "/></span> </div> </td> <% } %> </tr> </table> </td> </tr> <tr class="ligne_separation"><td></td></tr> <tr> <td class="column2"> <table class="data_column" cellpadding="0"> <% if(statutID.equalsIgnoreCase(devisStateID) ) { %> <%-- si c'est encore un devis --%> <fl:fieldEdit property="OppDatDev_" labelCode="FF0ED" format="date" mandatoryMsgCode="MF063"/> <%-- <fl:fieldEdit property="OppDate" labelCode="L3053" format="date"/> --%> <fl:fieldEdit property="OppCnlDev_" alt="" mandatoryMsgCode="MF092"/> <%} else if (statutID.equalsIgnoreCase(commandeStateID) ) {%> <fl:fieldEdit property="OppDatComm_" labelCode="FF0EE" format="date" mandatoryMsgCode="MF0AE"/> <fl:fieldEdit property="OppCnlCom_" mandatoryMsgCode="MF0AF"/> <%} else if (statutID.equalsIgnoreCase(factureStateID) || statutID.equalsIgnoreCase(avoirStateID) ) { %> <fl:fieldEdit property="OppDatExp_" labelCode="FF144" format="date" /> <%-- <fl:fieldEdit property="OppDatFact_" labelCode="F6112" format="date" mandatoryMsgCode="MF0B0"/> --%> <fl:fieldRead property="OppDatFact_" labelCode="FF0FD" format="date"/> <fl:fieldRead property="OppReferFact_" bean="true" href="true" disp="<%= request.getContextPath() + \"/read_opportunity.fl\" %>" alt=" "/> <% }%> <tr class="ligne_separation"><td></td></tr> <td class="titreInterneSmalltabs" colspan="5"> <fl:getMessage code="FF0A9" alt="Client"/> </td> <tr class="ligne_separation"><td></td></tr> <%-- if (statutID.equalsIgnoreCase(factureStateID) ) {--%> <% if(contratID == null) { %> <fl:fieldEdit property="OppCompteClient_" /> <%} else { %> <fl:fieldRead property="OppCompteClient_" bean="true" href="true" disp="<%= request.getContextPath() + \"/read_contrat_.fl\" %>" alt=" "/> <%} %> <%--} --%> <!-- <fl:fieldEdit property="OppEntID" mandatoryMsgCode="MF08F" ondelete="clearEntreprisePersonne()" query="EntStatus:RefVal = 'ON'"/> --> <!-- <fl:fieldEdit property="OppPerID" mandatoryMsgCode="LF1B7" query="PerEntID:EntStatus:RefVal = 'ON'" /> --> <fl:fieldEdit property="OppPerID" /> <fl:fieldEdit property="OppEntID" ondelete="clearEntreprisePersonne()" query="EntStatus:RefVal = 'ON'"/> <tr class="ligne_separation"><td></td></tr> <td class="titreInterneSmalltabs" colspan="5"> <fl:getMessage code="L63E9" alt="Fournisseur"/> </td> <tr class="ligne_separation"><td></td></tr> <!-- <fl:fieldEdit property="oppBizProviderID" mandatoryMsgCode="MF093" labelCode="F80ED" query="EntStatus:RefVal = 'ON'"/> --> <% if(isCreate){ %> <fl:fieldEdit label="Fournisseur" property="OppAccountID_" mandatoryMsgCode="MF091"/> <% }else{ %> <fl:fieldEdit label="Fournisseur" property="OppAccountID_" mandatoryMsgCode="MF091" readOnly="true"/> <% } %> </table> </td> <td class="separation"><div class="separation"></div></td> <td class="column2"> <table class="data_column" cellpadding="0"> <% if(statutID.equalsIgnoreCase(devisStateID) ) { %> <fl:fieldEdit property="OppDatExp_" format="date"/> <% } else if(statutID.equalsIgnoreCase(factureStateID) || statutID.equalsIgnoreCase(avoirStateID) ) { %> <fl:fieldEdit property="OppAcompte_" /> <fl:fieldEdit property="OppActID" mandatoryMsgCode="M3018" labelCode="FF107"/> <%} else if (statutID.equalsIgnoreCase(commandeStateID) || statutID.equalsIgnoreCase(devisStateID)) {%> <fl:fieldEdit property="OppTypCom_"/> <fl:fieldEdit property="OppModRegl_" alt="" mandatoryMsgCode="MF095"/> <tr class="ligne_separation"><td></td></tr> <fl:fieldEdit property="OppStatComm_"/> <fl:fieldEdit property="OppDatExp_" labelCode="FF144" format="date"/> <tr class="ligne_separation"><td></td></tr> <fl:fieldEdit property="OppActID" mandatoryMsgCode="MF097" labelCode="FF107"/> <%} %> <% //http://u-project2.umanis.com/view.php?id=37437 //création d'avoir - location d'enseigne - plaque millésimée supplémentaire if (statutID.equalsIgnoreCase(avoirStateID)){ if(id==null){%> <fl:fieldEdit property="OppAvoirDecrement_"/> <!-- <fl:fieldEdit property="OppAvoirProdHorsFact_"/> --> <% }else{%> <fl:fieldEdit property="OppAvoirDecrement_" readOnly="true"/> <%} }%> <fl:fieldEdit property="OppDateEcheance_" mandatoryMsgCode="MF1FB"/> </table> </td> </tr> </tbody> </table> <table class="container" cellpadding="0"> <tr class="ligne_separation"><td></td></tr> <tr> <td class="titrePartie"><fl:getMessage code="L64B4" alt="Commentaires"/></td> </tr> <tr> <td class="dataValue noPaddingLeft"><fl:input property="OppNotes_" nodiv="false"/></td> </tr> <tr class="ligne_separation"><td></td></tr> <tr class="ligne_separation_couleur"><td></td></tr> <tr class="ligne_separation"><td></td></tr> </table> <link href="<fl:webapp/>/css/smalltabs_css.jsp" rel="stylesheet" type="text/css"> <fl:smallTabs name="OpportunityTabs"> <fl:sTab id="PRODUCT" title="<%=titreOnglet%>" onselect="refreshPros();"> <div id="ProdOppTable" class="edealGrid"> <table class="container" cellpadding="0" style="width: 100%;"> <tr> <td> </td> </tr> </table> </div> </fl:sTab> <% if(statutID.equalsIgnoreCase(factureStateID) || statutID.equalsIgnoreCase(avoirStateID)) { %> <fl:sTab id="COMPTA" title="<%= Utils.getMessage(session, \"LF152\", \"Comptabilité\") %>"> <table class="container" style="" cellpadding="0"> <tr class="fieldline"> <td class="column2"> <fl:fieldEdit property="OppCodeCompta_" alt=""/> <fl:fieldEdit property="OppCdCpAnalytic_" alt=""/> </td> </tr> </table> </fl:sTab> <fl:sTab id="INVOICE" title="<%= Utils.getMessage(session, \"LF075\", \"Adresse de facturation\") %>"> <table class="container" style="" cellpadding="0"> <tr class="fieldline"> <td class="column2"> <fl:fieldEdit property="OppBillTiersID_"/> </td> </tr> </table> </fl:sTab> <% } %> <fl:sTab id="ATTACHMENT" title="<%= Utils.getMessage(session, \"L201C\", false, true, \"Documents joints\") %>"> <fl:attach name="Opportunity" colID="OppAttID" /> </fl:sTab> </fl:smallTabs> </fl:bigTabs> </fl:form>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de