Merged revisions 2868-2880 via svnmerge from

file:///home/developper/svn/phpcompta/branches/rel500

........
  r2869 | danydb | 2010-01-14 14:41:25 +0100 (Thu, 14 Jan 2010) | 1 line
  
  Bug :  fiche_attribut_synchro is really low, solution is to create 2 indexes
........
  r2874 | danydb | 2010-01-15 15:52:38 +0100 (Fri, 15 Jan 2010) | 3 lines
  
  The extra info are now available for ledger purchase, opportunity to clean
  code
........
  r2875 | danydb | 2010-01-15 19:51:33 +0100 (Fri, 15 Jan 2010) | 2 lines
  
  Fix bug : in rapport, the from doesn't work, the result is always 0
........
  r2876 | danydb | 2010-01-16 17:17:50 +0100 (Sat, 16 Jan 2010) | 1 line
  
  For Comptabilité->ACH and Comptabilité->VEN add shortcut to printing and customer/supplier
........
  r2877 | danydb | 2010-01-16 17:30:56 +0100 (Sat, 16 Jan 2010) | 2 lines
  
  Action : add search by type of documents
........
  r2878 | danydb | 2010-01-17 00:31:03 +0100 (Sun, 17 Jan 2010) | 1 line
  
  Fix bug : cannot choose a tva rate
........
  r2879 | danydb | 2010-01-20 22:37:11 +0100 (Wed, 20 Jan 2010) | 6 lines
  
  Action
  ======
  add a button for adding a card there is no filter on the category
  You can add whatever you want
........
  r2880 | danydb | 2010-01-21 16:10:57 +0100 (Thu, 21 Jan 2010) | 1 line
  
  Correct stylesheet : todo list 
........
This commit is contained in:
Dany De Bontridder 2010-01-21 15:13:17 +00:00
parent 6f99c261e6
commit 82a1bf9bb8
19 changed files with 156 additions and 55 deletions

View file

@ -36,9 +36,9 @@ html_min_page_start($User->theme,"onLoad='window.focus();'");
?>
<script>
function GetIt(ctl,tva_id) {
self.opener.SetValue(ctl,tva_id)
window.close();
}
set_inparent(ctl,tva_id);
window.close();
}
</script>
<?php

View file

@ -176,7 +176,7 @@ div.no span{
}
div.content span {
margin-left:40px;
margin-left:10px;
}
table.document {
border:solid blue 2px ;
@ -234,7 +234,7 @@ tr.odd {
border-size:0px;
}
tr {
font-size:12px;
font-size:10px;
}
tr.odd:hover td

View file

@ -189,7 +189,7 @@ font-color:red;
}
div.content span {
margin-left:40px;
margin-left:0px;
}
table.document {
border:solid blue 2px ;
@ -248,7 +248,7 @@ font-size:12px;
border-size:0px;
}
tr {
font-size:12px;
font-size:10px;
}
tr.odd:hover td
{

View file

@ -448,15 +448,14 @@ function sql_filter_per($p_cn,$p_from,$p_to,$p_form='p_id',$p_field='jr_tech_per
$p_from=$a_start['p_start'];
$p_to=$a_end['p_end'];
}
}
if ( $p_from == $p_to )
$periode=" $p_field = (select p_id from parm_periode ".
" where ".
" p_start = to_date('$p_from','DD.MM.YYYY')) ";
" p_start = to_date('$p_from','DD.MM.YYYY')) ";
else
$periode = "$p_field in (select p_id from parm_periode ".
" where p_start >= to_date('$p_from','DD.MM.YYYY') and p_end <= to_date('$p_to','DD.MM.YYYY')) ";
return $periode;
}

View file

