noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
Functions
accounting_item.js File Reference

containing the javascript for opening a windows to search an account (poste comptable) More...

Go to the source code of this file.

Functions

function errorPoste ()
 error for ajax
function PcmnUpdate (p_value, p_lib, p_parent, p_type, p_dossier)
function result_poste_search (req)
 show the answer of ajax request
function search_get_poste (obj)
 when you submit the form for searching a accounting item
function search_poste (obj)
 show the popup for search an accounting item
function set_jrn_parent (p_ctl, p_value)
function set_poste_parent (p_ctl, p_value)

Detailed Description

containing the javascript for opening a windows to search an account (poste comptable)

Definition in file accounting_item.js.


Function Documentation

function errorPoste ( )

error for ajax

Definition at line 247 of file accounting_item.js.

References alert().

Referenced by search_get_poste(), and search_poste().

{
    alert('Ajax failed');
}
function PcmnUpdate (   p_value,
  p_lib,
  p_parent,
  p_type,
  p_dossier 
)

Definition at line 44 of file accounting_item.js.

References offsetX, offsetY, posX, show, style, and value.

{
    $('p_valu').value=p_value;
    $('p_oldu').value=p_value;
    $('p_libu').value=p_lib;
    $('p_parentu').value=p_parent;
    $('p_typeu').value=p_type;
    $('acc_update').style.top=posY+offsetY+"px";
    $('acc_update').style.left=posX+offsetX+"px";
    $('acc_update').show();
}
function result_poste_search (   req)

show the answer of ajax request

Parameters:
answerin XML

Definition at line 211 of file accounting_item.js.

References alert(), getNodeText(), and unescape_xml().

Referenced by search_get_poste(), and search_poste().

{
    try
    {
        var answer=req.responseXML;
        var a=answer.getElementsByTagName('ctl');
        if ( a.length == 0 )
        {
            var rec=req.responseText;
            alert ('erreur :'+rec);
        }
        var html=answer.getElementsByTagName('code');

        var name_ctl=a[0].firstChild.nodeValue;
        var nodeXml=html[0];
        var code_html=getNodeText(nodeXml);
        code_html=unescape_xml(code_html);
        $('search_account').innerHTML=code_html;
    }
    catch (e)
    {
        alert(e.message);
    }
    try
    {
        code_html.evalScripts();
    }
    catch(e)
    {
        alert("Impossible executer script de la reponse\n"+e.message);
    }

}
function search_get_poste (   obj)

when you submit the form for searching a accounting item

Parameters:
objform
Note:
the same as search_poste, except it answer to a FORM and not to a click event

Definition at line 156 of file accounting_item.js.

References errorPoste(), loading(), result_poste_search(), and value.

{
    var dossier=$('gDossier').value;
    var queryString="gDossier="+dossier;

    queryString+="&op=sf";

    if ( obj.elements['jrn'] )
    {
        queryString+="&j="+$F('jrn');
    }
    if ( obj.elements['account'])
    {
        queryString+="&c="+$F('account');
    }
    if ( obj.elements['label'])
    {
        queryString+="&l="+$F('label');
    }
    if( obj.elements['acc_query'])
    {
        queryString+="&q="+$F('acc_query');
    }
    if (obj.ctl )
    {
        queryString+="&ctl="+obj.ctl;
    }
    if( obj.elements['nosearch'])
    {
        queryString+="&nq";
    }
    if( obj.elements['nover'])
    {
        queryString+="&nover";
    }
    if( obj.elements['bracket'])
    {
        queryString+="&bracket";
    }

    $('asearch').innerHTML=loading();
    var action=new Ajax.Request ( 'ajax_poste.php',
                                  {
                                  method:'get',
                                  parameters:queryString,
                                  onFailure:errorPoste,
                                  onSuccess:result_poste_search
                                  }
                                );
}
function search_poste (   obj)

show the popup for search an accounting item

Parameters:
objectthis, it must contains some attribute as
  • jrn if set and different to 0, will filter the accounting item for a ledger
  • account the tag which will contains the number
  • label the tag which will contains the label
  • bracket if the value must be surrounded by [ ]
  • acc_query for the initial query
See also:
ajax_poste.php

Definition at line 66 of file accounting_item.js.

References add_div(), alert(), encodeURI(), errorPoste(), loading(), removeDiv(), result_poste_search(), style, and value.

{
        var sx=0;
        if ( window.scrollY)
        {
            sx=window.scrollY+40;
        }
        else
        {
            sx=document.body.scrollTop+60;
        }

        var div_style="top:"+sx+"px";
        removeDiv('search_account');
        add_div({id:'search_account',cssclass:'inner_box',html:loading(),style:div_style,drag:true});

    var dossier=$('gDossier').value;

    var queryString="gDossier="+dossier;

    queryString+="&op=sf";
    try
    {
        if ( obj.jrn)
        {
            queryString+="&j="+obj.jrn;
        }
        if ( obj.account)
        {
            queryString+="&c="+obj.account;
        } 
        if ( obj.label)
        {
            queryString+="&l="+obj.label;
        }
        if ( obj.bracket)
        {
            queryString+="&b="+obj.bracket;
        }
        if( obj.noquery)
        {
            queryString+="&nq";
        }
        if( obj.no_overwrite)
        {
            queryString+="&nover";
        }
        if( obj.bracket)
        {
            queryString+="&bracket";
        }
        if ( ! obj.noquery)
        {
            if( obj.acc_query)
            {
                queryString+="&q="+obj.acc_query;
            }
            else
            {
                if ($(obj).account)
                {
                    var e=$(obj).account;
                    var str_account=$(e).value;
                    queryString+="&q="+str_account;
                }
            }
        }

        queryString+="&ctl="+'search_account';
        queryString=encodeURI(queryString);
        var action=new Ajax.Request ( 'ajax_poste.php',
                                      {
                                  method:'get',
                                  parameters:queryString,
                                  onFailure:errorPoste,
                                  onSuccess:result_poste_search
                                      }
                                    );
    }
    catch (e)
    {
        alert(e.getMessage);
    }
}
function set_jrn_parent (   p_ctl,
  p_value 
)

Definition at line 33 of file accounting_item.js.

References g(), and trim().

{
    var f=g(p_ctl);
    if ( f )
    {
        if ( trim(f.value)!="") f.value+=' ';
        f.value+=p_value;
    }
}
function set_poste_parent (   p_ctl,
  p_value 
)

Definition at line 27 of file accounting_item.js.

References g().

{
    var f=g(p_ctl);
    f.value+='['+p_value+']';
}
 All Data Structures Namespaces Files Functions Variables Enumerations