8 Replies Latest reply on Mar 19, 2010 4:53 PM by Efrain Farinango

    Hello, help example invoice

    Efrain Farinango Newbie

      Hello


      I'm new to this, I developed a project.


      Someone can help me with an example of an invoice.


      An application header detail

        • 2. Re: Hello, help example invoice
          Efrain Farinango Newbie
          I am developing an invoice
          with a header and detail.

          the headers is no problem
          the header call rich: modalPanel
          which is the next....
          ..................................................................
          rich:modalPanel id="editarItem"
                           xmlns="http://www.w3.org/1999/xhtml"
                           xmlns:s="http://jboss.com/products/seam/taglib"
                           xmlns:ui="http://java.sun.com/jsf/facelets"
                           xmlns:f="http://java.sun.com/jsf/core"
                           xmlns:h="http://java.sun.com/jsf/html"
                           xmlns:rich="http://richfaces.org/rich"
                           xmlns:a4j="http://richfaces.org/a4j" resizeable="true" width="600" height="300">

              <f:facet name="header">
                  <h:panelGroup>
                      <h:outputText value="Agregar Catalogo"/>
                  </h:panelGroup>
              </f:facet>

              <f:facet name="controls">
                  <h:panelGroup>
                      <h:graphicImage value="/img/close.png" id="hidelink"
                                      styleClass="hidelink" />
                      <rich:componentControl for="editarItem" attachTo="hidelink"
                                             operation="hide" event="onclick" />
                  </h:panelGroup>
              </f:facet>
                  <h:form id="guardar">
                  <s:validateAll>

                          <rich:panel >
                          <f:facet name="header">Agregar Item</f:facet>
                          <h:panelGrid columns="3" rowClasses="prop" columnClasses="name,value">
                                  <h:outputLabel for="items">cant</h:outputLabel>
                                  <h:inputText value="#{detalleCompraHome.instance.dmsCantidad}" id="cant"/>
                                     <h:commandButton value="calcular" action="none" actionListener="#{detalleCompraHome.calculaporcentaje}"/>
                              <h:outputLabel for="itemd">Catalogo</h:outputLabel>
                              <h:inputText value="#{detalleCompraHome.instance.item}" id="itemd"  converter="#{itemConverter}" style="text-transform:uppercase" size="30"/>
                              <rich:suggestionbox id="suggestionBoxId" for="itemd"
                                                  suggestionAction="#{itemBodegaHome.findItem}" var="result"
                                                  fetchValue="#{result.catalogo.eqcCodeqc}" tokens="," height="200" width="300" cellpadding="2"
                                                  cellspacing="2"   shadowOpacity="4" shadowDepth="4"
                                                  minChars="4"  rules="none" nothingLabel="No se encontro nada">
                                  <h:column>
                                      <h:outputText value="#{result.catalogo.eqcCodeqc}"/>
                                  </h:column>
                                  <h:column>
                                      <h:outputText value="#{result.catalogo.eqcDescri}"  />
                                  </h:column>
                              </rich:suggestionbox>
                          </h:panelGrid>
                      </rich:panel>
                  </s:validateAll>
                  <div class="actionButtons">
                      <h:commandButton value="Guardar" action="#{detalleCompraHome.persist}" rendered="#{!detalleCompraHome.isManaged()}"/>
                      <h:commandButton value="Guardar" action="#{detalleCompraHome.update}" oncomplete = "('editarCatalogo').component.hide()" rendered="#{detalleCompraHome.isManaged()}"/>
                      <h:commandButton value="Regresar" action="cancelar" immediate="true"/>
                  </div>
             </h:form>
          </rich:modalPanel>

          ...........................
          which adds items,
          My problem is that when you clik on calcular abandons modalpanel

          What I want is that the independent commadbotton the form to continue doing some independent calculations to fields


          thanks
          • 3. Re: Hello, help example invoice
            Efrain Farinango Newbie

            Hello


            commandbutton Send the application form
            That another option may be to not send the form and stay in modalpanel

            • 4. Re: Hello, help example invoice
              Bernard Labno Master

              How about using a4j:commandButton to perform ajax submit. This will not hide modal panel. You can provide reRender attribute for that button to rerender some part of modal panel.

              • 5. Re: Hello, help example invoice
                Efrain Farinango Newbie

                ok worked thanks


                Bernard


                Greetings


                Efraín

                • 6. Re: Hello, help example invoice
                  Efrain Farinango Newbie
                  Hello Dernard

                  Another cuestion please
                  How can I keep track of twice panelModal
                  of the code is as follows entityhome
                  public class DetalleCompraHome extends EntityHome<DetalleCompra>
                  .
                  .
                  .
                  @Override
                      public String persist()
                      {

                          this.getInstance().setDmsCantidad(this.getInstance().getDmsCantidad());
                           this.getInstance().setItem(this.getInstance().getItem());
                           System.out.println(this.getInstance().getDmsCantidad());
                           System.out.println(this.getInstance().getItem());
                            String s = super.persist();
                           this.getInstance().setDmsCantidad(this.getInstance().getDmsCantidad());
                           this.getInstance().setItem(this.getInstance().getItem());
                           System.out.println(this.getInstance().getDmsCantidad());
                           System.out.println(this.getInstance().getItem());
                            String s1 = super.persist();
                          return s+"D";
                      }

                  I have no idea
                  • 7. Re: Hello, help example invoice
                    Bernard Labno Master

                    I do not understand your English. What do you mean by track of twice panelModal ?
                    What i see from your I suspect that you want to make a copy of DetalleCompra and persist both original and the copy. Am I right ?


                    Anyway, the code is wrong. Explain what you want to do, please.

                    • 8. Re: Hello, help example invoice
                      Efrain Farinango Newbie
                      Sorry for my English ... I do not practice
                      My challenge is learn English and seam framework.

                      Indeed.
                      By submitting form (  <h:form id="guardar"> )
                      I have a copy of DetalleCompra and persist both original and the copy.