当前位置: 首页>>代码示例>>PHP>>正文


PHP dol_getdate函数代码示例

本文整理汇总了PHP中dol_getdate函数的典型用法代码示例。如果您正苦于以下问题:PHP dol_getdate函数的具体用法?PHP dol_getdate怎么用?PHP dol_getdate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dol_getdate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: llxHeader

llxHeader("", $title, "");
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project');
$param = $mode ? '&mode=' . $mode : '';
// Show navigation bar
$nav = "<a href=\"?year=" . $prev_year . "&amp;month=" . $prev_month . "&amp;day=" . $prev_day . $param . "\">" . img_previous($langs->trans("Previous")) . "</a>\n";
$nav .= " <span id=\"month_name\">" . dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "day") . " </span>\n";
$nav .= "<a href=\"?year=" . $next_year . "&amp;month=" . $next_month . "&amp;day=" . $next_day . $param . "\">" . img_next($langs->trans("Next")) . "</a>\n";
$nav .= " &nbsp; (<a href=\"?year=" . $nowyear . "&amp;month=" . $nowmonth . "&amp;day=" . $nowday . $param . "\">" . $langs->trans("Today") . "</a>)";
$nav .= '<br>' . $form->select_date(-1, '', 0, 0, 2, "addtime", 1, 0, 1) . ' ';
$nav .= ' <input type="submit" name="submitdateselect" class="button" value="' . $langs->trans("Refresh") . '">';
$picto = 'calendarweek';
print '<form name="addtime" method="POST" action="' . $_SERVER["PHP_SELF"] . ($project->id > 0 ? '?id=' . $project->id : '') . '">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="addtime">';
print '<input type="hidden" name="mode" value="' . $mode . '">';
$tmp = dol_getdate($daytoparse);
print '<input type="hidden" name="addtimeyear" value="' . $tmp['year'] . '">';
print '<input type="hidden" name="addtimemonth" value="' . $tmp['mon'] . '">';
print '<input type="hidden" name="addtimeday" value="' . $tmp['mday'] . '">';
$head = project_timesheet_prepare_head($mode);
dol_fiche_head($head, 'inputperday', '', 0, 'task');
// Show description of content
if ($mine) {
    print $langs->trans("MyTasksDesc") . ($onlyopenedproject ? ' ' . $langs->trans("OnlyOpenedProject") : '') . '<br>';
} else {
    if ($user->rights->projet->all->lire && !$socid) {
        print $langs->trans("ProjectsDesc") . ($onlyopenedproject ? ' ' . $langs->trans("OnlyOpenedProject") : '') . '<br>';
    } else {
        print $langs->trans("ProjectsPublicTaskDesc") . ($onlyopenedproject ? ' ' . $langs->trans("AlsoOnlyOpenedProject") : '') . '<br>';
    }
}
开发者ID:Albertopf,项目名称:prueba,代码行数:31,代码来源:perday.php

示例2: DolEditor

 print '<td colspan="4">&nbsp;</td>';
 print "</tr>\n";
 $var = true;
 print '<tr ' . $bcnd[$var] . ">\n";
 print '<td>';
 // editeur wysiwyg
 if (empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) {
     require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
     $doleditor = new DolEditor('np_desc', GETPOST('np_desc', 'alpha'), '', 100, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, ROWS_2, 70);
     $doleditor->Create();
 }
 print '</td>';
 // Date intervention
 print '<td align="center" class="nowrap">';
 $now = dol_now();
 $timearray = dol_getdate($now);
 if (!GETPOST('diday', 'int')) {
     $timewithnohour = dol_mktime(0, 0, 0, $timearray['mon'], $timearray['mday'], $timearray['year']);
 } else {
     $timewithnohour = dol_mktime(GETPOST('dihour', 'int'), GETPOST('dimin', 'int'), 0, GETPOST('dimonth', 'int'), GETPOST('diday', 'int'), GETPOST('diyear', 'int'));
 }
 $form->select_date($timewithnohour, 'di', 1, 1, 0, "addinter");
 print '</td>';
 // Duration
 print '<td align="right">';
 $selectmode = 'select';
 if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) {
     $selectmode = 'text';
 }
 $form->select_duration('duration', !GETPOST('durationhour', 'int') && !GETPOST('durationmin', 'int') ? 3600 : 60 * 60 * GETPOST('durationhour', 'int') + 60 * GETPOST('durationmin', 'int'), 0, $selectmode);
 print '</td>';
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:31,代码来源:card.php

示例3: countHistoricFac

 /**
  *
  * Count Facture history
  *
  */
 public static function countHistoricFac()
 {
     global $db, $conf, $user;
     $ret = -1;
     $function = "GetHistoric";
     $sql = 'SELECT (SELECT COUNT(f.rowid)';
     $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture as f';
     if (!$user->rights->societe->client->voir && !$user->societe_id) {
         $sql .= " RIGHT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON f.fk_soc = sc.fk_soc AND sc.fk_user = " . $user->id;
     }
     // We need this table joined to the select in order to filter by sale
     $sql .= ', ' . MAIN_DB_PREFIX . 'pos_facture as pf';
     $sql .= ' WHERE f.entity = ' . $conf->entity;
     $sql .= ' AND pf.fk_facture = f.rowid';
     if ($conf->global->POS_USER_TERMINAL) {
         $sql2 = " AND pf.fk_cash IN (";
         $sql2 .= "SELECT pu.fk_terminal FROM " . MAIN_DB_PREFIX . "pos_users as pu WHERE pu.fk_object = " . $_SESSION["uid"] . " AND pu.objtype = 'user'";
         $sql2 .= " UNION SELECT pu.fk_terminal FROM " . MAIN_DB_PREFIX . "pos_users as pu LEFT JOIN " . MAIN_DB_PREFIX . "usergroup_user as ug ON pu.fk_object = ug.fk_usergroup";
         $sql2 .= " WHERE ug.fk_user = " . $_SESSION["uid"] . " AND pu.objtype = 'group')";
     }
     $sql .= $sql2;
     $now = dol_now();
     $time = dol_getdate($now);
     $day = $time['mday'];
     $month = $time['mon'];
     $year = $time['year'];
     //Today
     $todayini = sprintf("%04d%02d%02d%02d%02d%02d", $year, $month, $day, 0, 0, 0);
     $todayfin = sprintf("%04d%02d%02d%02d%02d%02d", $year, $month, $day, 23, 59, 59);
     $sql .= " AND f.datec BETWEEN '" . $todayini . "' AND '" . $todayfin . "' ) as today, ";
     $sql .= '(SELECT COUNT(f.rowid)';
     $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture as f';
     if (!$user->rights->societe->client->voir && !$user->societe_id) {
         $sql .= " RIGHT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON f.fk_soc = sc.fk_soc AND sc.fk_user = " . $user->id;
     }
     // We need this table joined to the select in order to filter by sale
     $sql .= ', ' . MAIN_DB_PREFIX . 'pos_facture as pf';
     $sql .= ' WHERE f.entity = ' . $conf->entity;
     $sql .= ' AND pf.fk_facture = f.rowid';
     $sql .= $sql2;
     //Yesterday
     $time = dol_get_prev_day($day, $month, $year);
     $yestini = sprintf("%04d%02d%02d%02d%02d%02d", $time['year'], $time['month'], $time['day'], 0, 0, 0);
     $yestfin = sprintf("%04d%02d%02d%02d%02d%02d", $time['year'], $time['month'], $time['day'], 23, 59, 59);
     $sql .= " AND f.datec BETWEEN '" . $yestini . "' AND '" . $yestfin . "' ) as yesterday, ";
     $sql .= '(SELECT COUNT(f.rowid)';
     $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture as f';
     if (!$user->rights->societe->client->voir && !$user->societe_id) {
         $sql .= " RIGHT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON f.fk_soc = sc.fk_soc AND sc.fk_user = " . $user->id;
     }
     // We need this table joined to the select in order to filter by sale
     $sql .= ', ' . MAIN_DB_PREFIX . 'pos_facture as pf';
     $sql .= ' WHERE f.entity = ' . $conf->entity;
     $sql .= ' AND pf.fk_facture = f.rowid';
     $sql .= $sql2;
     //This week
     $time = dol_get_first_day_week($day, $month, $year);
     $weekini = sprintf("%04d%02d%02d%02d%02d%02d", $time['year'], $time['month'], $time['first_day'], 0, 0, 0);
     $weekfin = sprintf("%04d%02d%02d%02d%02d%02d", $year, $month, $day, 23, 59, 59);
     $sql .= " AND f.datec BETWEEN '" . $weekini . "' AND '" . $weekfin . "' ) as thisweek, ";
     $sql .= '(SELECT COUNT(f.rowid)';
     $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture as f';
     if (!$user->rights->societe->client->voir && !$user->societe_id) {
         $sql .= " RIGHT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON f.fk_soc = sc.fk_soc AND sc.fk_user = " . $user->id;
     }
     // We need this table joined to the select in order to filter by sale
     $sql .= ', ' . MAIN_DB_PREFIX . 'pos_facture as pf';
     $sql .= ' WHERE f.entity = ' . $conf->entity;
     $sql .= ' AND pf.fk_facture = f.rowid';
     $sql .= $sql2;
     //Last week
     $time = dol_get_first_day_week($day, $month, $year);
     $lweekini = sprintf("%04d%02d%02d%02d%02d%02d", $time['prev_year'], $time['prev_month'], $time['prev_day'], 0, 0, 0);
     $lweekfin = sprintf("%04d%02d%02d%02d%02d%02d", $year, $time['first_day'] - 1 == 0 ? $time['prev_month'] : $month, $time['first_day'] - 1 == 0 ? $time['prev_day'] + 6 : $time['first_day'] - 1, 23, 59, 59);
     $sql .= " AND f.datec BETWEEN '" . $lweekini . "' AND '" . $lweekfin . "' ) as lastweek, ";
     $sql .= '(SELECT COUNT(f.rowid)';
     $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture as f';
     if (!$user->rights->societe->client->voir && !$user->societe_id) {
         $sql .= " RIGHT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON f.fk_soc = sc.fk_soc AND sc.fk_user = " . $user->id;
     }
     // We need this table joined to the select in order to filter by sale
     $sql .= ', ' . MAIN_DB_PREFIX . 'pos_facture as pf';
     $sql .= ' WHERE f.entity = ' . $conf->entity;
     $sql .= ' AND pf.fk_facture = f.rowid';
     $sql .= $sql2;
     //Two weeks ago
     $time = dol_get_prev_week($day, '', $month, $year);
     $time2 = dol_get_prev_week($time['day'], '', $time['month'], $time['year']);
     $ini2week = sprintf("%04d%02d%02d%02d%02d%02d", $time2['year'], $time2['month'], $time2['day'], 0, 0, 0);
     $fin2week = sprintf("%04d%02d%02d%02d%02d%02d", $time['year'], $time['day'] - 1 == 0 ? $time2['month'] : $time['month'], $time['day'] - 1 == 0 ? $time2['day'] + 6 : $time['day'] - 1, 23, 59, 59);
     $sql .= " AND f.datec BETWEEN '" . $ini2week . "' AND '" . $fin2week . "' ) as twoweek, ";
     $sql .= '(SELECT COUNT(f.rowid)';
     $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture as f';
     if (!$user->rights->societe->client->voir && !$user->societe_id) {
         $sql .= " RIGHT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON f.fk_soc = sc.fk_soc AND sc.fk_user = " . $user->id;
//.........这里部分代码省略.........
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:101,代码来源:pos.class.mañanero.php

示例4: loadBox

    /**
     *  Load data into info_box_contents array to show array later.
     *
     *  @param	int		$max        Maximum number of records to load
     *  @return	void
     */
    function loadBox($max = 5)
    {
        global $conf, $user, $langs, $db;
        $this->max = $max;
        $refreshaction = 'refresh_' . $this->boxcode;
        include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
        $text = $langs->trans("BoxSuppliersInvoicesPerMonth", $max);
        $this->info_box_head = array('text' => $text, 'limit' => dol_strlen($text), 'graph' => 1, 'sublink' => '', 'subtext' => $langs->trans("Filter"), 'subpicto' => 'filter.png', 'subclass' => 'linkobject', 'target' => 'none');
        $dir = '';
        // We don't need a path because image file will not be saved into disk
        $prefix = '';
        $socid = 0;
        if ($user->societe_id) {
            $socid = $user->societe_id;
        }
        if (!$user->rights->societe->client->voir || $socid) {
            $prefix .= 'private-' . $user->id . '-';
        }
        // If user has no permission to see all, output dir is specific to user
        if ($user->rights->fournisseur->facture->lire) {
            $param_year = 'DOLUSERCOOKIE_box_' . $this->boxcode . '_year';
            $param_shownb = 'DOLUSERCOOKIE_box_' . $this->boxcode . '_shownb';
            $param_showtot = 'DOLUSERCOOKIE_box_' . $this->boxcode . '_showtot';
            include_once DOL_DOCUMENT_ROOT . '/core/class/dolgraph.class.php';
            include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facturestats.class.php';
            $autosetarray = preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE'));
            if (in_array('DOLUSERCOOKIE_box_' . $this->boxcode, $autosetarray)) {
                $endyear = GETPOST($param_year, 'int');
                $shownb = GETPOST($param_shownb, 'alpha');
                $showtot = GETPOST($param_showtot, 'alpha');
            } else {
                $tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_' . $this->boxcode], true);
                $endyear = $tmparray['year'];
                $shownb = $tmparray['shownb'];
                $showtot = $tmparray['showtot'];
            }
            if (empty($shownb) && empty($showtot)) {
                $showtot = 1;
            }
            $nowarray = dol_getdate(dol_now(), true);
            if (empty($endyear)) {
                $endyear = $nowarray['year'];
            }
            $startyear = $endyear - 1;
            $mode = 'supplier';
            $WIDTH = $shownb && $showtot || !empty($conf->dol_optimize_smallscreen) ? '256' : '320';
            $HEIGHT = '192';
            $stats = new FactureStats($this->db, $socid, $mode, 0);
            // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
            if ($shownb) {
                $data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, GETPOST('action') == $refreshaction ? -1 : 3600 * 24);
                $filenamenb = $dir . "/" . $prefix . "invoicessuppliernbinyear-" . $year . ".png";
                if ($mode == 'customer') {
                    $fileurlnb = DOL_URL_ROOT . '/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-' . $year . '.png';
                }
                if ($mode == 'supplier') {
                    $fileurlnb = DOL_URL_ROOT . '/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessuppliernbinyear-' . $year . '.png';
                }
                $px1 = new DolGraph();
                $mesg = $px1->isGraphKo();
                if (!$mesg) {
                    $px1->SetData($data1);
                    unset($data1);
                    $px1->SetPrecisionY(0);
                    $i = $startyear;
                    $legend = array();
                    while ($i <= $endyear) {
                        $legend[] = $i;
                        $i++;
                    }
                    $px1->SetLegend($legend);
                    $px1->SetMaxValue($px1->GetCeilMaxValue());
                    $px1->SetWidth($WIDTH);
                    $px1->SetHeight($HEIGHT);
                    $px1->SetYLabel($langs->trans("NumberOfBills"));
                    $px1->SetShading(3);
                    $px1->SetHorizTickIncrement(1);
                    $px1->SetPrecisionY(0);
                    $px1->SetCssPrefix("cssboxes");
                    $px1->mode = 'depth';
                    $px1->SetTitle($langs->trans("NumberOfBillsByMonth"));
                    $px1->draw($filenamenb, $fileurlnb);
                }
            }
            // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
            if ($showtot) {
                $data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, GETPOST('action') == $refreshaction ? -1 : 3600 * 24);
                $filenamenb = $dir . "/" . $prefix . "invoicessupplieramountinyear-" . $year . ".png";
                if ($mode == 'customer') {
                    $fileurlnb = DOL_URL_ROOT . '/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-' . $year . '.png';
                }
                if ($mode == 'supplier') {
                    $fileurlnb = DOL_URL_ROOT . '/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessupplieramountinyear-' . $year . '.png';
                }
//.........这里部分代码省略.........
开发者ID:Samara94,项目名称:dolibarr,代码行数:101,代码来源:box_graph_invoices_supplier_permonth.php

示例5: GETPOST

if (!$sortfield) {
    $sortfield = "dateevent";
}
$search_code = GETPOST("search_code");
$search_ip = GETPOST("search_ip");
$search_user = GETPOST("search_user");
$search_desc = GETPOST("search_desc");
$search_ua = GETPOST("search_ua");
$date_start = dol_mktime(0, 0, 0, $_REQUEST["date_startmonth"], $_REQUEST["date_startday"], $_REQUEST["date_startyear"]);
$date_end = dol_mktime(23, 59, 59, $_REQUEST["date_endmonth"], $_REQUEST["date_endday"], $_REQUEST["date_endyear"]);
// checks:if date_start>date_end  then date_end=date_start + 24 hours
if ($date_start > $date_end) {
    $date_end = $date_start + 86400;
}
$now = dol_now();
$nowarray = dol_getdate($now);
$params = "&amp;search_code={$search_code}&amp;search_ip={$search_ip}&amp;search_user={$search_user}&amp;search_desc={$search_desc}&amp;search_ua={$search_ua}";
$params .= "&amp;date_startmonth=" . $_REQUEST["date_startmonth"];
$params .= "&amp;date_startday=" . $_REQUEST["date_startday"];
$params .= "&amp;date_startyear=" . $_REQUEST["date_startyear"];
$params .= "&amp;date_endmonth=" . $_REQUEST["date_endmonth"];
$params .= "&amp;date_endday=" . $_REQUEST["date_endday"];
$params .= "&amp;date_endyear=" . $_REQUEST["date_endyear"];
if (empty($date_start)) {
    $date_start = dol_get_first_day($nowarray['year'], $nowarray['mon'], false);
}
if (empty($date_end)) {
    $date_end = dol_mktime(23, 59, 59, $nowarray['mon'], $nowarray['mday'], $nowarray['year']);
}
/*
 * Actions
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:31,代码来源:listevents.php

示例6: initAsSpecimen

 /**
  *  Initialise an instance with random values.
  *  Used to build previews or test instances.
  *	id must be 0 if object instance is a specimen.
  *
  *	@param	string		$option		''=Create a specimen invoice with lines, 'nolines'=No lines
  *  @return	void
  */
 function initAsSpecimen($option = '')
 {
     global $user, $langs, $conf;
     $now = dol_now();
     $arraynow = dol_getdate($now);
     $nownotime = dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']);
     $prodids = array();
     $sql = "SELECT rowid";
     $sql .= " FROM " . MAIN_DB_PREFIX . "product";
     $sql .= " WHERE entity IN (" . getEntity('product', 1) . ")";
     $resql = $this->db->query($sql);
     if ($resql) {
         $num_prods = $this->db->num_rows($resql);
         $i = 0;
         while ($i < $num_prods) {
             $i++;
             $row = $this->db->fetch_row($resql);
             $prodids[$i] = $row[0];
         }
     }
     // Initialize parameters
     $this->id = 0;
     $this->ref = 'SPECIMEN';
     $this->specimen = 1;
     $this->socid = 1;
     $this->date = $nownotime;
     $this->date_lim_reglement = $nownotime + 3600 * 24 * 30;
     $this->cond_reglement_id = 1;
     $this->cond_reglement_code = 'RECEP';
     $this->date_lim_reglement = $this->calculate_date_lim_reglement();
     $this->mode_reglement_id = 0;
     // Not forced to show payment mode CHQ + VIR
     $this->mode_reglement_code = '';
     // Not forced to show payment mode CHQ + VIR
     $this->note_public = 'This is a comment (public)';
     $this->note_private = 'This is a comment (private)';
     $this->note = 'This is a comment (private)';
     $this->fk_incoterms = 0;
     $this->location_incoterms = '';
     if (empty($option) || $option != 'nolines') {
         // Lines
         $nbp = 5;
         $xnbp = 0;
         while ($xnbp < $nbp) {
             $line = new FactureLigne($this->db);
             $line->desc = $langs->trans("Description") . " " . $xnbp;
             $line->qty = 1;
             $line->subprice = 100;
             $line->tva_tx = 19.6;
             $line->localtax1_tx = 0;
             $line->localtax2_tx = 0;
             $line->remise_percent = 0;
             if ($xnbp == 1) {
                 $prodid = rand(1, $num_prods);
                 $line->fk_product = $prodids[$prodid];
                 $line->qty = -1;
                 $line->total_ht = -100;
                 $line->total_ttc = -119.6;
                 $line->total_tva = -19.6;
             } else {
                 if ($xnbp == 2) {
                     $line->subprice = -100;
                     $line->total_ht = -100;
                     $line->total_ttc = -119.6;
                     $line->total_tva = -19.6;
                     $line->remise_percent = 0;
                 } else {
                     if ($xnbp == 3) {
                         $prodid = rand(1, $num_prods);
                         $line->fk_product = $prodids[$prodid];
                         $line->total_ht = 50;
                         $line->total_ttc = 59.8;
                         $line->total_tva = 9.800000000000001;
                         $line->remise_percent = 50;
                     } else {
                         $prodid = rand(1, $num_prods);
                         $line->fk_product = $prodids[$prodid];
                         $line->total_ht = 100;
                         $line->total_ttc = 119.6;
                         $line->total_tva = 19.6;
                         $line->remise_percent = 00;
                     }
                 }
             }
             $this->lines[$xnbp] = $line;
             $xnbp++;
             $this->total_ht += $line->total_ht;
             $this->total_tva += $line->total_tva;
             $this->total_ttc += $line->total_ttc;
         }
         $this->revenuestamp = 0;
         // Add a line "offered"
//.........这里部分代码省略.........
开发者ID:Samara94,项目名称:dolibarr,代码行数:101,代码来源:facture.class.php

示例7: initAsSpecimen

 /**
  *  Initialise an instance with random values.
  *  Used to build previews or test instances.
  *	id must be 0 if object instance is a specimen.
  *
  *	@param	string		$option		''=Create a specimen invoice with lines, 'nolines'=No lines
  *  @return	void
  */
 function initAsSpecimen($option = '')
 {
     global $user, $langs, $conf;
     $now = dol_now();
     $arraynow = dol_getdate($now);
     $nownotime = dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']);
     // Initialize parameters
     $this->id = 0;
     $this->ref = 'SPECIMEN';
     $this->specimen = 1;
     $this->facid = 1;
     $this->datepaye = $nownotime;
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:21,代码来源:paiement.class.php

示例8: dol_get_first_day_week

/**	Return first day of week for a date. First day of week may be monday if option MAIN_START_WEEK is 1.
 *
 *	@param		int		$day		Day
 * 	@param		int		$month		Month
 *  @param		int		$year		Year
 * 	@param		int		$gm			False or 0 or 'server' = Return date to compare with server TZ, True or 1 to compare with GM date.
 *	@return		array				year,month,week,first_day,first_month,first_year,prev_day,prev_month,prev_year
 */
function dol_get_first_day_week($day, $month, $year, $gm = false)
{
    global $conf;
    //$day=2; $month=2; $year=2015;
    $date = dol_mktime(0, 0, 0, $month, $day, $year, $gm);
    //Checking conf of start week
    $start_week = isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1;
    $tmparray = dol_getdate($date, true);
    // detail of current day
    //Calculate days = offset from current day
    $days = $start_week - $tmparray['wday'];
    if ($days >= 1) {
        $days = 7 - $days;
    }
    $days = abs($days);
    $seconds = $days * 24 * 60 * 60;
    //print 'start_week='.$start_week.' tmparray[wday]='.$tmparray['wday'].' day offset='.$days.' seconds offset='.$seconds.'<br>';
    //Get first day of week
    $tmpdaytms = date($tmparray[0]) - $seconds;
    // $tmparray[0] is day of parameters
    $tmpday = date("d", $tmpdaytms);
    //Check first day of week is in same month than current day or not
    if ($tmpday > $day) {
        $prev_month = $month - 1;
        $prev_year = $year;
        if ($prev_month == 0) {
            $prev_month = 12;
            $prev_year = $year - 1;
        }
    } else {
        $prev_month = $month;
        $prev_year = $year;
    }
    $tmpmonth = $prev_month;
    $tmpyear = $prev_year;
    //Get first day of next week
    $tmptime = dol_mktime(12, 0, 0, $month, $tmpday, $year, 1, 0);
    $tmptime -= 24 * 60 * 60 * 7;
    $tmparray = dol_getdate($tmptime, true);
    $prev_day = $tmparray['mday'];
    //Check prev day of week is in same month than first day or not
    if ($prev_day > $tmpday) {
        $prev_month = $month - 1;
        $prev_year = $year;
        if ($prev_month == 0) {
            $prev_month = 12;
            $prev_year = $year - 1;
        }
    }
    $week = date("W", dol_mktime(0, 0, 0, $tmpmonth, $tmpday, $tmpyear, $gm));
    return array('year' => $year, 'month' => $month, 'week' => $week, 'first_day' => $tmpday, 'first_month' => $tmpmonth, 'first_year' => $tmpyear, 'prev_year' => $prev_year, 'prev_month' => $prev_month, 'prev_day' => $prev_day);
}
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:60,代码来源:date.lib.php

示例9: showactions

 /**
  *  Show list of actions for element
  *
  *  @param	Object	$object			Object
  *  @param  string	$typeelement	'invoice','propal','order','invoice_supplier','order_supplier','fichinter'
  *	@param	int		$socid			socid of user
  *  @param	int		$forceshowtitle	Show title even if there is no actions to show
  *	@return	int						<0 if KO, >=0 if OK
  */
 function showactions($object, $typeelement, $socid = 0, $forceshowtitle = 0)
 {
     global $langs, $conf, $user;
     global $bc;
     require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
     $listofactions = ActionComm::getActions($this->db, $socid, $object->id, $typeelement);
     if (!is_array($listofactions)) {
         dol_print_error($this->db, 'FailedToGetActions');
     }
     $num = count($listofactions);
     if ($num || $forceshowtitle) {
         if ($typeelement == 'invoice') {
             $title = $langs->trans('ActionsOnBill');
         } elseif ($typeelement == 'invoice_supplier' || $typeelement == 'supplier_invoice') {
             $title = $langs->trans('ActionsOnBill');
         } elseif ($typeelement == 'propal') {
             $title = $langs->trans('ActionsOnPropal');
         } elseif ($typeelement == 'supplier_proposal') {
             $title = $langs->trans('ActionsOnSupplierProposal');
         } elseif ($typeelement == 'order') {
             $title = $langs->trans('ActionsOnOrder');
         } elseif ($typeelement == 'order_supplier' || $typeelement == 'supplier_order') {
             $title = $langs->trans('ActionsOnOrder');
         } elseif ($typeelement == 'project') {
             $title = $langs->trans('ActionsOnProject');
         } elseif ($typeelement == 'shipping') {
             $title = $langs->trans('ActionsOnShipping');
         } elseif ($typeelement == 'fichinter') {
             $title = $langs->trans('ActionsOnFicheInter');
         } else {
             $title = $langs->trans("Actions");
         }
         print load_fiche_titre($title, '', '');
         $total = 0;
         $var = true;
         print '<table class="noborder" width="100%">';
         print '<tr class="liste_titre">';
         print '<th class="liste_titre">' . $langs->trans('Ref') . '</th>';
         print '<th class="liste_titre">' . $langs->trans('Action') . '</th>';
         print '<th class="liste_titre">' . $langs->trans('Date') . '</th>';
         print '<th class="liste_titre">' . $langs->trans('By') . '</th>';
         print '<th class="liste_titre" align="right">' . $langs->trans('Status') . '</th>';
         print '</tr>';
         print "\n";
         $userstatic = new User($this->db);
         foreach ($listofactions as $action) {
             $ref = $action->getNomUrl(1, -1);
             $label = $action->getNomUrl(0, 38);
             $var = !$var;
             print '<tr ' . $bc[$var] . '>';
             print '<td>' . $ref . '</td>';
             print '<td>' . $label . '</td>';
             print '<td>' . dol_print_date($action->datep, 'dayhour');
             if ($action->datef) {
                 $tmpa = dol_getdate($action->datep);
                 $tmpb = dol_getdate($action->datef);
                 if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) {
                     if ($tmpa['hours'] != $tmpb['hours'] || $tmpa['minutes'] != $tmpb['minutes'] && $tmpa['seconds'] != $tmpb['seconds']) {
                         print '-' . dol_print_date($action->datef, 'hour');
                     }
                 } else {
                     print '-' . dol_print_date($action->datef, 'dayhour');
                 }
             }
             print '</td>';
             print '<td>';
             if (!empty($action->author->id)) {
                 $userstatic->id = $action->author->id;
                 $userstatic->firstname = $action->author->firstname;
                 $userstatic->lastname = $action->author->lastname;
                 print $userstatic->getNomUrl(1);
             }
             print '</td>';
             print '<td align="right">';
             if (!empty($action->author->id)) {
                 print $action->getLibStatut(3);
             }
             print '</td>';
             print '</tr>';
         }
         print '</table>';
     }
     return $num;
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:93,代码来源:html.formactions.class.php

示例10: projectLinesPerWeek


//.........这里部分代码省略.........
                print $taskstatic->getNomUrl(0, 'withproject', 'time');
                //print "<br>";
                //for ($k = 0 ; $k < $level ; $k++) print "&nbsp;&nbsp;&nbsp;";
                //print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
                print "</td>\n";
                // Planned Workload
                print '<td align="right">';
                if ($lines[$i]->planned_workload) {
                    print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin');
                } else {
                    print '--:--';
                }
                print '</td>';
                // Progress declared %
                print '<td align="right">';
                print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress');
                print '</td>';
                // Time spent by everybody
                print '<td align="right">';
                // $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consummed by user
                if ($lines[$i]->duration) {
                    print '<a href="' . DOL_URL_ROOT . '/projet/tasks/time.php?id=' . $lines[$i]->id . '">';
                    print convertSecondToTime($lines[$i]->duration, 'allhourmin');
                    print '</a>';
                } else {
                    print '--:--';
                }
                print "</td>\n";
                // Time spent by user
                print '<td align="right">';
                $tmptimespent = $taskstatic->getSummaryOfTimeSpent();
                if ($tmptimespent['total_duration']) {
                    print convertSecondToTime($tmptimespent['total_duration'], 'allhourmin');
                } else {
                    print '--:--';
                }
                print "</td>\n";
                $disabledproject = 1;
                $disabledtask = 1;
                //print "x".$lines[$i]->fk_project;
                //var_dump($lines[$i]);
                //var_dump($projectsrole[$lines[$i]->fk_project]);
                // If at least one role for project
                if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) {
                    $disabledproject = 0;
                    $disabledtask = 0;
                }
                // If $restricteditformytask is on and I have no role on task, i disable edit
                if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) {
                    $disabledtask = 1;
                }
                //var_dump($projectstatic->weekWorkLoadPerTask);
                // Fields to show current time
                $tableCell = '';
                $modeinput = 'hours';
                for ($idw = 0; $idw < 7; $idw++) {
                    $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd');
                    $tmparray = dol_getdate($tmpday);
                    $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id];
                    $alreadyspent = '';
                    if ($dayWorkLoad > 0) {
                        $alreadyspent = convertSecondToTime($dayWorkLoad, 'allhourmin');
                    }
                    $alttitle = $langs->trans("AddHereTimeSpentForDay", $tmparray['day'], $tmparray['mon']);
                    $tableCell = '<td align="center" class="hide' . $idw . '">';
                    if ($alreadyspent) {
                        $tableCell .= '<span class="timesheetalreadyrecorded"><input type="text" class="center smallpadd" size="2" disabled id="timespent[' . $inc . '][' . $idw . ']" name="task[' . $lines[$i]->id . '][' . $idw . ']" value="' . $alreadyspent . '"></span>';
                        //$placeholder=' placeholder="00:00"';
                        $placeholder = '';
                        //$tableCell.='+';
                    }
                    $tableCell .= '<input type="text" alt="' . ($disabledtask ? '' : $alttitle) . '" title="' . ($disabledtask ? '' : $alttitle) . '" ' . ($disabledtask ? 'disabled' : $placeholder) . ' class="center smallpadd" size="2" id="timeadded[' . $inc . '][' . $idw . ']" name="task[' . $lines[$i]->id . '][' . $idw . ']" value="" cols="2"  maxlength="5"';
                    $tableCell .= ' onkeypress="return regexEvent(this,event,\'timeChar\')"';
                    $tableCell .= 'onblur="regexEvent(this,event,\'' . $modeinput . '\'); updateTotal(' . $idw . ',\'' . $modeinput . '\')" />';
                    $tableCell .= '</td>';
                    print $tableCell;
                }
                print '<td align="right">';
                if (!$lines[$i]->public && $disabledproject) {
                    print $form->textwithpicto('', $langs->trans("YouAreNotContactOfProject"));
                } else {
                    if ($disabledtask) {
                        print $form->textwithpicto('', $langs->trans("TaskIsNotAffectedToYou"));
                    }
                }
                print '</td>';
                print "</tr>\n";
            }
            $inc++;
            $level++;
            if ($lines[$i]->id) {
                projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask);
            }
            $level--;
        } else {
            //$level--;
        }
    }
    return $inc;
}
开发者ID:Albertopf,项目名称:prueba,代码行数:101,代码来源:project.lib.php

