summaryrefslogtreecommitdiff
path: root/update_list_deadstock_opening.ktr
diff options
context:
space:
mode:
Diffstat (limited to 'update_list_deadstock_opening.ktr')
-rw-r--r--update_list_deadstock_opening.ktr93
1 files changed, 88 insertions, 5 deletions
diff --git a/update_list_deadstock_opening.ktr b/update_list_deadstock_opening.ktr
index 354b1d8..55f9883 100644
--- a/update_list_deadstock_opening.ktr
+++ b/update_list_deadstock_opening.ktr
@@ -571,6 +571,11 @@
</hop>
<hop>
<from>Calculator</from>
+ <to>If field value is null 2</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>If field value is null 2</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
@@ -602,6 +607,21 @@
<grouping_symbol/>
<currency_symbol/>
</calculation>
+ <calculation>
+ <field_name>new_qty_available</field_name>
+ <calc_type>SUBTRACT</calc_type>
+ <field_a>qty</field_a>
+ <field_b>qty_outgoing</field_b>
+ <field_c/>
+ <value_type>None</value_type>
+ <value_length>-1</value_length>
+ <value_precision>-1</value_precision>
+ <remove>N</remove>
+ <conversion_mask/>
+ <decimal_symbol/>
+ <grouping_symbol/>
+ <currency_symbol/>
+ </calculation>
<attributes/>
<cluster_schema/>
<remotesteps>
@@ -957,7 +977,7 @@ order by product_id</sql>
</value>
<value>
<name>qty_available_current</name>
- <rename>qty</rename>
+ <rename>new_qty_available</rename>
</value>
<value>
<name>brand</name>
@@ -977,7 +997,7 @@ order by product_id</sql>
</output>
</remotesteps>
<GUI>
- <xloc>640</xloc>
+ <xloc>816</xloc>
<yloc>304</yloc>
<draw>Y</draw>
</GUI>
@@ -1022,7 +1042,7 @@ order by pp.id</sql>
<name>product_id</name>
<length>9</length>
<precision>0</precision>
- <origin>Table input 2</origin>
+ <origin>avg hpp</origin>
<comments>product_id</comments>
<conversion_Mask>####0;-####0</conversion_Mask>
<decimal_symbol>.</decimal_symbol>
@@ -1045,7 +1065,7 @@ order by pp.id</sql>
<name>last_cost</name>
<length>-1</length>
<precision>-1</precision>
- <origin>Table input 2</origin>
+ <origin>avg hpp</origin>
<comments>last_cost</comments>
<conversion_Mask>######0.0###################;-######0.0###################</conversion_Mask>
<decimal_symbol>.</decimal_symbol>
@@ -1089,7 +1109,7 @@ order by pp.id</sql>
<schema_name/>
</partitioning>
<connection>erp indoteknik production (localhost)</connection>
- <sql>select sq.product_id, sum(quantity) as qty
+ <sql>select sq.product_id, sum(quantity) as qty, get_qty_outgoing(sq.product_id) as qty_outgoing
from stock_quant sq
join stock_location sl on sl.id = sq.location_id
where sq.location_id in(select id from stock_location where usage = 'internal' and active = true)
@@ -1148,6 +1168,29 @@ order by sq.product_id</sql>
<date_format_timezone>Asia/Bangkok</date_format_timezone>
<lenient_string_to_number>N</lenient_string_to_number>
</value-meta>
+ <value-meta>
+ <type>BigNumber</type>
+ <storagetype>normal</storagetype>
+ <name>qty_outgoing</name>
+ <length>-1</length>
+ <precision>-1</precision>
+ <origin>current qty</origin>
+ <comments>qty_outgoing</comments>
+ <conversion_Mask>######0.0###################;-######0.0###################</conversion_Mask>
+ <decimal_symbol>.</decimal_symbol>
+ <grouping_symbol/>
+ <currency_symbol/>
+ <trim_type>none</trim_type>
+ <case_insensitive>N</case_insensitive>
+ <collator_disabled>Y</collator_disabled>
+ <collator_strength>0</collator_strength>
+ <sort_descending>N</sort_descending>
+ <output_padding>N</output_padding>
+ <date_format_lenient>N</date_format_lenient>
+ <date_format_locale>en_US</date_format_locale>
+ <date_format_timezone>Asia/Bangkok</date_format_timezone>
+ <lenient_string_to_number>N</lenient_string_to_number>
+ </value-meta>
</row-meta>
<attributes/>
<cluster_schema/>
@@ -1163,6 +1206,46 @@ order by sq.product_id</sql>
<draw>Y</draw>
</GUI>
</step>
+ <step>
+ <name>If field value is null 2</name>
+ <type>IfNull</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <replaceAllByValue>0</replaceAllByValue>
+ <replaceAllMask/>
+ <selectFields>Y</selectFields>
+ <selectValuesType>N</selectValuesType>
+ <setEmptyStringAll>N</setEmptyStringAll>
+ <valuetypes>
+ </valuetypes>
+ <fields>
+ <field>
+ <name>new_qty_available</name>
+ <value>0</value>
+ <mask/>
+ <set_empty_string>N</set_empty_string>
+ </field>
+ </fields>
+ <attributes/>
+ <cluster_schema/>
+ <remotesteps>
+ <input>
+ </input>
+ <output>
+ </output>
+ </remotesteps>
+ <GUI>
+ <xloc>656</xloc>
+ <yloc>304</yloc>
+ <draw>Y</draw>
+ </GUI>
+ </step>
<step_error_handling>
</step_error_handling>
<slave-step-copy-partition-distribution>