示例#1
0
    $afiche = $cn->get_array("select fd_id from vw_fiche_def where ad_id=" . ATTR_DEF_ACCOUNT . " order by fd_label asc");
} else {
    $afiche[0] = array('fd_id' => $_REQUEST['cat']);
}
if ($allcard == 0) {
    echo $str_add_card;
}
echo $export_csv;
echo $export_pdf;
echo $export_print;
$fiche = new Fiche($cn);
for ($e = 0; $e < count($afiche); $e++) {
    $array = Fiche::get_fiche_def($cn, $afiche[$e]['fd_id'], 'name_asc');
    foreach ($array as $card) {
        $row = new Fiche($cn, $card['f_id']);
        $letter = new Lettering_Card($cn);
        $letter->set_parameter('quick_code', $row->strAttribut(ATTR_DEF_QUICKCODE));
        $letter->set_parameter('start', $_GET['start']);
        $letter->set_parameter('end', $_GET['end']);
        // all
        if ($_GET['histo'] == 0) {
            $letter->get_all();
        }
        // lettered
        if ($_GET['histo'] == 1) {
            $letter->get_letter();
        }
        // unlettered
        if ($_GET['histo'] == 2) {
            $letter->get_unletter();
        }
 /**
  * @brief try to letter same card between $p_jrid and $this->jr_id
  * @param jrn.jr_id $p_jrid  the operation to reconcile
  */
 function auto_letter($p_jrid)
 {
     // Try to find same card from both operation
     $sql = "select j1.f_id as fiche ,coalesce(j1.j_id,-1) as jrnx_id1,coalesce(j2.j_id,-1) as jrnx_id2,\nj1.j_poste as poste\n\t\t\t\tfrom jrnx as j1\n\t\t\t\t\tjoin jrn as jr1 on (j1.j_grpt=jr1.jr_grpt_id)\n\t\t\t\t\tjoin jrnx as j2 on (coalesce(j1.f_id,-1)=coalesce(j2.f_id,-1) and j1.j_poste=j2.j_poste)\n\t\t\t\t\tjoin jrn as jr2 on (j2.j_grpt=jr2.jr_grpt_id)\n\t\t\t\twhere\n\t\t\t\t\tjr1.jr_id=\$1\n\t\t\t\t\tand\n\t\t\t\t\tjr2.jr_id= \$2";
     $result = $this->db->get_array($sql, array($this->jr_id, $p_jrid));
     if (count($result) == 0) {
         return;
     }
     for ($i = 0; $i < count($result); $i++) {
         if ($result[$i]['fiche'] != -1) {
             $letter = new Lettering_Card($this->db);
             $letter->insert_couple($result[$i]['jrnx_id1'], $result[$i]['jrnx_id2']);
         } else {
             $letter = new Lettering_Account($this->db);
             $letter->insert_couple($result[$i]['jrnx_id1'], $result[$i]['jrnx_id2']);
         }
     }
 }
    $letter = new Lettering_Account($cn);
    $letter->save($_POST);
}
//--------------------------------------------------------------------------------
// Show the result
//--------------------------------------------------------------------------------
if (isset($_GET['start']) && isset($_GET['end'])) {
    if (isDate($_GET['start']) == null || isDate($_GET['end']) == null) {
        echo alert(_('Date malformée, désolé'));
        return;
    }
}
echo '<div id="list">';
$fiche = new Fiche($cn, $_REQUEST['f_id']);
$quick_code = $fiche->get_quick_code();
$letter = new Lettering_Card($cn);
$letter->set_parameter('quick_code', $quick_code);
$letter->set_parameter('start', $start->value);
$letter->set_parameter('end', $end->value);
if ($sel->selected == 0) {
    echo $letter->show_list('all');
}
if ($sel->selected == 1) {
    echo $letter->show_list('letter');
}
if ($sel->selected == 2) {
    echo $letter->show_list('unletter');
}
echo '</div>';
echo '<div id="detail" style="display:none">';
echo 'Un instant...';
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

* 
*/
/**
 * @file
 * @brief show the result of balance ageing, included from Balance_Age::display_purchase
 * @see Balance_Age
 */
bcscale(2);
?>

<?php 
$nb_fiche = count($a_fiche);
for ($i = 0; $i < $nb_fiche; $i++) {
    $card = new Lettering_Card($this->cn, $a_fiche[$i]['quick_code']);
    $card->set_parameter('start', $p_date_start);
    $card->get_balance_ageing($p_let);
    if (empty($card->content)) {
        continue;
    }
    echo HtmlInput::card_detail($a_fiche[$i]['quick_code'], h($a_fiche[$i]['name']) . ' ' . h($a_fiche[$i]['first_name']));
    ?>
<table class="result">
    <tr>
        <th> 
            <?php 
    echo _('Date opération');
    ?>
        </th>
        <th>
示例#5
0
     if (isset($search_end)) {
         $obj->end = $search_end;
     }
     if (isset($max_amount)) {
         $obj->fil_amount_max = $max_amount;
     }
     if (isset($min_amount)) {
         $obj->fil_amount_min = $min_amount;
     }
     if (isset($side)) {
         $obj->fil_deb = $side;
     }
     $form .= $obj->show_letter($j_id);
 } else {
     if ($ot == 'card') {
         $obj = new Lettering_Card($cn, $row['j_qcode']);
         if (isset($search_start)) {
             $obj->start = $search_start;
         }
         if (isset($search_end)) {
             $obj->end = $search_end;
         }
         if (isset($max_amount)) {
             $obj->fil_amount_max = $max_amount;
         }
         if (isset($min_amount)) {
             $obj->fil_amount_min = $min_amount;
         }
         if (isset($side)) {
             $obj->fil_deb = $side;
         }
示例#6
0
 function export_csv($p_date_start, $p_let)
 {
     $nb_fiche = count($this->afiche);
     $title = sprintf('"%s";', _('QuickCode'));
     $title .= sprintf('"%s";', _('Nom'));
     $title .= sprintf('"%s";', _('Prénom'));
     $title .= sprintf('"%s";', _('Date'));
     $title .= sprintf('"%s";', _('N° pièce'));
     $title .= sprintf('"%s";', _('Interne'));
     $title .= sprintf('"%s";', _('Fin'));
     $title .= sprintf('"%s";', _('<30 jours'));
     $title .= sprintf('"%s";', _('entre 30 et 60 jours'));
     $title .= sprintf('"%s";', _('entre 60 et 90 jours'));
     $title .= sprintf('"%s";', _('> 90 jours'));
     $title .= sprintf("\n\r");
     $flag_title = false;
     for ($i = 0; $i < $nb_fiche; $i++) {
         $card = new Lettering_Card($this->cn, $this->afiche[$i]['quick_code']);
         $card->set_parameter('start', $p_date_start);
         $card->get_balance_ageing($p_let);
         if (empty($card->content)) {
             continue;
         }
         if (!$flag_title) {
             echo $title;
             $flag_title = true;
         }
         $nb_row = count($card->content);
         $sum_lt_30 = 0;
         $sum_gt_30_lt_60 = 0;
         $sum_gt_60_lt_90 = 0;
         $sum_gt_90 = 0;
         $sum_fin = 0;
         for ($j = 0; $j < $nb_row; $j++) {
             $show = true;
             printf('"%s";', str_replace('"', '', $this->afiche[$i]['quick_code']));
             printf('"%s";', str_replace('"', '', $this->afiche[$i]['name']));
             printf('"%s";', str_replace('"', '', $this->afiche[$i]['first_name']));
             printf('"%s";', $card->content[$j]['j_date_fmt']);
             printf('"%s";', $card->content[$j]['jr_pj_number']);
             printf('"%s";', $card->content[$j]['jr_internal']);
             if ($card->content[$j]['jrn_def_type'] == 'FIN' || $card->content[$j]['jrn_def_type'] == 'ODS') {
                 printf("%s;", nb($card->content[$j]['j_montant']));
                 $sum_fin = bcadd($sum_fin, $card->content[$j]['j_montant']);
                 $show = false;
             } else {
                 printf('0;');
             }
             if ($show && $card->content[$j]['day_paid'] <= 30) {
                 printf("%s;", nb($card->content[$j]['j_montant']));
                 $sum_lt_30 = bcadd($sum_lt_30, $card->content[$j]['j_montant']);
                 $show = false;
             } else {
                 printf('0;');
             }
             if ($show && $card->content[$j]['day_paid'] > 30 && $card->content[$j]['day_paid'] <= 60) {
                 printf("%s;", nb($card->content[$j]['j_montant']));
                 $sum_gt_30_lt_60 = bcadd($sum_gt_30_lt_60, $card->content[$j]['j_montant']);
             } else {
                 printf('0;');
             }
             if ($show && $card->content[$j]['day_paid'] > 60 && $card->content[$j]['day_paid'] <= 90) {
                 printf("%s;", nb($card->content[$j]['j_montant']));
                 $sum_gt_60_lt_90 = bcadd($sum_gt_60_lt_90, $card->content[$j]['j_montant']);
             } else {
                 printf('0;');
             }
             if ($show && $card->content[$j]['day_paid'] > 90) {
                 printf("%s", nb($card->content[$j]['j_montant']));
                 $sum_gt_90 = bcadd($sum_gt_90, $card->content[$j]['j_montant']);
             } else {
                 printf('0;');
             }
             printf("\n\r");
         }
         printf('"%s";', _('Totaux'));
         printf('"";');
         printf('"";');
         printf('"";');
         printf('"";');
         printf('"";');
         printf('%s;', nb($sum_fin));
         printf('%s;', nb($sum_lt_30));
         printf('%s;', nb($sum_gt_30_lt_60));
         printf('%s;', nb($sum_gt_60_lt_90));
         printf('%s', nb($sum_gt_90));
         printf("\n\r");
     }
 }
if (!isset($_REQUEST['seek'])) {
    exit;
}
echo '<hr>';
//--------------------------------------------------------------------------------
// record the data
//--------------------------------------------------------------------------------
if (isset($_POST['record'])) {
    $letter = new Lettering_Account($cn);
    $letter->save($_POST);
}
//--------------------------------------------------------------------------------
// Show the result
//--------------------------------------------------------------------------------
echo '<div id="list">';
$letter = new Lettering_Card($cn);
$quick_code = strtoupper(trim($_GET['acc']));
$letter->set_parameter('quick_code', $quick_code);
$letter->set_parameter('start', $_GET['start']);
$letter->set_parameter('end', $_GET['end']);
if ($sel->selected == 0) {
    echo $letter->show_list('all');
}
if ($sel->selected == 1) {
    echo $letter->show_list('letter');
}
if ($sel->selected == 2) {
    echo $letter->show_list('unletter');
}
if ($sel->selected == 3) {
    echo $letter->show_list('letter_diff');