示例11: initAsSpecimen

 /**
  *  Initialise an instance with random values.
  *  Used to build previews or test instances.
  *	id must be 0 if object instance is a specimen.
  *
  *	@param	string		$option		''=Create a specimen invoice with lines, 'nolines'=No lines
  *  @return	void
  */
 function initAsSpecimen($option = '')
 {
     global $user, $langs, $conf;
     $now = dol_now();
     $arraynow = dol_getdate($now);
     $nownotime = dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']);
     parent::initAsSpecimen($option);
     $this->usenewprice = 1;
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:17,代码来源:facture-rec.class.php

示例12: show_actions_done


//.........这里部分代码省略.........
        $out .= '<table class="noborder" width="100%">';
        $out .= '<tr class="liste_titre">';
        if ($conf->global->AGENDA_USE_EVENT_TYPE) {
            $out .= '<td colspan="3">';
        } else {
            $out .= '<td colspan="2">';
        }
        if (get_class($object) == 'Societe') {
            $out .= '<a href="' . DOL_URL_ROOT . '/comm/action/listactions.php?socid=' . $object->id . '&amp;status=done">';
        }
        $out .= $langs->trans("ActionsDoneShort");
        if (get_class($object) == 'Societe') {
            $out .= '</a>';
        }
        $out .= '</td>';
        if ($conf->global->AGENDA_USE_EVENT_TYPE) {
            $out .= '<td>';
            $out .= $langs->trans("Type");
            $out .= '</td>';
            $out .= '<td colspan="4" align="right">';
        } else {
            $out .= '<td colspan="5" align="right">';
        }
        $out .= '</td>';
        $out .= '</tr>';
        foreach ($histo as $key => $value) {
            $var = !$var;
            $out .= "<tr " . $bc[$var] . ">";
            $actionstatic->fetch($histo[$key]['id']);
            // Champ date
            $out .= '<td width="120" class="nowrap">';
            $out .= dol_print_date($histo[$key]['datestart'], 'dayhour');
            if ($histo[$key]['dateend'] && $histo[$key]['dateend'] != $histo[$key]['datestart']) {
                $tmpa = dol_getdate($histo[$key]['datestart'], true);
                $tmpb = dol_getdate($histo[$key]['dateend'], true);
                if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) {
                    $out .= '-' . dol_print_date($histo[$key]['dateend'], 'hour');
                } else {
                    $out .= '-' . dol_print_date($histo[$key]['dateend'], 'dayhour');
                }
            }
            $out .= "</td>\n";
            // Picto
            $out .= '<td width="16">&nbsp;</td>';
            // Action
            $out .= '<td>';
            if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'action') {
                $actionstatic->type_code = $histo[$key]['acode'];
                $transcode = $langs->trans("Action" . $histo[$key]['acode']);
                $libelle = $transcode != "Action" . $histo[$key]['acode'] ? $transcode : $histo[$key]['libelle'];
                //$actionstatic->libelle=$libelle;
                $actionstatic->libelle = $histo[$key]['note'];
                $actionstatic->id = $histo[$key]['id'];
                $out .= $actionstatic->getNomUrl(1, 120);
            }
            if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') {
                $out .= '<a href="' . DOL_URL_ROOT . '/comm/mailing/card.php?id=' . $histo[$key]['id'] . '">' . img_object($langs->trans("ShowEMailing"), "email") . ' ';
                $transcode = $langs->trans("Action" . $histo[$key]['acode']);
                $libelle = $transcode != "Action" . $histo[$key]['acode'] ? $transcode : 'Send mass mailing';
                $out .= dol_trunc($libelle, 120);
            }
            $out .= '</td>';
            if ($conf->global->AGENDA_USE_EVENT_TYPE) {
                $out .= '<td>';
                $out .= $actionstatic->type;
                $out .= '</td>';
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:67,代码来源:company.lib.php

示例13: select_date


//.........这里部分代码省略.........
             $retstring .= '<option value="' . $min . '"' . ($min == $smin ? ' selected' : '') . '>' . $min . (empty($conf->dol_optimize_smallscreen) ? '' : '') . '</option>';
         }
         $retstring .= '</select>';
     }
     // Add a "Now" link
     if ($conf->use_javascript_ajax && $addnowlink) {
         // Script which will be inserted in the onClick of the "Now" link
         $reset_scripts = "";
         // Generate the date part, depending on the use or not of the javascript calendar
         $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date(dol_now(), 'day') . '\');';
         $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date(dol_now(), '%d') . '\');';
         $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date(dol_now(), '%m') . '\');';
         $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date(dol_now(), '%Y') . '\');';
         /*if ($usecalendar == "eldy")
           {
               $base=DOL_URL_ROOT.'/core/';
               $reset_scripts .= 'resetDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');';
           }
           else
           {
               $reset_scripts .= 'this.form.elements[\''.$prefix.'day\'].value=formatDate(new Date(), \'d\'); ';
               $reset_scripts .= 'this.form.elements[\''.$prefix.'month\'].value=formatDate(new Date(), \'M\'); ';
               $reset_scripts .= 'this.form.elements[\''.$prefix.'year\'].value=formatDate(new Date(), \'yyyy\'); ';
           }*/
         // Update the hour part
         if ($h) {
             if ($fullday) {
                 $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
             }
             //$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';
             $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date(dol_now(), '%H') . '\');';
             if ($fullday) {
                 $reset_scripts .= ' } ';
             }
         }
         // Update the minute part
         if ($m) {
             if ($fullday) {
                 $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
             }
             //$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';
             $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date(dol_now(), '%M') . '\');';
             if ($fullday) {
                 $reset_scripts .= ' } ';
             }
         }
         // If reset_scripts is not empty, print the link with the reset_scripts in the onClick
         if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) {
             $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">';
             $retstring .= $langs->trans("Now");
             $retstring .= '</button> ';
         }
     }
     // Add a "Plus one hour" link
     if ($conf->use_javascript_ajax && $addplusone) {
         // Script which will be inserted in the onClick of the "Add plusone" link
         $reset_scripts = "";
         // Generate the date part, depending on the use or not of the javascript calendar
         $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date(dol_now(), 'day') . '\');';
         $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date(dol_now(), '%d') . '\');';
         $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date(dol_now(), '%m') . '\');';
         $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date(dol_now(), '%Y') . '\');';
         // Update the hour part
         if ($h) {
             if ($fullday) {
                 $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
             }
             $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date(dol_now(), '%H') . '\');';
             if ($fullday) {
                 $reset_scripts .= ' } ';
             }
         }
         // Update the minute part
         if ($m) {
             if ($fullday) {
                 $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
             }
             $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date(dol_now(), '%M') . '\');';
             if ($fullday) {
                 $reset_scripts .= ' } ';
             }
         }
         // If reset_scripts is not empty, print the link with the reset_scripts in the onClick
         if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) {
             $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">';
             $retstring .= $langs->trans("DateStartPlusOne");
             $retstring .= '</button> ';
         }
     }
     // Add a "Plus one hour" link
     if ($conf->use_javascript_ajax && $adddateof) {
         $tmparray = dol_getdate($adddateof);
         $retstring .= ' - <button class="dpInvisibleButtons datenowlink" id="dateofinvoice" type="button" name="_dateofinvoice" value="now" onclick="jQuery(\'#re\').val(\'' . dol_print_date($adddateof, 'day') . '\');jQuery(\'#reday\').val(\'' . $tmparray['mday'] . '\');jQuery(\'#remonth\').val(\'' . $tmparray['mon'] . '\');jQuery(\'#reyear\').val(\'' . $tmparray['year'] . '\');">' . $langs->trans("DateInvoice") . '</a>';
     }
     if (!empty($nooutput)) {
         return $retstring;
     }
     print $retstring;
     return;
 }
