+ Start a Discussion
Cesar Ramirez Vasquez005391619375684564Cesar Ramirez Vasquez005391619375684564 

How can i sent all values in a visualforce page to my controller to run a method called pay ?

<apex:page action="{!init}" controller="mainControllerV1" showHeader="false" standardStylesheets="true">


<apex:outputPanel id="the_outputpanel_00">
    <p>
    Consecutivo: {!current_factura.Consecutivo__c}
    </p>
    <p>
    Fecha: {!current}
    </p>
</apex:outputPanel>

<apex:outputPanel id="the_outputpanel_0">
Método de Pago
    <apex:form >
    <apex:pageMessages />
        <apex:pageBlock >
       
        <p>
        <apex:inputCheckbox value="{!current_factura.Efectivo__c}">
         <apex:actionSupport event="onchange" action="{!toogle_a}" rerender="the_outputpanel_0"/> 
        </apex:inputCheckbox> Efectivo <br/>
        <br/>
        <apex:inputText value="{!Efectivo}" rendered="{!(!current_factura.Efectivo__c == false)}"/>
        
        </p>
        <p>
        <apex:inputCheckbox value="{!current_factura.Tarjeta__c}">
        <apex:actionSupport event="onchange" action="{!toogle_b}" rerender="the_outputpanel_0"/> 
        </apex:inputCheckbox> Tarjeta
        </p>
       
        <br/>
        <apex:commandButton value="Pagar" >
                       <apex:actionSupport event="onclic"  action="{!Pagar}"/>
                        
                       </apex:commandButton>
                       <br/>  
                                         
        </apex:pageBlock>
    </apex:form>
</apex:outputPanel>

Busqueda de productos

<apex:outputPanel id="the_outputpanel">

    <apex:pageBlock >
                <apex:form >
                <div><h4>Búsqueda por código</h4>  <apex:inputText value="{!STR_SRCH}"  >
                       </apex:inputText>
                       <apex:commandButton value="BUSCAR!" >
                       <apex:actionSupport event="onclic" rerender="the_outputpanel2"/> 
                       </apex:commandButton>
                   </div>
                </apex:form>
    </apex:pageBlock>
</apex:outputPanel>

<apex:outputPanel id="the_outputpanel_dec">

    <apex:pageBlock >
                <apex:form >
                <div><h4>Descuento</h4>  <apex:inputText value="{!STR_DESC}"  > %
                       </apex:inputText>
                       <apex:commandButton value="ACTUALIZAR!" >
                       <apex:actionSupport event="onclic" rerender="the_outputpanel3"/> 
                       </apex:commandButton>
                   </div>
                </apex:form>
    </apex:pageBlock>
</apex:outputPanel>

<apex:outputPanel id="the_outputpanel2">
    <apex:pageBlock >
        <apex:pageBlockTable id="srch_id" value="{!ListaSRCH}" var="o">
                               
            <apex:column value="{!o.CantidadExistencia__c}"> <apex:facet name="header"> </apex:facet> </apex:column>
            <apex:column value="{!o.Codigo__c}"> <apex:facet name="header"> </apex:facet> </apex:column>
            <apex:column value="{!o.Descripcion__c}"> <apex:facet name="header"> </apex:facet> </apex:column>
            <apex:column value="{!o.Precio__c}"> <apex:facet name="header"></apex:facet> </apex:column>
            <apex:column headerValue="Opciones" >
                <apex:form >
                    <apex:commandLink value="AGREGAR" action="{!add2carrito}">
                            <apex:actionSupport event="onclic" rerender="the_outputpanel3"/>    
                            <apex:param name="idz"   assignTo="{!current_prod}" value="{!o.id}"  />                               
                    </apex:commandLink>
                </apex:form>   
            </apex:column>
           
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:outputPanel>


CARRITO

<apex:outputPanel id="the_outputpanel3">
    <apex:form >
        <apex:commandButton value="CLEAR" action="{!clear_carr}">
            <apex:actionSupport event="onclic" rerender="srch_id2"/> 
        </apex:commandButton>  
    </apex:form>
    <apex:pageBlock >
        <apex:pageBlockTable id="srch_id2" value="{!ListaCARR}" var="o" >
                               
            <apex:column value="{!o.CantidadExistencia__c}"> <apex:facet name="header"> </apex:facet> </apex:column>
            <apex:column value="{!o.Codigo__c}"> <apex:facet name="header"> </apex:facet> </apex:column>
            <apex:column value="{!o.Descripcion__c}"> <apex:facet name="header"> </apex:facet> </apex:column>
            <apex:column value="{!o.Precio__c}"> <apex:facet name="header"></apex:facet> </apex:column>
           
        </apex:pageBlockTable>
    </apex:pageBlock>
    <apex:pageBlock >
    <h1>
    <p>
    Subtotal: {!total_str}</p> colones
    </h1>
    <h1>
    <p>
    Descuento: {!total_dstr} colones
    </p>
    </h1>
    <h1>
    <p>
    Total: {!total_final} colones
    </p>
    </h1>
    </apex:pageBlock>
</apex:outputPanel>


</apex:page>
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Controller method ;

public void Pagar(){
   
   
    if(current_factura.Efectivo__c=true && total_str > '0'){
      /*  
        calcular_total();
                     
        current_factura.Descuento__c == ;
        current_factura.Efectivo__c == ;
        current_factura.Estado__c == 'Pagado';
        current_factura.Fecha_y_Hora_de_Factura__c == system.now().addHours(-6);
        current_factura.Forma_de_Pago__c == ;
        current_factura.Porcentaje__c == ;
        current_factura.Subtotal__c == ;
        current_factura.Tarjeta__c == ;
        current_factura.Total__c == ;
        current_factura.Vuelto__c == ;
        
        insert(current_factura):
        */
       
    }
       
    else if (current_factura.Tarjeta__c=true && total_str > '0')
   
    {
   
    }
   
    else
   
    {
    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Por favor seleccione un metodo de pago'));
   
    }

}

I know i have to add the functionallity, but im unable to understand how to set all the parameters coming from the visualforce page i am really new to sales force and web programming.

Thanks
Ricky MartinRicky Martin
Which edition you are using? 
Cesar Ramirez Vasquez005391619375684564Cesar Ramirez Vasquez005391619375684564
Hi i am using the lastest i guess i just started 2 weeks ago i know that code is messy i did not writted it but i need to finished it; i hope you can help me thanks
Ricky MartinRicky Martin
Hi,
If you wish, I will work in your sandbox. my skype : rakishgobi05.