Esempio n. 1
0
require_once DOL_DOCUMENT_ROOT . '/core/lib/trip.lib.php';
require_once DOL_DOCUMENT_ROOT . '/compta/deplacement/class/deplacement.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
if (!empty($conf->projet->enabled)) {
    require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
}
$langs->load("trips");
// Security check
$id = GETPOST('id', 'int');
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'deplacement', $id, '');
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$object = new Deplacement($db);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('tripsandexpensescard', 'globalcard'));
$permissionnote = $user->rights->deplacement->creer;
// Used by the include of actions_setnotes.inc.php
/*
 * Actions
 */
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php';
// Must be include, not includ_once
if ($action == 'validate' && $user->rights->deplacement->creer) {
    $object->fetch($id);
    if ($object->statut == 0) {
        $result = $object->setStatut(1);
        if ($result > 0) {
            header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
Esempio n. 2
0
		$num = $db->num_rows($result);

		$i = 0;

		print '<table class="noborder" width="100%">';
		print '<tr class="liste_titre">';
		print '<td colspan="2">'.$langs->trans("BoxTitleLastModifiedExpenses",$max).'</td>';
        print '<td align="right">'.$langs->trans("FeesKilometersOrAmout").'</td>';
		print '<td align="right">'.$langs->trans("DateModificationShort").'</td>';
        print '<td width="16">&nbsp;</td>';
		print '</tr>';
		if ($num)
		{
			$total_ttc = $totalam = $total = 0;

			$deplacementstatic=new Deplacement($db);
			$userstatic=new User($db);
			while ($i < $num && $i < $max)
			{
				$objp = $db->fetch_object($result);
				$deplacementstatic->ref=$objp->rowid;
				$deplacementstatic->id=$objp->rowid;
				$userstatic->id=$objp->uid;
				$userstatic->nom=$objp->name;
				$userstatic->prenom=$objp->firstname;
				print '<tr '.$bc[$var].'>';
                print '<td>'.$deplacementstatic->getNomUrl(1).'</td>';
				print '<td>'.$userstatic->getNomUrl(1).'</td>';
                print '<td align="right">'.$objp->km.'</td>';
				print '<td align="right">'.dol_print_date($db->jdate($objp->dm),'day').'</td>';
                print '<td>'.$deplacementstatic->LibStatut($objp->fk_statut,3).'</td>';
Esempio n. 3
0
		else
		{
			$mesg=$deplacement->error;
		}
	}
	else
	{
		Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$_POST["id"]);
		exit;
	}
}

// Set into a project
if ($_POST['action'] == 'classin')
{
	$trip = new Deplacement($db);
	$trip->fetch($_GET['id']);
	$result=$trip->setProject($_POST['projectid']);
	if ($result < 0) dol_print_error($db,$trip->error);
}



/*
 * View
 */

llxHeader();

$html = new Form($db);
Esempio n. 4
0
if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="d.dated";
$limit = $conf->liste_limit;

$search_ref=GETPOST('search_ref');


/*
 * View
 */

$tripandexpense_static=new Deplacement($db);

llxHeader();

$sql = "SELECT s.nom, s.rowid as socid,";				// Ou
$sql.= " d.rowid, d.type, d.dated as dd, d.km,";		// Comment
$sql.= " u.name, u.firstname";							// Qui
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql.= ", ".MAIN_DB_PREFIX."deplacement as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON d.fk_soc = s.rowid";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql.= " WHERE d.fk_user = u.rowid";
$sql.= " AND d.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND sc.fk_user = "******" AND s.rowid = ".$socid;
if (trim($search_ref) != '')
 * 	\ingroup    trip
 * 	\brief      Page to show a trip information
 */
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/trip.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT . '/compta/deplacement/class/deplacement.class.php';
$langs->load("trips");
// Security check
$id = GETPOST('id', 'int');
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'deplacement', $id, '');
/*
 * View
 */
llxHeader();
if ($id) {
    $object = new Deplacement($db);
    $object->fetch($id);
    $object->info($id);
    $head = trip_prepare_head($object);
    dol_fiche_head($head, 'info', $langs->trans("TripCard"), 0, 'trip');
    print '<table width="100%"><tr><td>';
    dol_print_object_info($object);
    print '</td></tr></table>';
    print '</div>';
}
$db->close();
llxFooter();
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page', 'int');
if ($page == -1) {
    $page = 0;
}
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortorder) {
    $sortorder = "ASC";
}
if (!$sortfield) {
    $sortfield = "name";
}
$object = new Deplacement($db);
$object->fetch($id, $ref);
$upload_dir = $conf->deplacement->dir_output . '/' . dol_sanitizeFileName($object->ref);
$modulepart = 'trip';
/*
 * Actions
 */
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
/*
 * View
 */
$form = new Form($db);
llxHeader("", "", $langs->trans("TripCard"));
if ($object->id) {
    $object->fetch_thirdparty();
    $head = trip_prepare_head($object, $user);
Esempio n. 7
0


/******************************************************************************/
/* Affichage fiche                                                            */
/******************************************************************************/

llxHeader();

$html = new Form($db);

$id = $_GET['id'];
$ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
{
	$trip = new Deplacement($db);
	$trip->fetch($id,$ref);

	$soc = new Societe($db, $trip->socid);
    $soc->fetch($trip->socid);

	$h=0;

	$head[$h][0] = DOL_URL_ROOT."/compta/deplacement/fiche.php?id=$trip->id";
	$head[$h][1] = $langs->trans("Card");
	$head[$h][2] = 'card';
	$h++;

	$head[$h][0] = DOL_URL_ROOT."/compta/deplacement/note.php?id=$trip->id";
	$head[$h][1] = $langs->trans("Note");
	$head[$h][2] = 'note';
Esempio n. 8
0
require_once DOL_DOCUMENT_ROOT . "/core/class/html.formfile.class.php";
if ($conf->projet->enabled) {
    require_once DOL_DOCUMENT_ROOT . "/core/lib/project.lib.php";
    require_once DOL_DOCUMENT_ROOT . "/projet/class/project.class.php";
}
$langs->load("trips");
// Security check
$id = GETPOST('id', 'int');
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'deplacement', $id, '');
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$mesg = '';
$object = new Deplacement($db);
/*
 * Actions
*/
if ($action == 'validate' && $user->rights->deplacement->creer) {
    $object->fetch($id);
    if ($object->statut == 0) {
        $result = $object->setStatut(1);
        if ($result > 0) {
            Header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
            exit;
        } else {
            $mesg = $object->error;
        }
    }
} else {