function _create(&$PDOdb, &$db, &$user, &$conf, &$langs, $df = false, $ds = false, $de = false, $amount = 0, $label = '')
{
    unset($_SESSION['SENDTOINVOICETOADHERENT_ERRORS']);
    _list($PDOdb, $db, $user, $conf, $langs, 0);
    if (!$user->rights->sendinvoicetoadherent->create) {
        accessforbidden();
    } else {
        $form = new TFormCore();
        print_fiche_titre($langs->trans("sendinvoicetoadherentTitleCreate"));
        echo '<script type="text/javascript">
			$(function() {
				displayDateCotisation();
			});
			
			function displayDateCotisation(obj) {
				if ($(obj).attr("checked") == "checked") {
					$(".cotisation_create").show()
				} else {
					$(".cotisation_create").hide()
				}
			}
		</script>';
        echo '<form style="padding-top:15px;" name="formsoc" action="' . $_SERVER["PHP_SELF"] . '" method="post" enctype="multipart/form-data">';
        echo '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
        echo '<input type="hidden" name="action" value="createConfirm">';
        echo '<table class="border" width="100%">';
        $date_fac = $df === false ? date('d/m/Y') : $df;
        $date_start = $ds === false ? date('d/m/Y') : $ds;
        $date_end = $de === false ? date('d/m/Y', strtotime('+1 year -1 day')) : $de;
        $label = empty($label) ? $langs->trans("Subscription") . ' ' . ($ds ? substr($date_start, -4, 4) : dol_print_date(time(), '%Y')) : $label;
        echo '<tr><td width="20%" class="fieldrequired">' . $langs->trans("sendinvoicetoadherentDateFacture") . '</td><td width="80%">' . $form->calendrier('', 'date_fac', $date_fac) . '</td></tr>';
        echo '<tr><td width="20%">' . $langs->trans("sendinvoicetoadherentCreateCotisation") . '</td><td width="80%"><input type="checkbox" name="create_cotisation" value="1" onclick="javascript:displayDateCotisation(this);" /></td></tr>';
        echo '<tr class="cotisation_create" style="display:none;"><td width="20%" class="fieldrequired">' . $langs->trans("sendinvoicetoadherentDateStartAdhesion") . '</td><td width="80%">' . $form->calendrier('', 'date_start', $date_start) . '</td></tr>';
        echo '<tr class="cotisation_create" style="display:none;"><td width="20%">' . $langs->trans("sendinvoicetoadherentDateEndAdhesion") . '</td><td width="80%">' . $form->calendrier('', 'date_end', $date_end) . '</td></tr>';
        echo '<tr class="cotisation_create" style="display:none;"><td width="20%" class="fieldrequired">' . $langs->trans("sendinvoicetoadherentAmountAdhesion") . '</td><td width="80%">' . $form->texte('', 'amount_cotisation', $amount, 6, 15) . ' ' . $langs->trans("Currency" . $conf->currency) . '</td></tr>';
        echo '<tr class="cotisation_create" style="display:none;"><td width="20%">' . $langs->trans("sendinvoicetoadherentLabelAdhesion") . '</td><td width="80%">' . $form->texte('', 'label', $label, 32, 255) . '</td></tr>';
        echo '</table>';
        if ($user->rights->sendinvoicetoadherent->create) {
            echo '<br /><center>';
            echo '<input type="submit" class="button" value="' . $langs->trans('sendinvoicetoadherentActionCreateConfirm') . '" />&nbsp;&nbsp;&nbsp;&nbsp;';
            echo '<a href="' . dol_buildpath('/sendinvoicetoadherent/sendinvoicetoadherent.php?action=list', 2) . '" class="button" style="text-decoration:none;font-weight:normal;cusor:pointer;height:15px;padding-top:5px;">' . $langs->trans('Cancel') . '</a>';
            echo '</center>';
        }
        echo '</form>';
    }
    $PDOdb->close();
    llxFooter('');
}
 private function setSearch(&$TEntete, &$TParam)
 {
     global $langs;
     if (empty($TParam['search'])) {
         return array();
     }
     $TSearch = array();
     $form = new TFormCore();
     $nb_search_in_bar = 0;
     if (!empty($TParam['search'])) {
         foreach ($TEntete as $key => $libelle) {
             // init
             if (empty($TSearch[$key])) {
                 $TSearch[$key] = '';
             }
         }
     }
     foreach ($TParam['search'] as $key => $param_search) {
         $value = isset($_REQUEST['TListTBS'][$this->id]['search'][$key]) ? $_REQUEST['TListTBS'][$this->id]['search'][$key] : '';
         $typeRecherche = is_array($param_search) && isset($param_search['recherche']) ? $param_search['recherche'] : $param_search;
         if (is_array($typeRecherche)) {
             $typeRecherche = array('' => ' ') + $typeRecherche;
             $fsearch = $form->combo('', 'TListTBS[' . $this->id . '][search][' . $key . ']', $typeRecherche, $value);
         } else {
             if ($typeRecherche === 'calendar') {
                 $fsearch = $form->calendrier('', 'TListTBS[' . $this->id . '][search][' . $key . ']', $value, 10, 10);
             } else {
                 if ($typeRecherche === 'calendars') {
                     $fsearch = $form->calendrier('', 'TListTBS[' . $this->id . '][search][' . $key . '][deb]', isset($value['deb']) ? $value['deb'] : '', 10, 10) . ' ' . $form->calendrier('', 'TListTBS[' . $this->id . '][search][' . $key . '][fin]', isset($value['fin']) ? $value['fin'] : '', 10, 10);
                 } else {
                     if (is_string($typeRecherche)) {
                         $fsearch = $TParam['search'][$key];
                     } else {
                         $fsearch = $form->texte('', 'TListTBS[' . $this->id . '][search][' . $key . ']', $value, 15, 255);
                     }
                 }
             }
         }
         if (!empty($TEntete[$key]) || $TParam['type'] == 'chart') {
             $TSearch[$key] = $fsearch;
             $nb_search_in_bar++;
         } else {
             $libelle = !empty($TParam['title'][$key]) ? $TParam['title'][$key] : $key;
             $TParam['liste']['head_search'] .= '<div>' . $libelle . ' ' . $fsearch . '</div>';
         }
     }
     $search_button = ' <a href="#" onclick="TListTBS_submitSearch(this);" class="list-search-link">' . $TParam['liste']['picto_search'] . '</a>';
     if (!empty($TParam['liste']['head_search'])) {
         $TParam['liste']['head_search'] .= '<div align="right">' . $langs->trans('Search') . ' ' . $search_button . '</div>';
     }
     if ($nb_search_in_bar > 0) {
         end($TSearch);
         list($key, $v) = each($TSearch);
         $TSearch[$key] .= $search_button;
     } else {
         $TSearch = array();
     }
     return $TSearch;
 }
