initializing git repo
This commit is contained in:
commit
3df8fc53b8
86 changed files with 5649 additions and 0 deletions
155
pages/parts_by_store.php
Executable file
155
pages/parts_by_store.php
Executable file
|
|
@ -0,0 +1,155 @@
|
|||
<?php
|
||||
global $GlobalMysqlHandler;
|
||||
if (!isset($_SESSION['PartsByStoreStoreId'])) $_SESSION['PartsByStoreStoreId']=0;
|
||||
|
||||
function WriteTypeSelector ($ParentId)
|
||||
{
|
||||
global $GlobalMysqlHandler;
|
||||
global $GlobalContent;
|
||||
global $GlobalTemplate;
|
||||
|
||||
$ListQuery="SELECT * FROM `Storages` WHERE `ParentId` =$ParentId";
|
||||
$ListQuery=mysqli_query($GlobalMysqlHandler, $ListQuery);
|
||||
|
||||
if (!$ParentId || NestedListVisibilityIsSet($ParentId, 'PartStoreSelector'))
|
||||
$GlobalContent .= "<ul style=\"display:block;\">\n";
|
||||
else
|
||||
$GlobalContent .= "<ul style=\"display:none;\">\n";
|
||||
|
||||
if (mysqli_num_rows($ListQuery))
|
||||
{
|
||||
while ($ListData=mysqli_fetch_array($ListQuery))
|
||||
{
|
||||
$GlobalContent .= "<li>";
|
||||
if (!(isset($_SESSION['PartsByStoreStoreId']) && $_SESSION['PartsByStoreStoreId']==$ListData['Id']))
|
||||
$GlobalContent .= " <a href=\"index.php?Page=PartsByStore&ToDo=ToggleTypeSelectorVisibility&SublistId=".$ListData['Id']."\">";
|
||||
$GlobalContent .= LangStr2Html($ListData['Name']);
|
||||
if (!(isset($_SESSION['PartsByStoreStoreId']) && $_SESSION['PartsByStoreStoreId']==$ListData['Id']))
|
||||
$GlobalContent .= "</a>\n";
|
||||
if (NestedListCountSubElements($ListData['Id'], 'Storages'))
|
||||
WriteTypeSelector($ListData['Id']);
|
||||
$GlobalContent .= "</li>\n";
|
||||
}
|
||||
}
|
||||
$GlobalContent .= "</ul>\n";
|
||||
}
|
||||
|
||||
|
||||
///////////////
|
||||
// open sublist
|
||||
if ($ToDo=="ToggleTypeSelectorVisibility")
|
||||
{
|
||||
if (isset($_GET['SublistId']) && $_GET['SublistId'])
|
||||
{
|
||||
$ParentId = NestedListGetParentId($_GET['SublistId'], 'Storages');
|
||||
NestedListVisibilityUnsetAllElements('PartStoreSelector');
|
||||
NestedListVisibilitySetAllParents($_GET['SublistId'], 'PartStoreSelector', 'Storages');
|
||||
NestedListVisibilitySet($_GET['SublistId'], 'PartStoreSelector');
|
||||
$_SESSION['PartsByStoreStoreId'] = $_GET['SublistId'];
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLog("[parts_by_type.php] No SublistId to open type!");
|
||||
MessageError(LangSpell('SentenceUnknownError'));
|
||||
}
|
||||
$ToDo="";
|
||||
}
|
||||
|
||||
|
||||
///////////
|
||||
// Selector
|
||||
$GlobalContent .= '<div id="PartSelector">';
|
||||
$GlobalContent .= WriteTypeSelector (0);
|
||||
$GlobalContent .= '</div>'."\n";
|
||||
|
||||
////////////////
|
||||
// Sort Partlist
|
||||
if (!isset($_SESSION['SortPartListBy'])) $_SESSION['SortPartListBy']="Name";
|
||||
if (!isset($_SESSION['SortPartListOrder'])) $_SESSION['SortPartListOrder']="ASC";
|
||||
if (isset($_GET['SortBy']))
|
||||
{
|
||||
if ($_SESSION['SortPartListBy']==$_GET['SortBy']) //set order direction
|
||||
{
|
||||
if ($_SESSION['SortPartListOrder']=="ASC") $_SESSION['SortPartListOrder']="DESC";
|
||||
else $_SESSION['SortPartListOrder']="ASC";
|
||||
}
|
||||
else //set order by
|
||||
{
|
||||
$_SESSION['SortPartListBy']=$_GET['SortBy'];
|
||||
$_SESSION['SortPartListOrder']="ASC";
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////
|
||||
// Part List Begin
|
||||
$GlobalContent .= '<div id="PartList">';
|
||||
$GlobalContent .= '<table>'."\n";
|
||||
|
||||
//////////////////////
|
||||
// PartList Table Head
|
||||
$GlobalContent .= '<tr>';
|
||||
|
||||
//Name
|
||||
$GlobalContent .= '<th><a href="index.php?Page=PartsByStore&SortBy=Name" target="_top">';
|
||||
$GlobalContent .= LangSpellHtml('PartsName')." ";
|
||||
if ($_SESSION['SortPartListBy']=="Name" && $_SESSION['SortPartListOrder']=="ASC") $GlobalContent .= OtherGetIcon('SortUp',0);
|
||||
if ($_SESSION['SortPartListBy']=="Name" && $_SESSION['SortPartListOrder']=="DESC") $GlobalContent .= OtherGetIcon('SortDown',0);
|
||||
$GlobalContent .= '</a></th>';
|
||||
//Package
|
||||
$GlobalContent .= '<th><a href="index.php?Page=PartsByStore&SortBy=PackageId" target="_top">';
|
||||
$GlobalContent .= LangSpellHtml('PartsPackage')." ";
|
||||
if ($_SESSION['SortPartListBy']=="PackageId" && $_SESSION['SortPartListOrder']=="ASC") $GlobalContent .= OtherGetIcon('SortUp',0);
|
||||
if ($_SESSION['SortPartListBy']=="PackageId" && $_SESSION['SortPartListOrder']=="DESC") $GlobalContent .= OtherGetIcon('SortDown',0);
|
||||
$GlobalContent .= '</a></th>';
|
||||
//Quantity
|
||||
$GlobalContent .= '<th><a href="index.php?Page=PartsByStore&SortBy=Qty" target="_top">';
|
||||
$GlobalContent .= LangSpellHtml('PartsQuantity')." ";
|
||||
if ($_SESSION['SortPartListBy']=="Qty" && $_SESSION['SortPartListOrder']=="ASC") $GlobalContent .= OtherGetIcon('SortUp',0);
|
||||
if ($_SESSION['SortPartListBy']=="Qty" && $_SESSION['SortPartListOrder']=="DESC") $GlobalContent .= OtherGetIcon('SortDown',0);
|
||||
$GlobalContent .= '</a></th>';
|
||||
//Price
|
||||
$GlobalContent .= '<th><a href="index.php?Page=PartsByStore&SortBy=Price" target="_top">';
|
||||
$GlobalContent .= LangSpellHtml('PartsPrice')." ";
|
||||
if ($_SESSION['SortPartListBy']=="Price" && $_SESSION['SortPartListOrder']=="ASC") $GlobalContent .= OtherGetIcon('SortUp',0);
|
||||
if ($_SESSION['SortPartListBy']=="Price" && $_SESSION['SortPartListOrder']=="DESC") $GlobalContent .= OtherGetIcon('SortDown',0);
|
||||
$GlobalContent .= '</a></th>';
|
||||
//Obsolete
|
||||
$GlobalContent .= '<th>'.LangSpellHtml('PartsObsolete').'</th>';
|
||||
$GlobalContent .= '</tr>';
|
||||
|
||||
//////////////////////////
|
||||
// generate Partlist query
|
||||
$PartListQuery = "SELECT * FROM `Parts` WHERE `StorageId` = ".$_SESSION['PartsByStoreStoreId']."";
|
||||
$PartListQuery .= " ORDER BY `".$_SESSION['SortPartListBy']."` ".$_SESSION['SortPartListOrder'];
|
||||
//echo $PartListQuery;
|
||||
|
||||
/////////////////
|
||||
// Part List List
|
||||
$PartListQuery = mysqli_query($GlobalMysqlHandler, $PartListQuery);
|
||||
while ($Parts = mysqli_fetch_array($PartListQuery))
|
||||
{
|
||||
$GlobalContent .= ' <tr>';
|
||||
$GlobalContent .= ' <td><a href="index.php?Page=ShowPart&PartId='.$Parts['Id'].'" target="_top"><strong>'.$Parts['Name'].'</strong></a> '.$Parts['ShortDesc'].' </td>';
|
||||
//////////
|
||||
// Package
|
||||
$PackageQuery = "SELECT `Name` FROM `Packages` WHERE `Id` = ".$Parts['PackageId'];
|
||||
$PackageQuery = mysqli_query($GlobalMysqlHandler, $PackageQuery);
|
||||
if (mysqli_num_rows($PackageQuery))
|
||||
{
|
||||
$Package=mysqli_fetch_array($PackageQuery);
|
||||
$GlobalContent .= '<td>'.$Package['Name'].'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$GlobalContent .= '<td>-</td>';
|
||||
}
|
||||
$GlobalContent .= '<td>'.$Parts['Qty'].(($Parts['MinQty'])? "/".$Parts['MinQty']:"").'</td>';
|
||||
$GlobalContent .= '<td>'.OtherFormatPrice($Parts['Price']).'</td>';
|
||||
$GlobalContent .= '<td>'.((strtolower($Parts['Obsolete'])=="true")? LangSpellHtml('PartsObsolete'):"").'</td>';
|
||||
$GlobalContent .= ' </tr>';
|
||||
}
|
||||
|
||||
$GlobalContent .= '</table>'."\n";
|
||||
$GlobalContent .= '</div>'."\n";
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue