37 function is_empty($var, $allow_false =
false, $allow_ws =
false)
39 if (!isset($var) || is_null($var) || ($allow_ws ==
false && trim($var) ==
"" && !is_bool($var)) || ($allow_false ===
false && is_bool($var) && $var ===
false) || (is_array($var) && empty($var))) {
58 $head[$h][0] = DOL_URL_ROOT.
'/accountancy/admin/card.php?id='.$object->id;
59 $head[$h][1] = $langs->trans(
"AccountAccounting");
60 $head[$h][2] =
'card';
82 $account = rtrim($account,
"0");
97 if ($account < 0 ||
is_empty($account))
return '';
99 if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO))
return $account;
101 $g = $conf->global->ACCOUNTING_LENGTH_GACCOUNT;
104 $i = strlen($account);
132 if ($accounta < 0 ||
is_empty($accounta))
return '';
134 if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO))
return $accounta;
136 $a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT;
139 $i = strlen($accounta);
174 function journalHead($nom, $variante, $period, $periodlink, $description, $builddate, $exportlink =
'', $moreparam = array(), $calcmode =
'', $varlink =
'')
178 print "\n\n<!-- start banner journal -->\n";
180 if (!
is_empty($varlink)) $varlink =
'?'.$varlink;
184 $head[$h][0] =
$_SERVER[
"PHP_SELF"].$varlink;
185 $head[$h][1] = $langs->trans(
"Journalization");
186 $head[$h][2] =
'journal';
188 print '<form method="POST" action="'.$_SERVER[
"PHP_SELF"].$varlink.
'">';
189 print '<input type="hidden" name="token" value="'.newToken().
'">';
193 foreach ($moreparam as $key => $value)
195 print '<input type="hidden" name="'.$key.
'" value="'.$value.
'">';
197 print '<table width="100%" class="border">';
201 print '<td width="110">'.$langs->trans(
"Name").
'</td>';
202 print '<td colspan="3">';
211 print '<td width="110">'.$langs->trans(
"CalculationMode").
'</td>';
212 if (!$variante)
print '<td colspan="3">';
215 if ($variante)
print '</td><td colspan="2">'.$variante;
222 print '<td>'.$langs->trans(
"ReportPeriod").
'</td>';
223 if (!$periodlink)
print '<td colspan="3">';
225 if ($period)
print $period;
226 if ($periodlink)
print '</td><td colspan="2">'.$periodlink;
232 print '<td>'.$langs->trans(
"ReportDescription").
'</td>';
233 print '<td colspan="3">'.$description.
'</td>';
240 print '<div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans(
"Refresh").
'"></div>';
244 print "\n<!-- end banner journal -->\n\n";
257 $periodbydefaultontransfer = $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER;
258 isset($periodbydefaultontransfer) ? $periodbydefaultontransfer : 0;
259 if ($periodbydefaultontransfer == 2) {
260 $sql =
"SELECT date_start, date_end from ".MAIN_DB_PREFIX.
"accounting_fiscalyear ";
261 $sql .=
" where date_start < '".$db->idate(
dol_now()).
"' and date_end > '".$db->idate(
dol_now()).
"'";
262 $sql .= $db->plimit(1);
263 $res = $db->query($sql);
264 if ($res->num_rows > 0) {
265 $fiscalYear = $db->fetch_object($res);
266 $date_start = strtotime($fiscalYear->date_start);
267 $date_end = strtotime($fiscalYear->date_end);
269 $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
271 $year_end = $year_start + 1;
272 $month_end = $month_start - 1;
278 $date_start =
dol_mktime(0, 0, 0, $month_start, 1, $year_start);
281 } elseif ($periodbydefaultontransfer == 1) {
282 $year_current = strftime(
"%Y",
dol_now());
283 $pastmonth = strftime(
"%m",
dol_now());
284 $pastmonthyear = $year_current;
285 if ($pastmonth == 0) {
290 $year_current = strftime(
"%Y",
dol_now());
291 $pastmonth = strftime(
"%m",
dol_now()) - 1;
292 $pastmonthyear = $year_current;
293 if ($pastmonth == 0) {
300 'date_start' => $date_start,
301 'date_end' => $date_end,
302 'pastmonthyear' => $pastmonthyear,
303 'pastmonth' => $pastmonth
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_now($mode= 'auto')
Return date for now.
getDefaultDatesForTransfer()
Return Default dates for transfer based on periodicity option in accountancy setup.
journalHead($nom, $variante, $period, $periodlink, $description, $builddate, $exportlink= '', $moreparam=array(), $calcmode= '', $varlink= '')
Show header of a page used to transfer/dispatch data in accounting.
is_empty($var, $allow_false=false, $allow_ws=false)
Check if a value is empty with some options.
length_accounta($accounta)
Return Auxiliary accounting account of thirdparties with defined length.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
accounting_prepare_head(AccountingAccount $object)
Prepare array with list of tabs.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Class to manage accounting accounts.
clean_account($account)
Return accounting account without zero on the right.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode= 'add')
Complete or removed entries into a head array (used to build tabs).
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous) ...