#202 contrepartie DNA

This commit is contained in:
Dany De Bontridder 2011-01-20 19:38:17 +00:00
parent 1b8e03290d
commit 8bc37a2bd3
8 changed files with 65 additions and 39 deletions

View file

@ -0,0 +1,9 @@
begin;
insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (50,'Contrepartie pour TVA récup par impot','poste',22);
insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (51,'Contrepartie pour TVA non Ded.','poste',22);
insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (52,'Contrepartie pour dépense à charge du gérant','poste',22);
insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (53,'Contrepartie pour dépense fiscal. non déd.','poste',22);
update version set val=93;
commit;

View file

@ -41,6 +41,7 @@ content[10]="ATTENTION changer le poste comptable d'une fiche <b>ne modifiera pa
content[11]="ATTENTION si le poste comptable est vide, il sera créé automatiquement";
content[12]="Document généré uniquement si le mode de paiement est utilisé";
content[13]="Vous pouvez utiliser le % pour indiquer le poste parent";
content[14]="Attention, le poste comptable doit exister, il ne sera pas vérifié";
function showBulle(p_ctl)
{

View file

@ -74,7 +74,11 @@ $select_type->value=array(
array('value'=>'text','label'=>'Texte'),
array('value'=>'numeric','label'=>'Nombre'),
array('value'=>'date','label'=>'Date'),
array('value'=>'zone','label'=>'Zone de texte')
array('value'=>'zone','label'=>'Zone de texte'),
array('value'=>'poste','label'=>'Poste Comptable'),
array('value'=>'card','label'=>'Fiche'),
);
$remove=new IButton('rmfa');
$remove->label='Effacer';

View file

@ -251,7 +251,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
if ( $poste_nd->load() == false)
{
$nd_msg=sprintf(_("Pour la fiche %s, le compte %s n'existe pas"),
$fiche->getName,$poste_nd->id);
$fiche->getName(),$poste_nd->id);
$nd_msg=h($nd_msg);
throw new Exception ($nd_msg);
}
@ -552,6 +552,8 @@ class Acc_Ledger_Purchase extends Acc_Ledger
*/
if ( $tot_nd != 0)
{
$dna_default=new Acc_Parm_Code($this->db,'DNA');
/* save op. */
if ( ! $fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND))
{
@ -559,11 +561,13 @@ class Acc_Ledger_Purchase extends Acc_Ledger
}
else
{
$dna=new Acc_Parm_Code($this->db,'DNA');
$dna=$dna_default->p_value;
}
$dna=($dna=='')?$dna_default->p_value:$dna;
$acc_operation->type='d';
$acc_operation->amount=$tot_nd;
$acc_operation->poste=$dna->p_value;
$acc_operation->poste=$dna;
$acc_operation->qcode='';
if ( $tot_nd > 0 ) $tot_debit=bcadd($tot_debit,$tot_nd);
$j_id=$acc_operation->insert_jrnx();
@ -574,6 +578,8 @@ class Acc_Ledger_Purchase extends Acc_Ledger
*/
if ( $tot_perso != 0)
{
$dna_default=new Acc_Parm_Code($this->db,'DEP_PRIV');
/* save op. */
$acc_operation->type='d';
if ( ! $fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND_PERSO))
@ -582,11 +588,12 @@ class Acc_Ledger_Purchase extends Acc_Ledger
}
else
{
$dna=new Acc_Parm_Code($this->db,'DEV_PRIV');
$dna=$dna_default->p_value;
}
$dna=($dna=='')?$dna_default->p_value:$dna;
$acc_operation->amount=$tot_perso;
$acc_operation->poste=$dna->p_value;
$acc_operation->poste=$dna;
$acc_operation->qcode='';
if ( $tot_perso > 0 ) $tot_debit=bcadd($tot_debit,$tot_perso);
$j_id=$acc_operation->insert_jrnx();
@ -594,42 +601,47 @@ class Acc_Ledger_Purchase extends Acc_Ledger
}
if ( $tot_tva_nd != 0)
{
$dna_default=new Acc_Parm_Code($this->db,'TVA_DNA');
/* save op. */
$acc_operation->type='d';
$acc_operation->qcode='';
if ( ! $fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND_TVA))
{
$dna=$fiche->strAttribut(ATTR_DEF_ACCOUNT_ND_TVA);
}
else
{
$dna=new Acc_Parm_Code($this->db,'TVA_DNA');
}
$acc_operation->amount=$tot_tva_nd;
$acc_operation->poste=$dna->p_value;
if ( $tot_tva_nd > 0 ) $tot_debit=bcadd($tot_debit,$tot_tva_nd);
$j_id=$acc_operation->insert_jrnx();
}
if ( $tot_tva_ndded != 0)
{
/* save op. */
if ( ! $fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND_TVA_ND))
{
$dna=$fiche->strAttribut(ATTR_DEF_ACCOUNT_ND_TVA_ND);
}
else
{
$dna=new Acc_Parm_Code($this->db,'TVA_DED_IMPOT');
$dna=$dna_default->p_value;
}
$dna=($dna=='')?$dna_default->p_value:$dna;
$acc_operation->amount=$tot_tva_nd;
$acc_operation->poste=$dna;
if ( $tot_tva_nd > 0 ) $tot_debit=bcadd($tot_debit,$tot_tva_nd);
$j_id=$acc_operation->insert_jrnx();
}
if ( $tot_tva_ndded != 0)
{
$dna_default=new Acc_Parm_Code($this->db,'TVA_DED_IMPOT');
/* save op. */
if ( ! $fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND_TVA))
{
$dna=$fiche->strAttribut(ATTR_DEF_ACCOUNT_ND_TVA);
}
else
{
$dna=$dna_default->p_value;
}
$dna=($dna=='')?$dna_default->value:$dna;
$acc_operation->type='d';
$acc_operation->qcode='';
$acc_operation->amount=$tot_tva_ndded;
$acc_operation->poste=$dna->p_value;
$acc_operation->poste=$dna;
if ( $tot_tva_ndded > 0 ) $tot_debit=bcadd($tot_debit,$tot_tva_ndded);
$j_id=$acc_operation->insert_jrnx();

