コード例 #1
0
             $op = new Acc_Operation($cn);
             $op->jr_id = $detail['jr_id'];
             $op->poste = $_GET['poste_id'];
             echo $op->display_jrnx_detail(1);
         }
         echo '</table>';
         echo Acc_Account_Ledger::HtmlTableHeader();
     }
     echo "</div>";
     exit;
 }
 // A QuickCode  is given
 if ($go == 2) {
     if (!isset($_REQUEST['oper_detail'])) {
         echo '<div class="content">';
         echo '<h2 class="info"> ' . '(' . $fiche->id . ')' . $fiche->getName() . ' ' . ' [ ' . $fiche->get_quick_code() . ' ] ' . '</h2>';
         $fiche->HtmlTableHeader();
         $fiche->HtmlTable(null, $_GET['ople']);
         $fiche->HtmlTableHeader();
         echo "</div>";
     } else {
         // Detail //
         echo '<div class="content">';
         echo '<h2 class="info"> ' . '(' . $fiche->id . ')' . $fiche->getName() . ' ' . ' [ ' . $fiche->get_quick_code() . ' ] ' . '<h2>';
         $fiche->HtmlTableHeader();
         $fiche->HtmlTableDetail();
         $fiche->HtmlTableHeader();
         echo "</div>";
     }
     exit;
 }
コード例 #2
0
?>
                            </td>
                            <td>
                                <?php 
$date_paid = new IDate('p_date_paid');
$date_paid->value = format_date($obj->det->jr_date_paid);
echo $date_paid->input();
?>
                            </td>
                        </tr>

                        <tr><td>
                                <?php 
$bk = new Fiche($cn, $obj->det->array[0]['qp_supplier']);
echo td(_('Fournisseur'));
$view_card_detail = HtmlInput::card_detail($bk->get_quick_code(), h($bk->getName()), ' class="line" ');
echo td($view_card_detail);
?>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <?php 
$itext = new IText('npj');
$itext->value = strip_tags($obj->det->jr_pj_number);
echo td(_('Pièce')) . td($itext->input());
?>
                            </td>
                        <tr>
                            <td>
                                <?php 