function _printFormConfirm(&$user, &$db, &$conf, &$langs, &$TPayment)
{
    global $bc;
    $form = new Form($db);
    $TFormCore = new TFormCore();
    print load_fiche_titre($langs->trans('Payments'));
    print '<div class="tabBar">';
    print '<form name="import_confirm" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
    print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
    print '<input type="hidden" name="action" value="import_confirm">';
    print '<p>';
    print '<label><b>' . $langs->trans('paymentimport_typepayment') . '</b></label>&nbsp;';
    $form->select_types_paiements($conf->global->PAYMENTIMPORT_DEFAULT_REGLEMENT_CODE, 'paiementcode', '', 2);
    print '</p>';
    print '<p>';
    print '<label><b>' . $langs->trans('paymentimport_bankaccount') . '</b></label>&nbsp;';
    print $form->select_comptes($conf->global->PAYMENTIMPORT_DEFAULT_BANK_ACOUNT, 'fk_bank', 0);
    print '</p>';
    print '<table class="border" width="100%">';
    print '<tr class="liste_titre">';
    print '<td>' . $langs->trans("RefFacture") . '</td>';
    print '<td>' . $langs->trans("Company") . '</td>';
    print '<td>' . $langs->trans("CodeClient") . '</td>';
    print '<td>' . $langs->trans("Rib") . '</td>';
    print '<td>' . $langs->trans("AmountPayment") . '</td>';
    print '<td>' . $langs->trans("DatePayment") . '</td>';
    print '<td>' . $langs->trans("Num") . '</td>';
    print '<td>' . $langs->trans("Note") . '</td>';
    print '</tr>';
    $var = false;
    $i = 0;
    foreach ($TPayment as $TInfo) {
        $var = !$var;
        print '<tr ' . $bc[$var] . '>';
        print '<td><input type="text" name="payment[' . $i . '][facture_ref]" value="' . $TInfo['facture_ref'] . '" /> - <a target="_blank" href="' . dol_buildpath('/compta/facture.php?ref=' . $TInfo['facture_ref'], 1) . '">v</a></td>';
        print '<td>' . $TInfo['company_name'] . '</td>';
        print '<td>' . $TInfo['code_client'] . '</td>';
        print '<td>' . $TInfo['rib'] . '</td>';
        print '<td><input type="text" name="payment[' . $i . '][amount]" value="' . $TInfo['amount'] . '" /></td>';
        print '<td>' . $TFormCore->calendrier('', "payment[" . $i . "][date_creation]", $TInfo['date_creation']) . '</td>';
        print '<td><input type="text" name="payment[' . $i . '][num_payment]" value="' . $TInfo['num_payment'] . '" /></td>';
        print '<td><input type="text" name="payment[' . $i . '][note]" value="' . $TInfo['note'] . '" /></td>';
        print '</tr>';
        $i++;
    }
    print '</table>';
    print '<div class="tabsAction"><div class="center divButAction"><input class="button" type="submit" value="' . $langs->trans('CreatePayment') . '" /></div></div>';
    print '</form>';
}