22sidebar_position : 2
33title : Aluminium Extrution Manufactoring
44description : A guide for Aluminium Extrution Manufactoring
5- slug : /usage/myinvois/Al-Extrution-Manufactoring
5+ slug : /usage/myinvois/aluminium-extrution-manufactoring
66tags : ["SQL Account", "Usage"]
77---
88
99## Introduction
10+
1011Aluminium Extrusion manufacturing usually will based on a variable length and a fixed linear weight to determine the price before quote to customer.
1112
1213## Updates
14+
1315Last Customisation Update : 06 Nov 2015
1416
1517## Criterias
18+
1619### Maintain Stock Group
20+
1721[ Stock | Maintain Stock Group...]
1822
1923Stock group will be used as the Product Grade to categorise the stock items list.
2024
2125### Maintain Stock Item
26+
2227[ Stock | Maintain Stock Item...]
2328
24291 . Stock Master Data.
@@ -32,16 +37,20 @@ Stock group will be used as the Product Grade to categorise the stock items list
3237| DIY | Linear Weight (Kg/M) | Float | Size :10, SubSize: 4 | Linear Weight (Kg/M) value |
3338
3439### Sales Document Entry
40+
35411 . Sales documents entry are:-
36- - Quotation
37- - Sales Order
38- - Delivery Order
39- - Invoice
40- - Debit Note
41- - Credit Note
42+
43+ - Quotation
44+ - Sales Order
45+ - Delivery Order
46+ - Invoice
47+ - Debit Note
48+ - Credit Note
4249
43502 . Insert and update the following DIY fields & Script into above mentions sales documents in Tools | DIY | SQL Control Center...
51+
4452 1 . DIY Fields
53+
4554 | Type | Field Name | Data Types | Length |
4655 | --- | --- | --- | --- |
4756 | DIY-F | Length | Float | Size: 10, SubSize: 4 |
@@ -52,87 +61,86 @@ Stock group will be used as the Product Grade to categorise the stock items list
5261 | DIY-F | Qty_Pcs | Float | Size: 10, SubSize: 4 |
5362
5463 2 . DIY Script: OnGridColumnValueChange event
55- ``` sql
56- var
57- FComServer : Variant;
58-
59- function ComServer: Variant;
60- begin
61- if FComServer = Null then begin
62- FComServer := CreateOleObject(' SQLAcc.BizApp' );
63- end;
64- Result := FComServer;
65- end;
66-
67- var
68- lSQL, lCode : String;
69- cdsTemp : TClientDataSet;
70- D : TDataSource;
71-
72- begin
73- FComServer := null ;
74- D := TDataSource(Self .FindComponent (' dsDocDetail' ));
75-
76- cdsTemp := TClientDataSet .Create (nil);
77- lCode := D .DataSet .FindField(' ItemCode' ).AsString;
78- lSQL := Format(' SELECT UDF_LinearWeight FROM ST_ITEM WHERE Code=%s ' ,[QuotedStr(lCode)]);
79- cdsTemp .Data := ComServer .DBManager .Execute(lSQL);
80-
81- // select item and batch to retrieve the linear weight from item master
82- if SameText(editingfield,' ItemCode' ) or
83- SameText(editingfield,' Batch' ) then begin
84- D .DataSet .FindField(' UDF_LinearWeight' ).Value := cdsTemp .FindField (' UDF_LinearWeight' ).Value;
85- D .DataSet .FindField(' UDF_Length' ).Value := 0 ;
86- end;
87-
88- // select batch as " Length value"
89- if SameText(editingfield,' Batch' ) then begin
90- D .DataSet .FindField(' UDF_Length' ).Value := D .DataSet .FindField(' Batch' ).Value;
91- end;
92-
93- // key- in unit price per kg to convert into unit price per pcs
94- if SameText(editingfield,' UDF_UnitPrice_Kg' ) or
95- SameText(editingfield,' Batch' ) then begin
96- D .DataSet .FindField(' UDF_UnitPrice_Pcs' ).AsFloat := (D .DataSet .FindField(' UDF_UnitPrice_Kg' ).AsFloat*
97- D .DataSet .FindField(' UDF_Length' ).AsFloat*
98- D .DataSet .FindField(' UDF_LinearWeight' ).AsFloat);
99- end;
100-
101- // key- in unit price per pcs to convert into unit price per kg
102- if SameText(editingfield,' UDF_UnitPrice_Pcs' ) or
103- SameText(editingfield,' Batch' ) then begin
104- D .DataSet .FindField(' UDF_UnitPrice_Kg' ).AsFloat := (D .DataSet .FindField(' UDF_UnitPrice_Pcs' ).AsFloat/
105- D .DataSet .FindField(' UDF_Length' ).AsFloat/
106- D .DataSet .FindField(' UDF_LinearWeight' ).AsFloat);
107- end;
108-
109- // to compute the subtotal either based on unit price per pcs or per kg
110- if (D .DataSet .FindField(' UDF_Length' ).Value <> 0 .0000 ) or
111- (D .DataSet .FindField(' UDF_LinearWeight' ).Value <> 0 .000 ) or
112- (D .DataSet .FindField(' UDF_Qty_Pcs' ).Value <> 0 .0000 ) or
113- (D .DataSet .FindField(' UDF_UnitPrice_Pcs' ).Value <> 0 .0000 ) then begin
114- D .DataSet .FindField(' Qty' ).Value := D .DataSet .FindField(' UDF_Qty_Pcs' ).AsFloat;
115- D .DataSet .FindField(' UnitPrice' ).Value := D .DataSet .FindField(' UDF_UnitPrice_Pcs' ).AsFloat;
116- D .DataSet .FindField(' UDF_Qty_Kg' ).AsFloat := (D .DataSet .FindField(' UDF_Length' ).AsFloat*
117- D .DataSet .FindField(' UDF_LinearWeight' ).AsFloat*
118- D .DataSet .FindField(' UDF_Qty_Pcs' ).AsFloat);
119- end;
120-
121-
122- FComServer := null ;
123- cdsTemp .Free ;
124-
125- end.
126- ```
127-
128- ``` pascal
129- Formula:
130-
131- 1. Unit price per Pcs = Unit price per Kg x Length x Linear Weight
132- 2. Unit price per Kg = Unit price per Pcs / Length / Linear Weight
133- 3. Total Weight = Length x Linear Weight x No of Pcs
134-
135-
136- Both formula results are rounding up to 4 decimals.
137- ```
13864
65+ ``` sql
66+ var
67+ FComServer : Variant;
68+
69+ function ComServer: Variant;
70+ begin
71+ if FComServer = Null then begin
72+ FComServer := CreateOleObject(' SQLAcc.BizApp' );
73+ end;
74+ Result := FComServer;
75+ end;
76+
77+ var
78+ lSQL, lCode : String;
79+ cdsTemp : TClientDataSet;
80+ D : TDataSource;
81+
82+ begin
83+ FComServer := null ;
84+ D := TDataSource(Self .FindComponent (' dsDocDetail' ));
85+
86+ cdsTemp := TClientDataSet .Create (nil);
87+ lCode := D .DataSet .FindField(' ItemCode' ).AsString;
88+ lSQL := Format(' SELECT UDF_LinearWeight FROM ST_ITEM WHERE Code=%s ' ,[QuotedStr(lCode)]);
89+ cdsTemp .Data := ComServer .DBManager .Execute(lSQL);
90+
91+ // select item and batch to retrieve the linear weight from item master
92+ if SameText(editingfield,' ItemCode' ) or
93+ SameText(editingfield,' Batch' ) then begin
94+ D .DataSet .FindField(' UDF_LinearWeight' ).Value := cdsTemp .FindField (' UDF_LinearWeight' ).Value;
95+ D .DataSet .FindField(' UDF_Length' ).Value := 0 ;
96+ end;
97+
98+ // select batch as " Length value"
99+ if SameText(editingfield,' Batch' ) then begin
100+ D .DataSet .FindField(' UDF_Length' ).Value := D .DataSet .FindField(' Batch' ).Value;
101+ end;
102+
103+ // key- in unit price per kg to convert into unit price per pcs
104+ if SameText(editingfield,' UDF_UnitPrice_Kg' ) or
105+ SameText(editingfield,' Batch' ) then begin
106+ D .DataSet .FindField(' UDF_UnitPrice_Pcs' ).AsFloat := (D .DataSet .FindField(' UDF_UnitPrice_Kg' ).AsFloat*
107+ D .DataSet .FindField(' UDF_Length' ).AsFloat*
108+ D .DataSet .FindField(' UDF_LinearWeight' ).AsFloat);
109+ end;
110+
111+ // key- in unit price per pcs to convert into unit price per kg
112+ if SameText(editingfield,' UDF_UnitPrice_Pcs' ) or
113+ SameText(editingfield,' Batch' ) then begin
114+ D .DataSet .FindField(' UDF_UnitPrice_Kg' ).AsFloat := (D .DataSet .FindField(' UDF_UnitPrice_Pcs' ).AsFloat/
115+ D .DataSet .FindField(' UDF_Length' ).AsFloat/
116+ D .DataSet .FindField(' UDF_LinearWeight' ).AsFloat);
117+ end;
118+
119+ // to compute the subtotal either based on unit price per pcs or per kg
120+ if (D .DataSet .FindField(' UDF_Length' ).Value <> 0 .0000 ) or
121+ (D .DataSet .FindField(' UDF_LinearWeight' ).Value <> 0 .000 ) or
122+ (D .DataSet .FindField(' UDF_Qty_Pcs' ).Value <> 0 .0000 ) or
123+ (D .DataSet .FindField(' UDF_UnitPrice_Pcs' ).Value <> 0 .0000 ) then begin
124+ D .DataSet .FindField(' Qty' ).Value := D .DataSet .FindField(' UDF_Qty_Pcs' ).AsFloat;
125+ D .DataSet .FindField(' UnitPrice' ).Value := D .DataSet .FindField(' UDF_UnitPrice_Pcs' ).AsFloat;
126+ D .DataSet .FindField(' UDF_Qty_Kg' ).AsFloat := (D .DataSet .FindField(' UDF_Length' ).AsFloat*
127+ D .DataSet .FindField(' UDF_LinearWeight' ).AsFloat*
128+ D .DataSet .FindField(' UDF_Qty_Pcs' ).AsFloat);
129+ end;
130+
131+ FComServer := null ;
132+ cdsTemp .Free ;
133+
134+ end.
135+ ```
136+
137+ ` ` ` pascal
138+ Formula:
139+
140+ 1. Unit price per Pcs = Unit price per Kg x Length x Linear Weight
141+ 2. Unit price per Kg = Unit price per Pcs / Length / Linear Weight
142+ 3. Total Weight = Length x Linear Weight x No of Pcs
143+
144+
145+ Both formula results are rounding up to 4 decimals.
146+ ` ` `
0 commit comments