* Copyright (C) 2004 Eric Seigne * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/commande/apercu.php * \ingroup commande * \brief Page de l'onglet apercu d'une commande */ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/order.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'); if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'); if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php"); $langs->load('orders'); $langs->load('propal'); $langs->load("bills"); $langs->load('compta'); $langs->load('sendings'); // Security check $socid=0; $id = GETPOST("id"); $ref = GETPOST("ref"); if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'commande',$id,''); /* * View */ llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'); $html = new Form($db); /* *************************************************************************** */ /* */ /* Mode fiche */ /* */ /* *************************************************************************** */ if ($id > 0 || ! empty($ref)) { $object = new Commande($db); if ($object->fetch($id,$ref) > 0) { $soc = new Societe($db, $object->socid); $soc->fetch($object->socid); $head = commande_prepare_head($object); dol_fiche_head($head, 'preview', $langs->trans("CustomerOrder"), 0, 'order'); print ''; // Ref print '"; print ''; print '"; // Ref cde client print ''; print ''; $nbrow=6; print '"; // Client print ""; print ''; print ''; // Statut print ''; print "\n"; print ''; // Date print ''; print "\n"; print ''; // ligne 6 // partie Gauche print ''; print ''; print ''; // ligne 7 // partie Gauche print ''; print ''; print ''; print '
'.$langs->trans("Ref")."'.$object->ref.''.$langs->trans("Source").' : '.$object->getLabelSource(); if ($object->source == 0) { // Propale $propal = new Propal($db); $propal->fetch($object->propale_id); print ' -> '.$propal->ref.''; } print "
'; print ''; print '
'; print $langs->trans('RefCustomer').''; print '
'; print '
'; print $object->ref_client; print ''; /* * Documents */ $objectref = dol_sanitizeFileName($object->ref); $dir_output = $conf->commande->dir_output . "/"; $filepath = $dir_output . $objectref . "/"; $file = $filepath . $objectref . ".pdf"; $filedetail = $filepath . $objectref . "-detail.pdf"; $relativepath = $objectref.'/'.$objectref.'.pdf'; $relativepathdetail = $objectref.'/'.$objectref.'-detail.pdf'; // Chemin vers png apercus $fileimage = $file.".png"; // Si PDF d'1 page $fileimagebis = $file."-0.png"; // Si PDF de plus d'1 page $relativepathimage = $relativepath.'.png'; $var=true; // Si fichier PDF existe if (file_exists($file)) { $encfile = urlencode($file); print_titre($langs->trans("Documents")); print ''; print ""; print ''; print ''; print ''; print ''; // Si fichier detail PDF existe // TODO obsolete ? if (file_exists($filedetail)) { print ""; print ''; print ''; print ''; print ''; } print "
".$langs->trans("Order")." PDF'.$object->ref.'.pdf'.dol_print_size(dol_filesize($file)).''.dol_print_date(dol_filemtime($file),'dayhour').'
Commande detaillee'.$object->ref.'-detail.pdf'.dol_print_size(dol_filesize($filedetail)).''.dol_print_date(dol_filemtime($filedetail),'dayhour').'
\n"; // Conversion du PDF en image png si fichier png non existant if (! file_exists($fileimage) && ! file_exists($fileimagebis)) { if (class_exists("Imagick")) { $ret = dol_convert_file($file); if ($ret < 0) $error++; } else { $langs->load("other"); print ''.$langs->trans("ErrorNoImagickReadimage").''; } } } print "
".$langs->trans("Customer")."'; print ''.$soc->nom.''; print '
'.$langs->trans("Status").'".$object->getLibStatut(4)."
'.$langs->trans("Date").'".dol_print_date($object->date,"daytext")."
'.$langs->trans('GlobalDiscount').''.$object->remise_percent.'%
'.$langs->trans('AmountHT').''.price($object->total_ht).''.$langs->trans("Currency".$conf->monnaie).'
'; } else { // Object not found print $langs->trans("ErrorOrderNotFound",$id); } } // Si fichier png PDF d'1 page trouve if (file_exists($fileimage)) { print ''; } // Si fichier png PDF de plus d'1 page trouve elseif (file_exists($fileimagebis)) { $multiple = preg_replace('/\.png/','',$relativepath) . "-"; for ($i = 0; $i < 20; $i++) { $preview = $multiple.$i.'.png'; if (file_exists($dir_output.$preview)) { print '

'; } } } print ''; $db->close(); llxFooter(); ?>