diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index cf8b03f1fea..2752f9a9c9b 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -651,6 +651,11 @@ class pdf_espadon extends ModelePdfExpedition $nexY = max($pdf->GetY(), $nexY); } + if ($this->getColumnStatus('unit_order')) { + $this->printStdColumnContent($pdf, $curY, 'unit_order', measuringUnitString($object->lines[$i]->fk_unit)); + $nexY = max($pdf->GetY(), $nexY); + } + if ($this->getColumnStatus('qty_shipped')) { $this->printStdColumnContent($pdf, $curY, 'qty_shipped', $object->lines[$i]->qty_shipped); $nexY = max($pdf->GetY(), $nexY); @@ -1312,6 +1317,20 @@ class pdf_espadon extends ModelePdfExpedition ), ); + $rank = $rank + 10; + $this->cols['unit_order'] = array( + 'rank' => $rank, + 'width' => 15, // in mm + 'status' => empty($conf->global->PRODUCT_USE_UNITS) ? 0 : 1, + 'title' => array( + 'textkey' => 'Unit' + ), + 'border-left' => true, // add left line separator + 'content' => array( + 'align' => 'C', + ), + ); + $rank = $rank + 10; $this->cols['qty_shipped'] = array( 'rank' => $rank, diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index c87d2fcc5ce..3ff8cd490ad 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1160,10 +1160,16 @@ if ($action == 'create') { print "\n"; } + // unit of order + $unit_order = '' + if ($conf->global->PRODUCT_USE_UNITS) { + $unit_order = measuringUnitString($line->fk_unit); + } + // Qty print ''.$line->qty; print ''; - print ''; + print ''.$unit_order.''; $qtyProdCom = $line->qty; // Qty already shipped @@ -1171,7 +1177,7 @@ if ($action == 'create') { $quantityDelivered = $object->expeditions[$line->id]; print $quantityDelivered; print ''; - print ''; + print ''.$unit_order.''; // Qty to ship $quantityAsked = $line->qty; @@ -2056,7 +2062,7 @@ if ($action == 'create') { // Get list of products already sent for same source object into $alreadysent $alreadysent = array(); if ($origin && $origin_id > 0) { - $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end"; + $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.fk_unit, obj.date_start, obj.date_end"; $sql .= ", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot"; $sql .= ", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition"; //if ($conf->delivery_note->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; @@ -2176,8 +2182,13 @@ if ($action == 'create') { print "\n"; } + $unit_order = '' + if ($conf->global->PRODUCT_USE_UNITS) { + $unit_order = measuringUnitString($lines[$i]->fk_unit); + } + // Qty ordered - print ''.$lines[$i]->qty_asked.''; + print ''.$lines[$i]->qty_asked.' '.$unit_order.''; // Qty in other shipments (with shipment and warehouse used) if ($origin && $origin_id > 0) { @@ -2241,7 +2252,7 @@ if ($action == 'create') { print ''; print ''; // Qty to ship or shipped - print ''; + print ''.$unit_order.''; // Warehouse source print ''.$formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).''; // Batch number managment @@ -2252,7 +2263,7 @@ if ($action == 'create') { foreach ($lines[$i]->details_entrepot as $detail_entrepot) { print ''; // Qty to ship or shipped - print ''; + print ''.$unit_order.''; // Warehouse source print ''.$formproduct->selectWarehouses($detail_entrepot->entrepot_id, 'entl'.$detail_entrepot->line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).''; // Batch number managment @@ -2267,7 +2278,7 @@ if ($action == 'create') { print ''; print ''; // Qty to ship or shipped - print ''; + print ''.$unit_order.''; // Warehouse source print ''; // Batch number managment @@ -2289,7 +2300,7 @@ if ($action == 'create') { print ''; } else { // Qty to ship or shipped - print ''.$lines[$i]->qty_shipped.''; + print ''.$lines[$i]->qty_shipped.' '.$unit_order.''; // Warehouse source if (!empty($conf->stock->enabled)) { diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index a6ab016ef7b..b8814450030 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -617,7 +617,7 @@ if ($id > 0 || !empty($ref)) { $sql = "SELECT cd.rowid, cd.fk_product, cd.product_type as type, cd.label, cd.description,"; $sql .= " cd.price, cd.tva_tx, cd.subprice,"; - $sql .= " cd.qty,"; + $sql .= " cd.qty, cd.fk_unit,"; $sql .= ' cd.date_start,'; $sql .= ' cd.date_end,'; $sql .= ' cd.special_code,'; @@ -625,8 +625,10 @@ if ($id > 0 || !empty($ref)) { $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units,'; $sql .= ' p.surface, p.surface_units, p.volume, p.volume_units'; $sql .= ', p.tobatch, p.tosell, p.tobuy, p.barcode'; + $sql .= ', u.short_label as unit_order'; $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_units as u ON cd.fk_unit = u.rowid"; $sql .= " WHERE cd.fk_commande = ".((int) $object->id); $sql .= " ORDER BY cd.rang, cd.rowid"; @@ -766,7 +768,7 @@ if ($id > 0 || !empty($ref)) { } // Qty ordered - print ''.$objp->qty.''; + print ''.$objp->qty.($objp->unit_order ? ' '.$objp->unit_order : '').''; // Qty already shipped $qtyProdCom = $objp->qty; @@ -774,7 +776,7 @@ if ($id > 0 || !empty($ref)) { // Nb of sending products for this line of order $qtyAlreadyShipped = (!empty($object->expeditions[$objp->rowid]) ? $object->expeditions[$objp->rowid] : 0); print $qtyAlreadyShipped; - print ''; + print ($objp->unit_order ? ' '.$objp->unit_order : '').''; // Qty remains to ship print ''; @@ -785,7 +787,7 @@ if ($id > 0 || !empty($ref)) { } else { print '0 ('.$langs->trans("Service").')'; } - print ''; + print ($objp->unit_order ? ' '.$objp->unit_order : '').''; if ($objp->fk_product > 0) { $product = new Product($db);