Task #0001481: Encodage Vente, Achat, Fin ou OD
Task #0001485: possibilité de clouer une fenetre Ajout d'une fiche met automatiquement le quick-code au bon endroit
This commit is contained in:
parent
dbad12a578
commit
473acf862e
12 changed files with 96 additions and 59 deletions
|
|
@ -549,7 +549,7 @@ function select_card_type(obj)
|
|||
{
|
||||
|
||||
var dossier=$('gDossier').value;
|
||||
|
||||
var elementId="";
|
||||
// give a filter, -1 if not
|
||||
var filter=$(obj).filter;
|
||||
if ( filter==undefined)
|
||||
|
|
@ -582,6 +582,11 @@ function select_card_type(obj)
|
|||
{
|
||||
queryString+='&ref';
|
||||
}
|
||||
/* if an element id must be updated after creating a new card */
|
||||
if ( $(obj).elementId) {
|
||||
var elementId=$(obj).elementId;
|
||||
queryString+="&eltid="+elementId;
|
||||
}
|
||||
queryString+='&fil='+filter;
|
||||
// filter on the ledger, -1 if not
|
||||
var oledger=$(obj).jrn;
|
||||
|
|
@ -615,7 +620,7 @@ function select_card_type(obj)
|
|||
}
|
||||
if ( answer.length == 1) {
|
||||
// There is only one category of card
|
||||
dis_blank_card({"ctl":"div_new_card","fd_id":answer[0].firstChild.nodeValue,"op2":"bc","op":"card",gDossier:dossier});
|
||||
dis_blank_card({"ctl":"div_new_card","fd_id":answer[0].firstChild.nodeValue,"op2":"bc","op":"card",gDossier:dossier,"elementId":elementId});
|
||||
removeDiv(content);
|
||||
remove_waiting_box();
|
||||
return;
|
||||
|
|
@ -654,13 +659,14 @@ function dis_blank_card(obj)
|
|||
var str_style="top:"+nTop+"px;right:"+nLeft+"px;height:auto";
|
||||
|
||||
var popup={'id': content,'cssclass':'inner_box','style':str_style,'html':loading(),'drag':true};
|
||||
if ( $(content)) {removeDiv(content);}
|
||||
|
||||
add_div(popup);
|
||||
|
||||
if ( obj.gDossier.value != undefined ) {
|
||||
var dossier=$('gDossier').value;} else {
|
||||
if ( obj.gDossier.value != undefined ) {
|
||||
var dossier=$('gDossier').value;
|
||||
} else {
|
||||
var dossier=obj.gDossier;
|
||||
}
|
||||
}
|
||||
|
||||
var queryString='gDossier='+dossier;
|
||||
queryString+='&ctl='+content;
|
||||
|
|
@ -668,15 +674,19 @@ function dis_blank_card(obj)
|
|||
queryString+=ref;
|
||||
queryString+='&op2=bc'; // bc for blank card
|
||||
queryString+='&op=card'; // bc for blank card
|
||||
|
||||
if ( obj.elementId) queryString+="&eltid="+obj.elementId;
|
||||
var action=new Ajax.Request ( 'ajax_misc.php',
|
||||
{
|
||||
method:'get',
|
||||
parameters:queryString,
|
||||
onFailure:errorFid,
|
||||
onSuccess:successFill_ipopcard
|
||||
onSuccess: function (req,json) {
|
||||
|
||||
|
||||
successFill_ipopcard(req,json);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
function form_blank_card(obj)
|
||||
{
|
||||
|
|
@ -688,7 +698,7 @@ function form_blank_card(obj)
|
|||
var str_style="top:"+nTop+"px;left:"+nLeft+"px;width:60em;height:auto";
|
||||
|
||||
var popup={'id': content,'cssclass':'inner_box','style':str_style,'html':loading(),'drag':true};
|
||||
if ( $(content)) {removeDiv(content);}
|
||||
if ( $(content)) {removeDiv(content);}
|
||||
add_div(popup);
|
||||
|
||||
|
||||
|
|
@ -721,8 +731,7 @@ function save_card(obj)
|
|||
var content=$(obj).ipopup;
|
||||
// Data must be taken here
|
||||
data=$('save_card').serialize(false);
|
||||
$(content).innerHTML=loading();
|
||||
|
||||
waiting_box();
|
||||
var dossier=$('gDossier').value;
|
||||
var queryString='gDossier='+dossier;
|
||||
queryString+='&ctl='+content;
|
||||
|
|
@ -735,9 +744,24 @@ function save_card(obj)
|
|||
method:'post',
|
||||
parameters:queryString,
|
||||
onFailure:errorFid,
|
||||
onSuccess:fill_box
|
||||
onSuccess:function (req,json) {
|
||||
fill_box(req,json);
|
||||
var elt=req.responseXML.getElementsByTagName("eltid");
|
||||
remove_waiting_box();
|
||||
if ( elt.length != 0) {
|
||||
var eltid=getNodeText(elt[0]);
|
||||
if ( eltid !="") {
|
||||
var eltvalue=req.responseXML.getElementsByTagName("elt_value");
|
||||
$(eltid).value=getNodeText(eltvalue[0]);
|
||||
fill_data_onchange(eltid);
|
||||
$(eltid).focus();
|
||||
}
|
||||
//$(content).fade({duration:2.0});
|
||||
Effect.SlideUp(content, { duration: 1.0 });}
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
/**
|
||||
*@brief add a category of card,
|
||||
|
|
|
|||
|
|
@ -2764,9 +2764,9 @@ function show_description(p_id)
|
|||
* @param pn_fiche_card_id : fiche_def.fd_id
|
||||
* @param pn_dossier_id
|
||||
*/
|
||||
function select_cat(pn_fiche_card_id,pn_dossier_id)
|
||||
function select_cat(pn_fiche_card_id,pn_dossier_id,ps_element_id)
|
||||
{
|
||||
dis_blank_card({"ctl":"div_new_card","fd_id":pn_fiche_card_id,"op2":"bc","op":"card",gDossier:pn_dossier_id});
|
||||
dis_blank_card({"ctl":"div_new_card","fd_id":pn_fiche_card_id,"op2":"bc","op":"card",gDossier:pn_dossier_id,"elementId":ps_element_id});
|
||||
removeDiv('select_card_div');
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -93,7 +93,9 @@ $g_user=new User($cn);
|
|||
$g_user->check(true);
|
||||
$g_user->check_dossier($gDossier,true);
|
||||
$html=var_export($_REQUEST,true);
|
||||
|
||||
// For storing extra information , example the HTML elt id to update
|
||||
// after creating
|
||||
$extra="";
|
||||
switch($op2)
|
||||
{
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
@ -194,6 +196,9 @@ case 'bc':
|
|||
$r.='<p style="text-align:center">';
|
||||
$r.=HtmlInput::submit('sc',_('Sauve'));
|
||||
$r.='</p>';
|
||||
if ( isset ($eltid)) {
|
||||
$r.=HtmlInput::hidden("eltid", $eltid);
|
||||
}
|
||||
$r.='</form>';
|
||||
$html=$r;
|
||||
}
|
||||
|
|
@ -265,9 +270,8 @@ case 'st':
|
|||
|
||||
if ( empty($array))
|
||||
{
|
||||
$html.=_("Aucune catégorie de fiche ne correspond à".
|
||||
" votre demande");
|
||||
if ( DEBUG ) $html.=$sql;
|
||||
$html.=_("Aucune catégorie de fiche ne correspond à votre demande");
|
||||
if ( DEBUG ) $html.=$sql;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -277,7 +281,7 @@ case 'st':
|
|||
$r.='<div dd>';
|
||||
$r.='<p style="padding-left:2em">';
|
||||
$r.=_("Choisissez la catégorie de fiche à laquelle vous aimeriez ajouter une fiche").'</p>';
|
||||
|
||||
if ( ! isset($eltid)) $eltid="";
|
||||
$msg=_('Choisissez une catégorie svp');
|
||||
$r.='<span id="error_cat" class="notice"></span>';
|
||||
$r.=dossier::hidden();
|
||||
|
|
@ -290,10 +294,10 @@ case 'st':
|
|||
$class=($i%2==0)?' class="even" ':' class="odd" ';
|
||||
$r.='<tr '.$class.' id="select_cat_row_'.$array[$i]['fd_id'].'">';
|
||||
$r.='<td >';
|
||||
$r.='<a href="javascript:void(0)" onclick="select_cat(\''.$array[$i]['fd_id'].'\','.$gDossier.')">'.h($array[$i]['fd_label']).'</a>';
|
||||
$r.='<a href="javascript:void(0)" onclick="select_cat(\''.$array[$i]['fd_id'].'\','.$gDossier.',\''.$eltid.'\')">'.h($array[$i]['fd_label']).'</a>';
|
||||
$r.='</td>';
|
||||
$r.='<td>';
|
||||
$r.='<a href="javascript:void(0)" onclick="select_cat(\''.$array[$i]['fd_id'].'\','.$gDossier.')">'.h($array[$i]['fd_description']).'</a>';
|
||||
$r.='<a href="javascript:void(0)" onclick="select_cat(\''.$array[$i]['fd_id'].'\','.$gDossier.',\''.$eltid.'\')">'.h($array[$i]['fd_description']).'</a>';
|
||||
$r.='</td>';
|
||||
|
||||
$r.="</tr>";
|
||||
|
|
@ -338,6 +342,12 @@ case 'sc':
|
|||
$js="";
|
||||
if ( isset( $_POST['ref'])) $js=create_script(' window.location.reload()');
|
||||
$html.=$js;
|
||||
if ( isset ($eltid)) {
|
||||
// after adding a new card, we update some field
|
||||
$extra="<eltid>$eltid</eltid>".
|
||||
"<elt_value>{$f->get_quick_code ()}</elt_value>";
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -575,5 +585,6 @@ echo <<<EOF
|
|||
<data>
|
||||
<ctl>$ctl</ctl>
|
||||
<code>$xml</code>
|
||||
$extra
|
||||
</data>
|
||||
EOF;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ $op->set('direct',$d);
|
|||
$url=http_build_query(array('action'=>'use_opd','p_jrn_predef'=>$l,'ac'=>$_GET['ac'],'gDossier'=>dossier::id()));
|
||||
$html="";
|
||||
|
||||
$html.=HtmlInput::title_box(_("Modèle d'opérations"), 'modele_op_div', 'hide');
|
||||
$html.=HtmlInput::title_box(_("Modèle d'opérations"), 'modele_op_div', 'hide',"","n");
|
||||
$html.=$op->show_button('do.php?'.$url);
|
||||
$html.=' <p style="text-align: center">'.
|
||||
HtmlInput::button_hide('modele_op_div').
|
||||
|
|
|
|||
|
|
@ -1610,8 +1610,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
if ($g_user->check_action(FICADD) == 1)
|
||||
{
|
||||
// Button for adding customer
|
||||
$js_deb="this.filter='-1';this.jrn=\$('p_jrn').value; select_card_type(this);";
|
||||
$str_add_button= HtmlInput::button_image($js_deb,"xx",'class="smallbutton image_search"',"image/bouton-plus.png");
|
||||
$add_card=TRUE;
|
||||
}
|
||||
$wLedger = $this->select_ledger('ODS', 2);
|
||||
if ($wLedger == null)
|
||||
|
|
@ -1786,7 +1785,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
$deb->selected = (isset(${'ck' . $i})) ? true : false;
|
||||
$deb->readonly = $p_readonly;
|
||||
$deb->javascript = ' onChange="checkTotalDirect()"';
|
||||
|
||||
$str_add_button=($add_card==TRUE)?$this->add_card("-1", $quick_code->id):"";
|
||||
$ret.='<tr>';
|
||||
$ret.='<td>' . $quick_code->input() . $quick_code->search() .$str_add_button. '</td>';
|
||||
$ret.='<td>' . $poste->input() .
|
||||
|
|
@ -1805,7 +1804,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
$w = $oRapt->widget();
|
||||
$w->name = 'jrn_concerned';
|
||||
$w->value = (isset($jrn_concerned)) ? $jrn_concerned : "";
|
||||
$ret.="Réconciliation/rapprochements : " . $w->input();
|
||||
$ret.=sprintf(_("Réconciliation/rapprochements : %s"), $w->input());
|
||||
}
|
||||
$ret.= create_script("$('".$wDate->id."').focus()");
|
||||
return $ret;
|
||||
|
|
@ -4018,5 +4017,15 @@ class Acc_Ledger extends jrn_def_sql
|
|||
|
||||
echo '</FORM>';
|
||||
}
|
||||
/**
|
||||
* Return a button to create new card, depending of the ledger
|
||||
* @param $p_filter string : filter for adding : deb, cred or -1 for filter depending of the ledger
|
||||
* @param $p_id_update string
|
||||
*/
|
||||
function add_card($p_filter,$p_id_update) {
|
||||
$js_script="this.filter='{$p_filter}';this.elementId='{$p_id_update}';this.jrn=\$('p_jrn').value; select_card_type(this);";
|
||||
$str_add_button = HtmlInput::button_image($js_script, uniqid(),'class="smallbutton image_search"',"image/bouton-plus.png");
|
||||
return $str_add_button;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -248,11 +248,10 @@ class Acc_Ledger_Fin extends Acc_Ledger
|
|||
|
||||
$min_article=$this->get_min_row();
|
||||
|
||||
$str_add_button = "";
|
||||
if ( $g_user->check_action(FICADD) == 1) {
|
||||
// Button for adding new tiers
|
||||
$js_deb="this.filter='deb';this.jrn=\$('p_jrn').value; select_card_type(this);";
|
||||
$str_add_button = HtmlInput::button_image($js_deb,"xx",'class="smallbutton image_search"',"image/bouton-plus.png");
|
||||
$str_add_button_tiers = "";
|
||||
$add_card=FALSE;
|
||||
if ($g_user->check_action(FICADD) == 1) {
|
||||
$add_card=TRUE;
|
||||
}
|
||||
|
||||
// The first day of the periode
|
||||
|
|
@ -399,7 +398,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
|
|||
$W1->readonly = $pview_only;
|
||||
$array[$i]['qcode'] = $W1->input();
|
||||
$array[$i]['search'] = $W1->search();
|
||||
|
||||
$array[$i]['card_add']=($add_card==TRUE)?$this->add_card("deb", $W1->id):"";
|
||||
// Card name
|
||||
//
|
||||
$card_name = "";
|
||||
|
|
|
|||
|
|
@ -965,19 +965,13 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
if ( $p_array != null ) extract($p_array, EXTR_SKIP);
|
||||
|
||||
$flag_tva=$g_parameter->MY_TVA_USE;
|
||||
|
||||
/* Add button */
|
||||
|
||||
$str_add_button_tiers = "";
|
||||
$str_add_button_item = "";
|
||||
$add_card=FALSE;
|
||||
if ($g_user->check_action(FICADD) == 1) {
|
||||
$js_deb="this.filter='deb';this.jrn=\$('p_jrn').value; select_card_type(this);";
|
||||
$js_cred="this.filter='cred';this.jrn=\$('p_jrn').value; select_card_type(this);";
|
||||
|
||||
// Button for adding customer
|
||||
$str_add_button_tiers = HtmlInput::button_image($js_cred,"xx",'class="smallbutton image_search"',"image/bouton-plus.png");
|
||||
|
||||
// Button for adding services or items to sale
|
||||
$str_add_button_item = HtmlInput::button_image($js_deb,"xx",'class="smallbutton image_search"',"image/bouton-plus.png");
|
||||
$add_card=TRUE;
|
||||
$str_add_button_tiers = $this->add_card("cred", "e_client");
|
||||
}
|
||||
// The first day of the periode
|
||||
$oPeriode=new Periode($this->db);
|
||||
|
|
@ -1137,6 +1131,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$W1->name);
|
||||
$f_client_qcode=$W1->input();
|
||||
$client_label=new ISpan();
|
||||
$client_label->style="vertical-align:top";
|
||||
$client_label->table=0;
|
||||
$f_client=$client_label->input("e_client_label",$e_client_label);
|
||||
$f_client_bt=$W1->search();
|
||||
|
|
@ -1149,7 +1144,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$p_article=($p_article < $this->get_min_row())?$this->get_min_row():$p_article;
|
||||
|
||||
$Hid=new IHidden();
|
||||
$r.=$Hid->input("nb_item",$p_article);
|
||||
$r.=$Hid->input("nb_item",$p_article);
|
||||
|
||||
// For each article
|
||||
//--
|
||||
|
|
@ -1209,6 +1204,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$W1->readonly=false;
|
||||
$array[$i]['quick_code']=$W1->input();
|
||||
$array[$i]['bt']=$W1->search();
|
||||
$array[$i]['card_add']=($add_card==TRUE)?$this->add_card("deb", $W1->id):"";
|
||||
|
||||
$array[$i]['hidden']='';
|
||||
// For computing we need some hidden field for holding the value
|
||||
|
|
|
|||
|
|
@ -1017,16 +1017,12 @@ EOF;
|
|||
/* Add button */
|
||||
|
||||
$str_add_button_tiers = "";
|
||||
$str_add_button_item = "";
|
||||
$add_card=FALSE;
|
||||
if ($g_user->check_action(FICADD) == 1) {
|
||||
// Button for adding customer
|
||||
$js_deb="this.filter='deb';this.jrn=\$('p_jrn').value; select_card_type(this);";
|
||||
$str_add_button_tiers = HtmlInput::button_image($js_deb,"xx",'class="smallbutton image_search"',"image/bouton-plus.png");
|
||||
|
||||
// Button for adding services or items to sale
|
||||
$js_cred="this.filter='cred';this.jrn=\$('p_jrn').value; select_card_type(this);";
|
||||
$str_add_button_item = HtmlInput::button_image($js_cred,"xx",'class="smallbutton image_search"',"image/bouton-plus.png");
|
||||
$add_card=TRUE;
|
||||
$str_add_button_tiers = $this->add_card("deb", "e_client");
|
||||
}
|
||||
|
||||
// The first day of the periode
|
||||
$oPeriode = new Periode($this->db);
|
||||
list ($l_date_start, $l_date_end) = $oPeriode->get_date_limit($g_user->get_periode());
|
||||
|
|
@ -1160,6 +1156,7 @@ EOF;
|
|||
$W1->javascript = sprintf(' onchange="fill_data_onchange(\'%s\');" ', $W1->name);
|
||||
$f_client_qcode = $W1->input();
|
||||
$client_label = new ISpan();
|
||||
$client_label->style="vertical-align:top";
|
||||
$client_label->table = 0;
|
||||
$f_client = $client_label->input("e_client_label", $e_client_label);
|
||||
$f_client_bt = $W1->search();
|
||||
|
|
@ -1224,6 +1221,7 @@ EOF;
|
|||
|
||||
$array[$i]['quick_code'] = $W1->input();
|
||||
$array[$i]['bt'] = $W1->search();
|
||||
$array[$i]['card_add']=($add_card==TRUE)?$this->add_card("cred", $W1->id):"";
|
||||
// For computing we need some hidden field for holding the value
|
||||
$array[$i]['hidden'] = '';
|
||||
if ($flag_tva == 'Y')
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ class Pre_operation_detail
|
|||
{
|
||||
$r=HtmlInput::button_action(_("Modèle d'opérations"), ' $(\'modele_op_div\').style.display=\'block\';$(\'lk_modele_op_tab\').focus();');
|
||||
$r.='<div id="modele_op_div" class="noprint">';
|
||||
$r.=HtmlInput::title_box(_("Modèle d'opérations"), 'modele_op_div', 'hide');
|
||||
$r.=HtmlInput::title_box(_("Modèle d'opérations"), 'modele_op_div', 'hide',"","n");
|
||||
$hid=new IHidden();
|
||||
$r.=$hid->input("action","use_opd");
|
||||
$r.=$hid->input("jrn_type",$this->get("ledger_type"));
|
||||
|
|
|
|||
|
|
@ -569,8 +569,8 @@ class HtmlInput
|
|||
static function anchor_hide($action,$javascript)
|
||||
{
|
||||
$r='';
|
||||
$r.='<div style="position:absolute;margin:2px;right:2px">';
|
||||
$r.= '<span id="close_div" class="input_text" onclick="'.$javascript.'">'.$action.'</span>';
|
||||
$r.='<div>';
|
||||
$r.= '<span id="close_div" class="input_text" style="float:right;margin:0px;margin-right:10px;padding:0px;margin-top: 3px;" onclick="'.$javascript.'">'.$action.'</span>';
|
||||
$r.='</div>';
|
||||
return $r;
|
||||
}
|
||||
|
|
@ -853,7 +853,7 @@ class HtmlInput
|
|||
die (__FILE__.":".__LINE__._('Paramètre invaide'));
|
||||
|
||||
if ( $p_draggable=="y") {
|
||||
$drag=sprintf('<span id="pin_%s" style="float:right;margin:0px;padding:0px;margin-right:25px;padding-top:2px;font-size:120%%;border-width:0px" ><a class="input_text" onclick="pin(\'%s\')" id="close_div"> ↷ </a></span>',
|
||||
$drag=sprintf('<span id="pin_%s" style="float:right;margin:0px;padding:0px;font-size:120%%;border-width:0px" ><a class="input_text" onclick="pin(\'%s\')" id="close_div"> ❉ </a></span>',
|
||||
$p_div,
|
||||
$p_div);
|
||||
$r.=$drag;
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ echo '<tr>';
|
|||
// echo "<td>";
|
||||
echo $item['quick_code'];
|
||||
// echo "</td>";
|
||||
echo '<td>'.$item['bt'].$str_add_button_item.'</td>';
|
||||
echo '<td>'.$item['bt'].$item['card_add'].'</td>';
|
||||
?>
|
||||
<td class="visible_gt800 visible_gt1155"><?php echo $item['denom'] ?></td>
|
||||
<?php
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ foreach ($array as $item) {
|
|||
echo '<tr>';
|
||||
// echo td($item['dateop']);
|
||||
echo td($item['dateop'],' style="display:none" id="tdchdate'.$i.'"');
|
||||
echo td($item['qcode'].$item['search'].$str_add_button);
|
||||
echo td($item['qcode'].$item['search'].$item['card_add']);
|
||||
echo td($item['cname']);
|
||||
echo td($item['comment'],' class="visible_gt800 visible_gt1155" ');
|
||||
echo td($item['amount']);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue