Skip to content
Snippets Groups Projects
Commit 59f35690 authored by bobby's avatar bobby
Browse files

Accoutancy update

parent ba833dc4
No related branches found
No related tags found
No related merge requests found
......@@ -206,7 +206,8 @@ else
print '<td>';
$listmodelcsv=array(
'1'=>$langs->trans("Modelcsv_normal"),
'2'=>$langs->trans("Modelcsv_CEGID")
'2'=>$langs->trans("Modelcsv_CEGID"),
'3'=>$langs->trans("Modelcsv_COALA")
);
print $form->selectarray("modelcsv",$listmodelcsv,$conf->global->ACCOUNTING_EXPORT_MODELCSV,0);
......
This diff is collapsed.
This diff is collapsed.
......@@ -342,4 +342,66 @@ class FormVentilation extends Form
return $out;
}
/**
* Return HTML combo list of years existing into book keepping
*
* @param string $selected Preselected value
* @param string $htmlname Name of HTML select object
* @param int $useempty Affiche valeur vide dans liste
* @param string $output_format (html/opton (for option html only)/array (to return options arrays
* @return string/array
*/
function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html') {
$out = '';
$out_array = array ();
if ($output_format == 'html') {
$out .= '<select class="flat" placeholder="aa" id="' . $htmlname . '" name="' . $htmlname . '"' . $option . ' >';
}
if ($useempty) {
$selected_html = '';
if ($selected == '') {
$selected_html = ' selected';
}
if ($output_format == 'html' || $output_format == 'options') {
$out .= '<option value=""' . $selected_html . '>&nbsp;</option>';
} elseif ($output_format == 'array') {
$out_array[''] = '';
}
}
$sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
$sql .= " ORDER BY doc_date";
dol_syslog(get_class($this) . "::".__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
while ( $obj = $this->db->fetch_object($resql) ) {
$selected_html = '';
if ($selected > 0 && $obj->dtyear == $selected)
$selected_html = ' selected';
if ($output_format == 'html' || $output_format == 'options') {
$out .= '<option value="' . $obj->dtyear . '"' . $selected_html . ' >' . $obj->dtyear . '</option>';
} elseif ($output_format == 'array') {
$out_array[$obj->dtyear] = $obj->dtyear;
}
}
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::".__METHOD__ . $this->error, LOG_ERR);
return - 1;
}
$this->db->free($resql);
if ($output_format == 'html') {
$out .= "</select>\n";
}
if ($output_format == 'html' || $output_format == 'options') {
return $out;
} elseif ($output_format == 'array') {
return $out_array;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment