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


PHP dol_get_first_day函数代码示例

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


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

示例1: getNbByMonth

 /**
  * Return shipment number by month for a year
  *
  * @param	int		$year		Year to scan
  * @return	array				Array with number by month
  */
 function getNbByMonth($year)
 {
     global $user;
     $sql = "SELECT date_format(d.datedon,'%m') as dm, COUNT(*) as nb";
     $sql .= " FROM " . $this->from;
     $sql .= " WHERE d.datedon BETWEEN '" . $this->db->idate(dol_get_first_day($year)) . "' AND '" . $this->db->idate(dol_get_last_day($year)) . "'";
     $sql .= " AND " . $this->where;
     $sql .= " GROUP BY dm";
     $sql .= $this->db->order('dm', 'DESC');
     $res = $this->_getNbByMonth($year, $sql);
     return $res;
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:18,代码来源:donstats.class.php

示例2: loadBox

 /**
  *  Load data for box to show them later
  *
  *  @param  int     $max        Maximum number of records to load
  *  @return void
  */
 function loadBox($max = 5)
 {
     global $conf, $user, $langs, $db;
     $this->max = $max;
     $totalMnt = 0;
     $totalnb = 0;
     $totalDuree = 0;
     include_once DOL_DOCUMENT_ROOT . "/projet/class/task.class.php";
     $taskstatic = new Task($db);
     $textHead = $langs->trans("Tasks") . " " . date("Y");
     $this->info_box_head = array('text' => $textHead, 'limit' => dol_strlen($textHead));
     // list the summary of the orders
     if ($user->rights->projet->lire) {
         // FIXME fk_statut on a task is not be used. We use the percent. This means this box is useless.
         $sql = "SELECT pt.fk_statut, count(DISTINCT pt.rowid) as nb, sum(ptt.task_duration) as durationtot, sum(pt.planned_workload) as plannedtot";
         $sql .= " FROM " . MAIN_DB_PREFIX . "projet_task as pt, " . MAIN_DB_PREFIX . "projet_task_time as ptt";
         $sql .= " WHERE pt.datec BETWEEN '" . $this->db->idate(dol_get_first_day(date("Y"), 1)) . "' AND '" . $this->db->idate(dol_get_last_day(date("Y"), 12)) . "'";
         $sql .= " AND pt.rowid = ptt.fk_task";
         $sql .= " GROUP BY pt.fk_statut ";
         $sql .= " ORDER BY pt.fk_statut DESC";
         $sql .= $db->plimit($max, 0);
         $result = $db->query($sql);
         if ($result) {
             $num = $db->num_rows($result);
             $i = 0;
             while ($i < $num) {
                 $objp = $db->fetch_object($result);
                 $this->info_box_contents[$i][] = array('td' => 'align="left"', 'text' => $langs->trans("Task") . " " . $taskstatic->LibStatut($objp->fk_statut, 0));
                 $this->info_box_contents[$i][] = array('td' => 'align="right"', 'text' => $objp->nb . "&nbsp;" . $langs->trans("Tasks"), 'url' => DOL_URL_ROOT . "/projet/tasks/list.php?leftmenu=projects&viewstatut=" . $objp->fk_statut);
                 $totalnb += $objp->nb;
                 $this->info_box_contents[$i][] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->plannedtot, 'all', 25200, 5));
                 $totalplannedtot += $objp->plannedtot;
                 $this->info_box_contents[$i][] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->durationtot, 'all', 25200, 5));
                 $totaldurationtot += $objp->durationtot;
                 $this->info_box_contents[$i][] = array('td' => 'align="right" width="18"', 'text' => $taskstatic->LibStatut($objp->fk_statut, 3));
                 $i++;
             }
         } else {
             dol_print_error($this->db);
         }
     }
     // Add the sum à the bottom of the boxes
     $this->info_box_contents[$i][] = array('tr' => 'class="liste_total"', 'td' => 'align="left"', 'text' => $langs->trans("Total") . "&nbsp;" . $textHead);
     $this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ') . "&nbsp;" . $langs->trans("Tasks"));
     $this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot, 'all', 25200, 5));
     $this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot, 'all', 25200, 5));
     $this->info_box_contents[$i][] = array('td' => '', 'text' => "");
 }
开发者ID:Albertopf,项目名称:prueba,代码行数:54,代码来源:box_task.php

示例3: foreach

        });

    });

    </script>