开发者ID:Albertopf,项目名称:prueba,代码行数:101,代码来源:html.form.class.php

示例14: loadBox

    /**
     *  Load data into info_box_contents array to show array later.
     *
     *  @param	int		$max        Maximum number of records to load
     *  @return	void
     */
    function loadBox($max = 5)
    {
        global $conf, $user, $langs, $db;
        $this->max = $max;
        $refreshaction = 'refresh_' . $this->boxcode;
        include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
        include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
        include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
        $text = $langs->trans("BoxProductDistribution", $max);
        $this->info_box_head = array('text' => $text, 'limit' => dol_strlen($text), 'graph' => 1, 'sublink' => '', 'subtext' => $langs->trans("Filter"), 'subpicto' => 'filter.png', 'subclass' => 'linkobject', 'target' => 'none');
        $param_year = 'DOLUSERCOOKIE_box_' . $this->boxcode . '_year';
        $param_showinvoicenb = 'DOLUSERCOOKIE_box_' . $this->boxcode . '_showinvoicenb';
        $param_showpropalnb = 'DOLUSERCOOKIE_box_' . $this->boxcode . '_showpropalnb';
        $param_showordernb = 'DOLUSERCOOKIE_box_' . $this->boxcode . '_showordernb';
        $autosetarray = preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE'));
        if (in_array('DOLUSERCOOKIE_box_' . $this->boxcode, $autosetarray)) {
            $year = GETPOST($param_year, 'int');
            $showinvoicenb = GETPOST($param_showinvoicenb, 'alpha');
            $showpropalnb = GETPOST($param_showpropalnb, 'alpha');
            $showordernb = GETPOST($param_showordernb, 'alpha');
        } else {
            $tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_' . $this->boxcode], true);
            $year = $tmparray['year'];
            $showinvoicenb = $tmparray['showinvoicenb'];
            $showpropalnb = $tmparray['showpropalnb'];
            $showordernb = $tmparray['showordernb'];
        }
        if (empty($showinvoicenb) && empty($showpropalnb) && empty($showordernb)) {
            $showpropalnb = 1;
            $showinvoicenb = 1;
            $showordernb = 1;
        }
        if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) {
            $showinvoicenb = 0;
        }
        if (empty($conf->propal->enabled) || empty($user->rights->propal->lire)) {
            $showpropalnb = 0;
        }
        if (empty($conf->commande->enabled) || empty($user->rights->commande->lire)) {
            $showordernb = 0;
        }
        $nowarray = dol_getdate(dol_now(), true);
        if (empty($year)) {
            $year = $nowarray['year'];
        }
        $nbofgraph = 0;
        if ($showinvoicenb) {
            $nbofgraph++;
        }
        if ($showpropalnb) {
            $nbofgraph++;
        }
        if ($showordernb) {
            $nbofgraph++;
        }
        $paramtitle = $langs->transnoentitiesnoconv("Products") . '/' . $langs->transnoentitiesnoconv("Services");
        if (empty($conf->produit->enabled)) {
            $paramtitle = $langs->transnoentitiesnoconv("Services");
        }
        if (empty($conf->service->enabled)) {
            $paramtitle = $langs->transnoentitiesnoconv("Products");
        }
        $socid = empty($user->societe_id) ? 0 : $user->societe_id;
        $userid = 0;
        // No filter on user creation
        $WIDTH = $nbofgraph >= 2 || !empty($conf->dol_optimize_smallscreen) ? '160' : '320';
        $HEIGHT = '192';
        if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) {
            // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
            if ($showinvoicenb) {
                include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facturestats.class.php';
                $showpointvalue = 1;
                $nocolor = 0;
                $mode = 'customer';
                $stats_invoice = new FactureStats($this->db, $socid, $mode, $userid > 0 ? $userid : 0);
                $data1 = $stats_invoice->getAllByProductEntry($year, GETPOST('action') == $refreshaction ? -1 : 3600 * 24);
                if (empty($data1)) {
                    $showpointvalue = 0;
                    $nocolor = 1;
                    $data1 = array(array(0 => $langs->trans("None"), 1 => 1));
                }
                $filenamenb = $dir . "/prodserforinvoice-" . $year . ".png";
                $fileurlnb = DOL_URL_ROOT . '/viewimage.php?modulepart=productstats&amp;file=prodserforinvoice-' . $year . '.png';
                $px1 = new DolGraph();
                $mesg = $px1->isGraphKo();
                if (!$mesg) {
                    $i = 0;
                    $tot = count($data1);
                    $legend = array();
                    while ($i <= $tot) {
                        $data1[$i][0] = dol_trunc($data1[$i][0], 5);
                        // Required to avoid error "Could not draw pie with labels contained inside canvas"
                        $legend[] = $data1[$i][0];
                        $i++;
//.........这里部分代码省略.........
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:101,代码来源:box_graph_product_distribution.php

示例15:

    echo " </tr>\n";

    echo "</table>\n";
}
else    // View by day
{
    $newparam=$param;   // newparam is for birthday links
    $newparam=preg_replace('/action=show_month&?/i','',$newparam);
    $newparam=preg_replace('/action=show_week&?/i','',$newparam);
    $newparam=preg_replace('/day=[0-9][0-9]&?/i','',$newparam);
    $newparam=preg_replace('/month=[0-9][0-9]&?/i','',$newparam);
    $newparam=preg_replace('/year=[0-9]+&?/i','',$newparam);
    // Code to show just one day
    $style='cal_current_month';
    $today=0;
    $todayarray=dol_getdate($now,'fast');
    if ($todayarray['mday']==$day && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1;
    if ($today) $style='cal_today';

    $timestamp=dol_mktime(12,0,0,$month,$day,$year);
    $arraytimestamp=adodb_getdate(dol_mktime(12,0,0,$month,$day,$year));
    echo '<table width="100%" class="nocellnopadd">';
    echo ' <tr class="liste_titre">';
    echo '  <td align="center">'.$langs->trans("Day".$arraytimestamp['wday'])."</td>\n";
    echo " </tr>\n";
    echo " <tr>\n";
    echo '  <td class="'.$style.'" width="14%" valign="top"  nowrap="nowrap">';
    $maxnbofchar=80;
    show_day_events ($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
    echo "</td>\n";
    echo " </tr>\n";
开发者ID:remyyounes,项目名称:dolibarr,代码行数:31,代码来源:index.php


注:本文中的dol_getdate函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。