psr 0
This commit is contained in:
parent
e068655e6e
commit
2f6c979c32
@ -40,9 +40,9 @@ $result=restrictedArea($user,'produit|service');
|
|||||||
function ordered($product_id) {
|
function ordered($product_id) {
|
||||||
global $db;
|
global $db;
|
||||||
$sql = 'SELECT DISTINCT cfd.fk_product, SUM(cfd.qty) from ';
|
$sql = 'SELECT DISTINCT cfd.fk_product, SUM(cfd.qty) from ';
|
||||||
$sql .= MAIN_DB_PREFIX.'commande_fournisseurdet as cfd LEFT JOIN ';
|
$sql .= MAIN_DB_PREFIX . 'commande_fournisseurdet as cfd ';
|
||||||
$sql .= MAIN_DB_PREFIX.'commande_fournisseur as cf ON ';
|
$sql .= 'LEFT JOIN ' . MAIN_DB_PREFIX . 'commande_fournisseur as cf';
|
||||||
$sql .= 'cfd.fk_commande = cf.rowid WHERE cf.source = 42 ';
|
$sql .= ' ON cfd.fk_commande = cf.rowid WHERE cf.source = 42 ';
|
||||||
$sql .= 'AND cf.fk_statut < 5 AND cfd.fk_product = ' . $product_id;
|
$sql .= 'AND cf.fk_statut < 5 AND cfd.fk_product = ' . $product_id;
|
||||||
$sql .= ' GROUP BY cfd.fk_product';
|
$sql .= ' GROUP BY cfd.fk_product';
|
||||||
|
|
||||||
@ -60,51 +60,49 @@ function ordered($product_id) {
|
|||||||
else {
|
else {
|
||||||
$error=$db->lasterror();
|
$error=$db->lasterror();
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
dol_syslog("replenish.php: ".$error, LOG_ERROR);
|
dol_syslog('replenish.php: ' . $error, LOG_ERROR);
|
||||||
return $langs->trans('error');
|
return $langs->trans('error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$sref=GETPOST("sref");
|
$sref = GETPOST('sref');
|
||||||
$snom=GETPOST("snom");
|
$snom = GETPOST('snom');
|
||||||
$sall=GETPOST("sall");
|
$sall = GETPOST('sall');
|
||||||
$type=GETPOST("type","int");
|
$type = GETPOST('type','int');
|
||||||
$sbarcode=GETPOST("sbarcode");
|
$sbarcode = GETPOST('sbarcode');
|
||||||
$catid = GETPOST('catid','int');
|
$catid = GETPOST('catid','int');
|
||||||
$tobuy = GETPOST("tobuy");
|
$tobuy = GETPOST('tobuy');
|
||||||
|
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST('sortfield','alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST('sortorder','alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST('page','int');
|
||||||
if (! $sortfield) $sortfield="stock_physique";
|
if (! $sortfield) $sortfield = 'stock_physique';
|
||||||
if (! $sortorder) $sortorder="ASC";
|
if (! $sortorder) $sortorder = 'ASC';
|
||||||
$limit = $conf->liste_limit;
|
$limit = $conf->liste_limit;
|
||||||
$offset = $limit * $page ;
|
$offset = $limit * $page ;
|
||||||
|
|
||||||
// Load sale and categ filters
|
// Load sale and categ filters
|
||||||
$search_sale = GETPOST("search_sale");
|
$search_sale = GETPOST('search_sale');
|
||||||
$search_categ = GETPOST("search_categ");
|
$search_categ = GETPOST('search_categ');
|
||||||
|
|
||||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
// Get object canvas
|
||||||
//$object->getCanvas($id);
|
//(By default, this is not defined, so standard usage of dolibarr)
|
||||||
$canvas=GETPOST("canvas");
|
$canvas = GETPOST('canvas');
|
||||||
$objcanvas = '';
|
$objcanvas = '';
|
||||||
if (! empty($canvas))
|
if (! empty($canvas)) {
|
||||||
{
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/canvas.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/canvas.class.php';
|
||||||
$objcanvas = new Canvas($db,$action);
|
$objcanvas = new Canvas($db,$action);
|
||||||
$objcanvas->getCanvas('product', 'list', $canvas);
|
$objcanvas->getCanvas('product', 'list', $canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($_POST["button_removefilter_x"]))
|
if (! empty($_POST['button_removefilter_x'])) {
|
||||||
{
|
$sref = '';
|
||||||
$sref="";
|
$snom = '';
|
||||||
$snom="";
|
$sall = '';
|
||||||
$sall="";
|
$search_sale = '';
|
||||||
$search_sale="";
|
$search_categ = '';
|
||||||
$search_categ="";
|
$type = '';
|
||||||
$type="";
|
|
||||||
$catid = '';
|
$catid = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,15 +118,16 @@ if($action == 'order'){
|
|||||||
if($linecount > 0) {
|
if($linecount > 0) {
|
||||||
$suppliers = array();
|
$suppliers = array();
|
||||||
for($i = 0; $i < $linecount; $i++) {
|
for($i = 0; $i < $linecount; $i++) {
|
||||||
if(GETPOST($i, 'alpha') === 'on' && GETPOST('fourn'.$i, 'int') > 0) { //one line
|
if(GETPOST($i, 'alpha') === 'on'
|
||||||
|
&& GETPOST('fourn' . $i, 'int') > 0) { //one line
|
||||||
$supplierpriceid = GETPOST('fourn'.$i, 'int');
|
$supplierpriceid = GETPOST('fourn'.$i, 'int');
|
||||||
//get all the parameters needed to create a line
|
//get all the parameters needed to create a line
|
||||||
$qty = GETPOST('tobuy'.$i, 'int');
|
$qty = GETPOST('tobuy'.$i, 'int');
|
||||||
$desc = GETPOST('desc'.$i, 'alpha');
|
$desc = GETPOST('desc'.$i, 'alpha');
|
||||||
$sql = 'Select fk_product, fk_soc, ref_fourn';
|
$sql = 'SELECT fk_product, fk_soc, ref_fourn';
|
||||||
$sql .= ', tva_tx, unitprice';
|
$sql .= ', tva_tx, unitprice FROM ';
|
||||||
$sql .= ' from '.MAIN_DB_PREFIX.'product_fournisseur_price';
|
$sql .= MAIN_DB_PREFIX . 'product_fournisseur_price';
|
||||||
$sql .= ' where rowid = '.$supplierpriceid;
|
$sql .= ' WHERE rowid = ' . $supplierpriceid;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if($resql && $db->num_rows($resql) > 0) {
|
if($resql && $db->num_rows($resql) > 0) {
|
||||||
//might need some value checks
|
//might need some value checks
|
||||||
@ -140,7 +139,8 @@ if($action == 'order'){
|
|||||||
$line->tva_tx = $obj->tva_tx;
|
$line->tva_tx = $obj->tva_tx;
|
||||||
$line->subprice = $obj->unitprice;
|
$line->subprice = $obj->unitprice;
|
||||||
$line->total_ht = $obj->unitprice * $qty;
|
$line->total_ht = $obj->unitprice * $qty;
|
||||||
$line->total_tva = $line->total_ht * $line->tva_tx / 100;
|
$tva = $line->tva_tx / 100;
|
||||||
|
$line->total_tva = $line->total_ht * $tva;
|
||||||
$line->total_ttc = $line->total_ht + $line->total_tva;
|
$line->total_ttc = $line->total_ht + $line->total_tva;
|
||||||
$line->ref_fourn = $obj->ref_fourn;
|
$line->ref_fourn = $obj->ref_fourn;
|
||||||
$suppliers[$obj->fk_soc]['lines'][] = $line;
|
$suppliers[$obj->fk_soc]['lines'][] = $line;
|
||||||
@ -148,7 +148,7 @@ if($action == 'order'){
|
|||||||
else {
|
else {
|
||||||
$error=$db->lasterror();
|
$error=$db->lasterror();
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
dol_syslog("replenish.php: ".$error, LOG_ERROR);
|
dol_syslog('replenish.php: '.$error, LOG_ERROR);
|
||||||
}
|
}
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ if($action == 'order'){
|
|||||||
foreach($suppliers as $supplier) {
|
foreach($suppliers as $supplier) {
|
||||||
$order = new CommandeFournisseur($db);
|
$order = new CommandeFournisseur($db);
|
||||||
$order->socid = $suppliersid[$i];
|
$order->socid = $suppliersid[$i];
|
||||||
//little trick to know which orders have been generated this way
|
//trick to know which orders have been generated this way
|
||||||
$order->source = 42;
|
$order->source = 42;
|
||||||
foreach($supplier['lines'] as $line) {
|
foreach($supplier['lines'] as $line) {
|
||||||
$order->lines[] = $line;
|
$order->lines[] = $line;
|
||||||
@ -180,103 +180,119 @@ if($action == 'order'){
|
|||||||
|
|
||||||
$htmlother=new FormOther($db);
|
$htmlother=new FormOther($db);
|
||||||
|
|
||||||
$title=$langs->trans("Replenishment");
|
$title=$langs->trans('Replenishment');
|
||||||
|
|
||||||
$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,';
|
$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price';
|
||||||
$sql.= ' p.fk_product_type, p.tms as datem,';
|
$sql .= ', p.price_ttc, p.price_base_type,p.fk_product_type';
|
||||||
$sql.= ' p.duration, p.tobuy, p.seuil_stock_alerte,';
|
$sql .= ', p.tms as datem, p.duration, p.tobuy, p.seuil_stock_alerte,';
|
||||||
$sql .= ' SUM(s.reel) as stock_physique';
|
$sql .= ' SUM(s.reel) as stock_physique';
|
||||||
$sql .= ', p.desiredstock';
|
$sql .= ', p.desiredstock';
|
||||||
$sql .= ' FROM (' . MAIN_DB_PREFIX . 'product as p';
|
$sql .= ' FROM (' . MAIN_DB_PREFIX . 'product as p';
|
||||||
// We'll need this table joined to the select in order to filter by categ
|
// need this table joined to the select in order to filter by categ
|
||||||
if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_product as cp";
|
if ($search_categ) {
|
||||||
$sql .= ') LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf on p.rowid = pf.fk_product';
|
$sql.= ", " . MAIN_DB_PREFIX . "categorie_product as cp";
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s on p.rowid = s.fk_product';
|
}
|
||||||
|
$sql .= ') LEFT JOIN ' . MAIN_DB_PREFIX . 'product_fournisseur_price as pf';
|
||||||
|
$sql .= ' ON p.rowid = pf.fk_product';
|
||||||
|
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s';
|
||||||
|
$sql .= ' ON p.rowid = s.fk_product';
|
||||||
|
|
||||||
$sql.= " WHERE p.entity IN (".getEntity('product', 1).")";
|
$sql.= ' WHERE p.entity IN (' . getEntity("product", 1) . ')';
|
||||||
if ($search_categ) $sql.= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ
|
if ($search_categ) { // Join for the needed table to filter by categ
|
||||||
if ($sall)
|
$sql .= ' AND p.rowid = cp.fk_product';
|
||||||
{
|
}
|
||||||
$sql.= " AND (p.ref LIKE '%".$db->escape($sall)."%' OR p.label LIKE '%".$db->escape($sall)."%' OR p.description LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%')";
|
if ($sall) {
|
||||||
|
$sql .= ' AND (p.ref LIKE "%'.$db->escape($sall).'%" ';
|
||||||
|
$sql .= 'OR p.label LIKE "%'.$db->escape($sall).'%" ';
|
||||||
|
$sql .= 'OR p.description LIKE "%'.$db->escape($sall).'%" ';
|
||||||
|
$sql .= 'OR p.note LIKE "%'.$db->escape($sall).'%")';
|
||||||
}
|
}
|
||||||
// if the type is not 1, we show all products (type = 0,2,3)
|
// if the type is not 1, we show all products (type = 0,2,3)
|
||||||
if (dol_strlen($type))
|
if (dol_strlen($type)) {
|
||||||
{
|
if ($type == 1) {
|
||||||
if ($type==1)
|
$sql .= ' AND p.fk_product_type = 1';
|
||||||
{
|
|
||||||
$sql.= " AND p.fk_product_type = '1'";
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
$sql .= ' AND p.fk_product_type != 1';
|
||||||
$sql.= " AND p.fk_product_type <> '1'";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($sref) $sql.= " AND p.ref LIKE '%".$sref."%'";
|
if ($sref) {
|
||||||
if ($sbarcode) $sql.= " AND p.barcode LIKE '%".$sbarcode."%'";
|
$sql .= ' AND p.ref LIKE "%' . $sref . '%"';
|
||||||
if ($snom) $sql.= " AND p.label LIKE '%".$db->escape($snom)."%'";
|
|
||||||
|
|
||||||
$sql.= " AND p.tobuy = 1";
|
|
||||||
|
|
||||||
if (! empty($canvas))
|
|
||||||
{
|
|
||||||
$sql.= " AND p.canvas = '".$db->escape($canvas)."'";
|
|
||||||
}
|
}
|
||||||
if($catid)
|
if ($sbarcode) {
|
||||||
{
|
$sql .= ' AND p.barcode LIKE "%' . $sbarcode . '%"';
|
||||||
$sql.= " AND cp.fk_categorie = ".$catid;
|
}
|
||||||
|
if ($snom) {
|
||||||
|
$sql .= ' AND p.label LIKE "%' . $db->escape($snom) . '%"';
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql.= " AND p.rowid = pf.fk_product";
|
$sql .= ' AND p.tobuy = 1';
|
||||||
|
|
||||||
|
if (!empty($canvas)) {
|
||||||
|
$sql .= ' AND p.canvas = "' . $db->escape($canvas) . '"';
|
||||||
|
}
|
||||||
|
if($catid) {
|
||||||
|
$sql .= ' AND cp.fk_categorie = ' . $catid;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql .= ' AND p.rowid = pf.fk_product';
|
||||||
|
|
||||||
// Insert categ filter
|
// Insert categ filter
|
||||||
if ($search_categ)
|
if ($search_categ) {
|
||||||
{
|
$sql .= ' AND cp.fk_categorie = ' . $db->escape($search_categ);
|
||||||
$sql .= " AND cp.fk_categorie = ".$db->escape($search_categ);
|
|
||||||
}
|
}
|
||||||
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,";
|
$sql .= ' GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price';
|
||||||
$sql.= " p.fk_product_type, p.tms,";
|
$sql .= ', p.price_ttc, p.price_base_type,p.fk_product_type, p.tms';
|
||||||
$sql.= " p.duration, p.tobuy, p.seuil_stock_alerte";
|
$sql .= ', p.duration, p.tobuy, p.seuil_stock_alerte';
|
||||||
$sql .= ", p.desiredstock";
|
$sql .= ', p.desiredstock';
|
||||||
$sql .= ' HAVING p.desiredstock > SUM(s.reel) or SUM(s.reel) is NULL';
|
$sql .= ' HAVING p.desiredstock > SUM(s.reel) or SUM(s.reel) is NULL';
|
||||||
$sql .= $db->order($sortfield,$sortorder);
|
$sql .= $db->order($sortfield,$sortorder);
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|
||||||
if ($resql)
|
if ($resql) {
|
||||||
{
|
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
if ($num == 1 && ($sall or $snom or $sref)) {
|
||||||
if ($num == 1 && ($sall or $snom or $sref))
|
|
||||||
{
|
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
header("Location: fiche.php?id=$objp->rowid");
|
header('Location: ../fiche.php?id=' . $objp->rowid);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$helpurl='';
|
$helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|';
|
||||||
$helpurl='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
|
$helpurl .= 'ES:Módulo_Stocks';
|
||||||
$texte = $langs->trans('Replenishment');
|
$texte = $langs->trans('Replenishment');
|
||||||
llxHeader("",$title,$helpurl,$texte);
|
llxHeader('', $title, $helpurl, $texte);
|
||||||
|
|
||||||
if ($sref || $snom || $sall || GETPOST('search'))
|
if ($sref || $snom || $sall || GETPOST('search')) {
|
||||||
{
|
print_barre_liste($texte,
|
||||||
print_barre_liste($texte, $page, "replenish.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall, $sortfield, $sortorder,'',$num);
|
$page,
|
||||||
|
'replenish.php',
|
||||||
|
'&sref=' . $sref . '&snom=' . $snom . '&sall=' . $sall,
|
||||||
|
$sortfield,
|
||||||
|
$sortorder,
|
||||||
|
'',
|
||||||
|
$num
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
print_barre_liste($texte,
|
||||||
print_barre_liste($texte, $page, "replenish.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num);
|
$page,
|
||||||
|
'replenish.php',
|
||||||
|
'&sref=$sref&snom=$snom&fourn_id=$fourn_id' . (isset($type)?'&type=$type':''),
|
||||||
|
$sortfield,
|
||||||
|
$sortorder,
|
||||||
|
'',
|
||||||
|
$num);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($catid))
|
if (!empty($catid)) {
|
||||||
{
|
print '<div id="ways">';
|
||||||
print "<div id='ways'>";
|
|
||||||
$c = new Categorie($db);
|
$c = new Categorie($db);
|
||||||
$c->fetch($catid);
|
$c->fetch($catid);
|
||||||
$ways = $c->print_all_ways(' > ', 'product/replenish.php');
|
$ways = $c->print_all_ways(' > ', 'product/replenish.php');
|
||||||
print " > ".$ways[0]."<br>\n";
|
print ' > ' . $ways[0] . '<br>';
|
||||||
print "</div><br>";
|
print '</div><br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<form action="replenish.php" method="post" name="formulaire">';
|
print '<form action="replenish.php" method="post" name="formulaire">';
|
||||||
@ -291,40 +307,116 @@ if ($resql)
|
|||||||
|
|
||||||
// Filter on categories
|
// Filter on categories
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
if (! empty($conf->categorie->enabled))
|
if (!empty($conf->categorie->enabled)) {
|
||||||
{
|
|
||||||
$moreforfilter .= $langs->trans('Categories') . ': ';
|
$moreforfilter .= $langs->trans('Categories') . ': ';
|
||||||
$moreforfilter.=$htmlother->select_categories(0,$search_categ,'search_categ');
|
$moreforfilter .= $htmlother->select_categories(0,
|
||||||
|
$search_categ,
|
||||||
|
'search_categ'
|
||||||
|
);
|
||||||
$moreforfilter .= ' ';
|
$moreforfilter .= ' ';
|
||||||
}
|
}
|
||||||
if ($moreforfilter)
|
if ($moreforfilter) {
|
||||||
{
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre" colspan="9">';
|
print '<td class="liste_titre" colspan="9">';
|
||||||
print $moreforfilter;
|
print $moreforfilter;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$param=(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref";
|
$param = (isset($type)? '&type=$type' : '');
|
||||||
|
$param .= '&fourn_id=$fourn_id&snom=$snom&sref=$sref';
|
||||||
|
|
||||||
// Lignes des titres
|
// Lignes des titres
|
||||||
print "<tr class=\"liste_titre\">";
|
print '<tr class="liste_titre">';
|
||||||
print "<td> </td>";
|
print '<td> </td>';
|
||||||
print_liste_field_titre($langs->trans("Ref"),"replenish.php", "p.ref",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans('Ref'),
|
||||||
print_liste_field_titre($langs->trans("Label"),"replenish.php", "p.label",$param,"","",$sortfield,$sortorder);
|
'replenish.php',
|
||||||
if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans("Duration"),"replenish.php", "p.duration",$param,"",'align="center"',$sortfield,$sortorder);
|
'p.ref',
|
||||||
print_liste_field_titre($langs->trans("DesiredStock"),"replenish.php", "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder);
|
$param,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$sortfield,
|
||||||
|
$sortorder
|
||||||
|
);
|
||||||
|
print_liste_field_titre($langs->trans('Label'),
|
||||||
|
'replenish.php',
|
||||||
|
'p.label',
|
||||||
|
$param,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$sortfield,
|
||||||
|
$sortorder
|
||||||
|
);
|
||||||
|
if (!empty($conf->service->enabled) && $type == 1) {
|
||||||
|
print_liste_field_titre($langs->trans('Duration'),
|
||||||
|
'replenish.php',
|
||||||
|
'p.duration',
|
||||||
|
$param,
|
||||||
|
'',
|
||||||
|
'align="center"',
|
||||||
|
$sortfield,
|
||||||
|
$sortorder
|
||||||
|
);
|
||||||
|
}
|
||||||
|
print_liste_field_titre($langs->trans('DesiredStock'),
|
||||||
|
'replenish.php',
|
||||||
|
'p.desiredstock',
|
||||||
|
$param,
|
||||||
|
'',
|
||||||
|
'align="right"',
|
||||||
|
$sortfield,
|
||||||
|
$sortorder
|
||||||
|
);
|
||||||
if($conf->global->USE_VIRTUAL_STOCK) {
|
if($conf->global->USE_VIRTUAL_STOCK) {
|
||||||
print_liste_field_titre($langs->trans("VirtualStock"),"replenish.php", "",$param,"",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans('VirtualStock'),
|
||||||
|
'replenish.php',
|
||||||
|
'',
|
||||||
|
$param,
|
||||||
|
'',
|
||||||
|
'align="right"',
|
||||||
|
$sortfield,
|
||||||
|
$sortorder
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print_liste_field_titre($langs->trans("PhysicalStock"),"replenish.php", "stock_physique",$param,"",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans('PhysicalStock'),
|
||||||
|
'replenish.php',
|
||||||
|
'stock_physique',
|
||||||
|
$param,
|
||||||
|
'',
|
||||||
|
'align="right"',
|
||||||
|
$sortfield,
|
||||||
|
$sortorder
|
||||||
|
);
|
||||||
}
|
}
|
||||||
print_liste_field_titre($langs->trans("StockToBuy"),"replenish.php", "",$param,"",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans('StockToBuy'),
|
||||||
print_liste_field_titre($langs->trans("Ordered"),"replenish.php", "",$param,"",'align="right"',$sortfield,$sortorder);
|
'replenish.php',
|
||||||
print_liste_field_titre($langs->trans("Supplier"),"replenish.php", "",$param,"",'align="right"',$sortfield,$sortorder);
|
'',
|
||||||
|
$param,
|
||||||
|
'',
|
||||||
|
'align="right"',
|
||||||
|
$sortfield,
|
||||||
|
$sortorder
|
||||||
|
);
|
||||||
|
print_liste_field_titre($langs->trans('Ordered'),
|
||||||
|
'replenish.php',
|
||||||
|
'',
|
||||||
|
$param,
|
||||||
|
'',
|
||||||
|
'align="right"',
|
||||||
|
$sortfield,
|
||||||
|
$sortorder
|
||||||
|
);
|
||||||
|
print_liste_field_titre($langs->trans('Supplier'),
|
||||||
|
'replenish.php',
|
||||||
|
'',
|
||||||
|
$param,
|
||||||
|
'',
|
||||||
|
'align="right"',
|
||||||
|
$sortfield,
|
||||||
|
$sortorder
|
||||||
|
);
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
print "</tr>\n";
|
print '</tr>';
|
||||||
|
|
||||||
// Lignes des champs de filtre
|
// Lignes des champs de filtre
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -335,8 +427,7 @@ if ($resql)
|
|||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat" type="text" name="snom" value="' . $snom . '">';
|
print '<input class="flat" type="text" name="snom" value="' . $snom . '">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! empty($conf->service->enabled) && $type == 1)
|
if (!empty($conf->service->enabled) && $type == 1) {
|
||||||
{
|
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -352,27 +443,27 @@ if ($resql)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$product_static=new Product($db);
|
$prod = new Product($db);
|
||||||
|
|
||||||
$var = True;
|
$var = True;
|
||||||
while ($i < min($num,$limit))
|
while ($i < min($num, $limit)) {
|
||||||
{
|
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
if($conf->global->STOCK_SUPPORTS_SERVICES || $objp->fk_product_type == 0){
|
if($conf->global->STOCK_SUPPORTS_SERVICES
|
||||||
|
|| $objp->fk_product_type == 0) {
|
||||||
// Multilangs
|
// Multilangs
|
||||||
if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active
|
if(! empty($conf->global->MAIN_MULTILANGS)) {
|
||||||
{
|
$sql = 'SELECT label';
|
||||||
$sql = "SELECT label";
|
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'product_lang';
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
|
$sql .= ' WHERE fk_product = ' . $objp->rowid;
|
||||||
$sql.= " WHERE fk_product=".$objp->rowid;
|
$sql .= ' AND lang = "' . $langs->getDefaultLang() . '"';
|
||||||
$sql.= " AND lang='". $langs->getDefaultLang() ."'";
|
$sql .= ' LIMIT 1';
|
||||||
$sql.= " LIMIT 1";
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if($result) {
|
||||||
{
|
|
||||||
$objtp = $db->fetch_object($result);
|
$objtp = $db->fetch_object($result);
|
||||||
if (! empty($objtp->label)) $objp->label = $objtp->label;
|
if (!empty($objtp->label)) {
|
||||||
|
$objp->label = $objtp->label;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,40 +471,57 @@ if ($resql)
|
|||||||
print '<tr ' . $bc[$var] . '>';
|
print '<tr ' . $bc[$var] . '>';
|
||||||
print '<td><input type="checkbox" name="' . $i . '"></td>';
|
print '<td><input type="checkbox" name="' . $i . '"></td>';
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
$product_static->ref=$objp->ref;
|
$prod->ref = $objp->ref;
|
||||||
$product_static->id=$objp->rowid;
|
$prod->id = $objp->rowid;
|
||||||
$product_static->type=$objp->fk_product_type;
|
$prod->type = $objp->fk_product_type;
|
||||||
print $product_static->getNomUrl(1,'',16);
|
print $prod->getNomUrl(1, '', 16);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>' . $objp->label . '</td>';
|
print '<td>' . $objp->label . '</td>';
|
||||||
print '<input type="hidden" name="desc' . $i . '" value="' . $objp->label . '" >';
|
print '<input type="hidden" name="desc' . $i . '" value="' . $objp->label . '" >';
|
||||||
|
|
||||||
if (! empty($conf->service->enabled) && $type == 1)
|
if(!empty($conf->service->enabled) && $type == 1) {
|
||||||
{
|
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
|
if(preg_match('/([0-9]+)y/i', $objp->duration, $regs)) {
|
||||||
elseif (preg_match('/([0-9]+)m/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth");
|
print $regs[1] . ' ' . $langs->trans('DurationYear');
|
||||||
elseif (preg_match('/([0-9]+)d/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay");
|
}
|
||||||
else print $objp->duration;
|
else if(preg_match('/([0-9]+)m/i', $objp->duration, $regs)) {
|
||||||
|
print $regs[1] . ' ' . $langs->trans('DurationMonth');
|
||||||
|
}
|
||||||
|
else if(preg_match('/([0-9]+)d/i', $objp->duration, $regs)) {
|
||||||
|
print $regs[1] . ' ' . $langs->trans('DurationDay');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print $objp->duration;
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '<td align="right">' . $objp->desiredstock . '</td>';
|
print '<td align="right">' . $objp->desiredstock . '</td>';
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if(!$objp->stock_physique) $objp->stock_physique = 0;
|
if(!$objp->stock_physique) {
|
||||||
|
$objp->stock_physique = 0;
|
||||||
|
}
|
||||||
if($conf->global->USE_VIRTUAL_STOCK) {
|
if($conf->global->USE_VIRTUAL_STOCK) {
|
||||||
$product_static->fetch($product_static->id);
|
$prod->fetch($prod->id);
|
||||||
$result=$product_static->load_stats_commande(0,'1,2');
|
$result=$prod->load_stats_commande(0, '1,2');
|
||||||
if ($result < 0) dol_print_error($db,$product_static->error);
|
if ($result < 0) {
|
||||||
$stock_commande_client = $product_static->stats_commande['qty'];
|
dol_print_error($db, $prod->error);
|
||||||
$result=$product_static->load_stats_commande_fournisseur(0,'3');
|
}
|
||||||
if ($result < 0) dol_print_error($db,$product_static->error);
|
$stock_commande_client = $prod->stats_commande['qty'];
|
||||||
$stock_commande_fournisseur = $product_static->stats_commande_fournisseur['qty'];
|
$result=$prod->load_stats_commande_fournisseur(0, '3');
|
||||||
|
if ($result < 0) {
|
||||||
|
dol_print_error($db,$prod->error);
|
||||||
|
}
|
||||||
|
$stock_commande_fournisseur = $prod->stats_commande_fournisseur['qty'];
|
||||||
$stock = $objp->stock_physique - $stock_commande_client + $stock_commande_fournisseur;
|
$stock = $objp->stock_physique - $stock_commande_client + $stock_commande_fournisseur;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$stock = $objp->stock_physique;
|
$stock = $objp->stock_physique;
|
||||||
}
|
}
|
||||||
if ($objp->seuil_stock_alerte && ($stock < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' ';
|
if ($objp->seuil_stock_alerte
|
||||||
|
&& ($stock < $objp->seuil_stock_alerte)) {
|
||||||
|
$warn = $langs->trans('StockTooLow');
|
||||||
|
print img_warning($warn) . ' ';
|
||||||
|
}
|
||||||
print $stock;
|
print $stock;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
//depending on conf, use either physical stock or
|
//depending on conf, use either physical stock or
|
||||||
@ -422,38 +530,59 @@ if ($resql)
|
|||||||
print '<td align="right">'.$stocktobuy.'</td>';
|
print '<td align="right">'.$stocktobuy.'</td>';
|
||||||
print '<input type="hidden" name="tobuy' . $i . '" value="' . $stocktobuy . '" >';
|
print '<input type="hidden" name="tobuy' . $i . '" value="' . $stocktobuy . '" >';
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print ordered($product_static->id);
|
print ordered($prod->id);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
print '<td align="right">'.$form->select_product_fourn_price($product_static->id, "fourn".$i).'</td>';
|
print '<td align="right">';
|
||||||
|
print $form->select_product_fourn_price($prod->id,
|
||||||
|
"fourn".$i);
|
||||||
|
print '</td>';
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
print "</tr>\n";
|
print "</tr>";
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print '<table width="100%">';
|
print '<table width="100%">';
|
||||||
print '<tr><td align="right"><input class="button" type="submit" value="'.$langs->trans("Validate").'"></td></tr>';
|
print '<tr><td align="right">';
|
||||||
print '</table>';
|
$valid = $langs->trans("Validate");
|
||||||
|
print '<input class="button" type="submit" value="' . $valid . '">';
|
||||||
|
print '</td></tr></table>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
if ($num > $conf->liste_limit)
|
if ($num > $conf->liste_limit) {
|
||||||
{
|
if ($sref || $snom || $sall || GETPOST('search')) {
|
||||||
if ($sref || $snom || $sall || GETPOST('search'))
|
print_barre_liste('',
|
||||||
{
|
$page,
|
||||||
print_barre_liste('', $page, "replenish.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall, $sortfield, $sortorder,'',$num, 0, '');
|
'replenish.php',
|
||||||
|
'&sref=' . $sref . '&snom=' . $snom . '&sall=' . $sall,
|
||||||
|
$sortfield,
|
||||||
|
$sortorder,
|
||||||
|
'',
|
||||||
|
$num,
|
||||||
|
0,
|
||||||
|
''
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
print_barre_liste('',
|
||||||
print_barre_liste('', $page, "replenish.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num, 0, '');
|
$page,
|
||||||
|
'replenish.php',
|
||||||
|
"&sref=$sref&snom=$snom&fourn_id=$fourn_id" . (isset($type)?"&type=$type":""),
|
||||||
|
$sortfield,
|
||||||
|
$sortorder,
|
||||||
|
'',
|
||||||
|
$num,
|
||||||
|
0,
|
||||||
|
''
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,130 +595,207 @@ $sall=GETPOST('search_all');
|
|||||||
|
|
||||||
$page = GETPOST('page', 'int');
|
$page = GETPOST('page', 'int');
|
||||||
|
|
||||||
$sortorder="DESC";
|
$sortorder = 'DESC';
|
||||||
$sortfield="cf.date_creation";
|
$sortfield = 'cf.date_creation';
|
||||||
$offset = $conf->liste_limit * $page ;
|
$offset = $conf->liste_limit * $page ;
|
||||||
$sql = "SELECT s.rowid as socid, s.nom, cf.date_creation as dc,";
|
$sql = 'SELECT s.rowid as socid, s.nom, cf.date_creation as dc,';
|
||||||
$sql.= " cf.rowid,cf.ref, cf.fk_statut, cf.total_ttc, cf.fk_user_author,";
|
$sql .= ' cf.rowid,cf.ref, cf.fk_statut, cf.total_ttc';
|
||||||
$sql.= " u.login";
|
$sql .= ", cf.fk_user_author, u.login";
|
||||||
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s,";
|
$sql .= ' FROM (' . MAIN_DB_PREFIX . 'societe as s,';
|
||||||
$sql.= " ".MAIN_DB_PREFIX."commande_fournisseur as cf";
|
$sql .= ' ' . MAIN_DB_PREFIX . 'commande_fournisseur as cf';
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$socid) {
|
||||||
$sql.= ")";
|
$sql.= ', ' . MAIN_DB_PREFIX . 'societe_commerciaux as sc';
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON cf.fk_user_author = u.rowid";
|
|
||||||
$sql.= " WHERE cf.fk_soc = s.rowid ";
|
|
||||||
$sql.= " AND cf.entity = ".$conf->entity;
|
|
||||||
$sql.= " AND cf.source = 42";
|
|
||||||
$sql.= " AND cf.fk_statut < 5";
|
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
||||||
if ($sref)
|
|
||||||
{
|
|
||||||
$sql.= " AND cf.ref LIKE '%".$db->escape($sref)."%'";
|
|
||||||
}
|
}
|
||||||
if ($snom)
|
$sql .= ') LEFT JOIN ' . MAIN_DB_PREFIX . 'user as u ';
|
||||||
{
|
$sql .= 'ON cf.fk_user_author = u.rowid';
|
||||||
$sql.= " AND s.nom LIKE '%".$db->escape($snom)."%'";
|
$sql .= ' WHERE cf.fk_soc = s.rowid ';
|
||||||
|
$sql .= ' AND cf.entity = ' . $conf->entity;
|
||||||
|
$sql .= ' AND cf.source = 42';
|
||||||
|
$sql .= ' AND cf.fk_statut < 5';
|
||||||
|
|
||||||
|
if (!$user->rights->societe->client->voir && !$socid) {
|
||||||
|
$sql .= ' AND s.rowid = sc.fk_soc AND sc.fk_user = ' . $user->id;
|
||||||
}
|
}
|
||||||
if ($suser)
|
if ($sref) {
|
||||||
{
|
$sql .= ' AND cf.ref LIKE "%' . $db->escape($sref) . '%"';
|
||||||
$sql.= " AND u.login LIKE '%".$db->escape($suser)."%'";
|
|
||||||
}
|
}
|
||||||
if ($sttc)
|
if ($snom) {
|
||||||
{
|
$sql .= ' AND s.nom LIKE "%' . $db->escape($snom) . '%"';
|
||||||
$sql .= " AND total_ttc = ".price2num($sttc);
|
|
||||||
}
|
}
|
||||||
if ($sall)
|
if ($suser) {
|
||||||
{
|
$sql .= ' AND u.login LIKE "%' . $db->escape($suser) . '%"';
|
||||||
$sql.= " AND (cf.ref LIKE '%".$db->escape($sall)."%' OR cf.note LIKE '%".$db->escape($sall)."%')";
|
}
|
||||||
|
if ($sttc) {
|
||||||
|
$sql .= ' AND total_ttc = ' . price2num($sttc);
|
||||||
|
}
|
||||||
|
if ($sall) {
|
||||||
|
$sql .= ' AND (cf.ref LIKE "%' . $db->escape($sall) . '%" ';
|
||||||
|
$sql .= 'OR cf.note LIKE "%' . $db->escape($sall) . '%")';
|
||||||
|
}
|
||||||
|
if ($socid) {
|
||||||
|
$sql .= ' AND s.rowid = ' . $socid;
|
||||||
}
|
}
|
||||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
|
||||||
|
|
||||||
if (GETPOST('statut'))
|
if (GETPOST('statut'))
|
||||||
{
|
{
|
||||||
$sql .= " AND fk_statut =".GETPOST('statut');
|
$sql .= ' AND fk_statut = ' . GETPOST('statut');
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
|
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql) {
|
||||||
{
|
|
||||||
|
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
|
|
||||||
print_barre_liste($langs->trans('ReplenishmentOrders'), $page, "replenish.php", "", $sortfield, $sortorder, '', $num);
|
print_barre_liste($langs->trans('ReplenishmentOrders'),
|
||||||
|
$page,
|
||||||
|
'replenish.php',
|
||||||
|
'',
|
||||||
|
$sortfield,
|
||||||
|
$sortorder,
|
||||||
|
'',
|
||||||
|
$num
|
||||||
|
);
|
||||||
print '<form action="replenish.php" method="GET">';
|
print '<form action="replenish.php" method="GET">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"","","",'',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans('Ref'),
|
||||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"","","",'',$sortfield,$sortorder);
|
$_SERVER['PHP_SELF'],
|
||||||
print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"],"","","",'',$sortfield,$sortorder);
|
'',
|
||||||
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"","","",'',$sortfield,$sortorder);
|
'',
|
||||||
print_liste_field_titre($langs->trans("OrderCreation"),$_SERVER["PHP_SELF"],"","","",'align="center"',$sortfield,$sortorder);
|
'',
|
||||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"","","",'align="right"',$sortfield,$sortorder);
|
'',
|
||||||
print "</tr>\n";
|
$sortfield,
|
||||||
|
$sortorder
|
||||||
|
);
|
||||||
|
print_liste_field_titre($langs->trans('Company'),
|
||||||
|
$_SERVER['PHP_SELF'],
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$sortfield,
|
||||||
|
$sortorder
|
||||||
|
);
|
||||||
|
print_liste_field_titre($langs->trans('Author'),
|
||||||
|
$_SERVER['PHP_SELF'],
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$sortfield,
|
||||||
|
$sortorder
|
||||||
|
);
|
||||||
|
print_liste_field_titre($langs->trans('AmountTTC'),
|
||||||
|
$_SERVER['PHP_SELF'],
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$sortfield,
|
||||||
|
$sortorder
|
||||||
|
);
|
||||||
|
print_liste_field_titre($langs->trans('OrderCreation'),
|
||||||
|
$_SERVER['PHP_SELF'],
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'align="center"',
|
||||||
|
$sortfield,
|
||||||
|
$sortorder
|
||||||
|
);
|
||||||
|
print_liste_field_titre($langs->trans('Status'),
|
||||||
|
$_SERVER['PHP_SELF'],
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'align="right"',
|
||||||
|
$sortfield,
|
||||||
|
$sortorder
|
||||||
|
);
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td class="liste_titre">';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_ref" value="'.$sref.'"></td>';
|
print '<input type="text" class="flat" name="search_ref" value="' . $sref . '">';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_nom" value="'.$snom.'"></td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_user" value="'.$suser.'"></td>';
|
print '<td class="liste_titre">';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_ttc" value="'.$sttc.'"></td>';
|
print '<input type="text" class="flat" name="search_nom" value="' . $snom . '">';
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print '<input type="text" class="flat" name="search_user" value="' . $suser . '">';
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print '<input type="text" class="flat" name="search_ttc" value="' . $sttc . '">';
|
||||||
|
print '</td>';
|
||||||
print '<td colspan="2" class="liste_titre" align="right">';
|
print '<td colspan="2" class="liste_titre" align="right">';
|
||||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
$src = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png';
|
||||||
|
$value = dol_escape_htmltag($langs->trans('Search'));
|
||||||
|
print '<input type="image" class="liste_titre" name="button_search" src="' . $src . '" value="'.$value.'" title="'.$value.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$var = true;
|
$var = true;
|
||||||
|
|
||||||
$userstatic = new User($db);
|
$userstatic = new User($db);
|
||||||
|
|
||||||
while ($i < min($num,$conf->liste_limit))
|
while($i < min($num,$conf->liste_limit)) {
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/fourn/commande/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref.'</a></td>'."\n";
|
print '<td>';
|
||||||
|
$href = DOL_URL_ROOT . '/fourn/commande/fiche.php?id=' . $obj->rowid;
|
||||||
|
print '<a href="' . $href . '">';
|
||||||
|
print img_object($langs->trans('ShowOrder'), 'order') . ' ' . $obj->ref;
|
||||||
|
print '</a></td>'."";
|
||||||
|
|
||||||
// Company
|
// Company
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' ';
|
print '<td>';
|
||||||
print $obj->nom.'</a></td>'."\n";
|
$href = DOL_URL_ROOT . '/fourn/fiche.php?socid=' . $obj->socid;
|
||||||
|
print '<a href="' . $href .'">';
|
||||||
|
print img_object($langs->trans('ShowCompany'), 'company') . ' ' . $obj->nom;
|
||||||
|
print '</a></td>'."";
|
||||||
|
|
||||||
// Author
|
// Author
|
||||||
$userstatic->id = $obj->fk_user_author;
|
$userstatic->id = $obj->fk_user_author;
|
||||||
$userstatic->login = $obj->login;
|
$userstatic->login = $obj->login;
|
||||||
print "<td>";
|
print '<td>';
|
||||||
if ($userstatic->id) print $userstatic->getLoginUrl(1);
|
if ($userstatic->id) {
|
||||||
else print " ";
|
print $userstatic->getLoginUrl(1);
|
||||||
print "</td>";
|
}
|
||||||
|
else {
|
||||||
|
print ' ';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print '<td align="right" width="100">'.price($obj->total_ttc)."</td>";
|
print '<td align="right" width="100">';
|
||||||
|
print price($obj->total_ttc);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
print "<td align=\"center\" width=\"100\">";
|
print '<td align="center" width="100">';
|
||||||
if ($obj->dc)
|
if ($obj->dc) {
|
||||||
{
|
print dol_print_date($db->jdate($obj->dc), 'day');
|
||||||
print dol_print_date($db->jdate($obj->dc),"day");
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
print '-';
|
||||||
print "-";
|
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Statut
|
// Statut
|
||||||
print '<td align="right">'.$commandestatic->LibStatut($obj->fk_statut, 5).'</td>';
|
print '<td align="right">';
|
||||||
|
print $commandestatic->LibStatut($obj->fk_statut, 5);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print '</tr>';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print '</table>';
|
||||||
print "</form>\n";
|
print '</form>';
|
||||||
|
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user