24 if (empty($conf) || !is_object($conf)) {
25 print
"Error, template page can't be called as URL";
32 $nodateexport =
getDolGlobalInt(
'ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME');
35 $date_export =
"_".dol_print_date(
dol_now(),
'%Y%m%d%H%M%S');
38 if (empty($withAttachment)) {
39 header(
'Content-Type: text/csv');
42 include_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountancyexport.class.php';
46 if (($accountancyexport->getFormatCode($formatexportset) ==
'fec' || $accountancyexport->getFormatCode($formatexportset) ==
'fec2')
47 && $type_export ==
"general_ledger") {
49 if (empty($search_date_end)) {
53 $datetouseforfilename = $search_date_end;
55 $fiscalmonth = empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START;
57 if ($tmparray[
'mon'] <= $fiscalmonth) {
58 $tmparray[
'mon'] = $fiscalmonth;
60 $tmparray[
'mon'] = $fiscalmonth;
66 $completefilename = $siren.
"FEC".$endaccountingperiod.
".txt";
67 } elseif ($accountancyexport->getFormatCode($formatexportset) ==
'ciel' && $type_export ==
"general_ledger" && !empty($conf->global->ACCOUNTING_EXPORT_XIMPORT_FORCE_FILENAME)) {
68 $completefilename =
"XIMPORT.TXT";
70 $completefilename = ($code ? $code.
"_" :
"").($prefix ? $prefix.
"_" :
"").$filename.($nodateexport ?
"" : $date_export).
".".$format;
73 if (empty($withAttachment)) {
74 header(
'Content-Disposition: attachment;filename=' . $completefilename);
Manage the different format accountancy export.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.