@ -266,6 +266,17 @@ function ShowActionList($cn,$p_base)
printf (_('Titre ou référence').': <input type="text" name="query" value="%s">',
$a);
echo '<br/>';
/* type of documents */
$type_doc=new ISelect ('tdoc');
$aTDoc=$cn->make_array('select dt_id,dt_value from document_type');
$aTDoc[]=array('value'=>'-1','label'=>_('Tous les types'));
$type_doc->value=$aTDoc;
$type_doc->selected=(isset ($_GET['tdoc']))?$_GET['tdoc']:-1;
echo 'Type de document';
echo $type_doc->input();
echo '<br>';
$see_all=new ICheckBox('see_all');
$see_all->selected= (isset($_REQUEST['see_all']))?true:false;
echo _('les actions fermées aussi:').$see_all->input().'<br/>';
@ -298,7 +309,9 @@ function ShowActionList($cn,$p_base)
if ( (isset($_GET['qcode']) && trim($_GET['qcode']) != '') ||
(isset($_GET['query']) && trim($_GET['query']) != '') ||
isset ($_GET['all_action']) ||
isset ($_GET['see_all'])) {
isset ($_GET['see_all']) ||
(isset ($_GET['tdoc']) && trim($_GET['tdoc']) !='-1'))
{
/* nothing */
} else {
?>
@ -353,6 +366,9 @@ function ShowActionList($cn,$p_base)
$str=" and (f_id_dest= ".$fiche->id." ) ";
}
}
if (isset($_GET['tdoc']) && $_GET['tdoc'] != -1 ){
$query .= ' and dt_id = '.Formatstring($_GET['tdoc']);
}
if ( ! isset($_REQUEST['see_all'])) $query .= ' and ag_state in (2,3) ';
if ( ! isset($_REQUEST['all_action'])) $query .= " and (ag_owner='".$_SESSION['g_user']."' or ag_dest='".$_SESSION['g_user']."')";
$r=$act->myList($p_base,ACTION,$query.$str);

View file

@ -39,7 +39,7 @@ $search_card->title=_('Recherche de fiche');
$search_card->value='';
echo $search_card->input();
echo ICard::ipopup('ipopcard');
echo ICard::ipopup('ipop_newcard');
$retour=HtmlInput::button_anchor(_('Retour'),'?p_action=suivi_courrier&my_action&'.dossier::get());
//-----------------------------------------------------

View file

@ -209,6 +209,7 @@ function get_solde_detail($p_cond="") {
$Res=$this->db->exec_sql($sql);
$Max=Database::num_row($Res);
if ($Max==0) {
return array('debit'=>0,
'credit'=>0,

View file

@ -144,6 +144,26 @@ class Acc_Ledger_Info {
return $this->jr_id;
}
}
/**
*@brief save all extra information in once, called by compta_ven and compta_ach
*@param $p_jr_id is the jrn.jr_id concerned,
*@param $p_array is the array with the data usually it is $_POST
*@note will change this->jr_id
*@see compta_ven.inc.php compta_ach.inc.php
*/
function save_extra($p_jr_id,$p_array) {
$this->jr_id=$p_jr_id;
if (strlen(trim($p_array['bon_comm'] )) != 0 ) {
$this->set_type('BON_COMMANDE');
$this->set_value($p_array['bon_comm']);
$this->insert();
}
if (strlen(trim($p_array['other_info'] )) != 0 ) {
$this->set_type('OTHER');
$this->set_value($p_array['other_info']);
$this->insert();
}
}
static function test_me() {
echo "Dossier = ".Dossier::id();
$cn=new Database(Dossier::id());

View file

@ -160,6 +160,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
}
/*!\brief insert into the database, it calls first the verify function
* change the value of this->jr_id and this->jr_internal
*\param $p_array is usually $_POST or a predefined operation
*\return string
*\note throw an Exception
@ -172,7 +173,10 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
$group=$this->db->get_next_seq("s_oa_group"); /* for analytic */
$seq=$this->db->get_next_seq('s_grpt');
$this->id=$p_jrn;
$internal=$this->compute_internal_code($seq);
$this->internal=$internal;
$cust=new fiche($this->db);
$cust->get_by_qcode($e_client);
$poste=$cust->strAttribut(ATTR_DEF_ACCOUNT);
@ -448,7 +452,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
$acc_operation->periode=$tperiode;
$acc_operation->pj=$e_pj;
$acc_operation->mt=$mt;
$acc_operation->insert_jrn();
$this->jr_id=$acc_operation->insert_jrn();
$this->pj=$acc_operation->set_pj();
// Set Internal code
@ -1115,11 +1119,17 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
}
// check for upload piece
$file=new IFile();
/**
*@todo clean dead code
*/
/* $file=new IFile();
$file->table=0;
$r.=_("Ajoutez une pièce justificative ");
$r.=$file->input("pj","");
*/
$r.=HtmlInput::warnbulle(12);
$r.=$this->extra_info();
/* Propose to generate a note of fee */
if ( $this->db->count_sql("select md_id,md_name from document_modele where md_type=10") > 0 &&
$e_mp != 0)
@ -1138,6 +1148,45 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
return $r;
}
/*!\brief the function extra info allows to
* - add a attachment
* - generate an invoice
* - insert extra info
*\return string
*/
public function extra_info() {
$r="";
$r.='<div style="position:float;float:left;width:50%;text-align:right;line-height:3em;">';
$r.='<fieldset> <legend> '._('Document à générer').'</legend>';
// check for upload piece
$file=new IFile();
$file->table=0;
$r.=_("Ajoutez une pièce justificative ");
$r.=$file->input("pj","");
if ( $this->db->count_sql("select md_id,md_name from document_modele where md_type=4") > 0 )
{
$r.=_('ou générer un document').' <input type="checkbox" name="gen_invoice" CHECKED>';
// We propose to generate the note of fee
$doc_gen=new ISelect();
$doc_gen->name="gen_doc";
$doc_gen->value=$this->db->make_array(
"select md_id,md_name ".
" from document_modele where md_type=4");
$r.=$doc_gen->input().'<br>';
}
$r.='<br>';
$obj=new IText();
$r.=_('Numero de bon de commande : ').$obj->input('bon_comm').'<br>';
$r.=_('Autre information : ').$obj->input('other_info').'<br>';
$r.="</fieldset>";
$r.='</div>';
return $r;
}
/*!\brief update the payment
*/

View file

@ -160,7 +160,8 @@ class Acc_Ledger_Sold extends Acc_Ledger {
echo "<h2> Acc_Ledger_Sold::save Not implemented</h2>";
}
/*!\brief insert into the database, it calls first the verify function
/*!\brief insert into the database, it calls first the verify function,
* change the value of this->jr_id and this->jr_internal
*\param $p_array is usually $_POST or a predefined operation
*\return string
*\note throw an Exception
@ -174,6 +175,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
$seq=$this->db->get_next_seq('s_grpt');
$this->id=$p_jrn;
$internal=$this->compute_internal_code($seq);
$this->internal=$internal;
$oPeriode=new Periode($this->db);
$check_periode=$this->check_periode();
@ -331,7 +333,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
$acc_operation->pj=$e_pj;
$acc_operation->mt=$mt;
$acc_operation->insert_jrn();
$this->jr_id=$acc_operation->insert_jrn();
$this->pj=$acc_operation->set_pj();

View file

@ -255,6 +255,16 @@ class Action
$ag_ref->value=FormatString($this->ag_ref);
$client_label=new ISpan();
/* 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');
$filter=$this->db->make_list('select fd_id from fiche_def ');
$f_add_button->set_attribute('filter',$filter);
$f_add_button->javascript=" select_card_type(this);";
$str_add_button=$f_add_button->input();
// f_id_dest sender
if ( $this->qcode_dest != '- ERROR -' && strlen(trim($this->qcode_dest)) != 0)
{

View file

@ -34,7 +34,8 @@ require_once('class_html_input.php');
if ( $this->readOnly==true) return $this->display();
$r=sprintf('Tva <INPUT TYPE="Text" style="border:solid 1px blue;" '.
' NAME="%s" VALUE="%s" SIZE="3" onChange="ChangeTVA(\'%s\',\'%s\');">',
' ID="%s" NAME="%s" VALUE="%s" SIZE="3" onChange="ChangeTVA(\'%s\',\'%s\');">',
$this->name,
$this->name,
$this->value,
$this->label,

View file

@ -55,7 +55,9 @@ $str_dossier=dossier::get();
$array=array(
array('?p_action=ach&sa=n&'.$str_dossier,_('Nouvelle dépense'),_('Nouvel achat ou dépense'),1),
array('?p_action=ach&sa=l&'.$str_dossier,_('Liste achat'),_('Liste des achats'),2),
array('?p_action=ach&sa=lnp&'.$str_dossier,_('Liste dépenses non payées'),_('Liste des ventes non payées'),3)
array('?p_action=ach&sa=lnp&'.$str_dossier,_('Liste dépenses non payées'),_('Liste des ventes non payées'),3),
array('commercial.php?p_action=supplier&'.$str_dossier,_('Fournisseurs'),_('Fournisseurs')),
array('?p_action=impress&type=jrn&'.$str_dossier,_('Impression'),_('Impression'))
);
$sa=(isset ($_REQUEST['sa']))?$_REQUEST['sa']:-1;
@ -164,6 +166,10 @@ if ( $def==1 || $def == 4 ) {
if (isset($Ledger->doc)) {
echo $Ledger->doc.'<hr>';
}
/* Save the additional information into jrn_info */
$obj=new Acc_Ledger_Info($cn);
$obj->save_extra($Ledger->jr_id,$_POST);
echo HtmlInput::button_anchor(_('Nouvelle dépense'),$href.'?p_action=ach&sa=n&'.dossier::get());
echo '</div>';
exit();

View file

@ -54,7 +54,9 @@ $str_dossier=dossier::get();
$array=array(
array('?p_action=ven&sa=n&'.$str_dossier,_('Nouvelle vente'),_('Nouvelle vente'),1),
array('?p_action=ven&sa=l&'.$str_dossier,_('Liste ventes'),_('Liste des ventes'),2),
array('?p_action=ven&sa=lnp&'.$str_dossier,_('Liste vente non payées'),_('Liste des ventes non payées'),3)
array('?p_action=ven&sa=lnp&'.$str_dossier,_('Liste vente non payées'),_('Liste des ventes non payées'),3),
array('commercial.php?p_action=client&'.$str_dossier,_('Clients'),_('Clients')),
array('?p_action=impress&type=jrn&'.$str_dossier,_('Impression'),_('Impression'))
);
$sa=(isset ($_REQUEST['sa']))?$_REQUEST['sa']:-1;
@ -175,17 +177,8 @@ if ( $def==1 || $def == 4 ) {
/* Save the additional information into jrn_info */
$obj=new Acc_Ledger_Info($cn);
$jr_id=$obj->search_id_internal($internal);
if (strlen(trim($_POST['bon_comm'] )) != 0 ) {
$obj->set_type('BON_COMMANDE');
$obj->set_value($_POST['bon_comm']);
$obj->insert();
}
if (strlen(trim($_POST['other_info'] )) != 0 ) {
$obj->set_type('OTHER');
$obj->set_value($_POST['other_info']);
$obj->insert();
}
$obj->save_extra($Ledger->jr_id,$_POST);
echo HtmlInput::button_anchor(_('Nouvelle vente'),$href.'?p_action=ven&sa=n&'.dossier::get());
echo '</div>';

View file

@ -72,7 +72,7 @@ if ( isset($_POST['start_import'])){
// $array contient toutes les valeurs nécessaires à Fiche::insert,
$array=$client->toArray($_POST['fd_id']);
while ( $data=fgetcsv($f)) {
while ( ($data=fgetcsv($f))==true) {
// remarque : on a éliminé les traitements d'erreur
// On remet tous les attributs (propriétés) à vide

View file

@ -257,11 +257,11 @@ echo_debug(__FILE__,__LINE__,"receiving $p_formula");
// then we must modify the cond for the periode
$from=str_replace("FROM=","",$afrom[0]);
// Get the periode
/*! \note special value for the clause FROM=00.0000
*/
if ( $from == '00.0000' ) {
// retrieve the first month of this periode
$User=new User($p_cn);
$user_periode=$User->get_periode();
@ -269,8 +269,10 @@ echo_debug(__FILE__,__LINE__,"receiving $p_formula");
$periode=$oPeriode->get_exercice($user_periode);
list($first,$last)=$oPeriode->get_limit($periode);
$ret=$first->get_date_limit();
$end_date=$oPeriode->get_date_limit($p_end);
if ($ret == null ) throw new Exception ('Pas de limite à cette période',1);
$cond=sql_filter_per($p_cn,$ret['p_start'],$p_end,'date','j_tech_per');
$cond=sql_filter_per($p_cn,$ret['p_start'],$end_date['p_end'],'date','j_tech_per');
} else {
$oPeriode=new Periode($p_cn);
@ -286,9 +288,9 @@ echo_debug(__FILE__,__LINE__,"receiving $p_formula");
$year=$oPeriode->get_exercice($user_periode);
list($first,$last)=$oPeriode->get_limit($year);
$ret=$first->get_date_limit();
$end_date=$oPeriode->get_date_limit($p_end);
if ($ret == null ) throw new Exception ('Pas de limite à cette période',1);
$cond=sql_filter_per($p_cn,$ret['p_start'],$p_end,'date','j_tech_per');
$cond=sql_filter_per($p_cn,$ret['p_start'],$end_date['p_end'],'date','j_tech_per');
}
}
}
@ -300,8 +302,6 @@ echo_debug(__FILE__,__LINE__,"receiving $p_formula");
// Get sum of account
$P=new Acc_Account_Ledger($p_cn,$e[0]);
echo_debug(__FILE__.":".__LINE__." condition is $cond");
$detail=$P->get_solde_detail($cond);

View file

@ -185,7 +185,7 @@ function ShowOperationExpert($p_cn,$p_jr_id,$p_mode=1)
$r.="</table>";
$r.="Total ".$content['jr_montant']."<br>";
if ( $content['jrn_def_type'] == 'VEN' ) {
/* count the number of additionnal info */
$acc_jrn_info=new Acc_Ledger_Info($p_cn);
$acc_jrn_info->set_jrn_id($p_jr_id);
@ -203,7 +203,7 @@ function ShowOperationExpert($p_cn,$p_jr_id,$p_mode=1)
}
}
}
if ( $p_mode==1) {
// show all the related operation
$rec=new Acc_Reconciliation($p_cn);
@ -567,25 +567,25 @@ function ShowOperationUser($p_cn,$p_jr_id,$p_mode=1)
$_REQUEST['PHPSESSID'],
$content['jr_pj_name'])."</TD>";
$r.="</TR></TABLE>";
if ( $content['jrn_def_type'] == 'VEN' ) {
/* count the number of additionnal info */
$acc_jrn_info=new Acc_Ledger_Info($p_cn);
$acc_jrn_info->set_jrn_id($p_jr_id);
/* if additional info > 0 show them */
if ( $acc_jrn_info->count() > 0 ) {
$array=$acc_jrn_info->load_all();
foreach ($array as $row) {
if ( strpos($row->id_type,'BON_COMMANDE') ===0) {
$r.="Num bon de commande : ".$row->ji_value.'<br>';
}
if ( strpos($row->id_type,'OTHER') ===0) {
$r.="Autre info : ".$row->ji_value.'<br>';
}
/* count the number of additionnal info */
$acc_jrn_info=new Acc_Ledger_Info($p_cn);
$acc_jrn_info->set_jrn_id($p_jr_id);
/* if additional info > 0 show them */
if ( $acc_jrn_info->count() > 0 ) {
$array=$acc_jrn_info->load_all();
foreach ($array as $row) {
if ( strpos($row->id_type,'BON_COMMANDE') ===0) {
$r.="Num bon de commande : ".$row->ji_value.'<br>';
}
if ( strpos($row->id_type,'OTHER') ===0) {
$r.="Autre info : ".$row->ji_value.'<br>';
}
}
}
$r.="<hr>";
if ( $p_mode == 1 ) {
$r.= "<table>";

View file

@ -61,6 +61,8 @@
</td>
</Tr>
</table>
<?echo $str_add_button;?>
</div>
<div style="float:left;width:50%">
<table>
@ -122,7 +124,9 @@
</TD>
</TR>
</table>
</div>
</fieldset>
<fieldset>
<legend>

View file

@ -58,7 +58,7 @@ echo '</tr>';
?>
</table>
<?=$str_add_button2?>
<div style="position:float;float:right;text-align:right;padding-right:5px;font-size:1.2em;font-weight:bold;color:blue">
<?=HtmlInput::button('act',_('Actualiser'),'onClick="compute_all_ledger();"'); ?>
</div>