[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r5295 - in phpcompta/trunk: html/js include include/temp
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r5295 - in phpcompta/trunk: html/js include include/template |
Date: |
Tue, 21 May 2013 00:36:25 +0200 (CEST) |
Author: danydb
Date: 2013-05-21 00:36:25 +0200 (Tue, 21 May 2013)
New Revision: 5295
Added:
phpcompta/trunk/include/template/predf_ledger_detail.php
Modified:
phpcompta/trunk/html/js/scripts.js
phpcompta/trunk/include/ajax_mod_predf_op.php
phpcompta/trunk/include/ajax_save_predf_op.php
phpcompta/trunk/include/class_pre_op_ach.php
phpcompta/trunk/include/class_pre_op_advanced.php
phpcompta/trunk/include/class_pre_op_ven.php
phpcompta/trunk/include/class_pre_operation.php
phpcompta/trunk/include/preod.inc.php
Log:
task #0000847: Correction des actions pr?\195?\169d?\195?\169finies
Modified: phpcompta/trunk/html/js/scripts.js
===================================================================
--- phpcompta/trunk/html/js/scripts.js 2013-05-20 20:23:26 UTC (rev 5294)
+++ phpcompta/trunk/html/js/scripts.js 2013-05-20 22:36:25 UTC (rev 5295)
@@ -1038,8 +1038,8 @@
{
var target="mod_predf_op";
removeDiv(target);
- var sx=posY;
- var sy=posX;
+ var sx='20%';
+ var sy='20%';
var str_style="top:"+sx+";left:"+sy;
var div={id:target,
cssclass:'inner_box',style:str_style,html:loading(),drag:1};
@@ -1061,14 +1061,15 @@
function save_predf_op(obj)
{
+ waiting_box();
var querystring=$(obj).serialize()+'&op=save_predf';
// Create a ajax request to get all the person
var action = new Ajax.Request ('ajax_misc.php',
{
- method: 'get',
+ method: 'post',
parameters:
querystring,
onFailure: null,
- onSuccess:
refresh_window
+ onSuccess:
refresh_window
}
);
Modified: phpcompta/trunk/include/ajax_mod_predf_op.php
===================================================================
--- phpcompta/trunk/include/ajax_mod_predf_op.php 2013-05-20 20:23:26 UTC
(rev 5294)
+++ phpcompta/trunk/include/ajax_mod_predf_op.php 2013-05-20 22:36:25 UTC
(rev 5295)
@@ -32,8 +32,8 @@
echo h2info('Modification du nom');
echo '
- <form method="get" onsubmit="save_predf_op(this);return false;">';
-$name = new IText('predf_name');
+ <form method="POST" onsubmit="save_predf_op(this);return false;">';
+$name = new IText('opd_name');
$name->value = $op->od_name;
$name->size = 60;
echo "Nom =" . $name->input();
Modified: phpcompta/trunk/include/ajax_save_predf_op.php
===================================================================
--- phpcompta/trunk/include/ajax_save_predf_op.php 2013-05-20 20:23:26 UTC
(rev 5294)
+++ phpcompta/trunk/include/ajax_save_predf_op.php 2013-05-20 22:36:25 UTC
(rev 5295)
@@ -24,11 +24,27 @@
* \brief save the new predefined operation
* included from ajax_misc
*/
-
-if ( trim($_GET['predf_name']) != '')
+if ($g_user->check_module('PREDOP') == 0) exit();
+if ( trim($_POST['opd_name']) != '')
{
- $cn->exec_sql('update op_predef set od_name =$1 where od_id=$2',
- array($_GET['predf_name'],$_GET['od_id']));
+ $cn->exec_sql('delete from op_predef where od_id=$1',
+ array($_POST['od_id']));
+
+ var_dump($_POST);
+ $cn->exec_sql("delete from op_predef_detail where
od_id=$1",array($_POST['od_id']));
+ switch ($_POST['jrn_type']) {
+ case 'ACH':
+ $operation=new Pre_op_ach($cn);
+ break;
+ case 'VEN':
+ $operation=new Pre_op_ven($cn);
+ break;
+ case 'ODS':
+ $operation=new Pre_Op_Advanced($cn);
+ break;
+ }
+ $operation->get_post();
+ $operation->save();
$cn->commit();
}
?>
\ No newline at end of file
Modified: phpcompta/trunk/include/class_pre_op_ach.php
===================================================================
--- phpcompta/trunk/include/class_pre_op_ach.php 2013-05-20 20:23:26 UTC
(rev 5294)
+++ phpcompta/trunk/include/class_pre_op_ach.php 2013-05-20 22:36:25 UTC
(rev 5295)
@@ -54,6 +54,7 @@
}
}
+
/*!
* \brief save the detail and op in the database
*
@@ -145,6 +146,7 @@
}
function display($p_array)
{
+ require_once 'class_acc_ledger_purchase.php';
global $g_parameter,$g_user;
extract($p_array);
$ledger=new Acc_Ledger_Purchase($this->db,$this->jrn_def_id);
@@ -166,126 +168,23 @@
$f_add_button2->set_attribute('filter',$ledger->get_all_fiche_def ());
// $f_add_button2->set_attribute('jrn',$ledger->id);
$f_add_button2->javascript="
this.jrn=\$('p_jrn').value;select_card_type(this);";
- $str_add_button="";
- $str_add_button2="";
- if ($g_user->check_action(FICADD)==1)
- {
- $str_add_button=$f_add_button->input();
- $str_add_button2=$f_add_button2->input();
- }
- // 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());
- if ( $g_parameter->MY_DATE_SUGGEST=='Y' )
- $op_date=( ! isset($e_date) ) ?$l_date_start:$e_date;
- else
- $op_date=( ! isset($e_date) ) ?'':$e_date;
+ $str_add_button="";
+ $str_add_button2="";
+ if ($g_user->check_action(FICADD)==1)
+ {
+ $str_add_button=$f_add_button->input();
+ $str_add_button2=$f_add_button2->input();
+ }
- $e_ech=(isset($e_ech))?$e_ech:"";
- $e_comm=(isset($e_comm))?$e_comm:"";
-
$r="";
$r.=dossier::hidden();
$f_legend=_("En-tête facture fournisseur");
$f_legend_detail=_("Détail articles acheté");
-
- // Date
- //--
- $Date=new IDate();
- $Date->setReadOnly(false);
- $Date->table=1;
- $Date->tabindex=1;
- $f_date=$Date->input("e_date",$op_date);
- // Payment limit
- //--
- $Echeance=new IDate();
- $Echeance->setReadOnly(false);
- $Echeance->tabindex=2;
- $label=HtmlInput::infobulle(4);
- $f_echeance=$Echeance->input('e_ech',$e_ech,'Echéance'.$label);
- $f_periode="";
- if ($this->check_periode() == true)
- {
- // Periode
- //--
- $l_user_per=$g_user->get_periode();
- $def=(isset($periode))?$periode:$l_user_per;
-
- $period=new IPeriod("period");
- $period->user=$g_user;
- $period->cn=$ledger->db;
- $period->value=$def;
- $period->type=OPEN;
- try
- {
- $l_form_per=$period->input();
- }
- catch (Exception $e)
- {
- if ($e->getCode() == 1 )
- {
- echo _("Aucune période ouverte");
- exit();
- }
- }
-
- $r.="<td>";
- $label=HtmlInput::infobulle(3);
- $f_periode=_("Période comptable")." $label ".$l_form_per;
- }
// Ledger (p_jrn)
//--
/* if we suggest the next pj, then we need a javascript */
$add_js="";
- if ( $g_parameter->MY_PJ_SUGGEST=='Y')
- {
- $add_js="update_pj();";
- }
- if ($g_parameter->MY_DATE_SUGGEST == 'Y')
- {
- $add_js.='get_last_date();';
- }
- $add_js.='update_name();';
- $add_js.='update_pay_method();';
- $add_js.='update_row("sold_item");';
- $wLedger=$ledger->select_ledger('ACH',2);
- if ($wLedger == null) exit (_('Pas de journal disponible'));
- $wLedger->javascript="onChange='update_predef(\"ach\",\"f\");$add_js'";
- $label=" Journal ".HtmlInput::infobulle(2) ;
-
- $f_jrn=$wLedger->input();
-
- // Comment
- //--
- $Commentaire=new IText();
- $Commentaire->table=0;
- $Commentaire->setReadOnly(false);
- $Commentaire->size=60;
- $Commentaire->tabindex=3;
- $label=HtmlInput::infobulle(1) ;
- $f_desc=$label.$Commentaire->input("e_comm",h($e_comm));
-
- // PJ
- //--
- /* suggest PJ ? */
- $default_pj='';
- if ( $g_parameter->MY_PJ_SUGGEST=='Y')
- {
- $default_pj=$ledger->guess_pj();
- }
-
- $pj=new IText();
- $pj->value=(isset($e_pj))?$e_pj:$default_pj;
-
-
- $pj->table=0;
- $pj->name="e_pj";
- $pj->size=10;
- $pj->readonly=false;
-
- $f_pj=$pj->input().HtmlInput::hidden('e_pj_suggest',$default_pj);
-
// Display the customer
//--
$fiche='cred';
@@ -479,7 +378,7 @@
$f_type=_('Fournisseur');
ob_start();
- require_once('template/form_ledger_detail.php');
+ require_once('template/predf_ledger_detail.php');
$r.=ob_get_contents();
ob_end_clean();
@@ -487,15 +386,6 @@
$r.= HtmlInput::hidden('jrn_type','ACH');
$r.= HtmlInput::button('add_item',_('Ajout article'), '
onClick="ledger_add_row()"');
-
-
- /* if we suggest the pj n# the run the script */
- if ( $g_parameter->MY_PJ_SUGGEST=='Y')
- {
- $r.='<script> update_pj();</script>';
- }
- // set focus on date
- $r.= create_script("$('".$Date->id."').focus()");
return $r;
}
}
\ No newline at end of file
Modified: phpcompta/trunk/include/class_pre_op_advanced.php
===================================================================
--- phpcompta/trunk/include/class_pre_op_advanced.php 2013-05-20 20:23:26 UTC
(rev 5294)
+++ phpcompta/trunk/include/class_pre_op_advanced.php 2013-05-20 22:36:25 UTC
(rev 5295)
@@ -142,4 +142,136 @@
{
$this->operation->od_id=$p_id;
}
+ function display($p_array)
+ {
+ global $g_parameter, $g_user;
+ require_once 'class_acc_ledger.php';
+ $legder=new Acc_Ledger($this->db,$this->jrn_def_id);
+ $legder->nb=$legder->get_min_row();
+
+ if ($p_array != null)
+ extract($p_array);
+ $add_js = "";
+
+ $ret = "";
+ if ($g_user->check_action(FICADD) == 1)
+ {
+ /* Add button */
+ $f_add_button = new IButton('add_card');
+ $f_add_button->label = _('Créer une nouvelle fiche');
+ $f_add_button->set_attribute('ipopup', 'ipop_newcard');
+ $f_add_button->set_attribute('jrn', $legder->id);
+ $f_add_button->javascript = "
this.jrn=\$('p_jrn').value;select_card_type(this);";
+ $f_add_button->input();
+ }
+
+ $nb_row = (isset($nb_item) ) ? $nb_item : $legder->nb;
+
+ $ret.=HtmlInput::hidden('nb_item', $nb_row);
+ $ret.=HtmlInput::hidden('p_jrn', $this->jrn_def_id);
+ $ret.=dossier::hidden();
+
+ $ret.=dossier::hidden();
+
+ $ret.=HtmlInput::hidden('jrn_type', $legder->get_type());
+ $info = HtmlInput::infobulle(0);
+ $info_poste = HtmlInput::infobulle(9);
+ if ($g_user->check_action(FICADD) == 1)
+ $ret.=$f_add_button->input();
+ $ret.='<table id="quick_item" style="width:100%">';
+ $ret.='<tr>' .
+ '<th style="text-align:left">Quickcode' . $info .
'</th>' .
+ '<th style="text-align:left">' . _('Poste') .
$info_poste . '</th>' .
+ '<th style="text-align:left">' . _('Libellé') .
'</th>' .
+ '<th style="text-align:left">' . _('Montant') .
'</th>' .
+ '<th style="text-align:left">' . _('Débit') . '</th>' .
+ '</tr>';
+
+
+ for ($i = 0; $i < $nb_row; $i++)
+ {
+ // Quick Code
+ $quick_code = new ICard('qc_' . $i);
+ $quick_code->set_dblclick("fill_ipopcard(this);");
+ $quick_code->set_attribute('ipopup', 'ipopcard');
+
+ // name of the field to update with the name of the card
+ $quick_code->set_attribute('label', "ld" . $i);
+ $quick_code->set_attribute('jrn', $legder->id);
+
+ // name of the field to update with the name of the card
+ $quick_code->set_attribute('typecard', 'filter');
+
+ // Add the callback function to filter the card on the jrn
+ $quick_code->set_callback('filter_card');
+ $quick_code->set_function('fill_data');
+ $quick_code->javascript = sprintf('
onchange="fill_data_onchange(\'%s\');" ', $quick_code->name);
+
+ $quick_code->jrn = $legder->id;
+ $quick_code->value = (isset(${'qc_' . $i})) ? ${'qc_' . $i} :
"";
+
+ $label = '';
+ if ($quick_code->value != '')
+ {
+ $Fiche = new Fiche($legder->db);
+ $Fiche->get_by_qcode($quick_code->value);
+ $label = $Fiche->strAttribut(ATTR_DEF_NAME);
+ }
+
+
+ // Account
+ $poste = new IPoste();
+ $poste->name = 'poste' . $i;
+ $poste->set_attribute('jrn', $legder->id);
+ $poste->set_attribute('ipopup', 'ipop_account');
+ $poste->set_attribute('label', 'ld' . $i);
+ $poste->set_attribute('account', 'poste' . $i);
+ $poste->set_attribute('dossier', Dossier::id());
+
+ $poste->value = (isset(${'poste' . $i})) ? ${"poste" . $i} : ''
+ ;
+ $poste->dbl_click_history();
+
+
+ if ($poste->value != '')
+ {
+ $Poste = new Acc_Account($legder->db);
+ $Poste->set_parameter('value', $poste->value);
+ $label = $Poste->get_lib();
+ }
+
+ // Description of the line
+ $line_desc = new IText();
+ $line_desc->name = 'ld' . $i;
+ $line_desc->size = 30;
+ $line_desc->value = (isset(${"ld" . $i})) ? ${"ld" . $i} :
+ $label;
+
+ // Amount
+ $amount = new INum();
+ $amount->size = 10;
+ $amount->name = 'amount' . $i;
+ $amount->value = (isset(${'amount' . $i})) ? ${"amount" . $i}
: ''
+ ;
+ $amount->javascript = '
onChange="format_number(this);checkTotalDirect()"';
+ // D/C
+ $deb = new ICheckBox();
+ $deb->name = 'ck' . $i;
+ $deb->selected = (isset(${'ck' . $i})) ? true : false;
+ $deb->javascript = ' onChange="checkTotalDirect()"';
+
+ $ret.='<tr>';
+ $ret.='<td>' . $quick_code->input() . $quick_code->search() .
'</td>';
+ $ret.='<td>' . $poste->input() .
+ '<script> document.getElementById(\'poste' .
$i . '\').onblur=function(){ if (trim(this.value) !=\'\')
{document.getElementById(\'qc_' . $i . '\').value="";}}</script>' .
+ '</td>';
+ $ret.='<td>' . $line_desc->input() . '</td>';
+ $ret.='<td>' . $amount->input() . '</td>';
+ $ret.='<td>' . $deb->input() . '</td>';
+ $ret.='</tr>';
+ // If readonly == 1 then show CA
+ }
+ $ret.='</table>';
+ return $ret;
+ }
}
Modified: phpcompta/trunk/include/class_pre_op_ven.php
===================================================================
--- phpcompta/trunk/include/class_pre_op_ven.php 2013-05-20 20:23:26 UTC
(rev 5294)
+++ phpcompta/trunk/include/class_pre_op_ven.php 2013-05-20 22:36:25 UTC
(rev 5295)
@@ -140,4 +140,247 @@
{
$this->operation->od_id=$p_id;
}
+ function display($p_array)
+ {
+ global $g_parameter,$g_user;
+ if ( $p_array != null ) extract($p_array);
+ require_once 'class_acc_ledger_sold.php';
+ $ledger=new Acc_Ledger_Sold($this->db,$this->jrn_def_id);
+
+ $flag_tva=$g_parameter->MY_TVA_USE;
+ /* Add button */
+ $f_add_button=new IButton('add_card');
+ $f_add_button->tabindex=-1;
+ $f_add_button->label=_('Créer une nouvelle fiche');
+ $f_add_button->set_attribute('ipopup','ipop_newcard');
+ $f_add_button->set_attribute('jrn',$ledger->id);
+ $f_add_button->javascript="this.jrn=\$('p_jrn').value;
select_card_type(this);";
+
+ $f_add_button2=new IButton('add_card2');
+ $f_add_button2->tabindex=-1;
+ $f_add_button2->label=_('Créer une nouvelle fiche');
+ $f_add_button2->set_attribute('ipopup','ipop_newcard');
+ $f_add_button2->set_attribute('filter',$ledger->get_all_fiche_def ());
+ // $f_add_button2->set_attribute('jrn',$ledger->id);
+ $f_add_button2->javascript="
this.jrn=\$('p_jrn').value;select_card_type(this);";
+
+ $str_add_button="";
+ $str_add_button2="";
+ if ($g_user->check_action(FICADD)==1)
+ {
+ $str_add_button=$f_add_button->input();
+ $str_add_button2=$f_add_button2->input();
+ }
+
+ $r='';
+ $r.=dossier::hidden();
+ $f_legend=_('En-tête facture client');
+
+
+ /* if we suggest the next pj, then we need a javascript */
+
+ // Display the customer
+ //--
+ $fiche='deb';
+
+ // Save old value and set a new one
+ //--
+ $e_client=( isset ($e_client) )?$e_client:"";
+ $e_client_label=" ";//str_pad("",100,".");
+
+
+ // retrieve e_client_label
+ //--
+
+ if ( strlen(trim($e_client)) != 0)
+ {
+ $fClient=new Fiche($ledger->db);
+ $fClient->get_by_qcode($e_client);
+ $e_client_label=$fClient->strAttribut(ATTR_DEF_NAME).' '.
+ ' Adresse :
'.$fClient->strAttribut(ATTR_DEF_ADRESS).' '.
+ $fClient->strAttribut(ATTR_DEF_CP).' '.
+ $fClient->strAttribut(ATTR_DEF_CITY).' ';
+
+
+ }
+
+ $W1=new ICard();
+ $W1->label="Client ".HtmlInput::infobulle(0) ;
+ $W1->name="e_client";
+ $W1->tabindex=3;
+ $W1->value=$e_client;
+ $W1->table=0;
+ $W1->set_dblclick("fill_ipopcard(this);");
+ $W1->set_attribute('ipopup','ipopcard');
+
+ // name of the field to update with the name of the card
+ $W1->set_attribute('label','e_client_label');
+ // name of the field to update with the name of the card
+ $W1->set_attribute('typecard','deb');
+
+ // Add the callback function to filter the card on the jrn
+ $W1->set_callback('filter_card');
+ $W1->set_function('fill_data');
+ $W1->javascript=sprintf(' onchange="fill_data_onchange(\'%s\');" ',
+ $W1->name);
+ $f_client_qcode=$W1->input();
+ $client_label=new ISpan();
+ $client_label->table=0;
+ $f_client=$client_label->input("e_client_label",$e_client_label);
+ $f_client_bt=$W1->search();
+
+
+ // Record the current number of article
+ $Hid=new IHidden();
+ $p_article= ( isset ($nb_item))?$nb_item:MAX_ARTICLE;
+ $r.=$Hid->input("nb_item",$p_article);
+ $max=($p_article < MAX_ARTICLE)?MAX_ARTICLE:$p_article;
+
+
+ $f_legend_detail=_("Détail articles vendus");
+
+ // For each article
+ //--
+ for ($i=0;$i< $max;$i++)
+ {
+ // Code id, price & vat code
+ //--
+ $march=(isset(${"e_march$i"}))?${"e_march$i"}:""
+ ;
+
$march_price=(isset(${"e_march".$i."_price"}))?${"e_march".$i."_price"}:""
+ ;
+ if ( $flag_tva=='Y')
+ {
+
$march_tva_id=(isset(${"e_march$i"."_tva_id"}))?${"e_march$i"."_tva_id"}:"";
+
$march_tva_amount=(isset(${"e_march$i"."_tva_amount"}))?${"e_march$i"."_tva_amount"}:"";
+ }
+
$march_label=(isset(${"e_march".$i."_label"}))?${"e_march".$i."_label"}:"";
+
+ // retrieve the tva label and name
+ //--
+ if ( strlen(trim($march))!=0 && strlen(trim($march_label))==0)
+ {
+ $fMarch=new Fiche($ledger->db);
+ $fMarch->get_by_qcode($march);
+ $march_label=$fMarch->strAttribut(ATTR_DEF_NAME);
+ if ( $flag_tva=='Y')
+ {
+ if ( ! (isset(${"e_march$i"."_tva_id"})))
+ $march_tva_id=$fMarch->strAttribut(ATTR_DEF_TVA);
+ }
+ }
+ // Show input
+ //--
+ $W1=new ICard();
+ $W1->label="";
+ $W1->name="e_march".$i;
+ $W1->value=$march;
+ $W1->table=1;
+ $W1->set_attribute('typecard','cred');
+ $W1->set_dblclick("fill_ipopcard(this);");
+ $W1->set_attribute('ipopup','ipopcard');
+
+ // name of the field to update with the name of the card
+ $W1->set_attribute('label','e_march'.$i.'_label');
+ // name of the field with the price
+ $W1->set_attribute('price','e_march'.$i.'_price');
+ // name of the field with the TVA_ID
+ $W1->set_attribute('tvaid','e_march'.$i.'_tva_id');
+ // Add the callback function to filter the card on the jrn
+ $W1->set_callback('filter_card');
+ $W1->set_function('fill_data');
+ $W1->javascript=sprintf(' onchange="fill_data_onchange(\'%s\');" ',
+ $W1->name);
+
+ $W1->readonly=false;
+
+ $array[$i]['quick_code']=$W1->input();
+ $array[$i]['bt']=$W1->search();
+ // For computing we need some hidden field for holding the value
+ $array[$i]['hidden']='';
+ if ( $flag_tva=='Y')
$array[$i]['hidden'].=HtmlInput::hidden('tva_march'.$i,0);
+
+ $htva=new INum('htva_march'.$i);
+ $htva->readOnly=1;
+ $htva->value=0;
+ $array[$i]['htva']=$htva->input();
+
+ if ( $g_parameter->MY_TVA_USE=='Y')
+ $tvac=new INum('tvac_march'.$i);
+ else
+ $tvac=new IHidden('tvac_march'.$i);
+
+ $tvac->readOnly=1;
+ $tvac->value=0;
+ $array[$i]['tvac']=$tvac->input();
+
+ if ( $g_parameter->MY_UPDLAB == 'Y')
+ {
+ $Span=new IText("e_march".$i."_label");
+
+ $Span->css_size="100%";
+ } else
+ {
+ $Span=new ISpan("e_march".$i."_label");
+ }
+ $Span->value=$march_label;
+ $Span->setReadOnly(false);
+ // card's name, price
+ //--
+
$array[$i]['denom']=$Span->input("e_march".$i."_label",$march_label);
+ // price
+ $Price=new INum();
+ $Price->setReadOnly(false);
+ $Price->size=9;
+
$Price->javascript="onBlur='format_number(this);clean_tva($i);compute_ledger($i)'";
+ $array[$i]['pu']=$Price->input("e_march".$i."_price",$march_price);
+ $array[$i]['tva']='';
+ $array[$i]['amount_tva']='';
+ // if tva is not needed then no tva field
+ if ( $flag_tva == 'Y' )
+ {
+ // vat label
+ //--
+ $Tva=new ITva_Popup($ledger->db);
+ $Tva->in_table=true;
+ $Tva->set_attribute('compute',$i);
+
+
$Tva->js='onblur="format_number(this);clean_tva('.$i.');compute_ledger('.$i.')"';
+ $Tva->value=$march_tva_id;
+ $array[$i]['tva']=$Tva->input("e_march$i"."_tva_id");
+ // vat amount
+ //--
+ $wTva_amount=new INum();
+ $wTva_amount->readOnly=false;
+ $wTva_amount->size=6;
+
$wTva_amount->javascript="onBlur='format_number(this);compute_ledger($i)'";
+
$array[$i]['amount_tva']=$wTva_amount->input("e_march".$i."_tva_amount",$march_tva_amount);
+ }
+ // quantity
+ //--
+ $quant=(isset(${"e_quant$i"}))?${"e_quant$i"}:"1"
+ ;
+ $Quantity=new INum();
+ $Quantity->setReadOnly(false);
+ $Quantity->size=8;
+
$Quantity->javascript="onChange='format_number(this);clean_tva($i);compute_ledger($i)'";
+ $array[$i]['quantity']=$Quantity->input("e_quant".$i,$quant);
+
+ }// foreach article
+ $f_type=_('Client');
+
+
+ ob_start();
+ require_once('template/predf_ledger_detail.php');
+ $r.=ob_get_contents();
+ ob_end_clean();
+
+
+
+ // Set correctly the REQUEST param for jrn_type
+ $r.=HtmlInput::hidden('jrn_type','VEN');
+
+ $r.=HtmlInput::button('add_item',_('Ajout article'), '
onClick="ledger_add_row()"');
+ return $r;
+ }
}
Modified: phpcompta/trunk/include/class_pre_operation.php
===================================================================
--- phpcompta/trunk/include/class_pre_operation.php 2013-05-20 20:23:26 UTC
(rev 5294)
+++ phpcompta/trunk/include/class_pre_operation.php 2013-05-20 22:36:25 UTC
(rev 5295)
@@ -32,7 +32,7 @@
require_once("class_ihidden.php");
require_once 'class_pre_op_ach.php';
require_once 'class_pre_op_ven.php';
-require_once 'class_pre_op_ods.php';
+require_once 'class_pre_op_advanced.php';
class Pre_operation
{
var $db; /*!< $db database
connection */
@@ -108,7 +108,6 @@
{
$sql="select od_id,jrn_def_id,od_name,od_item,od_jrn_type".
" from op_predef where od_id=".$this->od_id.
- " and od_direct='".$this->od_direct."'".
" order by od_name";
$res=$this->db->exec_sql($sql);
$array=Database::fetch_all($res);
@@ -123,12 +122,13 @@
$this->detail=new Pre_Op_ven($this->db);
break;
case 'ODS':
- $this->detail=new Pre_op_ods($this->db);
+ $this->detail=new Pre_op_advanced($this->db);
+ break;
default:
- throw new Exception('Load PreOperatoin failed');
+ throw new Exception('Load PreOperatoin
failed'.$this->od_jrn_type);
}
$this->detail->set_od_id($this->od_id);
- $this->adetail=$this->detail->load();
+ $this->detail->jrn_def_id=$this->jrn_def_id;
return $array;
}
@@ -199,7 +199,7 @@
function display()
{
$array=$this->detail->compute_array();
- $this->detail->display($array);
+ echo $this->detail->display($array);
}
}
Modified: phpcompta/trunk/include/preod.inc.php
===================================================================
--- phpcompta/trunk/include/preod.inc.php 2013-05-20 20:23:26 UTC (rev
5294)
+++ phpcompta/trunk/include/preod.inc.php 2013-05-20 22:36:25 UTC (rev
5295)
@@ -34,7 +34,7 @@
$sel=new ISelect();
$sel->name="jrn";
$sel->value=$cn->make_array("select jrn_def_id,jrn_def_name from ".
- " jrn_def order by jrn_def_name");
+ " jrn_def where jrn_def_type in
('VEN','ACH','ODS') order by jrn_def_name");
// Show a list of ledger
$sa=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"";
$sel->selected=(isset($_REQUEST['jrn']))?$_REQUEST['jrn']:-1;
Added: phpcompta/trunk/include/template/predf_ledger_detail.php
===================================================================
--- phpcompta/trunk/include/template/predf_ledger_detail.php
(rev 0)
+++ phpcompta/trunk/include/template/predf_ledger_detail.php 2013-05-20
22:36:25 UTC (rev 5295)
@@ -0,0 +1,81 @@
+<fieldset>
+<legend><?php echo $f_legend ?>
+</legend>
+<?php echo $f_type?><?php echo $f_client_qcode?><?php echo $f_client_bt?>
<?php echo $f_client?><br>
+<input type="hidden" id="p_jrn" name="p_jrn" value="<?php echo
$this->jrn_def_id; ?>">
+<?php echo $str_add_button?>
+</fieldset>
+
+<fieldset>
+<legend><?php echo $f_legend_detail?></legend>
+<table id="sold_item" width="100%" border="0">
+<tr>
+<th style="width:auto"colspan="2">Code <?php echo
HtmlInput::infobulle(0)?></th>
+ <th><?php echo _('Dénomination')?></th>
+<?php if ($flag_tva =='Y') : ?>
+ <th><?php echo _('prix/unité htva')?><?php echo
HtmlInput::infobulle(6)?></th>
+ <th><?php echo _('quantité')?></th>
+ <th><?php echo _('Total HTVA')?></th>
+ <th><?php echo _('tva')?></th>
+ <th><?php echo _('tot.tva')?></th>
+ <th><?php echo _('tvac')?></th>
+<?php else: ?>
+ <th><?php echo _('prix/unité ')?><?php echo
HtmlInput::infobulle(6)?></th>
+ <th><?php echo _('quantité')?></th>
+ <th><?php echo _('Total ')?></th>
+<?php endif;?>
+
+
+
+</tr>
+<?php foreach ($array as $item) {
+echo '<tr>';
+echo $item['quick_code'];
+echo '<td>'.$item['bt'].'</td>';
+?>
+<td style="border-bottom: 1px dotted grey; width: 75%;"><?php echo
$item['denom'] ?></td>
+<?php
+echo td($item['pu']);
+echo td($item['quantity' ]);
+echo td($item['htva']);
+if ($flag_tva=='Y') {
+ echo td($item['tva']);
+ echo td($item['amount_tva'].$item['hidden']);
+
+}
+echo td($item['tvac']);
+echo '</tr>';
+}
+
+?>
+</table>
+
+<div
style="position:float;float:right;text-align:right;padding-right:5px;font-size:1.2em;font-weight:bold;color:blue">
+ <?php echo
HtmlInput::button('act',_('Actualiser'),'onClick="compute_all_ledger();"'); ?>
+ </div>
+
+ <div
style="position:float;float:right;text-align:left;font-size:1.2em;font-weight:bold;color:blue"
id="sum">
+ <br><span id="htva">0.0</span>
+<?php
+ if ( $flag_tva=='Y' ) : ?>
+ <br><span id="tva">0.0</span>
+ <br><span id="tvac">0.0</span>
+<?php endif; ?>
+
+ </div>
+
+<div
style="position:float;float:right;text-align:right;padding-right:5px;font-size:1.2em;font-weight:bold;color:blue">
+<?php
+ if ( $flag_tva =='Y') :
+ ?>
+ <br><?php echo _('Total HTVA')?>
+ <br><?php echo _('Total TVA')?>
+ <br><?php echo _('Total TVAC')?>
+ <?php else: ?>
+ <br><?php echo _('Total')?>
+<?php endif; ?>
+</div>
+
+</fieldset>
+
+
---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r5295 - in phpcompta/trunk: html/js include include/template,
phpcompta-dev <=