コード例 #3
0
require_once NOALYSS_INCLUDE . '/class_database.php';
require_once NOALYSS_INCLUDE . '/class_fiche.php';
$f_id = HtmlInput::default_value_request("f_id", "-");
if ($f_id == "-") {
    throw new Exception('Invalid parameter');
}
require_once NOALYSS_INCLUDE . '/class_dossier.php';
$gDossier = dossier::id();
/* Admin. Dossier */
$cn = new Database($gDossier);
$Fiche = new Fiche($cn, $f_id);
$qcode = $Fiche->get_quick_code();
header('Content-type: application/csv');
header('Pragma: public');
header('Content-Disposition: attachment;filename="fiche-' . $qcode . '.csv"', FALSE);
$Fiche->getName();
list($array, $tot_deb, $tot_cred) = $Fiche->get_row_date($_GET['from_periode'], $_GET['to_periode'], $_GET['ople']);
if (count($Fiche->row) == 0) {
    echo "Aucune donnée";
    return;
}
if (!isset($_REQUEST['oper_detail'])) {
    echo '"Qcode";' . "\"Date\";" . "\"n° pièce\";" . "\"Code interne\";" . '"Code journal";' . '"Nom journal";' . "\"Description\";" . "\"Débit\";" . "\"Crédit\";" . "\"Prog.\";" . "\"Let.\"";
    printf("\n");
    $progress = 0;
    $current_exercice = "";
    $tot_deb = 0;
    $tot_cred = 0;
    bcscale(2);
    foreach ($Fiche->row as $op) {
        /*
コード例 #4
0
ファイル: class_pdf.php プロジェクト: Kloadut/noalyss_ynh
 /**
  *@brief retrieve the client name and quick_code
  *@param $p_jr_id jrn.jr_id
  *@param $p_jrn_type ledger type ACH VEN FIN
  *@return array (0=>qcode,1=>name) or for FIN 0=>customer qc 1=>customer name 2=>bank qc 3=>bank name
  *@see class_print_ledger_simple, class_print_ledger_simple_without_vat
  */
 function get_tiers($p_jr_id, $p_jrn_type)
 {
     if ($p_jrn_type == 'ACH') {
         $array = $this->cn->get_array('SELECT
                                     jrnx.j_grpt,
                                     quant_purchase.qp_supplier,
                                     quant_purchase.qp_internal,
                                     jrn.jr_internal
                                     FROM
                                     public.quant_purchase,
                                     public.jrnx,
                                     public.jrn
                                     WHERE
                                     quant_purchase.j_id = jrnx.j_id AND
                                     jrnx.j_grpt = jrn.jr_grpt_id and jr_id=$1', array($p_jr_id));
         if (count($array) == 0) {
             return array("ERREUR {$p_jr_id}", '');
         }
         $customer_id = $array[0]['qp_supplier'];
         $fiche = new Fiche($this->cn, $customer_id);
         $customer_qc = $fiche->get_quick_code($customer_id);
         $customer_name = $fiche->getName();
         return array($customer_qc, $customer_name);
     }
     if ($p_jrn_type == 'VEN') {
         $array = $this->cn->get_array('SELECT
                                     quant_sold.qs_client
                                     FROM
                                     public.quant_sold,
                                     public.jrnx,
                                     public.jrn
                                     WHERE
                                     quant_sold.j_id = jrnx.j_id AND
                                     jrnx.j_grpt = jrn.jr_grpt_id and jr_id=$1', array($p_jr_id));
         if (count($array) == 0) {
             return array("ERREUR {$p_jr_id}", '');
         }
         $customer_id = $array[0]['qs_client'];
         $fiche = new Fiche($this->cn, $customer_id);
         $customer_qc = $fiche->get_quick_code($customer_id);
         $customer_name = $fiche->getName();
         return array($customer_qc, $customer_name);
     }
     if ($p_jrn_type == 'FIN') {
         $array = $this->cn->get_array('SELECT
                                     qf_other,qf_bank
                                     FROM
                                     public.quant_fin
                                     WHERE
                                     quant_fin.jr_id =$1', array($p_jr_id));
         if (count($array) == 0) {
             return array("ERREUR {$p_jr_id}", '', '', '');
         }
         $customer_id = $array[0]['qf_other'];
         $fiche = new Fiche($this->cn, $customer_id);
         $customer_qc = $fiche->get_quick_code($customer_id);
         $customer_name = $fiche->getName();
         $bank_id = $array[0]['qf_bank'];
         $fiche = new Fiche($this->cn, $bank_id);
         $bank_qc = $fiche->get_quick_code($bank_id);
         $bank_name = $fiche->getName();
         return array($customer_qc, $customer_name, $bank_qc, $bank_name);
     }
 }
コード例 #5
0
 /**
  * @brief get_detail gives the detail of row
  * this array must contains at least the field
  *       <ul>
  *       <li> montant</li>
  *       <li> grpt_id
  *       </ul>
  * the following field will be added
  *       <ul>
  *       <li> HTVA
  *       <li> TVAC
  *       <li> TVA array with
  *          <ul>
  *          <li> field 0 idx
  *          <li> array containing tva_id,tva_label and tva_amount
  *          </ul>
  *       </ul>
  *
  * @paramp_array the structure is set in get_rowSimple, this array is
  *        modified,
  * @param $trunc if the data must be truncated, usefull for pdf export
  * @paramp_jrn_type is the type of the ledger (ACH or VEN)
  * @param $a_TVA TVA Array (default null)
  * @param $a_ParmCode Array (default null)
  * \return p_array
  */
 function get_detail(&$p_array, $p_jrn_type, $trunc = 0, $a_TVA = null, $a_ParmCode = null)
 {
     bcscale(2);
     if ($a_TVA == null) {
         //Load TVA array
         $a_TVA = $this->db->get_array('select tva_id,tva_label,tva_poste
                                     from tva_rate where tva_rate != 0 order by tva_rate,tva_label,tva_id');
     }
     if ($a_ParmCode == null) {
         //Load Parm_code
         $a_ParmCode = $this->db->get_array('select p_code,p_value from parm_code');
     }
     // init
     $p_array['client'] = "";
     $p_array['TVAC'] = 0;
     $p_array['TVA'] = array();
     $p_array['AMOUNT_TVA'] = 0.0;
     $p_array['dep_priv'] = 0;
     $p_array['dna'] = 0;
     $p_array['tva_dna'] = 0;
     $p_array['tva_np'] = 0;
     $dep_priv = 0.0;
     //
     // Retrieve data from jrnx
     $sql = "select j_id,j_poste,j_montant, j_debit,j_qcode from jrnx where " . " j_grpt=" . $p_array['grpt_id'];
     $Res2 = $this->db->exec_sql($sql);
     $data_jrnx = Database::fetch_all($Res2);
     $c = 0;
     // Parse data from jrnx and fill diff. field
     foreach ($data_jrnx as $code) {
         $idx_tva = 0;
         $poste = new Acc_Account_Ledger($this->db, $code['j_poste']);
         // if card retrieve name if the account is not a VAT account
         if (strlen(trim($code['j_qcode'])) != 0 && $poste->isTva() == 0) {
             $fiche = new Fiche($this->db);
             $fiche->get_by_qcode(trim($code['j_qcode']), false);
             $fiche_def_id = $fiche->get_fiche_def_ref_id();
             // Customer or supplier
             if ($fiche_def_id == FICHE_TYPE_CLIENT || $fiche_def_id == FICHE_TYPE_FOURNISSEUR || $fiche_def_id == FICHE_TYPE_ADM_TAX) {
                 $p_array['TVAC'] = $code['j_montant'];
                 $p_array['client'] = $trunc == 0 ? $fiche->getName() : mb_substr($fiche->getName(), 0, 20);
                 $p_array['reversed'] = false;
                 if ($fiche_def_id == FICHE_TYPE_CLIENT && $code['j_debit'] == 'f') {
                     $p_array['reversed'] = true;
                     $p_array['TVAC'] *= -1;
                 }
                 if ($fiche_def_id == FICHE_TYPE_ADM_TAX && $code['j_debit'] == 'f') {
                     $p_array['reversed'] = true;
                     $p_array['TVAC'] *= -1;
                 }
                 if ($fiche_def_id == FICHE_TYPE_FOURNISSEUR && $code['j_debit'] == 't') {
                     $p_array['reversed'] = true;
                     $p_array['TVAC'] *= -1;
                 }
             } else {
                 // if we use the ledger ven / ach for others card than supplier and customer
                 if ($fiche_def_id != FICHE_TYPE_VENTE && $fiche_def_id != FICHE_TYPE_ACH_MAR && $fiche_def_id != FICHE_TYPE_ACH_SER && $fiche_def_id != FICHE_TYPE_ACH_MAT) {
                     $p_array['TVAC'] = $code['j_montant'];
                     $p_array['client'] = $trunc == 0 ? $fiche->getName() : mb_substr($fiche->getName(), 0, 20);
                     $p_array['reversed'] = false;
                     if ($p_jrn_type == 'ACH' && $code['j_debit'] == 't') {
                         $p_array['reversed'] = true;
                         $p_array['TVAC'] *= -1;
                     }
                     if ($p_jrn_type == 'VEN' && $code['j_debit'] == 'f') {
                         $p_array['reversed'] = true;
                         $p_array['TVAC'] *= -1;
                     }
                 }
             }
         }
         // if TVA, load amount, tva id and rate in array
         foreach ($a_TVA as $line_tva) {
             list($tva_deb, $tva_cred) = explode(',', $line_tva['tva_poste']);
             if ($code['j_poste'] == $tva_deb || $code['j_poste'] == $tva_cred) {
                 // For the reversed operation
                 if ($p_jrn_type == 'ACH' && $code['j_debit'] == 'f') {
                     $code['j_montant'] = -1 * $code['j_montant'];
                 }
                 if ($p_jrn_type == 'VEN' && $code['j_debit'] == 't') {
                     $code['j_montant'] = -1 * $code['j_montant'];
                 }
                 $p_array['AMOUNT_TVA'] += $code['j_montant'];
                 $p_array['TVA'][$c] = array($idx_tva, array($line_tva['tva_id'], $line_tva['tva_label'], $code['j_montant']));
                 $c++;
                 $idx_tva++;
             }
         }
         // isDNA
         // If operation is reversed then  amount are negatif
         /* if ND */
         if ($p_array['jrn_def_type'] == 'ACH') {
             $purchase = new Gestion_Purchase($this->db);
             $purchase->search_by_jid($code['j_id']);
             $purchase->load();
             $dep_priv += $purchase->qp_dep_priv;
             $p_array['dep_priv'] = $dep_priv;
             $p_array['dna'] = bcadd($p_array['dna'], $purchase->qp_nd_amount);
             $p_array['tva_dna'] = bcadd($p_array['tva_dna'], bcadd($purchase->qp_nd_tva, $purchase->qp_nd_tva_recup));
             $p_array['tva_np'] = bcadd($purchase->qp_vat_sided, $p_array['tva_np']);
         }
         if ($p_array['jrn_def_type'] == 'VEN') {
             $sold = new gestion_sold($this->db);
             $sold->search_by_jid($code['j_id']);
             $sold->load();
             $p_array['tva_np'] = bcadd($sold->qs_vat_sided, $p_array['tva_np']);
         }
     }
     $p_array['TVAC'] = sprintf('% 10.2f', $p_array['TVAC']);
     $p_array['HTVA'] = sprintf('% 10.2f', $p_array['TVAC'] - $p_array['AMOUNT_TVA'] - $p_array['tva_dna']);
     $r = "";
     $a_tva_amount = array();
     // inline TVA (used for the PDF)
     foreach ($p_array['TVA'] as $linetva) {
         foreach ($a_TVA as $tva) {
             if ($tva['tva_id'] == $linetva[1][0]) {
                 $a = $tva['tva_id'];
                 $a_tva_amount[$a] = $linetva[1][2];
             }
         }
     }
     foreach ($a_TVA as $line_tva) {
         $a = $line_tva['tva_id'];
         if (isset($a_tva_amount[$a])) {
             $tmp = sprintf("% 10.2f", $a_tva_amount[$a]);
             $r .= "{$tmp}";
         } else {
             $r .= sprintf("% 10.2f", 0);
         }
     }
     $p_array['TVA_INLINE'] = $r;
     return $p_array;
 }
コード例 #6
0
ファイル: ajax_history.php プロジェクト: Kloadut/noalyss_ynh
                $old = _("Autre exercice") . " " . $is->input();
            } else {
                $old = '<form method="get" action="popup.php">';
                $is = $exercice->select('ex', $default, 'onchange = "submit(this)"');
                $old .= _("Autre exercice") . " " . $is->input();
                $old .= HtmlInput::hidden('div', 'popup');
                $old .= HtmlInput::hidden('act', $_GET['act']);
                $old .= HtmlInput::hidden('f_id', $_GET['f_id']);
                $old .= HtmlInput::hidden('ajax', $_GET['ajax']);
                $old .= dossier::hidden();
                $old .= '</form>';
            }
        }
        ob_start();
        require_once NOALYSS_INCLUDE . '/template/history_top.php';
        $detail_card = HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE), $fiche->getName());
        echo h2($fiche->getName() . '[' . $fiche->strAttribut(ATTR_DEF_QUICKCODE) . ']', ' class="title" ');
        echo '<p style="text-align:center;">' . $detail_card . '</p>';
        if ($fiche->HtmlTable($array, 0, $from_div) == -1) {
            echo h2(_("Aucune opération pour l'exercice courant"), 'class="error"');
        }
        echo $old;
        $html = ob_get_contents();
        ob_end_clean();
    }
}
///////////////////////////////////////////////////////////////////////////
// for an account
///////////////////////////////////////////////////////////////////////////
if (isset($_REQUEST['pcm_val'])) {
    $poste = new Acc_Account_Ledger($cn, $_REQUEST['pcm_val']);
コード例 #7
0
 /**
  * myList($p_base, $p_filter = "", $p_search = "") 
  * Show list of action by default if sorted on date
  * @param $p_base base url with ac...
  * @param $p_filter filters on the document_type
  * @param $p_search must a valid sql command ( ex 'and  ag_title like upper('%hjkh%'))
  * @return string containing html code
  */
 function myList($p_base, $p_filter = "", $p_search = "")
 {
     // for the sort
     $url = HtmlInput::get_to_string(array("closed_action", "remind_date_end", "remind_date", "sag_ref", "only_internal", "state", "qcode", "ag_dest_query", "action_query", "tdoc", "date_start", "date_end", "hsstate", "searchtag")) . '&' . $p_base;
     $table = new Sort_Table();
     $table->add('Date Doc.', $url, 'order by ag_timestamp asc', 'order by ag_timestamp desc', 'da', 'dd');
     $table->add('Date Comm.', $url, 'order by last_comment', 'order by last_comment desc', 'dca', 'dcd');
     $table->add('Date Limite', $url, 'order by ag_remind_date asc', 'order by ag_remind_date  desc', 'ra', 'rd');
     $table->add('Tag', $url, 'order by tags asc', 'order by tags desc', 'taa', 'tad');
     $table->add('Réf.', $url, 'order by ag_ref asc', 'order by ag_ref desc', 'ra', 'rd');
     $table->add('Groupe', $url, "order by coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe')", "order by coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe') desc", 'dea', 'ded');
     $table->add('Dest/Exp', $url, 'order by name asc', 'order by name desc', 'ea', 'ed');
     $table->add('Titre', $url, 'order by ag_title asc', 'order by ag_title desc', 'ta', 'td');
     $ord = !isset($_GET['ord']) ? "dcd" : $_GET['ord'];
     $sort = $table->get_sql_order($ord);
     if (strlen(trim($p_filter)) != 0) {
         $p_filter_doc = " dt_id in ( {$p_filter} )";
     } else {
         $p_filter_doc = " 1=1 ";
     }
     $sql = "\n             select ag_id,to_char(ag_timestamp,'DD.MM.YYYY') as my_date,\n                to_char(ag_remind_date,'DD.MM.YYYY') as my_remind,\n                to_char(coalesce((select max(agc_date) from action_gestion_comment as agc where agc.ag_id=ag.ag_id),ag_timestamp),'DD.MM.YY') as str_last_comment,\n                coalesce((select max(agc_date) from action_gestion_comment as agc where agc.ag_id=ag.ag_id),ag_timestamp) as last_comment,\n                f_id_dest,\n                s_value,\n                ag_title,dt_value,ag_ref, ag_priority,ag_state,\n                coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe') as dest,\n                (select ad_value from fiche_Detail where f_id=ag.f_id_dest and ad_id=1) as name,\n                array_to_string((select array_agg(t1.t_tag) from action_tags as a1 join tags as t1 on (a1.t_id=t1.t_id) where a1.ag_id=ag.ag_id ),',') as tags\n            from action_gestion as ag\n                join document_type on (ag_type=dt_id)\n                join document_state on (ag_state=s_id)\n             where {$p_filter_doc} {$p_search} {$sort}";
     $max_line = $this->db->count_sql($sql);
     $step = $_SESSION['g_pagesize'];
     $page = isset($_GET['offset']) ? $_GET['page'] : 1;
     $offset = isset($_GET['offset']) ? Database::escape_string($_GET['offset']) : 0;
     if ($step != -1) {
         $limit = " LIMIT {$step} OFFSET {$offset} ";
     } else {
         $limit = '';
     }
     $bar = navigation_bar($offset, $max_line, $step, $page);
     $Res = $this->db->exec_sql($sql . $limit);
     $a_row = Database::fetch_all($Res);
     $r = "";
     $r .= '<p>' . $bar . '</p>';
     $r .= '<table class="document">';
     $r .= "<tr>";
     $r .= '<th name="ag_id_td" style="display:none" >' . ICheckBox::toggle_checkbox('ag', 'list_ag_frm') . '</th>';
     $r .= '<th>' . $table->get_header(0) . '</th>';
     $r .= '<th>' . $table->get_header(1) . '</th>';
     $r .= '<th>' . $table->get_header(2) . '</th>';
     $r .= '<th>' . $table->get_header(3) . '</th>';
     $r .= '<th>' . $table->get_header(4) . '</th>';
     $r .= '<th>' . $table->get_header(5) . '</th>';
     $r .= '<th>' . $table->get_header(6) . '</th>';
     $r .= '<th>' . $table->get_header(7) . '</th>';
     $r .= th('Priorité');
     $r .= "</tr>";
     // if there are no records return a message
     if (sizeof($a_row) == 0 or $a_row == false) {
         $r = '<div style="clear:both">';
         $r .= '<hr>Aucun enregistrement trouvé';
         $r .= "</div>";
         return $r;
     }
     $today = date('d.m.Y');
     $i = 0;
     $checkbox = new ICheckBox("mag_id[]");
     //show the sub_action
     foreach ($a_row as $row) {
         $href = '<A class="document" HREF="do.php?' . $p_base . HtmlInput::get_to_string(array("closed_action", "remind_date_end", "remind_date", "sag_ref", "only_internal", "state", "gDossier", "qcode", "ag_dest_query", "action_query", "tdoc", "date_start", "date_end", "hsstate", "searchtag", "ac"), "&") . '&sa=detail&ag_id=' . $row['ag_id'] . '">';
         $i++;
         $tr = $i % 2 == 0 ? 'even' : 'odd';
         if ($row['ag_priority'] < 2) {
             $tr = 'priority1';
         }
         $st = '';
         if ($row['my_date'] == $today) {
             $st = ' style="font-weight:bold; border:2px solid orange;"';
         }
         $date_remind = format_date($row['my_remind'], 'DD.MM.YYYY', 'YYYYMMDD');
         $date_today = date('Ymd');
         if ($date_remind != "" && $date_remind == $date_today && $row['ag_state'] != 1 && $row['ag_state'] != 3) {
             $st = ' style="font-weight:bold;background:orange"';
         }
         if ($date_remind != "" && $date_remind < $date_today && $row['ag_state'] != 1 && $row['ag_state'] != 3) {
             $st = ' style="font-weight:bold;background:#FF0000;color:white;"';
         }
         $r .= "<tr class=\"{$tr}\" {$st}>";
         $checkbox->value = $row['ag_id'];
         $r .= '<td name="ag_id_td" style="display:none">' . $checkbox->input() . '</td>';
         $r .= "<td>" . $href . smaller_date($row['my_date']) . '</a>' . "</td>";
         $r .= "<td>" . $href . $row['str_last_comment'] . '</a>' . "</td>";
         $r .= "<td>" . $href . smaller_date($row['my_remind']) . '</a>' . "</td>";
         $r .= "<td>" . $href . h($row['tags']) . '</a>' . "</td>";
         $r .= "<td>" . $href . $row['ag_ref'] . '</a>' . "</td>";
         $r .= "<td>" . $href . h($row['dest']) . '</a>' . "</td>";
         // Expediteur
         $fexp = new Fiche($this->db);
         $fexp->id = $row['f_id_dest'];
         $qcode_dest = $fexp->strAttribut(ATTR_DEF_QUICKCODE);
         $qexp = $qcode_dest == NOTFOUND ? "Interne" : $qcode_dest;
         $jsexp = sprintf("javascript:showfiche('%s')", $qexp);
         if ($qexp != 'Interne') {
             $r .= "<td>{$href}" . $qexp . " : " . $fexp->getName() . '</a></td>';
         } else {
             $r .= "<td>{$href} Interne </a></td>";
         }
         $ref = "";
         $r .= '<td>' . $href . h($row['ag_title']) . "</A></td>";
         /*
          * State
          */
         switch ($row['ag_priority']) {
             case 1:
                 $priority = 'Haute';
                 break;
             case 2:
                 $priority = "Moyenne";
                 break;
             case 3:
                 $priority = "Important";
                 break;
         }
         $r .= td($priority);
         $r .= "<td>" . $ref . "</td>";
         $r .= "</tr>";
     }
     $r .= "</table>";
     $r .= '<p>' . $bar . '</p>';
     return $r;
 }
コード例 #8
0
$ret = "";
$pdf = new PDF($cn);
$pdf->setDossierInfo("  Periode : " . $_GET['from_periode'] . " - " . $_GET['to_periode']);
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetAuthor('NOALYSS');
$pdf->setTitle("Détail fiche", true);
$Fiche = new Fiche($cn, $f_id);
list($array, $tot_deb, $tot_cred) = $Fiche->get_row_date($from_periode, $to_periode, $_GET['ople']);
// don't print empty account
if (count($array) == 0) {
    exit;
}
$size = array(13, 25, 20, 60, 12, 20, 20, 20);
$align = array('L', 'C', 'C', 'L', 'R', 'R', 'R', 'R');
$Libelle = sprintf("(%s) %s [ %s ]", $Fiche->id, $Fiche->getName(), $Fiche->get_quick_code());
$pdf->SetFont('DejaVu', '', 10);
$pdf->Cell(0, 8, $Libelle, 1, 0, 'C');
$pdf->Ln();
$pdf->SetFont('DejaVuCond', '', 8);
$l = 0;
$pdf->Cell($size[$l], 6, 'Date', 0, 0, 'L');
$l++;
$pdf->Cell($size[$l], 6, 'Ref', 0, 0, 'C');
$l++;
$pdf->Cell($size[$l], 6, 'Journal', 0, 0, 'C');
$l++;
$pdf->Cell($size[$l], 6, 'Libellé', 0, 0, 'L');
$l++;
$pdf->Cell($size[$l], 6, 'Let', 0, 0, 'R');
$l++;
コード例 #9
0
    function confirm($p_array, $p_summary = false)
    {
        global $g_parameter;
        extract($p_array);
        // don't need to verify for a summary
        if (!$p_summary) {
            $this->verify($p_array);
        }
        $anc = null;
        // to show a select list for the analytic & VAT USE
        // if analytic is op (optionnel) there is a blank line
        bcscale(4);
        $client = new Fiche($this->db);
        $client->get_by_qcode($e_client, true);
        $client_name = $client->getName() . ' ' . $client->strAttribut(ATTR_DEF_ADRESS) . ' ' . $client->strAttribut(ATTR_DEF_CP) . ' ' . $client->strAttribut(ATTR_DEF_CITY);
        $lPeriode = new Periode($this->db);
        if ($this->check_periode() == true) {
            $lPeriode->p_id = $period;
        } else {
            $lPeriode->find_periode($e_date);
        }
        $date_limit = $lPeriode->get_date_limit();
        $r = "";
        $r .= '<TABLE>';
        if ($p_summary) {
            $jr_id = $this->db->get_value('select jr_id from jrn where jr_internal=$1', array($this->internal));
            $r .= "<tr>";
            $r .= '<td>';
            $r .= _('Détail opération ');
            $r .= '</td>';
            $r .= '<td>';
            $r .= sprintf('<a class="line" style="display:inline" href="javascript:modifyOperation(%d,%d)">%s</a>', $jr_id, dossier::id(), $this->internal);
            $r .= '</td>';
            $r .= "</tr>";
        }
        $r .= '<tr>';
        if (!$p_summary) {
            $r .= '<td>' . _('Numéro Pièce') . '</td><td>' . hb($e_pj) . '</td>';
        } else {
            if (strcmp($this->pj, $e_pj) != 0) {
                $r .= '<td>' . _('Numéro Pièce') . '</td><td>' . hb($this->pj) . '<span class="notice"> ' . _('Attention numéro pièce existante, elle a du être adaptée') . '</span></td>';
            } else {
                $r .= '<td>' . _('Numéro Pièce') . '</td><td>' . hb($this->pj) . '</td>';
            }
        }
        $r .= '</tr>';
        $r .= '<tr>';
        $r .= '<td> ' . _('Date') . '</td><td> ' . hb($e_date) . '</td>';
        $r .= '</tr>';
        $r .= '<tr>';
        $r .= '<td>' . _('Echeance') . '</td><td> ' . hb($e_ech) . '</td>';
        $r .= '</tr>';
        $r .= '<tr>';
        $r .= '<td> ' . _('Période Comptable') . '</td><td> ' . hb($date_limit['p_start'] . '-' . $date_limit['p_end']) . '</td>';
        $r .= '</tr>';
        $r .= '<tr>';
        $r .= '<td> ' . _('Journal') . '</td><td> ' . hb($this->get_name()) . '</td>';
        $r .= '</tr>';
        $r .= '<tr>';
        $r .= '<td> ' . _('Libellé') . '</td><td> ' . hb($e_comm) . '</td>';
        $r .= '</tr>';
        $r .= '<tr>';
        $r .= '<td> ' . _('Client') . '</td><td> ' . hb($e_client . ':' . $client_name) . '</td>';
        $r .= '</tr>';
        $r .= '</table>';
        $r .= '<h2>' . _('Détail articles vendus') . '</h2>';
        $r .= '<p class="decale">';
        $r .= '<table class="result" >';
        $r .= '<TR>';
        $r .= "<th>" . _('Code') . "</th>";
        $r .= "<th>" . _('Dénomination') . "</th>";
        $r .= "<th style=\"text-align:right\">" . _('prix') . "</th>";
        $r .= "<th style=\"text-align:right\">" . _('quantité') . "</th>";
        if ($g_parameter->MY_TVA_USE == 'Y') {
            $r .= "<th style=\"text-align:right\">" . _('tva') . "</th>";
            $r .= '<th style="text-align:right"> ' . _('Montant TVA') . '</th>';
            $r .= '<th style="text-align:right">' . _('Montant HTVA') . '</th>';
            $r .= '<th style="text-align:right">' . _('Montant TVAC') . '</th>';
        } else {
            $r .= '<th style="text-align:right">' . _('Montant') . '</th>';
        }
        /* if we use the AC */
        if ($g_parameter->MY_ANALYTIC != 'nu') {
            $anc = new Anc_Plan($this->db);
            $a_anc = $anc->get_list();
            $x = count($a_anc);
            /* set the width of the col */
            $r .= '<th colspan="' . $x . '">' . _('Compt. Analytique') . '</th>';
            /* add hidden variables pa[] to hold the value of pa_id */
            $r .= Anc_Plan::hidden($a_anc);
        }
        $r .= '</tr>';
        $tot_amount = 0.0;
        $tot_tva = 0.0;
        for ($i = 0; $i < $nb_item; $i++) {
            if (strlen(trim(${"e_march" . $i})) == 0) {
                continue;
            }
            /* retrieve information for card */
            $fiche = new Fiche($this->db);
            $fiche->get_by_qcode(${"e_march" . $i});
            if ($g_parameter->MY_UPDLAB == 'Y') {
                $fiche_name = h(${"e_march" . $i . "_label"});
            } else {
                $fiche_name = $fiche->strAttribut(ATTR_DEF_NAME);
            }
            if ($g_parameter->MY_TVA_USE == 'Y') {
                $oTva = new Acc_Tva($this->db);
                $idx_tva = ${"e_march" . $i . "_tva_id"};
                $oTva->set_parameter('id', $idx_tva);
                $oTva->load();
            }
            $op = new Acc_Compute();
            $amount = bcmul(${"e_march" . $i . "_price"}, ${'e_quant' . $i});
            $op->set_parameter("amount", $amount);
            if ($g_parameter->MY_TVA_USE == 'Y') {
                $op->set_parameter('amount_vat_rate', $oTva->get_parameter('rate'));
                $op->compute_vat();
                $tva_computed = $op->get_parameter('amount_vat');
                $tva_item = ${"e_march" . $i . "_tva_amount"};
                if (isset($tva[$idx_tva])) {
                    $tva[$idx_tva] += $tva_item;
                } else {
                    $tva[$idx_tva] = $tva_item;
                }
                $tot_tva = round(bcadd($tva_item, $tot_tva), 2);
            }
            $tot_amount = round(bcadd($tot_amount, $amount), 2);
            $r .= '<tr>';
            $r .= '<td>';
            $r .= ${"e_march" . $i};
            $r .= '</td>';
            $r .= '<TD style="border-bottom:1px dotted grey;">';
            $r .= $fiche_name;
            $r .= '</td>';
            $r .= '<td class="num">';
            $r .= nbm(${"e_march" . $i . "_price"});
            $r .= '</td>';
            $r .= '<td class="num">';
            $r .= nbm(${"e_quant" . $i});
            $r .= '</td>';
            $both_side = 0;
            if ($g_parameter->MY_TVA_USE == 'Y') {
                $r .= '<td class="num">';
                $r .= $oTva->get_parameter('label');
                $r .= '</td>';
                $both_side = $oTva->get_parameter("both_side");
                /* warning if tva_computed and given are not the
                   same */
                if (bcsub($tva_item, $tva_computed) != 0 && !($tva_item == 0 && $both_side == 1)) {
                    $r .= '<td style="background-color:red" class="num">';
                    $r .= HtmlInput::infobulle(28);
                    $r .= '<a href="#" class="error" style="display:inline" title="' . _("Attention Différence entre TVA calculée et donnée") . '">' . nbm($tva_item) . '<a>';
                } else {
                    $r .= '<td  class="num">';
                    $r .= nbm($tva_item);
                }
                $r .= '</td>';
                $r .= '<td class="num">';
                $r .= nbm($amount);
                $r .= '</td>';
                $tot_row = bcadd($tva_item, $amount);
                $r .= td(nbm($tot_row), 'class="num"');
            } else {
                $r .= '<td class="num">';
                $r .= nbm($amount);
                $r .= '</td>';
            }
            // encode the pa
            if ($g_parameter->MY_ANALYTIC != 'nu') {
                // use of AA
                // show form
                $anc_op = new Anc_Operation($this->db);
                $null = $g_parameter->MY_ANALYTIC == 'op' ? 1 : 0;
                $r .= '<td>';
                $p_mode = $p_summary == false ? 1 : 0;
                $p_array['pa_id'] = $a_anc;
                /* op is the operation it contains either a sequence or a jrnx.j_id */
                $r .= HtmlInput::hidden('op[]=', $i);
                $r .= $anc_op->display_form_plan($p_array, $null, $p_mode, $i, $amount);
                $r .= '</td>';
            }
            $r .= '</tr>';
        }
        // end loop item
        //
        // Add the sum
        $decalage = $g_parameter->MY_TVA_USE == 'Y' ? '<td></td><td></td><td></td><td></td>' : '<td></td>';
        $tot = round(bcadd($tot_amount, $tot_tva), 2);
        $tot_tva = nbm($tot_tva);
        $tot = nbm($tot);
        $str_tot = _('Totaux');
        $tot_amount = nbm($tot_amount);
        $r .= <<<EOF
<tr class="highlight">
    {$decalage}            
     <td>
                {$str_tot}
     </td>
    <td class="num">
        {$tot_tva}
    </td>
    <td class="num">
        {$tot_amount}
    </td>
    <td class="num">
        {$tot}
    </td>
EOF;
        $r .= '</table>';
        $r .= '</p>';
        if ($g_parameter->MY_ANALYTIC != 'nu' && !$p_summary) {
            // use of AA
            $r .= '<input type="button" class="button" value="' . _('Vérifiez Imputation Analytique') . '" onClick="verify_ca(\'\');">';
        }
        $r .= !$p_summary ? '<div id="total_div_id" >' : '<div>';
        $r .= '<h2>Totaux</h2>';
        /* use VAT */
        if ($g_parameter->MY_TVA_USE == 'Y') {
            $r .= '<table>';
            $r .= '<tr><td>Total HTVA</td>';
            $r .= td(hb($tot_amount), 'class="num"');
            foreach ($tva as $i => $value) {
                $oTva->set_parameter('id', $i);
                $oTva->load();
                $r .= '<tr><td>  TVA ' . $oTva->get_parameter('label') . '</td>';
                $r .= td(hb(nbm($tva[$i])), 'class="num"');
            }
            $r .= '<tr>' . td(_('Total TVA')) . td(hb($tot_tva), 'class="num"');
            $r .= '<tr>' . td(_('Total TVAC')) . td(hb($tot), 'class="num"');
            $r .= '</table>';
        } else {
            $r .= '<br>Total ' . hb($tot);
        }
        $r .= '</div>';
        /*  Add hidden */
        $r .= HtmlInput::hidden('e_client', $e_client);
        $r .= HtmlInput::hidden('nb_item', $nb_item);
        $r .= HtmlInput::hidden('p_jrn', $p_jrn);
        $mt = microtime(true);
        $r .= HtmlInput::hidden('mt', $mt);
        if (isset($period)) {
            $r .= HtmlInput::hidden('period', $period);
        }
        /* \todo comment les types hidden gérent ils des contenus avec des quotes, double quote ou < > ??? */
        $r .= HtmlInput::hidden('e_comm', $e_comm);
        $r .= HtmlInput::hidden('e_date', $e_date);
        $r .= HtmlInput::hidden('e_ech', $e_ech);
        $r .= HtmlInput::hidden('e_pj', $e_pj);
        $r .= HtmlInput::hidden('e_pj_suggest', $e_pj_suggest);
        $e_mp = isset($e_mp) ? $e_mp : 0;
        $r .= HtmlInput::hidden('e_mp', $e_mp);
        if (isset($repo)) {
            // Show the available repository
            $r .= $this->select_depot($p_summary, $repo);
        }
        /* if the paymethod is not 0 and if a quick code is given */
        if ($e_mp != 0 && strlen(trim(${'e_mp_qcode_' . $e_mp})) != 0) {
            $r .= HtmlInput::hidden('e_mp_qcode_' . $e_mp, ${'e_mp_qcode_' . $e_mp});
            $r .= HtmlInput::hidden('acompte', $acompte);
            $r .= HtmlInput::hidden('e_comm_paiement', $e_comm_paiement);
            /* needed for generating a invoice */
            $r .= HtmlInput::hidden('qcode_benef', ${'e_mp_qcode_' . $e_mp});
            $fname = new Fiche($this->db);
            $fname->get_by_qcode(${'e_mp_qcode_' . $e_mp});
            $r .= '<h2>' . "Payé par " . ${'e_mp_qcode_' . $e_mp} . " " . $fname->getName() . '</h2> ' . '<p class="decale">' . _('Déduction acompte ') . h($acompte) . '</p>' . _('Libellé :') . h($e_comm_paiement);
            $r .= '<br>';
        }
        $r .= HtmlInput::hidden('jrn_type', $jrn_type);
        for ($i = 0; $i < $nb_item; $i++) {
            $r .= HtmlInput::hidden("e_march" . $i, ${"e_march" . $i});
            if (isset(${"e_march" . $i . "_label"})) {
                $r .= HtmlInput::hidden("e_march" . $i . "_label", ${"e_march" . $i . "_label"});
            }
            $r .= HtmlInput::hidden("e_march" . $i . "_price", ${"e_march" . $i . "_price"});
            if ($g_parameter->MY_TVA_USE == 'Y') {
                $r .= HtmlInput::hidden("e_march" . $i . "_tva_id", ${"e_march" . $i . "_tva_id"});
                $r .= HtmlInput::hidden("e_march" . $i . "_tva_amount", ${"e_march" . $i . "_tva_amount"});
            }
            $r .= HtmlInput::hidden("e_quant" . $i, ${"e_quant" . $i});
        }
        return $r;
    }