Skip to content

Commit

Permalink
Update Work Order Review Resources view
Browse files Browse the repository at this point in the history
Show correct Time Required and Time Used on Time based operations
  • Loading branch information
steveblamey committed Jun 11, 2018
1 parent e3dfba4 commit 5e93fd4
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ public function reviewResources()

$sh->addConstraint(new Constraint('stitem_id', '=', $transaction->stitem_id));

$sh->setFields(array('id', 'op_no', 'remarks', 'centre', 'resource', 'resource_qty', 'volume_period', 'volume_target', 'volume_uom_id'));
$sh->setFields(array('id', 'op_no', 'remarks', 'centre', 'resource', 'resource_qty', 'volume_period', 'volume_target', 'batch_op', 'volume_uom_id'));

parent::index($elements, $sh);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{**
* (c) 2017 uzERP LLP (support#uzerp.com). All rights reserved.
* (c) 2018 uzERP LLP (support#uzerp.com). All rights reserved.
*
* Released under GPLv3 license; see LICENSE.
**}
Expand Down Expand Up @@ -58,13 +58,25 @@
{$model->resource_qty}
{/grid_cell}
{grid_cell model=$model cell_num=6 field="resource_qty" class='numeric'}
{if $model->volume_target>0}
{if $model->volume_target>0 && $stockitem->cost_basis == 'VOLUME'}
{($stockitem->convertToUoM($stockitem->uom_id,$model->volume_uom_id,$transaction->order_qty)/$model->volume_target)|round:2} {$model->getFormatted('volume_period')}
{else}
{if $model->batch_op == 't' && (!is_null($stockitem->batch_size) && $stockitem->batch_size > 0)}
{$model->volume_target} {$model->getFormatted('volume_period')}
{else}
{($stockitem->convertToUoM($stockitem->uom_id,$model->volume_uom_id,$transaction->order_qty)*$model->volume_target)|round:2} {$model->getFormatted('volume_period')}
{/if}
{/if}
{/grid_cell}
{grid_cell model=$model cell_num=7 field="resource_qty" class='numeric'}
{if $model->volume_target>0}
{if $model->volume_target>0 && $stockitem->cost_basis == 'VOLUME'}
{($stockitem->convertToUoM($stockitem->uom_id,$model->volume_uom_id,$transaction->made_qty)/$model->volume_target)|round:2} {$model->getFormatted('volume_period')}
{else}
{if $model->batch_op == 't' && (!is_null($stockitem->batch_size) && $stockitem->batch_size > 0) && $transaction->made_qty > 0}
{$model->volume_target} {$model->getFormatted('volume_period')}
{else}
{($stockitem->convertToUoM($stockitem->uom_id,$model->volume_uom_id,$transaction->made_qty)*$model->volume_target)|round:2} {$model->getFormatted('volume_period')}
{/if}
{/if}
{/grid_cell}
{/grid_row}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php


use UzerpPhinx\UzerpMigration;

class MfoperationOverviewColumnChanges extends UzerpMigration
{
/**
* Add batch_op flag
*/
public function up()
{
$view_name = 'mf_operationsoverview';
$view_owner = 'www-data';
$view = <<<'VIEW'
CREATE OR REPLACE VIEW mf_operationsoverview AS
SELECT o.id,
o.op_no,
o.start_date,
o.end_date,
o.remarks,
o.stitem_id,
o.mfcentre_id,
o.mfresource_id,
o.usercompanyid,
o.volume_period,
o.volume_uom_id,
o.quality_target,
o.uptime_target,
o.volume_target,
o.resource_qty,
o.batch_op,
o.std_cost,
o.std_lab,
o.std_ohd,
o.latest_cost,
o.latest_lab,
o.latest_ohd,
o.created,
o.createdby,
o.alteredby,
o.lastupdated,
(s.item_code::text || ' - '::text) || s.description::text AS stitem,
s.obsolete_date,
u.uom_name AS volume_uom,
c.centre,
r.description AS resource
FROM mf_operations o
JOIN st_items s ON o.stitem_id = s.id
JOIN st_uoms u ON o.volume_uom_id = u.id
JOIN mf_centres c ON o.mfcentre_id = c.id
JOIN mf_resources r ON o.mfresource_id = r.id;
VIEW;

$this->query("DROP VIEW {$view_name}");
$this->query($view);
$this->query("ALTER TABLE {$view_name} OWNER TO \"{$view_owner}\"");
}
}

0 comments on commit 5e93fd4

Please sign in to comment.