View file

@ -499,14 +499,14 @@ class Fiche
$w->heigh=2;
break;
case 'poste':
$w=new IPoste("av_text".$r->ad_id);
$w=new IPoste("av_text".$attr->ad_id);
$w->set_attribute('ipopup','ipop_account');
$w->set_attribute('account',"av_text".$r->ad_id);
$w->set_attribute('account',"av_text".$attr->ad_id);
$w->table=1;
$bulle=HtmlInput::infobulle(10);
$bulle=HtmlInput::infobulle(14);
break;
case 'card':
$w=new ICard("av_text".$r->ad_id);
$w=new ICard("av_text".$attr->ad_id);
// filter on frd_id
$sql=' select fd_id from fiche_def ';
$filter=$this->cn->make_list($sql);
@ -640,7 +640,7 @@ class Fiche
$w->set_attribute('ipopup','ipop_account');
$w->set_attribute('account',"av_text".$r->ad_id);
$w->table=1;
$bulle=HtmlInput::infobulle(10);
$bulle=HtmlInput::infobulle(14);
break;
case 'card':
$w=new ICard("av_text".$r->ad_id);

View file

@ -64,8 +64,8 @@ class Fiche_Attr
if ( strlen(trim($this->ad_type))==0)
throw new Exception('Le type ne peut pas être vide',1);
$this->ad_type=strtolower($this->ad_type);
if ( in_array($this->ad_type,array('date','text','numeric','zone'))==false)
throw new Exception('Le type doit être text, numeric ou date',1);
if ( in_array($this->ad_type,array('date','text','numeric','zone','poste','card'))==false)
throw new Exception('Le type doit être text, numeric,poste, card ou date',1);
if ( trim($this->ad_size)=='' || isNumber($this->ad_size)==0||$this->ad_size>22)
{
switch ($this->ad_type)

View file

@ -39,7 +39,7 @@ $g_captcha=false;
$version_phpcompta=3872;
define ("DBVERSION",92);
define ("DBVERSION",93);
define ("DBVERSIONREPO",13);
define ('NOTFOUND','--not found--');

View file

@ -1,5 +1,5 @@
insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (50,'Contrepartie pour TVA récup par impot',poste,22);
insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (51,'Contrepartie pour TVA non Ded.',poste,22);
insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (52,'Contrepartie pour Dépense personnel',poste,22);
insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (53,'Contrepartie pour DNA',poste,22);
insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (50,'Contrepartie pour TVA récup par impot','poste',22);
insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (51,'Contrepartie pour TVA non Ded.','poste',22);
insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (52,'Contrepartie pour dépense à charge du gérant','poste',22);
insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (53,'Contrepartie pour dépense fiscal. non déd.','poste',22);