NEW Add color and picto for direction of movement

This commit is contained in:
Laurent Destailleur 2021-03-21 13:46:01 +01:00
parent eeb1c5d884
commit af199189b3
6 changed files with 93 additions and 42 deletions

View File

@ -2577,7 +2577,7 @@ class Form
}
}
if ($showempty) {
$out .= '<option value="0" selected>'.$textifempty.'</option>';
$out .= '<option value="0" selected>'.($textifempty ? $textifempty : '&nbsp;').'</option>';
}
$i = 0;

View File

@ -155,7 +155,7 @@ StockMustBeEnoughForInvoice=Stock level must be enough to add product/service to
StockMustBeEnoughForOrder=Stock level must be enough to add product/service to order (check is done on current real stock when adding a line into order whatever the rule for automatic stock change)
StockMustBeEnoughForShipment= Stock level must be enough to add product/service to shipment (check is done on current real stock when adding a line into shipment whatever the rule for automatic stock change)
MovementLabel=Label of movement
TypeMovement=Type of movement
TypeMovement=Direction of movement
DateMovement=Date of movement
InventoryCode=Movement or inventory code
IsInPackage=Contained into package

View File

@ -1107,6 +1107,47 @@ class MouvementStock extends CommonObject
// There is no specific properties. All data into insert are provided as method parameter.
}
/**
* Return html string with picto for type of movement
*
* @param int $withlabel With label
* @return string String with URL
*/
public function getTypeMovement($withlabel = 0)
{
global $langs;
$s = '';
switch ($this->type) {
case "0":
$s = '<span class="fa fa-level-down-alt stockmovemententry stockmovementtransfer" title="'.$langs->trans('StockIncreaseAfterCorrectTransfer').'"></span>';
if ($withlabel) {
$s .= $langs->trans('StockIncreaseAfterCorrectTransfer');
}
break;
case "1":
$s = '<span class="fa fa-level-up-alt stockmovementexit stockmovementtransfer" title="'.$langs->trans('StockDecreaseAfterCorrectTransfer').'"></span>';
if ($withlabel) {
$s .= $langs->trans('StockDecreaseAfterCorrectTransfer');
}
break;
case "2":
$s = '<span class="fa fa-long-arrow-alt-up stockmovementexit stockmovement" title="'.$langs->trans('StockDecrease').'"></span>';
if ($withlabel) {
$s .= $langs->trans('StockDecrease');
}
break;
case "3":
$s = '<span class="fa fa-long-arrow-alt-down stockmovemententry stockmovement" title="'.$langs->trans('StockIncrease').'"></span>';
if ($withlabel) {
$s .= $langs->trans('StockIncrease');
}
break;
}
return $s;
}
/**
* Return a link (with optionaly the picto)
* Use this->id,this->lastname, this->firstname

View File

@ -944,22 +944,6 @@ if ($resql) {
print '<input class="flat" type="text" size="8" name="search_movement" value="'.dol_escape_htmltag($search_movement).'">';
print '</td>';
}
if (!empty($arrayfields['m.type_mouvement']['checked'])) {
// Type of movement
print '<td class="liste_titre center">';
//print '<input class="flat" type="text" size="3" name="search_type_mouvement" value="'.dol_escape_htmltag($search_type_mouvement).'">';
print '<select id="search_type_mouvement" name="search_type_mouvement" class="maxwidth150">';
print '<option value="" '.(($search_type_mouvement == "") ? 'selected="selected"' : '').'></option>';
print '<option value="0" '.(($search_type_mouvement == "0") ? 'selected="selected"' : '').'>'.$langs->trans('StockIncreaseAfterCorrectTransfer').'</option>';
print '<option value="1" '.(($search_type_mouvement == "1") ? 'selected="selected"' : '').'>'.$langs->trans('StockDecreaseAfterCorrectTransfer').'</option>';
print '<option value="2" '.(($search_type_mouvement == "2") ? 'selected="selected"' : '').'>'.$langs->trans('StockDecrease').'</option>';
print '<option value="3" '.(($search_type_mouvement == "3") ? 'selected="selected"' : '').'>'.$langs->trans('StockIncrease').'</option>';
print '</select>';
print ajax_combobox('search_type_mouvement');
// TODO: add new function $formentrepot->selectTypeOfMovement(...) like
// print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'maxwidth200');
print '</td>';
}
if (!empty($arrayfields['origin']['checked'])) {
// Origin of movement
print '<td class="liste_titre left">';
@ -972,6 +956,22 @@ if ($resql) {
print '&nbsp; ';
print '</td>';
}
if (!empty($arrayfields['m.type_mouvement']['checked'])) {
// Type of movement
print '<td class="liste_titre center">';
//print '<input class="flat" type="text" size="3" name="search_type_mouvement" value="'.dol_escape_htmltag($search_type_mouvement).'">';
print '<select id="search_type_mouvement" name="search_type_mouvement" class="maxwidth150">';
print '<option value="" '.(($search_type_mouvement == "") ? 'selected="selected"' : '').'>&nbsp;</option>';
print '<option value="0" '.(($search_type_mouvement == "0") ? 'selected="selected"' : '').'>'.$langs->trans('StockIncreaseAfterCorrectTransfer').'</option>';
print '<option value="1" '.(($search_type_mouvement == "1") ? 'selected="selected"' : '').'>'.$langs->trans('StockDecreaseAfterCorrectTransfer').'</option>';
print '<option value="2" '.(($search_type_mouvement == "2") ? 'selected="selected"' : '').'>'.$langs->trans('StockDecrease').'</option>';
print '<option value="3" '.(($search_type_mouvement == "3") ? 'selected="selected"' : '').'>'.$langs->trans('StockIncrease').'</option>';
print '</select>';
print ajax_combobox('search_type_mouvement');
// TODO: add new function $formentrepot->selectTypeOfMovement(...) like
// print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'maxwidth200');
print '</td>';
}
if (!empty($arrayfields['m.value']['checked'])) {
// Qty
print '<td class="liste_titre right">';
@ -1044,15 +1044,15 @@ if ($resql) {
if (!empty($arrayfields['m.label']['checked'])) {
print_liste_field_titre($arrayfields['m.label']['label'], $_SERVER["PHP_SELF"], "m.label", "", $param, "", $sortfield, $sortorder);
}
if (!empty($arrayfields['m.type_mouvement']['checked'])) {
print_liste_field_titre($arrayfields['m.type_mouvement']['label'], $_SERVER["PHP_SELF"], "m.type_mouvement", "", $param, '', $sortfield, $sortorder, 'center ');
}
if (!empty($arrayfields['origin']['checked'])) {
print_liste_field_titre($arrayfields['origin']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
}
if (!empty($arrayfields['m.fk_projet']['checked'])) {
print_liste_field_titre($arrayfields['m.fk_projet']['label'], $_SERVER["PHP_SELF"], "m.fk_projet", "", $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['m.type_mouvement']['checked'])) {
print_liste_field_titre($arrayfields['m.type_mouvement']['label'], $_SERVER["PHP_SELF"], "m.type_mouvement", "", $param, '', $sortfield, $sortorder, 'center ');
}
if (!empty($arrayfields['m.value']['checked'])) {
print_liste_field_titre($arrayfields['m.value']['label'], $_SERVER["PHP_SELF"], "m.value", "", $param, '', $sortfield, $sortorder, 'right ');
}
@ -1113,6 +1113,8 @@ if ($resql) {
$warehousestatic->fk_parent = $objp->fk_parent;
$warehousestatic->statut = $objp->statut;
$movement->type = $objp->type_mouvement;
$arrayofuniqueproduct[$objp->rowid] = $objp->produit;
if (!empty($objp->fk_origin)) {
$origin = $movement->get_origin($objp->fk_origin, $objp->origintype);
@ -1176,23 +1178,6 @@ if ($resql) {
// Label of movement
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($objp->label).'">'.$objp->label.'</td>';
}
if (!empty($arrayfields['m.type_mouvement']['checked'])) {
// Type of movement
switch ($objp->type_mouvement) {
case "0":
print '<td class="center">'.$langs->trans('StockIncreaseAfterCorrectTransfer').'</td>';
break;
case "1":
print '<td class="center">'.$langs->trans('StockDecreaseAfterCorrectTransfer').'</td>';
break;
case "2":
print '<td class="center">'.$langs->trans('StockDecrease').'</td>';
break;
case "3":
print '<td class="center">'.$langs->trans('StockIncrease').'</td>';
break;
}
}
if (!empty($arrayfields['origin']['checked'])) {
// Origin of movement
print '<td class="nowraponall">'.$origin.'</td>';
@ -1205,13 +1190,25 @@ if ($resql) {
}
print '</td>';
}
if (!empty($arrayfields['m.type_mouvement']['checked'])) {
// Type of movement
print '<td class="center">';
print $movement->getTypeMovement();
print '</td>';
}
if (!empty($arrayfields['m.value']['checked'])) {
// Qty
print '<td class="right">';
if ($objp->qt > 0) {
if ($objp->qty > 0) {
print '<span class="stockmovemententry">';
print '+';
print $objp->qty;
print '</span>';
} else {
print '<span class="stockmovementexit">';
print $objp->qty;
print '</span>';
}
print $objp->qty;
print '</td>';
}
if (!empty($arrayfields['m.price']['checked'])) {

View File

@ -358,12 +358,12 @@ print '<span class="fieldrequired">'.$langs->trans('Date').'</span> '.$form->sel
print ' <span class="clearbothonsmartphone marginleftonly paddingleftonly marginrightonly paddingrightonly">&nbsp;</span> ';
print img_picto('', 'product').' ';
print $langs->trans('Product').'</span> ';
$form->select_produits($productid, 'productid', '', 0, 0, -1, 2, '', 0, array(), 0, '1', 0, 'maxwidth300');
print $form->select_produits($productid, 'productid', '', 0, 0, -1, 2, '', 0, array(), 0, '1', 0, 'maxwidth300', 0, '', null, 1);
print ' <span class="clearbothonsmartphone marginleftonly paddingleftonly marginrightonly paddingrightonly">&nbsp;</span> ';
print img_picto('', 'stock').' ';
print $langs->trans('Warehouse').'</span> ';
print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? $fk_warehouse : 'ifone'), 'fk_warehouse', '', 1);
print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? $fk_warehouse : 'ifone'), 'fk_warehouse', '', 1, 0, 0, '', 0, 0, null, '', '', 1, false, 'e.ref');
print '</div>';
$parameters = array();

View File

@ -768,6 +768,19 @@ i.fa-mars::before, i.fa-venus::before, i.fa-genderless::before {
opacity: 0.4;
padding-<?php echo $left; ?>: 3px;
}
.stockmovemententry {
color: #080;
transform: rotate(0.25turn);
font-size: 1.2em;
}
.stockmovementexit {
color: #968822;
transform: rotate(0.3turn);
font-size: 1.2em;
}
.stockmovement {
font-size: 1.4em;
}
body[class*="colorblind-"] .text-warning{
color : <?php print $colorblind_deuteranopes_textWarning; ?>