Merge pull request #18518 from henrynopo/patch-10
Add - Shipment lines showing Unit for Qty from order lines
This commit is contained in:
commit
e71ba444c9
@ -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,
|
||||
|
||||
@ -1160,10 +1160,16 @@ if ($action == 'create') {
|
||||
print "</td>\n";
|
||||
}
|
||||
|
||||
// unit of order
|
||||
$unit_order = ''
|
||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
||||
$unit_order = measuringUnitString($line->fk_unit);
|
||||
}
|
||||
|
||||
// Qty
|
||||
print '<td class="center">'.$line->qty;
|
||||
print '<input name="qtyasked'.$indiceAsked.'" id="qtyasked'.$indiceAsked.'" type="hidden" value="'.$line->qty.'">';
|
||||
print '</td>';
|
||||
print ''.$unit_order.'</td>';
|
||||
$qtyProdCom = $line->qty;
|
||||
|
||||
// Qty already shipped
|
||||
@ -1171,7 +1177,7 @@ if ($action == 'create') {
|
||||
$quantityDelivered = $object->expeditions[$line->id];
|
||||
print $quantityDelivered;
|
||||
print '<input name="qtydelivered'.$indiceAsked.'" id="qtydelivered'.$indiceAsked.'" type="hidden" value="'.$quantityDelivered.'">';
|
||||
print '</td>';
|
||||
print ''.$unit_order.'</td>';
|
||||
|
||||
// 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 "</td>\n";
|
||||
}
|
||||
|
||||
$unit_order = ''
|
||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
||||
$unit_order = measuringUnitString($lines[$i]->fk_unit);
|
||||
}
|
||||
|
||||
// Qty ordered
|
||||
print '<td class="center linecolqty">'.$lines[$i]->qty_asked.'</td>';
|
||||
print '<td class="center linecolqty">'.$lines[$i]->qty_asked.' '.$unit_order.'</td>';
|
||||
|
||||
// Qty in other shipments (with shipment and warehouse used)
|
||||
if ($origin && $origin_id > 0) {
|
||||
@ -2241,7 +2252,7 @@ if ($action == 'create') {
|
||||
print '<!-- case edit 2 -->';
|
||||
print '<tr>';
|
||||
// Qty to ship or shipped
|
||||
print '<td><input class="qtyl" name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'"></td>';
|
||||
print '<td><input class="qtyl" name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'">'.$unit_order.'</td>';
|
||||
// Warehouse source
|
||||
print '<td>'.$formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'</td>';
|
||||
// Batch number managment
|
||||
@ -2252,7 +2263,7 @@ if ($action == 'create') {
|
||||
foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
|
||||
print '<tr>';
|
||||
// Qty to ship or shipped
|
||||
print '<td><input class="qtyl" name="qtyl'.$detail_entrepot->line_id.'" id="qtyl'.$detail_entrepot->line_id.'" type="text" size="4" value="'.$detail_entrepot->qty_shipped.'"></td>';
|
||||
print '<td><input class="qtyl" name="qtyl'.$detail_entrepot->line_id.'" id="qtyl'.$detail_entrepot->line_id.'" type="text" size="4" value="'.$detail_entrepot->qty_shipped.'">'.$unit_order.'</td>';
|
||||
// Warehouse source
|
||||
print '<td>'.$formproduct->selectWarehouses($detail_entrepot->entrepot_id, 'entl'.$detail_entrepot->line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'</td>';
|
||||
// Batch number managment
|
||||
@ -2267,7 +2278,7 @@ if ($action == 'create') {
|
||||
print '<!-- case edit 5 -->';
|
||||
print '<tr>';
|
||||
// Qty to ship or shipped
|
||||
print '<td><input class="qtyl" name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'"></td>';
|
||||
print '<td><input class="qtyl" name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'">'.$unit_order.'</td>';
|
||||
// Warehouse source
|
||||
print '<td></td>';
|
||||
// Batch number managment
|
||||
@ -2289,7 +2300,7 @@ if ($action == 'create') {
|
||||
print '</table></td>';
|
||||
} else {
|
||||
// Qty to ship or shipped
|
||||
print '<td class="linecolqtytoship center">'.$lines[$i]->qty_shipped.'</td>';
|
||||
print '<td class="linecolqtytoship center">'.$lines[$i]->qty_shipped.' '.$unit_order.'</td>';
|
||||
|
||||
// Warehouse source
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
|
||||
@ -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 '<td class="center">'.$objp->qty.'</td>';
|
||||
print '<td class="center">'.$objp->qty.($objp->unit_order ? ' '.$objp->unit_order : '').'</td>';
|
||||
|
||||
// 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 '</td>';
|
||||
print ($objp->unit_order ? ' '.$objp->unit_order : '').'</td>';
|
||||
|
||||
// Qty remains to ship
|
||||
print '<td class="center">';
|
||||
@ -785,7 +787,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
} else {
|
||||
print '0 ('.$langs->trans("Service").')';
|
||||
}
|
||||
print '</td>';
|
||||
print ($objp->unit_order ? ' '.$objp->unit_order : '').'</td>';
|
||||
|
||||
if ($objp->fk_product > 0) {
|
||||
$product = new Product($db);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user