_END;
    // Add number of product when there is a filter on period
    if (count($arrayofuniqueproduct) == 1 && is_numeric($year)) {
        $productidselected = 0;
        foreach ($arrayofuniqueproduct as $key => $val) {
            $productidselected = $key;
            $productlabelselected = $val;
        }
        $datebefore = dol_get_first_day($year ? $year : strftime("%Y", time()), $month ? $month : 1, true);
        $dateafter = dol_get_last_day($year ? $year : strftime("%Y", time()), $month ? $month : 12, true);
        $balancebefore = $movement->calculateBalanceForProductBefore($productidselected, $datebefore);
        $balanceafter = $movement->calculateBalanceForProductBefore($productidselected, $dateafter);
        //print '<tr class="total"><td class="liste_total">';
        print $langs->trans("NbOfProductBeforePeriod", $productlabelselected, dol_print_date($datebefore, 'day', 'gmt'));
        //print '</td>';
        //print '<td class="liste_total" colspan="6" align="right">';
        print ': ' . $balancebefore;
        print "<br>\n";
        //print '</td></tr>';
        //print '<tr class="total"><td class="liste_total">';
        print $langs->trans("NbOfProductAfterPeriod", $productlabelselected, dol_print_date($dateafter, 'day', 'gmt'));
        //print '</td>';
        //print '<td class="liste_total" colspan="6" align="right">';
        print ': ' . $balanceafter;
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:30,代码来源:mouvement.intentohector.php

示例4: date_format

if ($search_amount) {
    $sql .= " AND bc.amount='" . $db->escape(price2num(trim($search_amount))) . "'";
}
if ($month > 0) {
    if ($year > 0 && empty($day)) {
        $sql .= " AND bc.date_bordereau BETWEEN '" . $db->idate(dol_get_first_day($year, $month, false)) . "' AND '" . $db->idate(dol_get_last_day($year, $month, false)) . "'";
    } else {
        if ($year > 0 && !empty($day)) {
            $sql .= " AND bc.date_bordereau BETWEEN '" . $db->idate(dol_mktime(0, 0, 0, $month, $day, $year)) . "' AND '" . $db->idate(dol_mktime(23, 59, 59, $month, $day, $year)) . "'";
        } else {
            $sql .= " AND date_format(bc.date_bordereau, '%m') = '" . $month . "'";
        }
    }
} else {
    if ($year > 0) {
        $sql .= " AND bc.date_bordereau BETWEEN '" . $db->idate(dol_get_first_day($year, 1, false)) . "' AND '" . $db->idate(dol_get_last_day($year, 12, false)) . "'";
    }
}
$sql .= " ORDER BY {$sortfield} {$sortorder}";
$sql .= $db->plimit($limit + 1, $offset);
//print "$sql";
$resql = $db->query($sql);
if ($resql) {
    $num = $db->num_rows($resql);
    $i = 0;
    $params = '';
    print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num);
    print '<form method="GET" action="' . $_SERVER["PHP_SELF"] . '">';
    print '<table class="liste" width="100%">';
    print '<tr class="liste_titre">';
    print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "bc.number", "", $params, "", $sortfield, $sortorder);
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:31,代码来源:list.php

