本文整理汇总了PHP中measuring_units_string函数的典型用法代码示例。如果您正苦于以下问题:PHP measuring_units_string函数的具体用法?PHP measuring_units_string怎么用?PHP measuring_units_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了measuring_units_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _autocomplete_lot_number
function _autocomplete_lot_number(&$PDOdb, $productid)
{
global $db, $conf, $langs;
$langs->load('other');
dol_include_once('/core/lib/product.lib.php');
$sql = "SELECT DISTINCT(lot_number),rowid, SUM(contenancereel_value) as qty, contenancereel_units as unit\n\t\t\tFROM " . MAIN_DB_PREFIX . "asset\n\t\t\tWHERE fk_product = " . $productid . " GROUP BY lot_number,contenancereel_units,rowid";
$PDOdb->Execute($sql);
$TLotNumber = array('');
$PDOdb->Execute($sql);
$Tres = $PDOdb->Get_All();
foreach ($Tres as $res) {
$asset = new TAsset();
$asset->load($PDOdb, $res->rowid);
$asset->load_asset_type($PDOdb);
//pre($asset,true);exit;
$TLotNumber[$res->lot_number]['lot_number'] = $res->lot_number;
$TLotNumber[$res->lot_number]['label'] = $res->lot_number . " / " . $res->qty . " " . ($asset->assetType->measuring_units == 'unit' ? 'unité(s)' : measuring_units_string($res->unit, $asset->assetType->measuring_units));
}
return $TLotNumber;
}
示例2: beforePDFCreation
/** Overloading the doActions function : replacing the parent's function with the one below
* @param parameters meta datas of the hook (context, etc...)
* @param object the object you want to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
* @param action current action (if set). Generally create or edit or null
* @return void
*/
function beforePDFCreation($parameters, &$object, &$action, $hookmanager)
{
// pour implementation dans Dolibarr 3.7
if (in_array('pdfgeneration', explode(':', $parameters['context']))) {
define('INC_FROM_DOLIBARR', true);
dol_include_once('/dispatch/config.php');
dol_include_once('/asset/class/asset.class.php');
dol_include_once('/dispatch/class/dispatchdetail.class.php');
global $conf;
if (isset($parameters['object']) && get_class($object) == 'Expedition') {
$PDOdb = new TPDOdb();
foreach ($object->lines as &$line) {
$sql = 'SELECT DISTINCT(lot_number),rowid FROM ' . MAIN_DB_PREFIX . 'expeditiondet_asset WHERE fk_expeditiondet = ' . $line->line_id;
$PDOdb->Execute($sql);
$TRes = $PDOdb->Get_All();
if (count($TRes) > 0) {
$line->desc .= "<br>Lot(s) expédié(s) : ";
foreach ($TRes as $res) {
$dispatchDetail = new TDispatchDetail();
$dispatchDetail->load($PDOdb, $res->rowid);
$asset = new TAsset();
$asset->load($PDOdb, $dispatchDetail->fk_asset);
$asset->load_asset_type($PDOdb);
$unite = $asset->assetType->measuring_units == 'unit' ? 'unité(s)' : measuring_units_string($dispatchDetail->weight_reel_unit, $asset->assetType->measuring_units);
$desc = "<br>- " . $res->lot_number . " x " . $dispatchDetail->weight_reel . " " . $unite;
if (empty($conf->global->DISPATCH_HIDE_DLUO_PDF)) {
$desc .= ' (DLUO : ' . $asset->get_date('dluo') . ')';
}
$line->desc .= $desc;
}
}
}
}
//pre($object,true);exit;
}
}
示例3: measuring_units_string
} else {
print ' ';
}
print "</td></tr>\n";
// Surface
print '<tr><td>' . $langs->trans("Surface") . '</td><td colspan="2">';
if ($object->surface != '') {
print $object->surface . " " . measuring_units_string($object->surface_units, "surface");
} else {
print ' ';
}
print "</td></tr>\n";
// Volume
print '<tr><td>' . $langs->trans("Volume") . '</td><td colspan="2">';
if ($object->volume != '') {
print $object->volume . " " . measuring_units_string($object->volume_units, "volume");
} else {
print ' ';
}
print "</td></tr>\n";
}
// Unit
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$unit = $object->getLabelOfUnit();
print '<tr><td>' . $langs->trans('DefaultUnitToShow') . '</td><td>';
if ($unit !== '') {
print $langs->trans($unit);
}
print '</td></tr>';
}
// Custom code
示例4: getNomUrl
/**
* Return clicable link of object (with eventually picto)
*
* @param int $withpicto Add picto into link
* @param string $option Where point the link
* @param int $maxlength Maxlength of ref
* @return string String with URL
*/
function getNomUrl($withpicto = 0, $option = '', $maxlength = 0)
{
global $conf, $langs;
include_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
$result = '';
$newref = $this->ref;
if ($maxlength) {
$newref = dol_trunc($newref, $maxlength, 'middle');
}
if ($this->type == Product::TYPE_PRODUCT) {
$label = '<u>' . $langs->trans("ShowProduct") . '</u>';
}
if ($this->type == Product::TYPE_SERVICE) {
$label = '<u>' . $langs->trans("ShowService") . '</u>';
}
if (!empty($this->ref)) {
$label .= '<br><b>' . $langs->trans('ProductRef') . ':</b> ' . $this->ref;
}
if (!empty($this->label)) {
$label .= '<br><b>' . $langs->trans('ProductLabel') . ':</b> ' . $this->label;
}
$tmptext = '';
if ($this->weight) {
$tmptext .= "<br>" . $langs->trans("Weight") . ': ' . $this->weight . ' ' . measuring_units_string($this->weight_units, "weight");
}
if ($this->length) {
$tmptext .= "<br>" . $langs->trans("Length") . ': ' . $this->length . ' ' . measuring_units_string($this->length_units, 'length');
}
if ($this->surface) {
$tmptext .= "<br>" . $langs->trans("Surface") . ': ' . $this->surface . ' ' . measuring_units_string($this->surface_units, 'surface');
}
if ($this->volume) {
$tmptext .= "<br>" . $langs->trans("Volume") . ': ' . $this->volume . ' ' . measuring_units_string($this->volume_units, 'volume');
}
if ($tmptext) {
$label .= $tmptext;
}
if (!empty($this->entity)) {
$label .= '<br>' . $this->show_photos($conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 80);
}
$linkclose = '" title="' . str_replace('\\n', '', dol_escape_htmltag($label, 1)) . '" class="classfortooltip">';
if ($option == 'supplier') {
$link = '<a href="' . DOL_URL_ROOT . '/product/fournisseurs.php?id=' . $this->id . $linkclose;
$linkend = '</a>';
} else {
if ($option == 'stock') {
$link = '<a href="' . DOL_URL_ROOT . '/product/stock/product.php?id=' . $this->id . $linkclose;
$linkend = '</a>';
} else {
if ($option == 'composition') {
$link = '<a href="' . DOL_URL_ROOT . '/product/composition/card.php?id=' . $this->id . $linkclose;
$linkend = '</a>';
} else {
if ($option == 'category') {
$link = '<a href="' . DOL_URL_ROOT . '/categories/categorie.php?id=' . $this->id . '&type=0' . $linkclose;
} else {
$link = '<a href="' . DOL_URL_ROOT . '/product/card.php?id=' . $this->id . $linkclose;
$linkend = '</a>';
}
}
}
}
if ($withpicto) {
if ($this->type == Product::TYPE_PRODUCT) {
$result .= $link . img_object($langs->trans("ShowProduct") . ' ' . $this->label, 'product', 'class="classfortooltip"') . $linkend . ' ';
}
if ($this->type == Product::TYPE_SERVICE) {
$result .= $link . img_object($langs->trans("ShowService") . ' ' . $this->label, 'service', 'class="classfortooltip"') . $linkend . ' ';
}
}
$result .= $link . $newref . $linkend;
return $result;
}
示例5:
// Surface
print '<tr><td>'.$langs->trans("Surface").'</td><td colspan="2">';
if ($product->surface != '')
{
print $product->surface." ".measuring_units_string($product->surface_units,"surface");
}
else
{
print ' ';
}
print "</td></tr>\n";
// Volume
print '<tr><td>'.$langs->trans("Volume").'</td><td colspan="2">';
if ($product->volume != '')
{
print $product->volume." ".measuring_units_string($product->volume_units,"volume");
}
else
{
print ' ';
}
print "</td></tr>\n";
}
// Custom code
print '<tr><td>'.$langs->trans("CustomCode").'</td><td colspan="2">'.$product->customcode.'</td>';
// Origin country code
print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td colspan="2">'.getCountry($product->country_id,0,$db).'</td>';
示例6: get_substitutionarray_shipment_lines
/**
* Define array with couple substitution key => substitution value
*
* @param array $line Array of lines
* @param Translate $outputlangs Lang object to use for output
* @return array Substitution array
*/
function get_substitutionarray_shipment_lines($line, $outputlangs)
{
global $conf;
dol_include_once('/core/lib/product.lib.php');
return array('line_fulldesc' => doc_getlinedesc($line, $outputlangs), 'line_product_ref' => $line->product_ref, 'line_product_label' => $line->product_label, 'line_desc' => $line->desc, 'line_vatrate' => vatrate($line->tva_tx, true, $line->info_bits), 'line_up' => price($line->subprice), 'line_qty' => $line->qty, 'line_qty_shipped' => $line->qty_shipped, 'line_qty_asked' => $line->qty_asked, 'line_discount_percent' => $line->remise_percent ? $line->remise_percent . '%' : '', 'line_price_ht' => price($line->total_ht), 'line_price_ttc' => price($line->total_ttc), 'line_price_vat' => price($line->total_tva), 'line_weight' => empty($line->weight) ? '' : $line->weight * $line->qty_shipped . ' ' . measuring_units_string($line->weight_units, 'weight'), 'line_length' => empty($line->length) ? '' : $line->length * $line->qty_shipped . ' ' . measuring_units_string($line->length_units, 'size'), 'line_surface' => empty($line->surface) ? '' : $line->surface * $line->qty_shipped . ' ' . measuring_units_string($line->surface_units, 'surface'), 'line_volume' => empty($line->volume) ? '' : $line->volume * $line->qty_shipped . ' ' . measuring_units_string($line->volume_units, 'volume'));
}
示例7: assign_values
//.........这里部分代码省略.........
// Price
$this->tpl['price'] = $this->price;
$this->tpl['price_min'] = $this->price_min;
$this->tpl['price_base_type'] = $form->load_PriceBaseType($this->price_base_type, "price_base_type");
// VAT
$this->tpl['tva_tx'] = $form->load_tva("tva_tx", -1, $mysoc, '');
}
if ($action == 'create' || $action == 'edit') {
// Status
$statutarray = array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
$this->tpl['status'] = $form->selectarray('statut', $statutarray, $this->status);
//To Buy
$statutarray = array('1' => $langs->trans("Yes"), '0' => $langs->trans("No"));
$this->tpl['tobuy'] = $form->selectarray('tobuy', $statutarray, $this->status_buy);
$this->tpl['description'] = $this->description;
$this->tpl['note'] = $this->note;
}
if ($action == 'view') {
$head = product_prepare_head($this->object, $user);
$this->tpl['showrefnav'] = $form->showrefnav($this->object, 'ref', '', 1, 'ref');
$titre = $langs->trans("CardProduct" . $this->object->type);
$picto = $this->object->type == 1 ? 'service' : 'product';
$this->tpl['showhead'] = dol_get_fiche_head($head, 'card', $titre, 0, $picto);
$this->tpl['showend'] = dol_get_fiche_end();
// Accountancy buy code
$this->tpl['accountancyBuyCodeKey'] = $form->editfieldkey("ProductAccountancyBuyCode", 'productaccountancycodesell', $this->accountancy_code_sell, $this, $user->rights->produit->creer);
$this->tpl['accountancyBuyCodeVal'] = $form->editfieldval("ProductAccountancyBuyCode", 'productaccountancycodesell', $this->accountancy_code_sell, $this, $user->rights->produit->creer);
// Accountancy sell code
$this->tpl['accountancySellCodeKey'] = $form->editfieldkey("ProductAccountancySellCode", 'productaccountancycodebuy', $this->accountancy_code_buy, $this, $user->rights->produit->creer);
$this->tpl['accountancySellCodeVal'] = $form->editfieldval("ProductAccountancySellCode", 'productaccountancycodebuy', $this->accountancy_code_buy, $this, $user->rights->produit->creer);
}
$this->tpl['finished'] = $this->object->finished;
$this->tpl['ref'] = $this->object->ref;
$this->tpl['label'] = $this->object->label;
$this->tpl['id'] = $this->object->id;
$this->tpl['type'] = $this->object->type;
$this->tpl['note'] = $this->object->note;
$this->tpl['seuil_stock_alerte'] = $this->object->seuil_stock_alerte;
if ($action == 'create') {
// Title
$this->tpl['title'] = $langs->trans("NewProduct");
}
if ($action == 'edit') {
$this->tpl['title'] = $langs->trans('Modify') . ' ' . $langs->trans('Product') . ' : ' . $this->object->ref;
}
if ($action == 'create' || $action == 'edit') {
// Status
$statutarray = array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
$this->tpl['status'] = $form->selectarray('statut', $statutarray, $_POST["statut"]);
$statutarray = array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy"));
$this->tpl['status_buy'] = $form->selectarray('statut_buy', $statutarray, $_POST["statut_buy"]);
// Finished
$statutarray = array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
$this->tpl['finished'] = $form->selectarray('finished', $statutarray, $this->object->finished);
// Weight
$this->tpl['weight'] = $this->object->weight;
$this->tpl['weight_units'] = $formproduct->load_measuring_units("weight_units", "weight", $this->object->weight_units);
// Length
$this->tpl['length'] = $this->object->length;
$this->tpl['length_units'] = $formproduct->load_measuring_units("length_units", "size", $this->object->length_units);
// Surface
$this->tpl['surface'] = $this->object->surface;
$this->tpl['surface_units'] = $formproduct->load_measuring_units("surface_units", "surface", $this->object->surface_units);
// Volume
$this->tpl['volume'] = $this->object->volume;
$this->tpl['volume_units'] = $formproduct->load_measuring_units("volume_units", "volume", $this->object->volume_units);
}
if ($action == 'view') {
// Status
$this->tpl['status'] = $this->object->getLibStatut(2, 0);
$this->tpl['status_buy'] = $this->object->getLibStatut(2, 1);
// Photo
$this->tpl['nblignes'] = 4;
if ($this->object->is_photo_available($conf->product->multidir_output[$this->object->entity])) {
$this->tpl['photos'] = $this->object->show_photos($conf->product->multidir_output[$this->object->entity], 1, 1, 0, 0, 0, 80);
}
// Nature
$this->tpl['finished'] = $this->object->getLibFinished();
// Weight
if ($this->object->weight != '') {
$this->tpl['weight'] = $this->object->weight . " " . measuring_units_string($this->object->weight_units, "weight");
}
// Length
if ($this->object->length != '') {
$this->tpl['length'] = $this->object->length . " " . measuring_units_string($this->object->length_units, "size");
}
// Surface
if ($this->object->surface != '') {
$this->tpl['surface'] = $this->object->surface . " " . measuring_units_string($this->object->surface_units, "surface");
}
// Volume
if ($this->object->volume != '') {
$this->tpl['volume'] = $this->object->volume . " " . measuring_units_string($this->object->volume_units, "volume");
}
$this->tpl['fiche_end'] = dol_get_fiche_end();
}
if ($action == 'list') {
$this->LoadListDatas($GLOBALS['limit'], $GLOBALS['offset'], $GLOBALS['sortfield'], $GLOBALS['sortorder']);
}
}
示例8: tabImport
function tabImport(&$TImport, &$expedition)
{
global $langs, $db;
$form = new TFormCore();
$formDoli = new Form($db);
$formproduct = new FormProduct($db);
$PDOdb = new TPDOdb();
print count($TImport) . ' équipement(s) dans votre expédition';
?>
<table width="100%" class="border">
<tr class="liste_titre">
<td>Produit</td>
<td>Numéro de série</td>
<td>Numéro de Lot</td>
<td>Quantité</td>
<td> </td>
</tr>
<?php
$prod = new Product($db);
$form->Set_typeaff('view');
if (is_array($TImport)) {
foreach ($TImport as $k => $line) {
if ($prod->id == 0 || $line['ref'] != $prod->ref) {
if (!empty($line['fk_product'])) {
$prod->fetch($line['fk_product']);
} else {
$prod->fetch('', $line['ref']);
}
}
$asset = new TAsset();
$asset->loadBy($PDOdb, $line['numserie'], 'serial_number');
$asset->load_asset_type($PDOdb);
$assetLot = new TAssetLot();
$assetLot->loadBy($PDOdb, $line['lot_number'], 'lot_number');
$Trowid = TRequeteCore::get_id_from_what_you_want($PDOdb, MAIN_DB_PREFIX . "expeditiondet_asset", array('fk_asset' => $asset->rowid, 'fk_expeditiondet' => $line['fk_expeditiondet']));
?>
<tr>
<td><?php
echo $prod->getNomUrl(1) . $form->hidden('TLine[' . $k . '][fk_product]', $prod->id) . $form->hidden('TLine[' . $k . '][ref]', $prod->ref);
?>
</td>
<td><a href="<?php
echo dol_buildpath('/asset/fiche.php?id=' . $asset->rowid, 1);
?>
"><?php
echo $form->texte('', 'TLine[' . $k . '][numserie]', $line['numserie'], 30);
?>
</a></td>
<td><a href="<?php
echo dol_buildpath('/asset/fiche_lot.php?id=' . $assetLot->rowid, 1);
?>
"><?php
echo $form->texte('', 'TLine[' . $k . '][lot_number]', $line['lot_number'], 30);
?>
</a></td>
<td><?php
echo $line['quantity'] . " " . ($asset->assetType->measuring_units == 'unit' ? 'unité(s)' : measuring_units_string($line['quantity_unit'], $asset->assetType->measuring_units));
?>
</td>
<td>
<?php
if ($expedition->statut != 1) {
echo '<a href="?action=DELETE_LINE&k=' . $k . '&id=' . $expedition->id . '&rowid=' . $Trowid[0] . '">' . img_delete() . '</a>';
}
?>
</td>
</tr>
<?php
}
}
?>
</table>
<br>
<?php
}
示例9: measuring_units_string
// Volume
print '<tr><td>';
print $langs->trans("Volume");
print '</td>';
print '<td colspan="3">';
$calculatedVolume = 0;
if ($object->trueWidth && $object->trueHeight && $object->trueDepth) {
$calculatedVolume = $object->trueWidth * $object->trueHeight * $object->trueDepth;
}
// If sending volume not defined we use sum of products
if ($calculatedVolume > 0) {
print $calculatedVolume . ' ';
if ($volumeUnit < 50) {
print measuring_units_string(0, "volume");
} else {
print measuring_units_string($volumeUnit, "volume");
}
}
if ($totalVolume > 0) {
if ($calculatedVolume) {
print ' (' . $langs->trans("SumOfProductVolumes") . ': ';
}
print $totalVolume;
if ($calculatedVolume) {
print ')';
}
}
print "</td>\n";
print '</tr>';
// Status
print '<tr><td>' . $langs->trans("Status") . '</td>';
示例10: createPdf
//.........这里部分代码省略.........
$pdf->MultiCell(65, 5, dol_trunc($mysoc->nom, 25), 0, 'L');
$flag = 1;
} elseif ($conf->global->LAB_PROD_LABEL) {
$pdf->MultiCell(65, 5, dol_trunc($product->libelle, 25), 0, 'L');
$flag = 2;
} else {
$pdf->MultiCell(65, 5, dol_trunc($conf->global->LAB_FREE_TEXT, 25), 0, 'L');
$flag = 3;
}
$pdf->SetFont('dejavusans', '', 10);
//Position Y
$PosYLabel = $PosY + $Line + 2;
//Product label
$pdf->SetXY($PosXLabel, $PosYLabel);
if ($flag == 1) {
if ($conf->global->LAB_PROD_LABEL) {
$pdf->Cell(25, 5, dol_trunc($product->libelle, 25), 0, 0, 'L');
} else {
$pdf->Cell(25, 5, dol_trunc($conf->global->LAB_FREE_TEXT, 25), 0, 0, 'L');
}
}
if ($flag == 2) {
$pdf->Cell(25, 5, dol_trunc($conf->global->LAB_FREE_TEXT, 25), 0, 0, 'L');
} else {
$pdf->Cell(25, 5, "", 0, 0, 'L');
}
//$pdf->Cell(25,5,dol_trunc($product->libelle,25),0,0,'L');
//$pdf->Write($Line,dol_trunc($product->libelle,25));
$PosYLabel = $PosYLabel + $Line + 2;
$pdf->SetXY($PosXLabel, $PosYLabel);
//Barcode
if ($conf->barcode->enabled) {
$product->fetch_barcode();
$pdf->write1DBarcode($product->barcode, $product->barcode_type_code, '', '', 35, 18, 0.4, $style, 'N');
}
//Price
$pdf->SetFont('dejavusans', 'B', 10);
if (empty($conf->global->PRODUIT_MULTIPRICES)) {
$labelPrice = price($product->price_ttc);
} else {
$labelPrice = price($product->multiprices_ttc[$objp->price_level]);
}
$pdf->SetXY($PosXLabel + 38, $PosYLabel);
$pdf->Cell(25, 5, $labelPrice, 0, 0, 'R');
$PosYLabel = $PosYLabel + $Line + 1;
$labelPrice = $langs->trans(currency_name($conf->currency));
$pdf->SetXY($PosXLabel + 38, $PosYLabel);
$pdf->Cell(25, 5, $labelPrice, 0, 0, 'R');
$PosYLabel = $PosYLabel + $Line;
if ($conf->global->LAB_WEIGHT) {
$labelSet = $product->weight;
$labelSet .= " " . measuring_units_string($product->weight_units, "weight");
} elseif ($conf->global->LAB_LENGTH) {
$labelSet = $product->length;
$labelSet .= " " . measuring_units_string($product->length_units, "size");
} elseif ($conf->global->LAB_AREA) {
$labelSet = $product->surface;
$labelSet .= " " . measuring_units_string($product->surface_units, "surface");
} elseif ($conf->global->LAB_VOLUME) {
$labelSet = $product->volume;
$labelSet .= " " . measuring_units_string($product->volume_units, "volume");
} elseif ($conf->global->LAB_COUNTRY) {
$labelSet = getCountry($product->country_id, '', 0, $langs, 0);
}
$pdf->SetXY($PosXLabel + 38, $PosYLabel);
$pdf->Cell(25, 5, $labelSet, 0, 0, 'R');
$pdf->SetAutoPageBreak(false);
$PosX = $PosX + 70;
if ($PosX >= 200) {
$PosX = 5;
if ($conf->global->MAIN_MODULE_LABELPRINT_LABELS_0) {
$PosY = $PosY + 36;
} else {
$PosY = $PosY + 37;
}
if ($PosY >= 265) {
if ($conf->global->MAIN_MODULE_LABELPRINT_LABELS_0) {
$PosY = 5;
} else {
$PosY = 4;
}
$pdf->AddPage();
}
}
$n++;
}
$i++;
}
}
ini_set('display_errors', 'Off');
$buf = $pdf->Output("", "S");
$len = strlen($buf);
//$file_temp = ini_get("session.save_path")."/".dol_now().".pdf";
$file_temp = DOL_DATA_ROOT . "/" . dol_now() . ".pdf";
$gestor = fopen($file_temp, "w");
fwrite($gestor, $buf);
fclose($gestor);
$url = dol_buildpath("/labelprint/download.php", 1) . "?file=" . $file_temp;
print "<meta http-equiv='refresh' content='0;url=" . $url . "'>";
}
示例11: dol_include_once
<?php
require 'config.php';
dol_include_once('/core/lib/product.lib.php');
$langs->load("other");
llxHeader('', 'Liste des expéditions à préparer', '', '');
$ATMdb = new TPDOdb();
$sql = "SELECT s.rowid as soc_id, s.nom as soc_nom, e.rowid as expe_id, e.ref as expe_ref, c.rowid as comm_id, c.ref as comm_ref, ";
$sql .= "p.rowid as prod_id, CONCAT(p.ref, ' ', p.label) as prod_ref, cd.qty, cd.tarif_poids, cd.poids, cd.asset_lot ";
$sql .= "FROM " . MAIN_DB_PREFIX . "expedition e ";
$sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "expeditiondet ed ON ed.fk_expedition = e.rowid ";
//$sql.= "LEFT JOIN ".MAIN_DB_PREFIX."element_element ee ON ee.fk_target = e.rowid AND ee.targettype = 'shipping' ";
//$sql.= "LEFT JOIN ".MAIN_DB_PREFIX."commande c ON ee.fk_source = c.rowid AND ee.sourcetype = 'commande' ";
$sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "commandedet cd ON ed.fk_origin_line = cd.rowid ";
$sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "commande c ON cd.fk_commande = c.rowid ";
$sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "product p ON cd.fk_product = p.rowid ";
$sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "societe s ON c.fk_soc = s.rowid ";
$sql .= "WHERE e.fk_statut = 0 ";
$sql .= "ORDER BY prod_ref, soc_nom";
$r = new TListviewTBS('expe');
$measuring_units = array(-9 => 1, -6 => 1, -3 => 1, 0 => 1, 3 => 1, 99 => 1, 100 => 1);
foreach ($measuring_units as $key => $value) {
$TPoids[$key] = measuring_units_string($key, 'weight');
}
echo $r->render($ATMdb, $sql, array('limit' => array('nbLine' => '30'), 'link' => array('soc_nom' => '<a href="' . DOL_URL_ROOT . '/societe/soc.php?socid=@soc_id@">' . img_picto('', 'object_company.png', '', 0) . ' @val@</a>', 'expe_ref' => '<a href="' . DOL_URL_ROOT . '/expedition/fiche.php?id=@expe_id@">' . img_picto('', 'object_sending.png', '', 0) . ' @val@</a>', 'comm_ref' => '<a href="' . DOL_URL_ROOT . '/commande/fiche.php?id=@comm_id@">' . img_picto('', 'object_order.png', '', 0) . ' @val@</a>', 'prod_ref' => '<a href="' . DOL_URL_ROOT . '/product/fiche.php?id=@prod_id@">' . img_picto('', 'object_product.png', '', 0) . ' @val@</a>'), 'translate' => array('poids' => $TPoids), 'hide' => array('soc_id', 'expe_id', 'comm_id', 'prod_id'), 'type' => array('tarif_poids' => 'number', 'qty' => 'number'), 'liste' => array('titre' => 'Liste des expéditions à préparer', 'image' => img_picto('', 'title.png', '', 0), 'picto_precedent' => img_picto('', 'back.png', '', 0), 'picto_suivant' => img_picto('', 'next.png', '', 0), 'noheader' => (int) isset($_REQUEST['fk_soc']) | (int) isset($_REQUEST['fk_product']), 'messageNothing' => "Il n'y a aucunes expédition à afficher", 'picto_search' => img_picto('', 'search.png', '', 0)), 'title' => array('soc_nom' => 'Client', 'expe_ref' => 'Expédition', 'comm_ref' => 'Commande', 'prod_ref' => 'Produit', 'qty' => 'Quantité', 'tarif_poids' => 'Poids', 'asset_lot' => 'Lot')));
llxFooter();
示例12: generateODTOF
function generateODTOF(&$PDOdb, &$assetOf)
{
global $db, $conf, $TProductCachegenerateODTOF;
$TBS = new TTemplateTBS();
dol_include_once("/product/class/product.class.php");
$TToMake = array();
// Tableau envoyé à la fonction render contenant les informations concernant les produit à fabriquer
$TNeeded = array();
// Tableau envoyé à la fonction render contenant les informations concernant les produit nécessaires
$TWorkstations = array();
// Tableau envoyé à la fonction render contenant les informations concernant les stations de travail
$TWorkstationUser = array();
// Tableau de liaison entre les postes et les utilisateurs
$TWorkstationTask = array();
// Tableau de liaison entre les postes et les tâches 'mode opératoire'
$TAssetWorkstation = array();
// Tableau de liaison entre les composants et les postes de travails
$TControl = array();
// Tableau de liaison entre l'OF et les controles associés
$societe = new Societe($db);
$societe->fetch($assetOf->fk_soc);
//pre($societe,true); exit;
if (!empty($conf->global->ASSET_USE_CONTROL)) {
$TControl = $assetOf->getControlPDF($PDOdb);
}
if (empty($TProductCachegenerateODTOF)) {
$TProductCachegenerateODTOF = array();
}
// On charge les tableaux de produits à fabriquer, et celui des produits nécessaires
foreach ($assetOf->TAssetOFLine as $k => &$v) {
if (!isset($TProductCachegenerateODTOF[$v->fk_product])) {
$prod_cache = new Product($db);
if ($prod_cache->fetch($v->fk_product) > 0) {
$prod_cache->fetch_optionals($prod_cache->id);
$TProductCachegenerateODTOF[$v->fk_product] = $prod_cache;
}
} else {
//echo 'cache '.$v->fk_product.':'.$TProductCachegenerateODTOF[$v->fk_product]->ref.' / '.$TProductCachegenerateODTOF[$v->fk_product]->id.'<br />';
}
$prod =& $TProductCachegenerateODTOF[$v->fk_product];
if ($conf->nomenclature->enabled) {
$n = new TNomenclature();
if (!empty($v->fk_nomenclature)) {
$n->load($PDOdb, $v->fk_nomenclature);
$TTypesProductsNomenclature = $n->getArrayTypesProducts();
}
}
$qty = !empty($v->qty_needed) ? $v->qty_needed : $v->qty;
if (!empty($conf->asset->enabled)) {
$TAssetType = new TAsset_type();
$TAssetType->load($PDOdb, $prod->array_options['options_type_asset']);
$unitLabel = $TAssetType->measuring_units == 'unit' || $TAssetType->gestion_stock == 'UNIT' ? 'unité(s)' : measuring_units_string($prod->weight_units, 'weight');
} else {
$unitLabel = 'unité(s)';
}
if ($v->type == "TO_MAKE") {
$TToMake[] = array('type' => $v->type, 'qte' => $qty . " " . utf8_decode($unitLabel), 'nomProd' => $prod->ref, 'designation' => utf8_decode($prod->label), 'dateBesoin' => date("d/m/Y", $assetOf->date_besoin), 'lot_number' => $v->lot_number ? "\n(Lot numero " . $v->lot_number . ")" : "", 'code_suivi_ponderal' => $prod->array_options['options_suivi_ponderal'] ? "\n" . $prod->array_options['options_suivi_ponderal'] : "\n(Aucun)");
} else {
if ($v->type == "NEEDED") {
$TNeeded[] = array('type' => $conf->nomenclature->enabled ? $TTypesProductsNomenclature[$v->fk_product] : $v->type, 'qte' => $qty, 'nomProd' => $prod->ref, 'designation' => utf8_decode($prod->label), 'dateBesoin' => date("d/m/Y", $assetOf->date_besoin), 'poids' => $prod->weight ? $prod->weight : 1, 'unitPoids' => utf8_decode($unitLabel), 'finished' => $prod->finished ? "PM" : "MP", 'lot_number' => $v->lot_number ? "\n(Lot numero " . $v->lot_number . ")" : "", 'code_suivi_ponderal' => $prod->array_options['options_suivi_ponderal'] ? "\n(Code suivi ponderal : " . $prod->array_options['options_suivi_ponderal'] . ")" : "");
if (!empty($conf->global->ASSET_DEFINED_WORKSTATION_BY_NEEDED)) {
$TAssetWorkstation[] = array('nomProd' => utf8_decode($prod->label), 'workstations' => utf8_decode($v->getWorkstationsPDF($db)));
}
}
}
}
//exit;
// On charge le tableau d'infos sur les stations de travail de l'OF courant
foreach ($assetOf->TAssetWorkstationOF as $k => $v) {
$TWorkstations[] = array('libelle' => utf8_decode($v->ws->libelle), 'nb_hour_max' => utf8_decode($v->ws->nb_hour_capacity), 'nb_hour_real' => utf8_decode($v->nb_hour_real), 'nb_hour_preparation' => utf8_decode($v->nb_hour_prepare), 'nb_heures_prevues' => utf8_decode($v->nb_hour));
if (!empty($conf->global->ASSET_DEFINED_USER_BY_WORKSTATION)) {
$TWorkstationUser[] = array('workstation' => utf8_decode($v->ws->libelle), 'users' => utf8_decode($v->getUsersPDF($PDOdb)));
}
if (!empty($conf->global->ASSET_DEFINED_OPERATION_BY_WORKSTATION)) {
$TWorkstationTask[] = array('workstation' => utf8_decode($v->ws->libelle), 'tasks' => utf8_decode($v->getTasksPDF($PDOdb)));
}
}
$dirName = 'OF' . $assetOf->rowid . '(' . date("d_m_Y") . ')';
$dir = DOL_DATA_ROOT . ($conf->entity > 1 ? '/' . $conf->entity : '') . '/of/' . $dirName . '/';
@mkdir($dir, 0777, true);
if (defined('TEMPLATE_OF')) {
$template = TEMPLATE_OF;
} else {
$template = "templateOF.odt";
//$template = "templateOF.doc";
}
$refcmd = '';
if (!empty($assetOf->fk_commande)) {
$cmd = new Commande($db);
$cmd->fetch($assetOf->fk_commande);
$refcmd = $cmd->ref;
}
$barcode_pic = getBarCodePicture($assetOf);
//var_dump($TToMake);
$file_path = $TBS->render(dol_buildpath('/of/exempleTemplate/' . $template), array('lignesToMake' => $TToMake, 'lignesNeeded' => $TNeeded, 'lignesWorkstation' => $TWorkstations, 'lignesAssetWorkstations' => $TAssetWorkstation, 'lignesUser' => $TWorkstationUser, 'lignesTask' => $TWorkstationTask, 'lignesControl' => $TControl), array('date' => date("d/m/Y"), 'numeroOF' => $assetOf->numero, 'statutOF' => utf8_decode(TAssetOF::$TStatus[$assetOf->status]), 'prioriteOF' => utf8_decode(TAssetOF::$TOrdre[$assetOf->ordre]), 'date' => date("d/m/Y"), 'refcmd' => $refcmd, 'societe' => $societe->name, 'logo' => DOL_DATA_ROOT . "/mycompany/logos/" . MAIN_INFO_SOCIETE_LOGO, 'barcode' => $barcode_pic, 'use_lot' => (int) $conf->global->ASSET_DEFINED_WORKSTATION_BY_NEEDED, 'defined_user' => (int) $conf->global->ASSET_DEFINED_USER_BY_WORKSTATION, 'defined_task' => (int) $conf->global->ASSET_DEFINED_OPERATION_BY_WORKSTATION, 'use_control' => (int) $conf->global->ASSET_USE_CONTROL), array(), array('outFile' => $dir . $assetOf->numero . ".odt", "convertToPDF" => true));
return array('file_path' => $file_path, 'dir_name' => $dirName, 'num_of' => $assetOf->numero);
header("Location: " . DOL_URL_ROOT . "/document.php?modulepart=of&entity=1&file=" . $dirName . "/" . $assetOf->numero . ".pdf");
//header("Location: ".DOL_URL_ROOT."/document.php?modulepart=asset&entity=1&file=".$dirName."/".$assetOf->numero.".doc");
}
示例13: Entrepot
// Qte commande
print '<td align="center">'.$lines[$i]->qty_asked.'</td>';
// Qte a expedier ou expedier
print '<td align="center">'.$lines[$i]->qty_shipped.'</td>';
// Weight
print '<td align="center">';
if ($lines[$i]->fk_product_type == 0) print $lines[$i]->weight*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->weight_units,"weight");
else print ' ';
print '</td>';
// Volume
print '<td align="center">';
if ($lines[$i]->fk_product_type == 0) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume");
else print ' ';
print '</td>';
// Size
//print '<td align="center">'.$lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume").'</td>';
// Entrepot source
if ($conf->stock->enabled)
{
print '<td align="left">';
if ($lines[$i]->entrepot_id > 0)
{
$entrepot = new Entrepot($db);
$entrepot->fetch($lines[$i]->entrepot_id);
print $entrepot->getNomUrl(1);
示例14: tabImport
//.........这里部分代码省略.........
?>
</td>
<td rel="entrepotChild" fk_product="<?php
echo $prod->id;
?>
"><?php
$formproduct = new FormProduct($db);
$formproduct->loadWarehouses();
if (count($formproduct->cache_warehouses) > 1) {
print $formproduct->selectWarehouses($line['fk_warehouse'], 'TLine[' . $k . '][entrepot]', '', 1, 0, $prod->id, '', 0, 1);
} elseif (count($formproduct->cache_warehouses) == 1) {
print $formproduct->selectWarehouses($line['fk_warehouse'], 'TLine[' . $k . '][entrepot]', '', 0, 0, $prod->id, '', 0, 1);
} else {
print $langs->trans("NoWarehouseDefined");
}
?>
</td>
<?php
if (!empty($conf->global->ASSET_SHOW_DLUO)) {
?>
<td><?php
echo $form->calendrier('', 'TLine[' . $k . '][dluo]', date('d/m/Y', strtotime($line['dluo'])));
?>
</td>
<?php
}
if (empty($conf->global->DISPATCH_USE_ONLY_UNIT_ASSET_RECEPTION)) {
?>
<td><?php
echo $form->texte('', 'TLine[' . $k . '][quantity]', $line['quantity'], 10);
?>
</td><?php
if (!empty($conf->global->DISPATCH_SHOW_UNIT_RECEPTION)) {
echo '<td>' . ($commande->statut < 5) ? $formproduct->select_measuring_units('TLine[' . $k . '][quantity_unit]', 'weight', $line['quantity_unit']) : measuring_units_string($line['quantity_unit'], 'weight') . '</td>';
}
} else {
echo $form->hidden('TLine[' . $k . '][quantity]', $line['quantity']);
echo $form->hidden('TLine[' . $k . '][quantity_unit]', $line['quantity_unit']);
}
if ($conf->global->clinomadic->enabled) {
?>
<td><?php
echo $form->texte('', 'TLine[' . $k . '][imei]', $line['imei'], 30);
?>
</td>
<td><?php
echo $form->texte('', 'TLine[' . $k . '][firmware]', $line['firmware'], 30);
?>
</td>
<?php
}
?>
<td>
<?php
if ($commande->statut < 5) {
echo '<a href="?action=DELETE_LINE&k=' . $k . '&id=' . $commande->id . '&rowid=' . $line['commande_fournisseurdet_asset'] . '">' . img_delete() . '</a>';
}
?>
</td>
</tr>
<?php
}
}
if ($commande->statut < 5 && $commande->statut > 2) {
$pListe[0] = "Sélectionnez un produit";
foreach ($commande->lines as $line) {
示例15: load_measuring_units
/**
* Return a combo box with list of units
* For the moment, units labels are defined in measuring_units_string
*
* @param string $name Name of HTML field
* @param string $measuring_style Unit to show: weight, size, surface, volume
* @param string $default Force unit
* @param int $adddefault Add empty unit called "Default"
* @return void
*/
function load_measuring_units($name = 'measuring_units', $measuring_style = '', $default = '0', $adddefault = 0)
{
global $langs, $conf, $mysoc;
$langs->load("other");
$return = '';
$measuring_units = array();
if ($measuring_style == 'weight') {
$measuring_units = array(-6 => 1, -3 => 1, 0 => 1, 3 => 1, 99 => 1);
} else {
if ($measuring_style == 'size') {
$measuring_units = array(-3 => 1, -2 => 1, -1 => 1, 0 => 1, 98 => 1, 99 => 1);
} else {
if ($measuring_style == 'surface') {
$measuring_units = array(-6 => 1, -4 => 1, -2 => 1, 0 => 1, 98 => 1, 99 => 1);
} else {
if ($measuring_style == 'volume') {
$measuring_units = array(-9 => 1, -6 => 1, -3 => 1, 0 => 1, 88 => 1, 89 => 1, 97 => 1, 99 => 1);
}
}
}
}
// Liter is not used as already available with dm3
$return .= '<select class="flat" name="' . $name . '">';
if ($adddefault) {
$return .= '<option value="0">' . $langs->trans("Default") . '</option>';
}
foreach ($measuring_units as $key => $value) {
$return .= '<option value="' . $key . '"';
if ($key == $default) {
$return .= ' selected="selected"';
}
//$return.= '>'.$value.'</option>';
$return .= '>' . measuring_units_string($key, $measuring_style) . '</option>';
}
$return .= '</select>';
return $return;
}