Fix: debug replanishment feature
This commit is contained in:
parent
661faa63dd
commit
864315d018
@ -42,7 +42,7 @@ $debit=GETPOST("debit");
|
||||
$credit=GETPOST("credit");
|
||||
$type=GETPOST("type");
|
||||
$account=GETPOST("account");
|
||||
$bid=GETPOST("bid");
|
||||
$bid=GETPOST("bid","int");
|
||||
|
||||
$param='';
|
||||
if ($description) $param.='&description='.$description;
|
||||
@ -83,7 +83,7 @@ $sql.= " b.fk_account, b.fk_type,";
|
||||
$sql.= " ba.rowid as bankid, ba.ref as bankref,";
|
||||
$sql.= " bu.label as labelurl, bu.url_id";
|
||||
$sql.= " FROM ";
|
||||
if (! empty($_REQUEST["bid"])) $sql.= MAIN_DB_PREFIX."bank_class as l,";
|
||||
if ($bid) $sql.= MAIN_DB_PREFIX."bank_class as l,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."bank_account as ba,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND type = 'company'";
|
||||
@ -92,21 +92,21 @@ $sql.= " WHERE b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity = ".$conf->entity;
|
||||
if (GETPOST("req_nb"))
|
||||
{
|
||||
$sql.= " AND b.num_chq like '%".$db->escape(GETPOST("req_nb"))."%'";
|
||||
$sql.= " AND b.num_chq LIKE '%".$db->escape(GETPOST("req_nb"))."%'";
|
||||
$param.='&req_nb='.urlencode(GETPOST("req_nb"));
|
||||
}
|
||||
if (GETPOST("thirdparty"))
|
||||
{
|
||||
$sql.=" AND (COALESCE(s.nom,'') LIKE '%".$db->escape(GETPOST("thirdparty"))."%')";
|
||||
$sql.=" AND s.nom LIKE '%".$db->escape(GETPOST("thirdparty"))."%'";
|
||||
$param.='&thirdparty='.urlencode(GETPOST("thirdparty"));
|
||||
}
|
||||
if (! empty($_REQUEST["bid"]))
|
||||
if ($bid)
|
||||
{
|
||||
$sql.= " AND b.rowid=l.lineid AND l.fk_categ=".$_REQUEST["bid"];
|
||||
$sql.= " AND b.rowid=l.lineid AND l.fk_categ=".$bid;
|
||||
}
|
||||
if(! empty($type))
|
||||
if (! empty($type))
|
||||
{
|
||||
$sql .= " AND b.fk_type = '" . $type ."' ";
|
||||
$sql.= " AND b.fk_type = '".$db->escape($type)."' ";
|
||||
}
|
||||
// Search criteria amount
|
||||
$si=0;
|
||||
|
||||
@ -100,5 +100,5 @@ AlertOnly= Alerts only
|
||||
WarehouseForStockDecrease=The warehouse <b>%s</b> will be used for stock decrease
|
||||
WarehouseForStockIncrease=The warehouse <b>%s</b> will be used for stock increase
|
||||
ForThisWarehouse=For this warehouse
|
||||
ReplenishmentStatusDesc=This is list of all product with a physical stock lower than desired stock and suggest you to create supplier orders to fill the difference.
|
||||
ReplenishmentStatusDesc=This is list of all product with a physical stock lower than desired stock (or alert value if checkbox "alert only" is checked) and suggest you to create supplier orders to fill the difference.
|
||||
ReplenishmentOrdersDesc=This is list of all opened supplier orders
|
||||
@ -100,5 +100,5 @@ AlertOnly = Alertes seulement
|
||||
WarehouseForStockDecrease=L'entrepôt <b>%s</b> sera utilisé pour la décrémentation du stock
|
||||
WarehouseForStockIncrease=L'entrepôt <b>%s</b> sera utilisé pour l'incrémentation du stock
|
||||
ForThisWarehouse=Pour cet entrepôt
|
||||
ReplenishmentStatusDesc=Cet écran permet de voir les produits avec un stock physique inférieure à la quantité minimale désirée et propose de créer des commandes fournisseurs pour compléter la différence
|
||||
ReplenishmentStatusDesc=Cet écran permet de voir les produits avec un stock physique inférieure à la quantité minimale désirée (ou à la quantité du seuil d'alerte si la case "alerte seulement" est cochée) et propose de créer des commandes fournisseurs pour compléter la différence
|
||||
ReplenishmentOrdersDesc=Voici la liste des commandes fournisseurs en cours
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Laurent Destaileur <ely@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -173,14 +173,14 @@ if ($action == 'order' && isset($_POST['valid']))
|
||||
|
||||
$title = $langs->trans('Status');
|
||||
|
||||
$sql = 'SELECT p.rowid, p.ref, p.label, p.price';
|
||||
$sql .= ', p.price_ttc, p.price_base_type,p.fk_product_type';
|
||||
$sql .= ', p.tms as datem, p.duration, p.tobuy, p.seuil_stock_alerte,';
|
||||
$sql .= ' SUM(COALESCE(s.reel, 0)) as stock_physique';
|
||||
$sql .= ', p.desiredstock';
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'product as p';
|
||||
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s';
|
||||
$sql .= ' ON p.rowid = s.fk_product';
|
||||
$sql = 'SELECT p.rowid, p.ref, p.label, p.price,';
|
||||
$sql.= ' p.price_ttc, p.price_base_type,p.fk_product_type,';
|
||||
$sql.= ' p.tms as datem, p.duration, p.tobuy, p.seuil_stock_alerte,';
|
||||
$sql.= ' p.desiredstock,';
|
||||
$sql.= ' SUM('.$db->ifsql("s.reel IS NULL", "s.reel", "0").') as stock_physique';
|
||||
$sql.= ' FROM ' . MAIN_DB_PREFIX . 'product as p';
|
||||
$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) . ')';
|
||||
if ($sall) {
|
||||
$sql .= ' AND (p.ref LIKE "%'.$db->escape($sall).'%" ';
|
||||
@ -193,7 +193,7 @@ if (dol_strlen($type)) {
|
||||
if ($type == 1) {
|
||||
$sql .= ' AND p.fk_product_type = 1';
|
||||
} else {
|
||||
$sql .= ' AND p.fk_product_type != 1';
|
||||
$sql .= ' AND p.fk_product_type <> 1';
|
||||
}
|
||||
}
|
||||
if ($sref) {
|
||||
@ -210,21 +210,23 @@ if ($snom) {
|
||||
$sql .= ' AND p.label LIKE "%' . $db->escape($crit) . '%"';
|
||||
}
|
||||
}
|
||||
$sql .= ' AND p.tobuy = 1';
|
||||
$sql.= ' AND p.tobuy = 1';
|
||||
if (!empty($canvas)) $sql .= ' AND p.canvas = "' . $db->escape($canvas) . '"';
|
||||
$sql .= ' GROUP BY p.rowid, p.ref, p.label, p.price';
|
||||
$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.desiredstock, s.fk_product';
|
||||
$sql .= ' HAVING p.desiredstock > SUM(COALESCE(s.reel, 0))';
|
||||
$sql .= ' AND p.desiredstock > 0';
|
||||
if ($salert == 'on')
|
||||
$sql.= ' GROUP BY p.rowid, p.ref, p.label, p.price';
|
||||
$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.desiredstock, s.fk_product';
|
||||
$sql.= ' HAVING p.desiredstock > SUM('.$db->ifsql("s.reel IS NULL", "s.reel", "0").')';
|
||||
$sql.= ' AND p.desiredstock > 0';
|
||||
if ($salert == 'on') // Option to see when stock is lower than alert
|
||||
{
|
||||
$sql .= ' AND SUM(COALESCE(s.reel, 0)) < p.seuil_stock_alerte AND p.seuil_stock_alerte is not NULL';
|
||||
$sql .= ' AND SUM('.$db->ifsql("s.reel IS NULL", "s.reel", "0").') < p.seuil_stock_alerte AND p.seuil_stock_alerte is not NULL';
|
||||
$alertchecked = 'checked="checked"';
|
||||
}
|
||||
$sql .= $db->order($sortfield,$sortorder);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
|
||||
dol_syslog('Execute request sql='.$sql);
|
||||
$resql = $db->query($sql);
|
||||
if (empty($resql))
|
||||
{
|
||||
@ -397,10 +399,10 @@ print '</tr>';
|
||||
print '<tr class="liste_titre">'.
|
||||
'<td class="liste_titre"> </td>'.
|
||||
'<td class="liste_titre">'.
|
||||
'<input class="flat" type="text" name="sref" value="' . $sref . '">'.
|
||||
'<input class="flat" type="text" name="sref" size="8" value="'.dol_escape_htmltag($sref).'">'.
|
||||
'</td>'.
|
||||
'<td class="liste_titre">'.
|
||||
'<input class="flat" type="text" name="snom" value="' . $snom . '">'.
|
||||
'<input class="flat" type="text" name="snom" size="8" value="'.dol_escape_htmltag($snom).'">'.
|
||||
'</td>';
|
||||
if (!empty($conf->service->enabled) && $type == 1)
|
||||
{
|
||||
@ -491,11 +493,12 @@ while ($i < min($num, $limit))
|
||||
} else {
|
||||
$picto = img_picto('', './img/no', '', 1);
|
||||
}
|
||||
print '<tr ' . $bc[$var] . '>';
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
// Select field
|
||||
//print '<td><input type="checkbox" class="check" name="' . $i . '"' . $disabled . '></td>';
|
||||
print '<td><input type="checkbox" class="check" name="' . $i . '"></td>';
|
||||
print '<td><input type="checkbox" class="check" name="'.$i.'"></td>';
|
||||
|
||||
print '<td class="nowrap">'.
|
||||
$prod->getNomUrl(1, '', 16).
|
||||
@ -529,7 +532,7 @@ while ($i < min($num, $limit))
|
||||
|
||||
// To order
|
||||
//print '<td align="right"><input type="text" name="tobuy'.$i.'" value="'.$stocktobuy.'" '.$disabled.'></td>';
|
||||
print '<td align="right"><input type="text" name="tobuy'.$i.'" value="'.$stocktobuy.'"></td>';
|
||||
print '<td align="right"><input type="text" size="4" name="tobuy'.$i.'" value="'.$stocktobuy.'"></td>';
|
||||
|
||||
// Supplier
|
||||
print '<td align="right">'. $form->select_product_fourn_price($prod->id, 'fourn'.$i, 1).'</td>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user