示例5: strftime

        exit;
    }
}
// Formulaire saisie salaire
if ($action == 'create') {
    $year_current = strftime("%Y", dol_now());
    $pastmonth = strftime("%m", dol_now()) - 1;
    $pastmonthyear = $year_current;
    if ($pastmonth == 0) {
        $pastmonth = 12;
        $pastmonthyear--;
    }
    $datesp = dol_mktime(0, 0, 0, $datespmonth, $datespday, $datespyear);
    $dateep = dol_mktime(23, 59, 59, $dateepmonth, $dateepday, $dateepyear);
    if (empty($datesp) || empty($dateep)) {
        $datesp = dol_get_first_day($pastmonthyear, $pastmonth, false);
        $dateep = dol_get_last_day($pastmonthyear, $pastmonth, false);
    }
    print '<form name="salary" action="' . $_SERVER["PHP_SELF"] . '" method="post">';
    print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
    print '<input type="hidden" name="action" value="add">';
    print_fiche_titre($langs->trans("NewSalaryPayment"), '', 'title_accountancy.png');
    dol_fiche_head('', '');
    print '<table class="border" width="100%">';
    print "<tr>";
    print '<td class="fieldrequired">' . $langs->trans("DatePayment") . '</td><td>';
    print $form->select_date(empty($datep) ? -1 : $datep, "datep", '', '', '', 'add', 1, 1);
    print '</td></tr>';
    print '<tr><td>' . $langs->trans("DateValue") . '</td><td>';
    print $form->select_date(empty($datev) ? -1 : $datev, "datev", '', '', '', 'add', 1, 1);
    print '</td></tr>';
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:31,代码来源:card.php

示例6: ROUND

$sql .= "  ROUND(SUM(IF(MONTH(ff.datef)=1,ffd.total_ht,0)),2) AS 'Janvier',";
$sql .= "  ROUND(SUM(IF(MONTH(ff.datef)=2,ffd.total_ht,0)),2) AS 'Fevrier',";
$sql .= "  ROUND(SUM(IF(MONTH(ff.datef)=3,ffd.total_ht,0)),2) AS 'Mars',";
$sql .= "  ROUND(SUM(IF(MONTH(ff.datef)=4,ffd.total_ht,0)),2) AS 'Avril',";
$sql .= "  ROUND(SUM(IF(MONTH(ff.datef)=5,ffd.total_ht,0)),2) AS 'Mai',";
$sql .= "  ROUND(SUM(IF(MONTH(ff.datef)=6,ffd.total_ht,0)),2) AS 'Juin',";
$sql .= "  ROUND(SUM(IF(MONTH(ff.datef)=7,ffd.total_ht,0)),2) AS 'Juillet',";
$sql .= "  ROUND(SUM(IF(MONTH(ff.datef)=8,ffd.total_ht,0)),2) AS 'Aout',";
$sql .= "  ROUND(SUM(IF(MONTH(ff.datef)=9,ffd.total_ht,0)),2) AS 'Septembre',";
$sql .= "  ROUND(SUM(IF(MONTH(ff.datef)=10,ffd.total_ht,0)),2) AS 'Octobre',";
$sql .= "  ROUND(SUM(IF(MONTH(ff.datef)=11,ffd.total_ht,0)),2) AS 'Novembre',";
$sql .= "  ROUND(SUM(IF(MONTH(ff.datef)=12,ffd.total_ht,0)),2) AS 'Decembre',";
$sql .= "  ROUND(SUM(ffd.total_ht),2) as 'Total'";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
$sql .= "  LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
$sql .= " WHERE ff.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
$sql .= "  AND ff.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
$sql .= "  AND ff.fk_statut > 0 ";
if (!empty($conf->multicompany->enabled)) {
    $sql .= " AND ff.entity IN (" . getEntity("facture_fourn", 1) . ")";
}
dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql);
$resql = $db->query($sql);
if ($resql) {
    $i = 0;
    $num = $db->num_rows($resql);
    while ($i < $num) {
        $row = $db->fetch_row($resql);
        print '<tr><td>' . $row[0] . '</td>';
        print '<td align="right">' . $row[1] . '</td>';
        print '<td align="right">' . price($row[2]) . '</td>';
开发者ID:Albertopf,项目名称:prueba,代码行数:31,代码来源:index.php

示例7: ROUND

$sql .= "  ROUND(SUM(IF(MONTH(lp.date_paiement)=1,lp.montant,0)),2) AS 'Janvier',";
$sql .= "  ROUND(SUM(IF(MONTH(lp.date_paiement)=2,lp.montant,0)),2) AS 'Fevrier',";
$sql .= "  ROUND(SUM(IF(MONTH(lp.date_paiement)=3,lp.montant,0)),2) AS 'Mars',";
$sql .= "  ROUND(SUM(IF(MONTH(lp.date_paiement)=4,lp.montant,0)),2) AS 'Avril',";
$sql .= "  ROUND(SUM(IF(MONTH(lp.date_paiement)=5,lp.montant,0)),2) AS 'Mai',";
$sql .= "  ROUND(SUM(IF(MONTH(lp.date_paiement)=6,lp.montant,0)),2) AS 'Juin',";
$sql .= "  ROUND(SUM(IF(MONTH(lp.date_paiement)=7,lp.montant,0)),2) AS 'Juillet',";
$sql .= "  ROUND(SUM(IF(MONTH(lp.date_paiement)=8,lp.montant,0)),2) AS 'Aout',";
$sql .= "  ROUND(SUM(IF(MONTH(lp.date_paiement)=9,lp.montant,0)),2) AS 'Septembre',";
$sql .= "  ROUND(SUM(IF(MONTH(lp.date_paiement)=10,lp.montant,0)),2) AS 'Octobre',";
$sql .= "  ROUND(SUM(IF(MONTH(lp.date_paiement)=11,lp.montant,0)),2) AS 'Novembre',";
$sql .= "  ROUND(SUM(IF(MONTH(lp.date_paiement)=12,lp.montant,0)),2) AS 'Decembre',";
$sql .= "  ROUND(SUM(lp.montant),2) as 'Total'";
$sql .= " FROM " . MAIN_DB_PREFIX . "immo_paie as lp";
$sql .= " , " . MAIN_DB_PREFIX . "immo_local as ll";
$sql .= " WHERE lp.date_paiement >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
$sql .= "  AND lp.date_paiement <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
$sql .= "  AND lp.local_id = ll.rowid ";
if ($user->id != 1) {
    $sql .= " AND ll.proprietaire_id=" . $user->id;
}
$resql = $db->query($sql);
if ($resql) {
    $i = 0;
    $num = $db->num_rows($resql);
    while ($i < $num) {
        $row = $db->fetch_row($resql);
        print '<tr><td>' . $row[0] . '</td>';
        print '<td align="right">' . $row[1] . '</td>';
        print '<td align="right">' . $row[2] . '</td>';
        print '<td align="right">' . $row[3] . '</td>';
开发者ID:abbenbouchta,项目名称:immobilier,代码行数:31,代码来源:paiement_mois.php

示例8: while

} else {
    $j = 0;
    $numlt = 0;
}
while ($j < $numlt) {
    if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly') {
        print "<br>";
        $tva = new Tva($db);
        print_fiche_titre($langs->transcountry($j == 1 ? "LT1Payments" : "LT2Payments", $mysoc->country_code) . ($year ? ' (' . $langs->trans("Year") . ' ' . $year . ')' : ''), '', '');
        $sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm, pv.datep as dp";
        $sql .= " FROM " . MAIN_DB_PREFIX . "localtax as pv";
        $sql .= " WHERE pv.entity = " . $conf->entity . " AND localtaxtype = " . $j;
        if ($year > 0) {
            // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
            // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
            $sql .= " AND pv.datev between '" . $db->idate(dol_get_first_day($year, 1, false)) . "' AND '" . $db->idate(dol_get_last_day($year, 12, false)) . "'";
        }
        if (preg_match('/^pv/', $sortfield)) {
            $sql .= $db->order($sortfield, $sortorder);
        }
        $result = $db->query($sql);
        if ($result) {
            $num = $db->num_rows($result);
            $i = 0;
            $total = 0;
            print '<table class="noborder" width="100%">';
            print '<tr class="liste_titre">';
            print_liste_field_titre($langs->trans("PeriodEndDate"), $_SERVER["PHP_SELF"], "pv.datev", "", $param, 'width="120"', $sortfield, $sortorder);
            print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "pv.label", "", $param, '', $sortfield, $sortorder);
            print_liste_field_titre($langs->trans("ExpectedToPay"), $_SERVER["PHP_SELF"], "pv.amount", "", $param, 'align="right"', $sortfield, $sortorder);
            print_liste_field_titre($langs->trans("RefPayment"), $_SERVER["PHP_SELF"], "pv.rowid", "", $param, '', $sortfield, $sortorder);
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:31,代码来源:index.php

示例9: activitytrim

function activitytrim($product_type)
{
    global $conf, $langs, $db;
    // We display the last 3 years
    $yearofbegindate = date('Y', dol_time_plus_duree(time(), -3, "y"));
    // breakdown by quarter
    $sql = "SELECT DATE_FORMAT(p.datep,'%Y') as annee, DATE_FORMAT(p.datep,'%m') as mois, SUM(fd.total_ht) as Mnttot";
    $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s," . MAIN_DB_PREFIX . "facture as f, " . MAIN_DB_PREFIX . "facturedet as fd";
    $sql .= " , " . MAIN_DB_PREFIX . "paiement as p," . MAIN_DB_PREFIX . "paiement_facture as pf";
    $sql .= " WHERE f.fk_soc = s.rowid";
    $sql .= " AND f.rowid = fd.fk_facture";
    $sql .= " AND pf.fk_facture = f.rowid";
    $sql .= " AND pf.fk_paiement= p.rowid";
    $sql .= " AND fd.product_type=" . $product_type;
    $sql .= " AND s.entity = " . $conf->entity;
    $sql .= " AND p.datep >= '" . $db->idate(dol_get_first_day($yearofbegindate), 1) . "'";
    $sql .= " GROUP BY annee, mois ";
    $sql .= " ORDER BY annee, mois ";
    $result = $db->query($sql);
    if ($result) {
        $tmpyear = $beginyear;
        $trim1 = 0;
        $trim2 = 0;
        $trim3 = 0;
        $trim4 = 0;
        $lgn = 0;
        $num = $db->num_rows($result);
        if ($num > 0) {
            print '<br>';
            print '<table class="noborder" width="75%">';
            if ($product_type == 0) {
                print '<tr class="liste_titre"><td  align=left>' . $langs->trans("ProductSellByQuarterHT") . '</td>';
            } else {
                print '<tr class="liste_titre"><td  align=left>' . $langs->trans("ServiceSellByQuarterHT") . '</td>';
            }
            print '<td align=right>' . $langs->trans("Quarter1") . '</td>';
            print '<td align=right>' . $langs->trans("Quarter2") . '</td>';
            print '<td align=right>' . $langs->trans("Quarter3") . '</td>';
            print '<td align=right>' . $langs->trans("Quarter4") . '</td>';
            print '<td align=right>' . $langs->trans("Total") . '</td>';
            print '</tr>';
        }
        $i = 0;
        while ($i < $num) {
            $objp = $db->fetch_object($result);
            if ($tmpyear != $objp->annee) {
                if ($trim1 + $trim2 + $trim3 + $trim4 > 0) {
                    print '<tr ><td align=left>' . $tmpyear . '</td>';
                    print '<td align=right>' . price($trim1) . '</td>';
                    print '<td align=right>' . price($trim2) . '</td>';
                    print '<td align=right>' . price($trim3) . '</td>';
                    print '<td align=right>' . price($trim4) . '</td>';
                    print '<td align=right>' . price($trim1 + $trim2 + $trim3 + $trim4) . '</td>';
                    print '</tr>';
                    $lgn++;
                }
                // We go to the following year
                $tmpyear = $objp->annee;
                $trim1 = 0;
                $trim2 = 0;
                $trim3 = 0;
                $trim4 = 0;
            }
            if ($objp->mois == "01" || $objp->mois == "02" || $objp->mois == "03") {
                $trim1 += $objp->Mnttot;
            }
            if ($objp->mois == "04" || $objp->mois == "05" || $objp->mois == "06") {
                $trim2 += $objp->Mnttot;
            }
            if ($objp->mois == "07" || $objp->mois == "08" || $objp->mois == "09") {
                $trim3 += $objp->Mnttot;
            }
            if ($objp->mois == "10" || $objp->mois == "11" || $objp->mois == "12") {
                $trim4 += $objp->Mnttot;
            }
            $i++;
        }
        if ($trim1 + $trim2 + $trim3 + $trim4 > 0) {
            print '<tr ><td align=left>' . $tmpyear . '</td>';
            print '<td align=right>' . price($trim1) . '</td>';
            print '<td align=right>' . price($trim2) . '</td>';
            print '<td align=right>' . price($trim3) . '</td>';
            print '<td align=right>' . price($trim4) . '</td>';
            print '<td align=right>' . price($trim1 + $trim2 + $trim3 + $trim4) . '</td>';
            print '</tr>';
        }
        if ($num > 0) {
            print '</table>';
        }
    }
}
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:91,代码来源:index.php

示例10: vat_by_date

/**
 *  \brief      Gets VAT to collect for the given year (and given quarter or month)
 *              The function gets the VAT in split results, as the VAT declaration asks
 *              to report the amounts for different VAT rates as different lines.
 *              This function also accounts recurrent invoices
 *  \param      db          Database handler object
 *  \param      y           Year
 *  \param      q           Quarter
 *  \param      date_start  Start date
 *  \param      date_end    End date
 *  \param      modetax     0 or 1 (option vat on debit)
 *  \param      direction   'sell' (customer invoice) or 'buy' (supplier invoices)
 *  \param      m           Month
 *  \return     array       List of quarters with vat
 */
function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, $m=0)
{
    global $conf;

    $list=array();

    if ($direction == 'sell')
    {
        $invoicetable='facture';
        $invoicedettable='facturedet';
        $fk_facture='fk_facture';
        $fk_facture2='fk_facture';
        $fk_payment='fk_paiement';
        $total_tva='total_tva';
        $paymenttable='paiement';
        $paymentfacturetable='paiement_facture';
    }
    if ($direction == 'buy')
    {
        $invoicetable='facture_fourn';
        $invoicedettable='facture_fourn_det';
        $fk_facture='fk_facture_fourn';
        $fk_facture2='fk_facturefourn';
        $fk_payment='fk_paiementfourn';
        $total_tva='tva';
        $paymenttable='paiementfourn';
        $paymentfacturetable='paiementfourn_facturefourn';
    }

    // CAS DES BIENS

    // Define sql request
    $sql='';
    if ($modetax == 1)  // Option vat on delivery for goods (payment) and debit invoice for services
    {
        if ($conf->global->MAIN_MODULE_ACCOUNTING)
        {
            // \todo a ce jour on se sait pas la compter car le montant tva d'un payment
            // n'est pas stocke dans la table des payments.
            // Seul le module compta expert peut resoudre ce probleme.
            // (Il faut quand un payment a lieu, stocker en plus du montant du paiement le
            // detail part tva et part ht).
            $sql='TODO';
        }
        if ($conf->global->MAIN_MODULE_COMPTABILITE)
        {
            // Count on delivery date (use invoice date as delivery is unknown)
            $sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.tva_tx as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
            $sql.= " d.date_start as date_start, d.date_end as date_end,";
            $sql.= " f.facnumber as facnum, f.type, f.total_ttc as ftotal_ttc,";
            $sql.= " p.rowid as pid, p.ref as pref, p.fk_product_type as ptype,";
            $sql.= " 0 as payment_id, 0 as payment_amount";
            $sql.= " FROM ".MAIN_DB_PREFIX.$invoicetable." as f,";
            $sql.= " ".MAIN_DB_PREFIX.$invoicedettable." as d" ;
            $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid";
            $sql.= " WHERE f.entity = " . $conf->entity;
            $sql.= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely)
            $sql.= " AND (f.type = 0";      // Standard
            $sql.= " OR f.type = 1";        // Replacement
            $sql.= " OR f.type = 2)";       // Credit note
            //$sql.= " OR f.type = 3";      // We do not include deposit
            $sql.= " AND f.rowid = d.".$fk_facture;
            if ($y && $m)
            {
                $sql.= " AND f.datef >= '".$db->idate(dol_get_first_day($y,$m,false))."'";
                $sql.= " AND f.datef <= '".$db->idate(dol_get_last_day($y,$m,false))."'";
            }
            else if ($y)
            {
                $sql.= " AND f.datef >= '".$db->idate(dol_get_first_day($y,1,false))."'";
                $sql.= " AND f.datef <= '".$db->idate(dol_get_last_day($y,12,false))."'";
            }
            if ($q) $sql.= " AND (date_format(f.datef,'%m') > ".(($q-1)*3)." AND date_format(f.datef,'%m') <= ".($q*3).")";
            if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
            $sql.= " AND (d.product_type = 0";                              // Limit to products
            $sql.= " AND d.date_start is null AND d.date_end IS NULL)";     // enhance detection of service
            $sql.= " ORDER BY d.rowid, d.".$fk_facture;
        }
    }
    else    // Option vat on delivery for goods (payments) and payments for services
    {
        if ($conf->global->MAIN_MODULE_ACCOUNTING)
        {
            // \todo a ce jour on se sait pas la compter car le montant tva d'un payment
            // n'est pas stocke dans la table des payments.
//.........这里部分代码省略.........
开发者ID:remyyounes,项目名称:dolibarr,代码行数:101,代码来源:tax.lib.php

示例11: buildWhere

	/**
	 * Build the where part
	 * 
	 * @return string
	 */
	public function buildWhere() 
	{
		$sqlwhere_str = '';
		$sqlwhere = array();

		$sqlwhere[] = ' t.entity IN (' . getEntity('project') . ')';

		if (! empty($this->userid))
			$sqlwhere[] = ' t.fk_user_resp=' . $this->userid;
		if (! empty($this->socid))
			$sqlwhere[] = ' t.fk_soc=' . $this->socid;
		if (! empty($this->year) && empty($this->yearmonth))
			$sqlwhere[] = " date_format(t.datec,'%Y')='" . $this->year . "'";
		if (! empty($this->yearmonth))
			$sqlwhere[] = " t.datec BETWEEN '" . $this->db->idate(dol_get_first_day($this->yearmonth)) . "' AND '" . $this->db->idate(dol_get_last_day($this->yearmonth)) . "'";

		if (! empty($this->status))
			$sqlwhere[] = " t.fk_opp_status IN (" . $this->status . ")";

		if (count($sqlwhere) > 0) {
			$sqlwhere_str = ' WHERE ' . implode(' AND ', $sqlwhere);
		}

		return $sqlwhere_str;
	}
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:30,代码来源:projectstats.class.php

示例12: write_file

 /**
  *	Fonction generant la rapport sur le disque
  *
  *	@param	string	$_dir			repertoire
  *	@param	int		$month			mois du rapport
  *	@param	int		$year			annee du rapport
  *	@param	string	$outputlangs	Lang output object
  *	@return	int						<0 if KO, >0 if OK
  */
 function write_file($_dir, $month, $year, $outputlangs)
 {
     include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
     global $user, $langs, $conf;
     $socid = 0;
     if ($user->societe_id) {
         $socid = $user->societe_id;
     }
     if (!is_object($outputlangs)) {
         $outputlangs = $langs;
     }
     // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
     if (!empty($conf->global->MAIN_USE_FPDF)) {
         $outputlangs->charset_output = 'ISO-8859-1';
     }
     $this->month = $month;
     $this->year = $year;
     $dir = $_dir . '/' . $year;
     if (!is_dir($dir)) {
         $result = dol_mkdir($dir);
         if ($result < 0) {
             $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
             return -1;
         }
     }
     $month = sprintf("%02d", $month);
     $year = sprintf("%04d", $year);
     $file = $dir . "/payments-" . $year . "-" . $month . ".pdf";
     $pdf = pdf_getInstance($this->format);
     $default_font_size = pdf_getPDFFontSize($outputlangs);
     // Must be after pdf_getInstance
     if (class_exists('TCPDF')) {
         $pdf->setPrintHeader(false);
         $pdf->setPrintFooter(false);
     }
     $pdf->SetFont(pdf_getPDFFont($outputlangs));
     $num = 0;
     $lines = array();
     $sql = "SELECT p.datep as dp, f.facnumber";
     //$sql .= ", c.libelle as paiement_type, p.num_paiement";
     $sql .= ", c.code as paiement_code, p.num_paiement";
     $sql .= ", p.amount as paiement_amount, f.total_ttc as facture_amount ";
     $sql .= ", pf.amount as pf_amount ";
     $sql .= ", p.rowid as prowid";
     $sql .= " FROM " . MAIN_DB_PREFIX . "paiement as p, " . MAIN_DB_PREFIX . "facture as f,";
     $sql .= " " . MAIN_DB_PREFIX . "c_paiement as c, " . MAIN_DB_PREFIX . "paiement_facture as pf,";
     $sql .= " " . MAIN_DB_PREFIX . "societe as s";
     if (!$user->rights->societe->client->voir && !$socid) {
         $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
     }
     $sql .= " WHERE f.fk_soc = s.rowid AND pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid";
     $sql .= " AND f.entity = " . $conf->entity;
     $sql .= " AND p.fk_paiement = c.id ";
     $sql .= " AND p.datep BETWEEN '" . $this->db->idate(dol_get_first_day($year, $month)) . "' AND '" . $this->db->idate(dol_get_last_day($year, $month)) . "'";
     if (!$user->rights->societe->client->voir && !$socid) {
         $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
     }
     if (!empty($socid)) {
         $sql .= " AND s.rowid = " . $socid;
     }
     $sql .= " ORDER BY p.datep ASC, pf.fk_paiement ASC";
     dol_syslog(get_class($this) . "::write_file sql=" . $sql);
     $result = $this->db->query($sql);
     if ($result) {
         $num = $this->db->num_rows($result);
         $i = 0;
         $var = True;
         while ($i < $num) {
             $objp = $this->db->fetch_object($result);
             $var = !$var;
             $lines[$i][0] = $objp->facnumber;
             $lines[$i][1] = dol_print_date($this->db->jdate($objp->dp), "day", false, $outputlangs, true);
             $lines[$i][2] = $langs->transnoentities("PaymentTypeShort" . $objp->paiement_code);
             $lines[$i][3] = $objp->num_paiement;
             $lines[$i][4] = price($objp->paiement_amount);
             $lines[$i][5] = price($objp->facture_amount);
             $lines[$i][6] = price($objp->pf_amount);
             $lines[$i][7] = $objp->prowid;
             $i++;
         }
     } else {
         dol_print_error($this->db);
     }
     $pages = intval($num / $this->line_per_page);
     if ($lines % $this->line_per_page > 0) {
         $pages++;
     }
     if ($pages == 0) {
         // force to build at least one page if report has no line
         $pages = 1;
     }
//.........这里部分代码省略.........
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:101,代码来源:pdf_paiement.class.php

示例13: dol_print_date

print '<br>';
/* Affichage de la liste des projets du mois */
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>' . $langs->trans("ActivityOnProjectThisMonth") . ': ' . dol_print_date($now, "%B %Y") . '</td>';
print '<td align="right">' . $langs->trans("Time") . '</td>';
print "</tr>\n";
$sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb";
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as p";
$sql .= ", " . MAIN_DB_PREFIX . "projet_task as t";
$sql .= ", " . MAIN_DB_PREFIX . "projet_task_time as tt";
$sql .= " WHERE t.fk_projet = p.rowid";
$sql .= " AND p.entity = " . $conf->entity;
$sql .= " AND tt.fk_task = t.rowid";
$sql .= " AND tt.fk_user = " . $user->id;
$sql .= " AND task_date BETWEEN '" . $db->idate(dol_get_first_day($year, $month)) . "' AND '" . $db->idate(dol_get_last_day($year, $month)) . "'";
$sql .= " AND p.rowid in (" . $projectsListId . ")";
$sql .= " GROUP BY p.rowid, p.ref, p.title, p.public";
$resql = $db->query($sql);
if ($resql) {
    $total = 0;
    $var = false;
    while ($row = $db->fetch_object($resql)) {
        print "<tr " . $bc[$var] . ">";
        print '<td>';
        $projectstatic->id = $row->rowid;
        $projectstatic->ref = $row->ref;
        $projectstatic->title = $row->title;
        $projectstatic->public = $row->public;
        print $projectstatic->getNomUrl(1, '', 1);
        print '</td>';
开发者ID:Albertopf,项目名称:prueba,代码行数:31,代码来源:index.php

示例14: build_exportfile

 /**
  *		Export events from database into a cal file.
  *		@param		format			'vcal', 'ical/ics', 'rss'
  *		@param		type			'event' or 'journal'
  *		@param		cachedelay		Do not rebuild file if date older than cachedelay seconds
  *		@param		filename		Force filename
  *		@param		filters			Array of filters
  *		@return     int     		<0 if error, nb of events in new file if ok
  */
 function build_exportfile($format, $type, $cachedelay, $filename, $filters)
 {
     global $conf, $langs, $dolibarr_main_url_root, $mysoc;
     require_once DOL_DOCUMENT_ROOT . "/lib/xcal.lib.php";
     require_once DOL_DOCUMENT_ROOT . "/lib/date.lib.php";
     dol_syslog("ActionComm::build_exportfile Build export file format=" . $format . ", type=" . $type . ", cachedelay=" . $cachedelay . ", filename=" . $filename . ", filters size=" . sizeof($filters), LOG_DEBUG);
     // Check parameters
     if (empty($format)) {
         return -1;
     }
     // Clean parameters
     if (!$filename) {
         $extension = 'vcs';
         if ($format == 'ical') {
             $extension = 'ics';
         }
         $filename = $format . '.' . $extension;
     }
     // Create dir and define output file (definitive and temporary)
     $result = create_exdir($conf->agenda->dir_temp);
     $outputfile = $conf->agenda->dir_temp . '/' . $filename;
     $result = 0;
     $buildfile = true;
     $login = '';
     $logina = '';
     $logind = '';
     $logint = '';
     $now = dol_now();
     if ($cachedelay) {
         $nowgmt = dol_now();
         include_once DOL_DOCUMENT_ROOT . '/lib/files.lib.php';
         if (dol_filemtime($outputfile) > $nowgmt - $cachedelay) {
             dol_syslog("ActionComm::build_exportfile file " . $outputfile . " is not older than now - cachedelay (" . $nowgmt . " - " . $cachedelay . "). Build is canceled");
             $buildfile = false;
         }
     }
     if ($buildfile) {
         // Build event array
         $eventarray = array();
         $sql = "SELECT a.id,";
         $sql .= " a.datep,";
         // Start
         $sql .= " a.datep2,";
         // End
         $sql .= " a.durationp,";
         $sql .= " a.datec, a.tms as datem,";
         $sql .= " a.note, a.label, a.fk_action as type_id,";
         $sql .= " a.fk_soc,";
         $sql .= " a.fk_user_author, a.fk_user_mod,";
         $sql .= " a.fk_user_action, a.fk_user_done,";
         $sql .= " a.fk_contact, a.percent as percentage,";
         $sql .= " a.fk_element, a.elementtype,";
         $sql .= " a.priority, a.fulldayevent, a.location,";
         $sql .= " u.firstname, u.name,";
         $sql .= " s.nom as socname,";
         $sql .= " c.id as type_id, c.code as type_code, c.libelle";
         $sql .= " FROM (" . MAIN_DB_PREFIX . "c_actioncomm as c, " . MAIN_DB_PREFIX . "actioncomm as a)";
         $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u on u.rowid = a.fk_user_author";
         $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s on s.rowid = a.fk_soc AND s.entity IN (0, " . $conf->entity . ")";
         $sql .= " WHERE a.fk_action=c.id";
         $sql .= " AND a.entity = " . $conf->entity;
         foreach ($filters as $key => $value) {
             if ($key == 'notolderthan') {
                 $sql .= " AND a.datep >= '" . $this->db->idate($now - $value * 24 * 60 * 60) . "'";
             }
             if ($key == 'year') {
                 $sql .= " AND a.datep BETWEEN '" . $this->db->idate(dol_get_first_day($value, 1)) . "' AND '" . $this->db->idate(dol_get_last_day($value, 12)) . "'";
             }
             if ($key == 'id') {
                 $sql .= " AND a.id=" . (is_numeric($value) ? $value : 0);
             }
             if ($key == 'idfrom') {
                 $sql .= " AND a.id >= " . (is_numeric($value) ? $value : 0);
             }
             if ($key == 'idto') {
                 $sql .= " AND a.id <= " . (is_numeric($value) ? $value : 0);
             }
             if ($key == 'login') {
                 $login = $value;
                 $userforfilter = new User($this->db);
                 $result = $userforfilter->fetch('', $value);
                 $sql .= " AND (";
                 $sql .= " a.fk_user_author = " . $userforfilter->id;
                 $sql .= " OR a.fk_user_action = " . $userforfilter->id;
                 $sql .= " OR a.fk_user_done = " . $userforfilter->id;
                 $sql .= ")";
             }
             if ($key == 'logina') {
                 $logina = $value;
                 $userforfilter = new User($this->db);
                 $result = $userforfilter->fetch('', $value);
//.........这里部分代码省略.........
开发者ID:netors,项目名称:dolibarr,代码行数:101,代码来源:actioncomm.class.php

示例15: print_projecttasks_array

/**
 * Return HTML table with list of projects and number of opened tasks
 *
 * @param	DoliDB	$db					Database handler
 * @param	Form	$form				Object form
 * @param   int		$socid				Id thirdparty
 * @param   int		$projectsListId     Id of project I have permission on
 * @param   int		$mytasks            Limited to task I am contact to
 * @param	int		$statut				-1=No filter on statut, 0 or 1 = Filter on status
 * @param	array	$listofoppstatus	List of opportunity status
 * @param   array   $hiddenfields       List of info to not show ('projectlabel', 'declaredprogress', '...', )
 * @return	void
 */
function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $statut = -1, $listofoppstatus = array(), $hiddenfields = array())
{
    global $langs, $conf, $user, $bc;
    require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
    $projectstatic = new Project($db);
    $thirdpartystatic = new Societe($db);
    $sortfield = '';
    $sortorder = '';
    $project_year_filter = 0;
    $title = $langs->trans("Projects");
    if (strcmp($statut, '') && $statut >= 0) {
        $title = $langs->trans("Projects") . ' ' . $langs->trans($projectstatic->statuts_long[$statut]);
    }
    $arrayidtypeofcontact = array();
    print '<table class="noborder" width="100%">';
    $sql .= " FROM " . MAIN_DB_PREFIX . "projet as p";
    if ($mytasks) {
        $sql .= ", " . MAIN_DB_PREFIX . "projet_task as t";
        $sql .= ", " . MAIN_DB_PREFIX . "element_contact as ec";
        $sql .= ", " . MAIN_DB_PREFIX . "c_type_contact as ctc";
    } else {
        $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "projet_task as t ON p.rowid = t.fk_projet";
    }
    $sql .= " WHERE p.entity = " . $conf->entity;
    $sql .= " AND p.rowid IN (" . $projectsListId . ")";
    if ($socid) {
        $sql .= "  AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = " . $socid . ")";
    }
    if ($mytasks) {
        $sql .= " AND p.rowid = t.fk_projet";
        $sql .= " AND ec.element_id = t.rowid";
        $sql .= " AND ec.fk_socpeople = " . $user->id;
        $sql .= " AND ec.fk_c_type_contact = ctc.rowid";
        // Replace the 2 lines with ec.fk_c_type_contact in $arrayidtypeofcontact
        $sql .= " AND ctc.element = 'project_task'";
    }
    if ($statut >= 0) {
        $sql .= " AND p.fk_statut = " . $statut;
    }
    if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) {
        $project_year_filter = GETPOST("project_year_filter");
        //Check if empty or invalid year. Wildcard ignores the sql check
        if ($project_year_filter != "*") {
            if (empty($project_year_filter) || !ctype_digit($project_year_filter)) {
                $project_year_filter = date("Y");
            }
            $sql .= " AND (p.dateo IS NULL OR p.dateo <= " . $db->idate(dol_get_last_day($project_year_filter, 12, false)) . ")";
            $sql .= " AND (p.datee IS NULL OR p.datee >= " . $db->idate(dol_get_first_day($project_year_filter, 1, false)) . ")";
        }
    }
    // Get id of project we must show tasks
    $arrayidofprojects = array();
    $sql1 = "SELECT p.rowid as projectid";
    $sql1 .= $sql;
    $resql = $db->query($sql1);
    if ($resql) {
        $i = 0;
        $num = $db->num_rows($resql);
        while ($i < $num) {
            $objp = $db->fetch_object($resql);
            $arrayidofprojects[$objp->projectid] = $objp->projectid;
            $i++;
        }
    } else {
        dol_print_error($db);
    }
    if (empty($arrayidofprojects)) {
        $arrayidofprojects[0] = -1;
    }
    // Get list of project with calculation on tasks
    $sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc, s.nom as socname, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_amount,";
    $sql2 .= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload";
    $sql2 .= " FROM " . MAIN_DB_PREFIX . "projet as p";
    $sql2 .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = p.fk_soc";
    $sql2 .= " LEFT JOIN " . MAIN_DB_PREFIX . "projet_task as t ON p.rowid = t.fk_projet";
    $sql2 .= " WHERE p.rowid IN (" . join(',', $arrayidofprojects) . ")";
    $sql2 .= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_amount";
    $sql2 .= " ORDER BY p.title, p.ref";
    $var = true;
    $resql = $db->query($sql2);
    if ($resql) {
        $total_task = 0;
        $total_opp_amount = 0;
        $ponderated_opp_amount = 0;
        $num = $db->num_rows($resql);
        $i = 0;
        print '<tr class="liste_titre">';
//.........这里部分代码省略.........
开发者ID:Albertopf,项目名称:prueba,代码行数:101,代码来源:project.lib.php


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