352 $group = $this->
db->get_next_seq(
"s_oa_group");
353 $seq = $this->
db->get_next_seq(
's_grpt');
356 $this->jr_internal = $internal;
367 $cust->get_by_qcode($e_client);
372 if (strpos($sposte,
',') != 0) {
373 $array = explode(
',', $sposte);
394 $tva_reverse = array();
401 for (
$i = 0;
$i < $nb_item;
$i++) {
404 if ( empty(${
'e_march'.$i}) || empty(${
'e_quant'.$i}) )
continue;
408 $fiche->get_by_qcode(${
"e_march" .
$i});
409 $amount_currency = bcmul(${
'e_march' .
$i .
'_price'}, ${
'e_quant' .
$i});
412 $amount=bcdiv($amount_currency,$p_currency_rate);
417 $acc_operation->date =
$e_date;
421 if (strpos($sposte,
',') != 0) {
422 $array = explode(
',', $sposte);
425 $poste_val = $sposte;
428 $acc_operation->poste = $poste_val;
429 $acc_operation->amount =
$amount;
430 $acc_operation->grpt =
$seq;
431 $acc_operation->jrn =
$p_jrn;
432 $acc_operation->type =
'c';
433 $acc_operation->periode = $tperiode;
436 $acc_operation->desc=strip_tags(${
"e_march".$i.
"_label"});
440 $acc_operation->desc=
null;
443 $acc_operation->qcode = ${
"e_march" .
$i};
446 $tot_debit=round(bcadd($tot_debit, abs(
$amount)),2);
449 $j_id = $acc_operation->insert_jrnx();
454 $idx_tva =$oTva->get_parameter(
"id");
456 $auto_reverse=$oTva->get_parameter(
"both_side");
458 $tva_item_currency = ${
'e_march' .
$i .
'_tva_amount'};
461 if (trim($tva_item_currency) ==
'' || ${
'e_march'.$i.
'_tva_amount'} == 0) {
462 $tva_item_currency = bcmul(
$amount, $oTva->get_parameter(
'rate'));
463 $tva_item=round($tva_item_currency,2);
465 $tva_item=bcdiv($tva_item_currency,$p_currency_rate);
466 $tva_item=round($tva_item,2);
468 $tva[$idx_tva]=(isset($tva[$idx_tva]))?$tva[$idx_tva]:0;
470 if ( $auto_reverse == 0)
472 $tva[$idx_tva]=bcadd($tva_item,$tva[$idx_tva]);
473 $tva[$idx_tva]=round($tva[$idx_tva],2);
474 $tot_tva = bcadd($tva_item, $tot_tva);
475 $tot_tva = round($tot_tva, 2);
480 $tva_item_currency = 0;
483 $tot_debit=round(bcadd($tot_debit, abs($n_both)),2);
484 $tva_reverse[$idx_tva]=(isset($tva_reverse[$idx_tva]))?$tva_reverse[$idx_tva]:0;
485 $tva_reverse[$idx_tva]=bcadd($tva_item,$tva_reverse[$idx_tva]);
486 $tva_reverse[$idx_tva]=round($tva_reverse[$idx_tva],2);
489 $tva[$idx_tva]=bcadd($tva_item,$tva[$idx_tva]);
490 $tva[$idx_tva]=round($tva[$idx_tva],2);
500 $nNeg = (${
"e_quant" .
$i} < 0) ? -1 : 1;
506 $dir=(${
'e_quant'.$i} < 0 ) ?
'd':
'c';
514 $op->set_currency_rate($p_currency_rate);
515 $op->oa_group = $group;
522 if (empty( ${
'e_march' .
$i .
'_price'} ) ) ${
'e_march' .
$i .
'_price'} = 0;
523 if (empty( ${
'e_march' .
$i } ) ) ${
'e_march' .
$i } = 0;
524 if (empty( ${
'e_quant' .
$i } ) ) ${
'e_quant' .
$i } = 0;
526 $price_euro=bcdiv(${
'e_march'.$i.
'_price'}, $p_currency_rate);
530 $r = $this->
db->exec_sql(
"select insert_quant_sold ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)", array(
null,
536 $oTva->get_parameter(
"id"),
542 $tva_item_currency=0;
544 $r = $this->
db->exec_sql(
"select insert_quant_sold ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10) ", array(
null,
560 $operation_currency->oc_amount=$amount_currency;
561 $operation_currency->oc_vat_amount=$tva_item_currency;
562 $operation_currency->oc_price_unit=${
'e_march'.$i.
'_price'};
563 $operation_currency->j_id=
$j_id;
564 $operation_currency->insert();
565 $tot_amount_cur=round(bcadd($tot_amount_cur,$amount_currency,4),4);
566 $tot_amount_cur=round(bcadd($tot_amount_cur,$tva_item_currency,4),4);
571 $row=$this->
db->get_row(
"select ac_id,ac_label,ac_accounting
575 if ( ! empty (
$row )) {
579 $acc_operation->poste=
$row[
'ac_accounting'];
581 $acc_operation->grpt=
$seq;
582 $acc_operation->jrn=
$p_jrn;
583 $acc_operation->type=
'c';
584 $acc_operation->periode=$tperiode;
585 $acc_operation->desc=
$row[
'ac_label'];
587 $jrn_tax_sql->j_id=$acc_operation->insert_jrnx();
588 $jrn_tax_sql->ac_id=
$row[
'ac_id'];
589 $jrn_tax_sql->pcm_val=
$row[
'ac_accounting'];
590 $jrn_tax_sql->insert();
592 if (
$p_array[
'other_tax_amount'] < 0 ) {
596 $operation_currency->oc_amount=
$p_array[
'other_tax_amount'];
597 $operation_currency->oc_vat_amount=0;
598 $operation_currency->oc_price_unit=0;
599 $operation_currency->j_id=$jrn_tax_sql->j_id;
600 $operation_currency->insert();
608 $cust_amount = round($cust_amount,2);
609 if ( DEBUGNOALYSS > 1 ) {
610 echo __LINE__.
" cust_amount $cust_amount<br>";
611 echo __LINE__.
" tot_amount $tot_amount<br>";
612 echo __LINE__.
" tot_tva $tot_tva<br>";
617 $acc_operation->date =
$e_date;
618 $acc_operation->poste =
$poste;
619 $acc_operation->amount = $cust_amount;
620 $acc_operation->grpt =
$seq;
621 $acc_operation->jrn =
$p_jrn;
622 $acc_operation->type =
'd';
623 $acc_operation->periode = $tperiode;
624 $acc_operation->qcode = ${
"e_client"};
627 $tot_debit=bcadd($tot_debit, $cust_amount);
628 $tot_debit=round($tot_debit, 2);
630 $let_tiers = $acc_operation->insert_jrnx();
634 $operation_currency->oc_amount=$tot_amount_cur;
635 $operation_currency->oc_vat_amount=0;
636 $operation_currency->oc_price_unit=0;
637 $operation_currency->j_id=$let_tiers ;
638 $operation_currency->insert();
650 $poste_vat = $oTva->get_side(
'c');
654 $acc_operation->date =
$e_date;
655 $acc_operation->poste = $poste_vat;
656 $acc_operation->amount =
$value;
657 $acc_operation->grpt =
$seq;
658 $acc_operation->jrn =
$p_jrn;
659 $acc_operation->type =
'c';
660 $acc_operation->periode = $tperiode;
663 $tot_debit=bcadd($tot_debit, abs(
$value));
664 $tot_debit=round($tot_debit, 2);
666 if ( $oTva->get_parameter(
"both_side") == 1 &&
$value ==0 )
continue;
667 $acc_operation->insert_jrnx();
670 if ($oTva->get_parameter(
"both_side") == 1 ) {
672 $x=$oTva->get_parameter(
"tva_reverse_account");
674 $poste_vat =(trim(
$x??
"")==
"")? $oTva->get_side(
'd'):
$x;
675 if ($poste_vat ==
'#') $poste_vat=$oTva->get_side(
'c');
678 $acc_operation->date =
$e_date;
679 $acc_operation->poste = $poste_vat;
680 $acc_operation->amount =
$value;
681 $acc_operation->grpt =
$seq;
682 $acc_operation->jrn =
$p_jrn;
683 $acc_operation->type =
'd';
684 $acc_operation->periode = $tperiode;
685 $acc_operation->insert_jrnx();
686 $tot_debit = bcadd($tot_debit,
$value);
687 $tot_debit = round($tot_debit, 2);
692 foreach ($tva_reverse as
$i =>
$value) {
694 $poste_vat = $oTva->get_side(
'c');
695 if ( $poste_vat ==
'#')
697 $poste_vat=$oTva->get_side(
'd');
701 $acc_operation->date =
$e_date;
702 $acc_operation->poste = $poste_vat;
703 $acc_operation->amount =
$value;
704 $acc_operation->grpt =
$seq;
705 $acc_operation->jrn =
$p_jrn;
706 $acc_operation->type =
'c';
707 $acc_operation->periode = $tperiode;
710 $tot_debit=bcadd($tot_debit, abs(
$value));
711 $tot_debit=round($tot_debit, 2);
713 $acc_operation->insert_jrnx();
716 $poste_vat = $oTva->get_side(
'd');
717 if ( $poste_vat ==
'#')
719 $poste_vat=$oTva->get_side(
'c');
722 $acc_operation->date =
$e_date;
723 $acc_operation->poste = $poste_vat;
724 $acc_operation->amount =
$value;
725 $acc_operation->grpt =
$seq;
726 $acc_operation->jrn =
$p_jrn;
727 $acc_operation->type =
'd';
728 $acc_operation->periode = $tperiode;
729 $acc_operation->insert_jrnx();
730 $tot_debit = bcadd($tot_debit,
$value);
731 $tot_debit = round($tot_debit, 2);
743 if ( DEBUGNOALYSS > 1 ) { echo __LINE__.
" tot_debit ".round($tot_debit,2).
"<br>"; }
745 $acc_operation->date =
$e_date;
746 $acc_operation->echeance = $e_ech;
747 $acc_operation->amount = abs(round($tot_debit, 2));
748 $acc_operation->desc = $e_comm;
749 $acc_operation->grpt =
$seq;
750 $acc_operation->jrn =
$p_jrn;
751 $acc_operation->periode = $tperiode;
752 $acc_operation->pj = $e_pj;
753 $acc_operation->mt = $mt;
754 $acc_operation->currency_id=$p_currency_code;
755 $acc_operation->currency_rate=$p_currency_rate;
756 $acc_operation->currency_rate_ref=$currency_rate_ref->get_rate();
758 if ( ! $this->
jr_id=$acc_operation->insert_jrn() ) {
759 throw new Exception (
_(
"Erreur de balance"),
EXC_BALANCE);
762 $this->pj = $acc_operation->update_receipt();
771 $this->
db->exec_sql(
"update jrn set jr_internal=$1 where jr_grpt_id = $2" ,[$internal,
$seq]);
775 $this->
db->exec_sql(
'update quant_sold set qs_internal = $1
776 where j_id in (select j_id from jrnx where j_grpt=$2)'
777 , array($internal,
$seq));
787 $pay_date=($mp_date==
"")?
$e_date:$mp_date;
795 $acseq = $this->
db->get_next_seq(
's_grpt');
796 $acjrn =
new Acc_Ledger($this->
db, $mp->get_parameter(
'ledger_target'));
797 $acinternal = $acjrn->compute_internal_code($acseq);
802 if ( $acjrn->get_type()==
'FIN') {
804 $acfiche=
new Fiche($this->
db,$acjrn->get_bank());
807 $fqcode = ${
'e_mp_qcode_' . $e_mp};
808 $acfiche =
new Fiche($this->
db);
809 $acfiche->get_by_qcode($fqcode);
814 $acc_pay->date = $pay_date;
818 if (strpos($sposte,
',') != 0) {
819 $array = explode(
',', $sposte);
822 $poste_val = $sposte;
825 $acompte_eur=bcdiv(
$acompte, $p_currency_rate);
827 $famount=bcsub($cust_amount,$acompte_eur);
828 $acc_pay->poste = $poste_val;
829 $acc_pay->qcode = $fqcode;
830 $acc_pay->amount = abs(round($famount, 2));
831 $acc_pay->desc =
null;
833 $acc_pay->grpt = $acseq;
834 $acc_pay->jrn = $mp->get_parameter(
'ledger_target');
835 $acc_pay->periode = $tperiode;
836 $acc_pay->type = ($famount >= 0) ?
'd' :
'c';
837 $let_pay=$acc_pay->insert_jrnx();
841 $acc_pay->date = $pay_date;
843 $acc_pay->qcode = $e_client;
844 $acc_pay->amount = abs(round($famount, 2));
845 $acc_pay->desc =
null;
846 $acc_pay->grpt = $acseq;
847 $acc_pay->jrn = $mp->get_parameter(
'ledger_target');
848 $acc_pay->periode = $tperiode;
849 $acc_pay->type = ($famount >= 0) ?
'c' :
'd';
850 $let_other = $acc_pay->insert_jrnx();
854 $operation_currency->oc_amount=bcsub($tot_amount_cur,
$acompte);
855 $operation_currency->oc_vat_amount=0;
856 $operation_currency->oc_price_unit=0;
857 $operation_currency->j_id=$let_other;
858 $operation_currency->insert();
862 $operation_currency->oc_amount=bcsub($tot_amount_cur,
$acompte);
863 $operation_currency->oc_vat_amount=0;
864 $operation_currency->oc_price_unit=0;
865 $operation_currency->j_id=$let_pay;
866 $operation_currency->insert();
869 $acc_pay->currency_id=$p_currency_code;
870 $acc_pay->currency_rate=$p_currency_rate;
871 $acc_pay->currency_rate_ref=$currency_rate_ref->get_rate();
876 $acjrn->jr_grpt_id = $acseq;
877 $acc_pay->desc = (!isset($e_comm_paiement) ||
noalyss_strlentrim($e_comm_paiement) == 0) ? $e_comm : $e_comm_paiement;
878 $mp_jr_id = $acc_pay->insert_jrn();
879 $acjrn->update_internal_code($acinternal);
881 if ($acjrn->get_type()==
"ODS") {
882 $acc_pay->pj=$acjrn->guess_pj();
883 $acc_pay->update_receipt();
885 $r1 = $this->
get_id($internal);
886 $r2 = $this->
get_id($acinternal);
892 $oletter->insert_couple($let_tiers, $let_other);
896 $Res = $this->
db->exec_sql(
"update jrn set jr_rapt='paid' where jr_id=$1", array($r1));
900 $rec->set_jr_id($r1);
913 if (
$prop[
'jrn_def_type'] ==
'FIN') {
914 $ledger->insert_quant_fin($acfiche->id, $mp_jr_id, $cust->id, bcmul($famount, 1),$let_other);
920 if (isset(
$p_array[
'jrn_note_input']) && !empty(
$p_array[
'jrn_note_input'])) {
922 $acc_operation_note->setNote(
$p_array[
'jrn_note_input']);
923 $acc_operation_note->setOperation_id( $this->
jr_id);
924 $acc_operation_note->save();
926 }
catch (Exception
$e) {
928 $this->
db->rollback();
959 $client =
new Fiche($this->
db);
960 $client->get_by_qcode($e_client,
true);
962 $client_name = $client->getName() .
966 $lPeriode =
new Periode($this->
db);
968 $lPeriode->p_id = $period;
970 $lPeriode->find_periode(
$e_date);
974 $r .=
'<div id="summary_op1" >';
977 $jr_id=$this->
db->get_value(
'select jr_id from jrn where jr_internal=$1',array($this->jr_internal));
980 $r.=
_(
'Détail opération ');
983 $r.=sprintf (
'<a class="line" style="display:inline" href="javascript:modifyOperation(%d,%d)">%s</a>',
984 $jr_id,dossier::id(),$this->jr_internal);
991 $r.=
'<td>' .
_(
'Numéro Pièce') .$span.
'</td><td>'.
hb($e_pj) .
'</td>';
995 if ( strcmp($this->pj,$e_pj) != 0 )
997 $r.=
'<td>' .
_(
'Numéro Pièce') .$span.
'</td><td>'.
hb($this->pj) .
998 '<span class="notice"> '._(
'Attention numéro pièce existante, elle a du être adaptée').
'</span></td>';
1000 $r.=
'<td>' .
_(
'Numéro Pièce') .$span.
'</td><td>'.
hb($this->pj) .
'</td>';
1003 $e_comm=($e_comm ==
"")?
_(
'Facture').
" $e_pj":$e_comm;
1006 $r.=
'<td> ' .
_(
'Date') .
'</td><td> ' .
hb(
$e_date) .
'</td>';
1009 $r.=
'<td>' .
_(
'Echeance') .
'</td><td> ' .
hb($e_ech) .
'</td>';
1012 $r.=
'<td> ' .
_(
'Période Comptable') .
'</td><td> ' .hb(
$date_limit[
'p_start'] .
'-' .
$date_limit[
'p_end']) .
'</td>';
1016 $r .=
'<div id="summary_op2">';
1019 $r.=
'<td> ' .
_(
'Journal') .
'</td><td> ' .
hb($this->
get_name()) .
'</td>';
1022 $r.=
'<td> ' .
_(
'Libellé') .
'</td><td> ' .
hb($e_comm) .
'</td>';
1026 $r.=
'<td> ' .
_(
'Client') .
'</td><td> ' . HtmlInput::card_detail($e_client).
":".
hb( $client_name) .
'</td>';
1029 $r.=
'<div>'._(
'Note').
'<div id="jrn_note_td">'.
$p_array[
'jrn_note_input'].
'</div></div>';
1031 $r.=
'<div style="float:none;clear:both">';
1034 $r.=
'<h2 class="h-section" class="h-section">' .
_(
'Détail articles vendus') .
'</h2>';
1035 $r.=
'<p class="decale">';
1036 $r.=
'<table class="result" >';
1038 $r.=
"<th>" .
_(
'Code') .
"</th>";
1039 $r.=
"<th>" .
_(
'Dénomination') .
"</th>";
1040 $r.=
"<th style=\"text-align:right\">" .
_(
'prix') .
"</th>";
1041 $r.=
"<th style=\"text-align:right\">" .
_(
'quantité') .
"</th>";
1045 $r.=
"<th style=\"text-align:right\">" .
_(
'tva') .
"</th>";
1046 $r.=
'<th style="text-align:right"> ' .
_(
'Montant TVA') .
'</th>';
1047 $r.=
'<th style="text-align:right">' .
_(
'Montant HTVA') .
'</th>';
1048 $r.=
'<th style="text-align:right">' .
_(
'Montant TVAC') .
'</th>';
1050 $r.=
'<th style="text-align:right">' .
_(
'Montant') .
'</th>';
1055 $a_anc =
$anc->get_list();
1058 $r.=
'<th colspan="' .
$x .
'">' .
_(
'Compt. Analytique') .
'</th>';
1066 for (
$i = 0;
$i < $nb_item;
$i++) {
1072 $fiche->get_by_qcode(${
"e_march" .
$i});
1074 $fiche_name =
h(${
"e_march" .
$i .
"_label"});
1078 $idx_tva = ${
"e_march" .
$i .
"_tva_id"};
1083 $amount = bcmul(${
"e_march" .
$i .
"_price"}, ${
'e_quant' .
$i});
1086 $op->set_parameter(
'amount_vat_rate', $oTva->get_parameter(
'rate'));
1088 $tva_computed =
$op->get_parameter(
'amount_vat');
1089 $tva_item = ${
"e_march" .
$i .
"_tva_amount"};
1090 if (isset($tva[$idx_tva]))
1091 $tva[$idx_tva]=bcadd($tva[$idx_tva],$tva_item,2);
1093 $tva[$idx_tva] = $tva_item;
1094 $tot_tva = round(bcadd($tva_item, $tot_tva), 2);
1100 $r.=${
"e_march" .
$i};
1102 $r.=
'<TD style="border-bottom:1px dotted grey;">';
1105 $r.=
'<td class="num">';
1106 $r.=
nbm(${
"e_march" .
$i .
"_price"},4);
1108 $r.=
'<td class="num">';
1113 $r.=
'<td class="num">';
1114 $r.=$oTva->get_parameter(
'label');
1116 $both_side=$oTva->get_parameter(
"both_side");
1119 if (bcsub($tva_item, $tva_computed) != 0 && ! ($tva_item == 0 && $both_side == 1)) {
1120 $r.=
'<td style="background-color:red" class="num">';
1122 $r.=
'<a href="#" class="error" style="display:inline" title="' .
_(
"Attention Différence entre TVA calculée et donnée") .
'">'
1123 .
nbm($tva_item) .
'<a>';
1125 $r.=
'<td class="num">';
1129 $r.=
'<td class="num">';
1132 $tot_row = bcadd($tva_item,
$amount);
1133 $r.=
td(
nbm($tot_row),
'class="num"');
1135 $r.=
'<td class="num">';
1146 $p_mode = ($p_summary ==
false) ? 1 : 0;
1149 $r.=HtmlInput::hidden(
'op[]=',
$i);
1159 $decalage=(
$g_parameter->MY_TVA_USE ==
'Y')?
'<td></td><td></td><td></td><td></td>':
'<td></td>';
1161 $tot_eur=round(bcdiv(
$tot, $p_currency_rate),2);
1163 $str_tot=
_(
'Totaux');
1168 if ( $p_currency_code != 0 ) {
1170 $acc_currency->set_id($p_currency_code);
1175 $tot_tva=
nbm($tot_tva);
1179 <
tr class=
"highlight">
1195 if ($p_currency_code !=0) {
1197 $iso_code=$sql_currency->getp(
"cr_code_iso");
1200 <
tr class=
"highlight">
1209 {$rate} {$p_currency_rate}
1212 {$tot_eur} {$iso_code}
1220 $str_code=$sql_currency->getp(
"cr_code_iso");
1222 $iso_code=$sql_currencydefault->getp(
"cr_code_iso");
1225 <
tr class=
"highlight">
1240 <
tr class=
"highlight">
1248 {$rate} {$p_currency_rate}
1251 {$tot_eur} {$iso_code}
1259 $r.=
'<input type="button" class="button" value="' .
_(
'Vérifiez Imputation Analytique') .
'" onClick="verify_ca(\'\');">';
1260 $r.=
'<div id="total_div_id" >';
1261 $r.=
'<h2 class="h-section">Totaux</h2>';
1262 $other_tax_label=
"";
1265 $other_tax_label=
_(
"Autre taxe");
1271 $r.=
'<tr><td>Total HTVA</td>';
1277 $r.=
'<tr><td> TVA ' . $oTva->get_parameter(
'label').
'</td>';
1280 $r.=
'<tr>'.td(
_(
'Total TVA')).td(
hb($tot_tva),
'class="num"');
1281 if ( ! empty($other_tax_label) ) {
1285 $r.=
'<tr>'.td(
_(
'Total TVAC')).td(
hb(
$tot),
'class="num"');
1288 if ( ! empty($other_tax_label) ) {
1292 $r.=
'<br>Total '.hb(
$tot);
1298 $r.=HtmlInput::hidden(
'e_client', $e_client);
1299 $r.=HtmlInput::hidden(
'nb_item', $nb_item);
1300 $r.=HtmlInput::hidden(
'p_jrn',
$p_jrn);
1301 $r.=HtmlInput::hidden(
'jrn_note_input',
h(
$p_array[
'jrn_note_input']));
1302 $mt = microtime(
true);
1303 $r.=HtmlInput::hidden(
'mt', $mt);
1304 $r.=HtmlInput::post_to_hidden([
'p_currency_rate',
'p_currency_code']);
1308 $r.=HtmlInput::hidden(
'period', $period);
1311 $r.=HtmlInput::hidden(
'e_comm', $e_comm);
1312 $r.=HtmlInput::hidden(
'e_date',
$e_date);
1313 $r.=HtmlInput::hidden(
'e_ech', $e_ech);
1314 $r.=HtmlInput::hidden(
'e_pj', $e_pj);
1315 $r.=HtmlInput::hidden(
'e_pj_suggest', $e_pj_suggest);
1317 $r.=HtmlInput::hidden(
"other_tax",
$p_array[
'other_tax']);
1318 $r.=HtmlInput::hidden(
"other_tax_amount",
$p_array[
'other_tax_amount']);
1320 $e_mp = (isset($e_mp)) ? $e_mp : 0;
1321 $r.=HtmlInput::hidden(
'e_mp', $e_mp);
1323 if ( isset(
$repo) ) {
1330 $r.=HtmlInput::hidden(
'e_mp_qcode_' . $e_mp, ${
'e_mp_qcode_' . $e_mp});
1332 $r.=HtmlInput::hidden(
'e_comm_paiement', $e_comm_paiement);
1334 $r.=HtmlInput::hidden(
'qcode_benef', ${
'e_mp_qcode_' . $e_mp});
1335 $r.=HtmlInput::hidden(
'mp_date', ${
'mp_date'});
1337 $fname =
new Fiche($this->
db);
1338 $fname->get_by_qcode(${
'e_mp_qcode_' . $e_mp});
1339 $r.=
'<h2 class="h-section">' .
"Payé par " . ${
'e_mp_qcode_' . $e_mp} .
1340 " le ".${
"mp_date"}.
1341 " " . $fname->getName() .
'</h2> ' .
'<p class="decale">' .
_(
'Déduction acompte ') .
h(
$acompte) .
'</p>' .
1342 _(
'Libellé :') .
h($e_comm_paiement) ;
1347 for (
$i = 0;
$i < $nb_item;
$i++) {
1348 $r.=HtmlInput::hidden(
"e_march" .
$i, ${
"e_march" .
$i});
1349 if (isset(${
"e_march" .
$i .
"_label"}))
1350 $r.=HtmlInput::hidden(
"e_march" .
$i .
"_label", ${
"e_march" . $i .
"_label"});
1351 $r.=HtmlInput::hidden(
"e_march" .
$i .
"_price", ${
"e_march" .
$i .
"_price"});
1353 $r.=HtmlInput::hidden(
"e_march" .
$i .
"_tva_id", ${
"e_march" .
$i .
"_tva_id"});
1354 $r.=HtmlInput::hidden(
"e_march" .
$i .
"_tva_amount", ${
"e_march" .
$i .
"_tva_amount"});
1356 $r.=HtmlInput::hidden(
"e_quant" .
$i, ${
"e_quant" .
$i});
1362 if ( $negative !=
"") {
1363 $r.=
span($negative,
'class="warning" ');
1425 $http->set_array([]);
1434 $str_add_button_tiers =
"";
1438 $str_add_button_tiers = $this->
add_card(
"deb",
"e_client");
1443 list ($l_date_start, $l_date_end) =
$oPeriode->get_date_limit(
$g_user->get_periode());
1449 $e_ech = (isset($e_ech)) ? $e_ech :
"";
1450 $e_comm = (isset($e_comm)) ? $e_comm :
"";
1453 $r.=dossier::hidden();
1454 $f_legend =
_(
'Client');
1456 $Echeance =
new IDate();
1457 $Echeance->setReadOnly(
false);
1459 $Echeance->tabindex = 2;
1461 $f_echeance = $Echeance->input(
'e_ech', $e_ech,
_(
'Echéance') .
$label);
1462 $Date =
new IDate();
1463 $Date->setReadOnly(
false);
1465 $f_date = $Date->input(
"e_date", $op_date);
1471 $l_user_per =
$g_user->get_periode();
1474 $period =
new IPeriod(
"period");
1477 $period->value =
$def;
1478 $period->type =
OPEN;
1480 $l_form_per = $period->input();
1481 }
catch (Exception
$e) {
1482 if (
$e->getCode() == 1) {
1483 throw new Exception(
_(
"Aucune période ouverte") );
1487 $f_periode =
'<td>' .
_(
"Période comptable") .
"</td> <td> $label " . $l_form_per .
'</td>';
1492 $add_js =
"update_receipt();";
1495 $add_js.=
'get_last_date();';
1497 $add_js.=
'update_name();';
1498 $add_js.=
'update_pay_method();';
1499 $add_js.=
'update_row("sold_item");';
1500 $add_js.=
'update_other_tax();';
1501 $add_js.=
'update_visibility_quantity();';
1505 throw new Exception(
_(
'Pas de journal disponible'));
1507 $wLedger->javascript =
"onChange='update_predef(\"ven\",\"f\",\"".$_REQUEST[
'ac'].
"\");$add_js'";
1512 $Commentaire =
new IText();
1513 $Commentaire->table = 0;
1514 $Commentaire->setReadOnly(
false);
1515 $Commentaire->size = (empty($e_comm))?60:strlen($e_comm)+5;
1516 $Commentaire->size = ($Commentaire->size<60)?60:$Commentaire->size;
1517 $Commentaire->tabindex = 3;
1521 $f_desc = $Commentaire->input(
"e_comm", $e_comm) ;
1533 $pj->setReadOnly(
true);
1540 $pj->value = (isset($e_pj)) ? $e_pj : $default_pj;
1541 $f_pj =
$pj->input() . HtmlInput::hidden(
'e_pj_suggest', $default_pj);
1548 $e_client = ( isset($e_client) ) ? $e_client :
"";
1549 $e_client_label =
" ";
1554 $fClient =
new Fiche($this->
db);
1555 $fClient->get_by_qcode($e_client);
1556 $e_client_label = $fClient->get_attribute(
ATTR_DEF_NAME) .
' ' .
1564 $W1->name =
"e_client";
1566 $W1->value = $e_client;
1568 $W1->set_dblclick(
"fill_ipopcard(this);");
1569 $W1->set_attribute(
'ipopup',
'ipopcard');
1572 $W1->set_attribute(
'label',
'e_client_label');
1574 $W1->set_attribute(
'typecard',
'deb');
1577 $W1->set_callback(
'filter_card');
1578 $W1->set_function(
'fill_data');
1579 $W1->javascript = sprintf(
' onchange="fill_data_onchange(\'%s\');" ', $W1->name);
1580 $f_client_qcode = $W1->input();
1581 $client_label =
new ISpan();
1582 $client_label->table = 0;
1583 $f_client = $client_label->input(
"e_client_label", $e_client_label);
1584 $f_client_bt = $W1->search();
1589 $p_article = ( isset($nb_item)) ? $nb_item : $this->
get_min_row();
1590 $r.=$Hid->input(
"nb_item", $p_article);
1594 $f_legend_detail =
_(
"Détail articles vendus");
1598 for (
$i = 0;
$i < $p_article;
$i++) {
1601 $march = (isset(${
"e_march$i"})) ? ${
"e_march$i"} :
"";
1602 $march_price = (isset(${
"e_march" .
$i .
"_price"})) ? ${
"e_march" .
$i .
"_price"} :
"" ;
1603 if ($flag_tva ==
'Y') {
1604 $march_tva_id = (isset(${
"e_march$i" .
"_tva_id"})) ? ${
"e_march$i" .
"_tva_id"} :
"";
1605 $march_tva_amount = (isset(${
"e_march$i" .
"_tva_amount"})) ? ${
"e_march$i" .
"_tva_amount"} :
"";
1607 $march_label = (isset(${
"e_march" .
$i .
"_label"})) ? ${
"e_march" .
$i .
"_label"} :
"";
1612 $fMarch =
new Fiche($this->
db);
1613 $fMarch->get_by_qcode($march);
1615 if ($flag_tva ==
'Y') {
1616 if (!(isset(${
"e_march$i" .
"_tva_id"})))
1624 $W1->name =
"e_march" .
$i;
1625 $W1->value = $march;
1627 $W1->setAfter_clean(
"compute_all_ledger()");
1628 $W1->set_attribute(
'typecard',
'cred');
1629 $W1->set_dblclick(
"fill_ipopcard(this);");
1630 $W1->set_attribute(
'ipopup',
'ipopcard');
1633 $W1->set_attribute(
'label',
'e_march' .
$i .
'_label');
1635 $W1->set_attribute(
'price',
'e_march' .
$i .
'_price');
1637 $W1->set_attribute(
'tvaid',
'e_march' .
$i .
'_tva_id');
1639 $W1->set_callback(
'filter_card');
1640 $W1->set_function(
'fill_data');
1641 $W1->javascript = sprintf(
' onchange="fill_data_onchange(\'%s\');" ', $W1->name);
1643 $W1->readonly =
false;
1645 $array[
$i][
'quick_code'] = $W1->input();
1647 $array[
$i][
'card_add']=($add_card==TRUE)?$this->
add_card(
"cred", $W1->id):
"";
1650 if ($flag_tva ==
'Y')
1651 $array[
$i][
'hidden'].=HtmlInput::hidden(
'tva_march' .
$i, 0);
1653 $htva =
new INum(
'htva_march' .
$i);
1654 $htva->readOnly = 1;
1656 $array[
$i][
'htva'] = $htva->input();
1659 $tvac =
new INum(
'tvac_march' .
$i);
1663 $tvac->readOnly = 1;
1665 $array[
$i][
'tvac'] = $tvac->input();
1669 $Span=
new IText(
"e_march".
$i.
"_label");
1670 $Span->style=
'class="input_text label_item"';
1673 $Span=
new ISpan(
"e_march".
$i.
"_label");
1674 $Span->extra=
'class="label_item"';
1676 $Span->value = $march_label;
1677 $Span->setReadOnly(
false);
1680 $array[
$i][
'denom'] = $Span->input(
"e_march" .
$i .
"_label", $march_label);
1682 $Price =
new INum();
1683 $Price->setReadOnly(
false);
1685 $Price->javascript =
"onblur=\"format_number(this,4);clean_tva($i);compute_ledger($i)\"";
1686 $array[
$i][
'pu'] = $Price->input(
"e_march" .
$i .
"_price", $march_price);
1690 if ($flag_tva ==
'Y') {
1694 $Tva->id=
"e_march$i".
"_tva_id";
1695 $Tva->in_table =
true;
1696 $Tva->set_attribute(
'compute',
$i);
1697 $Tva->set_filter(
"sale");
1699 $Tva->js =
'onblur="clean_tva(' .
$i .
');compute_ledger(' .
$i .
')"';
1700 $Tva->value = $march_tva_id;
1701 $array[
$i][
'tva'] = $Tva->input(
"e_march$i" .
"_tva_id");
1704 $wTva_amount =
new INum();
1705 $wTva_amount->readOnly =
false;
1706 $wTva_amount->size = 6;
1707 $wTva_amount->javascript =
"onblur='format_number(this);compute_ledger($i)'";
1708 $array[
$i][
'amount_tva'] = $wTva_amount->input(
"e_march" .
$i .
"_tva_amount", $march_tva_amount);
1712 $quant = (isset(${
"e_quant$i"})) ? ${
"e_quant$i"} :
"1";
1713 $Quantity =
new INum();
1715 $Quantity->setReadOnly(
false);
1716 $Quantity->size = 8;
1717 $Quantity->javascript =
"onchange=\"format_number(this,2);clean_tva($i);compute_ledger($i);\"";
1718 $array[
$i][
'quantity'] = $Quantity->input(
"e_quant" .
$i, $quant);
1720 $f_type =
_(
'Client');
1723 $currency_select = $this->
CurrencyInput(
"currency_code",
"p_currency_rate" ,
"p_currency_euro");
1724 $currency_select->selected=
$http->extract(
'p_currency_code',
'string',0);
1726 $currency_input=
new INum(
"p_currency_rate");
1727 $currency_input->id=
"p_currency_rate";
1728 $currency_input->prec=8;
1729 $currency_input->value=
$http->extract(
'p_currency_rate',
'string',1);
1730 $currency_input->javascript=
'onchange="format_number(this,4);CurrencyCompute(\'p_currency_rate\',\'p_currency_euro\');"';
1738 echo
'<div id="predef_form">';
1739 echo HtmlInput::hidden(
'p_jrn_predef', $this->
id);
1741 $op->set_jrn_type(
"VEN");
1742 $op->set_p_jrn($this->
id);
1743 $op->set_od_direct(
'f');
1744 $url=http_build_query(array(
'p_jrn_predef'=>$this->
id,
'ac'=>
$http->request(
'ac'),
1745 'gDossier'=>dossier::id()));
1746 echo
$op->form_get(
'do.php?'.
$url);
1748 $str_op_template=ob_get_contents();
1752 require_once NOALYSS_TEMPLATE.
'/form_ledger_detail.php';
1753 $form_ledger_detail=ob_get_contents();
1756 $r.=$form_ledger_detail;
1759 $r.=HtmlInput::hidden(
'jrn_type',
'VEN');
1762 $r.=
'<div id="additional_tax_div">';