Skip to content

Commit 285c873

Browse files
committed
feat: add sql view guide
1 parent 8cd137d commit 285c873

18 files changed

+180
-0
lines changed

docs/additional-module/sql-view.md

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
---
2+
title: SQL View Branch Control
3+
description: A guide about SQL View branch control for SQL Account
4+
slug: /additional-module/sql-view-branch-control
5+
tags: ["SQL Account", "Additional Module"]
6+
---
7+
8+
## Branch Control Module
9+
10+
![branch-control-module](../../static/img/additional-module/sql-view/branch-control-module.png)
11+
12+
**SQL View (Branch Control)** is used to:
13+
14+
1. Restrict users to view or edit only the data belonging to their assigned branch
15+
16+
2. Protect data privacy between branches
17+
18+
3. Prevent users from accidentally selecting or modifying records from other branches
19+
20+
## Scenario Example
21+
22+
Company has 3 branches:
23+
24+
![scenario-example-company](../../static/img/additional-module/sql-view/scenario-example-company.png)
25+
26+
Example users:
27+
28+
![scenario-example-users](../../static/img/additional-module/sql-view/scenario-example-users.png)
29+
30+
:::info
31+
32+
Project from other branches will be auto-filtered, preventing accidental selection of unauthorized or irrelevant data.
33+
34+
:::
35+
36+
## How to Set Branch Control Using SQL View
37+
38+
### A. Project Filtering
39+
40+
#### A1. Single Project Code (e.g., PEN Branch – P1)
41+
42+
1. **Tools** | **DIY** | **Maintain DIY**
43+
44+
![single-project-code-1](../../static/img/additional-module/sql-view/single-project-code-1.png)
45+
46+
2. **View Template** | Right-click **Project** | **New View Template**
47+
48+
![single-project-code-2](../../static/img/additional-module/sql-view/single-project-code-2.png)
49+
50+
3. Click **New**
51+
52+
![single-project-code-3](../../static/img/additional-module/sql-view/single-project-code-3.png)
53+
54+
4. Set the Filter Condition
55+
56+
1. **Description**: Enter a name for this template
57+
58+
2. **Code**: Select Project Code
59+
60+
3. **Condition**: Equal
61+
62+
4. **Value**: Enter the project code (e.g., P1)
63+
64+
![single-project-code-4](../../static/img/additional-module/sql-view/single-project-code-4.png)
65+
66+
5. Select the new template form the list
67+
68+
![single-project-code-5](../../static/img/additional-module/sql-view/single-project-code-5.png)
69+
70+
6. Right-click **Project** | Select **User View**
71+
72+
![single-project-code-6](../../static/img/additional-module/sql-view/single-project-code-6.png)
73+
74+
7. Tick the user
75+
76+
![single-project-code-7](../../static/img/additional-module/sql-view/single-project-code-7.png)
77+
78+
#### A2. Multiple Project Codes(e.g., KL + SEL = P1 & P2)
79+
80+
1. Set the Filter Condition
81+
82+
1. Set Condition: is any of
83+
84+
2. Add project codes (P1, P2)
85+
86+
3. Click + if you need more codes
87+
88+
![multiple-project-codes](../../static/img/additional-module/sql-view/multiple-project-codes.png)
89+
90+
**Results:**
91+
92+
User can select both P1 and P2 only.
93+
94+
![result-multiple-project-codes](../../static/img/additional-module/sql-view/result-multiple-project-codes.png)
95+
96+
### B. Agent Filtering
97+
98+
**Scenario 1: Agent can only see their own documents**
99+
100+
For Agent, if login user same as agent code, you can follow below step in the link on (Step 2) to get the ready view template and load side.
101+
102+
https://docs.sql.com.my/sqlacc/sql-mobile-connect/set-user-view
103+
104+
If not available, follow these manual steps:
105+
106+
1. May follow **[Project Filtering](#a-project-filtering)** part Step1 and Step2 to create new view template
107+
108+
2. Choose Agent
109+
110+
1. Select ‘Equals’
111+
112+
2. Point the dropdown list
113+
114+
3. Select the **current user**. \*current user = login user
115+
116+
![agent-filtering-scenario-1](../../static/img/additional-module/sql-view/agent-filtering-scenario-1.png)
117+
118+
**Results:**
119+
120+
When Yap opens any document, the Agent field will only show her own agent code
121+
122+
![result-agent-filtering-scenario-1](../../static/img/additional-module/sql-view/result-agent-filtering-scenario-1.png)
123+
124+
**Scenario 2: Assign a user to a specific Agent Code**
125+
126+
Type the Agent Code directly into the filter value
127+
128+
![agent-filtering-scenario-2](../../static/img/additional-module/sql-view/agent-filtering-scenario-2.png)
129+
130+
**Results:**
131+
132+
User will only see the assigned agent (e.g., **Sales**)
133+
134+
![result-agent-filtering-scenario-2](../../static/img/additional-module/sql-view/result-agent-filtering-scenario-2.png)
135+
136+
## Other Modules Using the Same Steps
137+
138+
The same View Template steps apply to:
139+
140+
- Area
141+
142+
- Location
143+
144+
- Stock Group
145+
146+
- Stock Item
147+
148+
- Payment Method
149+
150+
- Account Code
151+
152+
## How SQL View Affects the System
153+
154+
**View Sales and Purchase Price History**
155+
156+
If an SQL View is applied, the Sales Price History will only display values that pass the filter. Any values not permitted by the view will be excluded.
157+
158+
**View Available Stock Balance**
159+
160+
If an SQL View is applied for location, the View Available Stock Balance will only display the Total Qty belong to the location in Stock Card Qty, Qty in DO, Qty in PO and Available Qty.
161+
162+
Same as each Location Balance only refer to the location assigned.
163+
164+
**Sales Invoice Transfer Dialog**
165+
166+
When we transfer from Sales Order, if an SQL View is applied, the dialog will only display values that pass the filter. Any values not permitted by the view will be excluded.
167+
168+
**All Report Listing**
169+
170+
When SQL Views are used to restrict Agent, the Agent dropdown in reports will only show values allowed by the view. Same applies to Project, Location, Stock Item and Area etc.
171+
172+
![report-listing](../../static/img/additional-module/sql-view/report-listing.png)
173+
174+
:::important
175+
176+
- **ADMIN** user is a superuser. Even if SQL View is applied, ADMIN can still view everything.
177+
178+
- SQL View does not support Stock Transfer documents. Locking can only be applied via the DIY Script module.
179+
180+
:::
165 KB
Loading
347 KB
Loading
233 KB
Loading
165 KB
Loading
227 KB
Loading
252 KB
Loading
168 KB
Loading
386 KB
Loading
61.3 KB
Loading

0 commit comments

Comments
 (0)