Bạn đang cần chương trình quản lý bán hàng và tính tồn kho, khi nhập sản phẩm sẽ cộng dồn số lượng vào kho, ngược lại khi xuất phải trử số lượng trong kho tương ứng cho từng sản phẩm nhập hay xuất. Khi nhập hay xuất có thể nhập xuất nhiều sản phẩm cùng lúc. Sharepoint sẽ giúp bạn xây dựng chương trình quản lý này.
Các Bước Triển Khai Ứng Dụng Quản Lý Bán Hàng Với SharePoint 2016:
Bài LAB này được chia làm các bước sau:
- Tạo Subsite Quản lý Tồn Kho,Cấp quyền
- Tạo List Sản Phẩm, tạo column list sản phẩm
- Edit form nhập sản phẩm
- Tạo List phiếu nhập, tạo column list phiếu nhập
- Tạo workflow sản phẩm nhập
- Thiết kế form phiếu nhập
- Tạo list phiếu xuất, tạo column phiếu xuất
- Tạo workflow sản phẩm xuất
- Thiết kế form phiếu xuất
- Tạo View
- Kiểm Tra
Mục đích của bài lab: hướng dẫn sử dụng sharepoint designer 2013 để tính toán xuất nhập sản phẩm
Thực Hiện Ứng Dụng Quản Lý Bán Hàng Với SharePoint 2016:
B1: Tạo Subsite Quản lý tồn kho và cấp quyền. Tại site Internal.nhatnghe.local vào setting\Site Contents
Chọn New subsite trong phần subsite
Title: Quan Ly Ton Kho,
URL name: QLTK,
Select a template: Team Site
Chọn option Use Unique permissions Create
Chọn Option Create a new group, cấp quyền cho Visitors, members và owners Ok
B2. Tạo List Sản Phẩm, tạo column list sản phẩm. Tại site Quản lý tồn kho vào Setting\Add an app
Chọn Custom List
Name: SanPham Create
Tại list sản phẩm chọn tab list Create Column
Column Name: Ten san Pham, chọn option Single line of text
Chọn option Yes trong phần Require that this column contains information Ok
Tiếp tục tạo column Soluong, chọn option Number
Tiếp tục tạo column Gia, chọn option Currency
Currency format: Vietnam đồng
Chọn List sản phẩm chọn tab list\list settings
Chọn List name, description and navigation
Sửa name thành Sản Phẩm (tiếng viết có dấu) Save
Chọn Title trong phần columns
Đổi column name: Masp OK
B3. Edit form nhập sản phẩm. chọn list sản phẩm chọn list Customize form
Đánh dấu và xóa dòng Attachments
Thiết kế lại form thông tin sản phẩm như trong hình
Vào tab home trong controls add thêm 2 button
Phải chuột vào 1 button chọn button properties
Action: Rules, Label: Save Ok
Phải chuột vào button còn lại chọn button properties.
Action: Rules, Label: Thoát Ok
Chọn text box soluong chọn text box properties
Default value: 0 Ok
Chọn text box Gia chọn text box properties
Default value: 0 Ok
Chọn button Save, vào tab Home Manage Rules chọn New Action
Đặt tên rule save, Chọn None-rule runs when button trong phần condition
Set điều kiện như trong hình Ok
Ấn Add chọn Submit using a data connection và close this form
Chọn button thoát, chọn New Action
Đặt tên Rule thoát, ấn Add chọn Close this form, thiết kế form xong
Vào Tab File\ info chọn Form Options
Trong phần Web Browser bỏ chọn checkbox Show infopath commands in Ribbon or toolbar ok
Chọn Publish SharePoint List. Trở về site Quản lý tồn kho nhập liệu thử cho list sản phẩm
B4. Tạo List phiếu nhập, tạo column list phiếu nhập. Trở lại Site quản lý tồn kho vào settings Add an app
Chọn custom list
Name: PhieuNhap Create
Chọn phiếu nhập vào List chọn Create column
Column name: TenSanPhamNhap, chọn option Lookup
Chọn Sản Phẩm trong Get information from, Chọn ten san pham trong In this column
Tại Phiếu nhập tiếp tục chọn Create column
Column name: Soluongnhap chọn option Number
Trả lời Yes trong Require that this column…
Trong phần Column validation nhập vào Soluongnhap>=0 trong phần Formula. Trong phần User message: So luong nhap khong hop le ok
Tại Phiếu nhập tiếp tục chọn Create column
Column name: Gianhap, chọn option Currency
Trả lời Yes trong Require that this column…
Currency format: Vietnam đồng
Trong phần Column Validation kiểm tra Gianhap>=0 ok
Tại List phiếu nhập chọn List\list settings
Chọn List name, decription and navigation
Sửa Name: Phiếu Nhập (tiếng Việt) Save
Chọn Title trong phần column
Sửa Column name: MaPhieuNhap Ok
B5. Tạo workflow sản phẩm nhập, Chọn Phiếu Nhập vào List Create a workflow in sharepoint designer
Ấn Allow
Đặt tên workflow: san Pham Nhap, Platform type: Sharepoint 2013 workflow Ok
Đặt con trỏ vào phần Stage 1 vào action chọn Do calculation
Trong calculate click vào Value.
Click vào Fx
Data Source: sản Phẩm, Field from source: Soluong, Field: ID, value ấn Fx
Data source: current item, Field from source: tensanphamnhap
Return field as: Lookup Id(as interger) Ok
Ok
Chọn Plus
Click vào value thứ 2
ấn Fx
Data source: Current Item, Field from source: Soluongnhap Ok
Trong phần Output to chọn Create a new variable
Name: TinhNhap, Type: Number
Workflow sẽ lấy số lượng trong list sản phẩm cộng với số lượng nhập hiện tại đặt vào biến Tinhnhap
Đặt con trỏ trong phần Transition to Stage, vào Condition chọn If any value equals value
Trong If chọn value đầu tiên
ấn Fx
Data source: Workflow variables and Parameters, Field from source: Variable Tinhnhap
Chọn Is greater than
Ấn value thứ 2
ấn Fx
Data source: sản phẩm, Field from source: soluong
Field: ID, Trong phần Value click Fx
Data source: Current Item, Field from source: TenSanPhamNhap,
return field as: Lookup Id (as Interger) OK Ok
Phía dưới If đặt con trỏ vào Insert go-to action with…vào Action chọn Go to stage, tương tự trong phần Else
Click vào Stage để thêm Stage 2
Click vào Stage 1 sửa lại thành Tinh Nhap, Stage 2 thành Cong Nhap
Stage Tinh nhap, trong if click go to chọn Cong Nhap
trong else click go to chọn End of Workflow
Đặt con trỏ phía dưới stage cong nhap vào action chọn Update list Item
Click this list
Chọn List sản phẩm, ấn add
Set this field: Soluong, ấn fx
Data source: Workflow variables and parameters, Field from source: Tinh Nhap Ok
OK
Tiếp tục ấn add
Set this field: Gia, ấn Fx
Data source: Current item, Field from source: Gianhap Ok
OK
Field: chọn ID, click Fx trong phần Value
Data source: Current Item,
Field from source: Tensanphamnhap,
Return field as: Lookup id (as Interger) Ok Ok
Trong stage Cong nhap đặt con trỏ dưới Insert go-to actions with.. vào action chọn Go to stage
Click gog to chọn End of Workflow.
Chọn Workflow Settings
Check vào các checkbox như trong hình, chọn Publish, hoàn tất việc tạo workflow
B6. Thiết kế form phiếu nhập, Mở Infopath vào Tab File\New chọn Sharepoint list Design Form
Sharepoint site: http://internal.nhatnghe.local/QLTK next
Chọn List phiếu nhập next
Check vào checkbox manage multiple list items with this form next
Xóa bỏ dòng Attachments
Phải chuột vào Repeating Section properties
Check vào Allow users to insert and delete the sections Ok
Vào Tab Data Data Connections
Ấn Add
Chọn option Receive data next
Chọn option Sharepoint library or list next
Nhập vào site http://internal.nhatnghe.local/QLTK next
Chọn phiếu nhập next
Chọn ID next
Check vào Store a copy of the data in the form template next
Nhập name: Phiếu nhập Finish Close
Phải chuột field MaPhieuNhap chọn textbox properties…
Default Value ấn Fx
Formula: nhập Concat(“ Phieu Nhap – “, ấn Insert Function
chọn max OK
Chọn Double click to Insert field
Chọn Show advanced view
Trong Fields chọn Phiếu nhập chọn ID Ok
OK
OK
Vào Tab File chọn Publish Sharepoint list. Thiết kế xong form phiếu nhập
B7. Tạo list phiếu xuất, tạo column phiếu xuất. Trở về site Quản lý tồn kho vào settings chọn Add an app
Chọn custom List
Nhập Name: PhieuXuat Create
Chọn Phiếu Xuất vừa tạo
Chọn Create Column.
Column Name: TenSanPhamXuat, chọn option Lookup
Get Information from: Sản Phẩm
In this column: Tên Sản Phẩm, check thêm Soluong Ok
Tiếp tục chọn Create Colomn
Column name: SluongXuat, chọn option Number
trong phần Column validation kiểm tra Sluongxuat>=0 Ok
Tiếp tục tạo column Giaxuat, chọn option currency
Currency format: Vietnam đồng
Kiểm tra Giaxuat >= 0 -> Ok. Tạo Column xong
Chọn list PhieuXuat vào tab list List settings
Chọn List name, description and navigation
Đổi name: Phiếu Xuất save
Trong phần column chọn Title
Đổi column name: MaPXuat
Cũng trong Column chọn TenSanPhamXuat:Soluong
Đổi Column name : SoluongTon ok
B8. Tạo workflow sản phẩm xuất. Chọn List phiếu xuất vào Tab List chọn Create a workflow in sharepoint designer Allow
Name: San Pham Xuat, Platform Type: Sharepoint 2013 Workflow Ok
Đặt con trỏ phía dưới Stage 1 vào action chọn Do calculation
Click vào Value đầu tiên
Chọn Fx
Data source: Sản phẩm, Field from source: soluong, Field chọn ID, Value ấn Fx
Data source: Current Item, Field from source: TenSanPhamXuat,
Return fields as: Lookup Id(as Interger) Ok
Ok
Chọn Minus, click vào Value thứ 2
Ấn Fx
Data source: Current Item; Field from source: SluongXuat Ok
Output to chọn Create a new variable
Name: Sluongcon; Type: Number Ok
Đặt con trỏ trong phần Transition to stage vào action chọn If any value equals value
Click vào value đầu tiên
Click Fx
Data source: Workflow variables and parameters; Field from source: variable:Sluongcon
Chọn Is greater than or equal to 0
Đặt con trỏ phía dưới If vào Action chọn Goto Stage, tương tự cho Else
tương tự cho Else, vào Stage add thêm Stage 2
Chọn Stage 1 đổi thành Tinh Xuat
Đổi stage 2 thành Tru Sp
Trong If của Tinh xuat chọn Goto Tru Sp
Đặt con trỏ phía dưới Stage Tru Sp vào Action chọn Update List item
Click vào this list
List: sản Phẩm, ấn add
Set this field: Soluongn ấn Fx
Data source: Workflow variables and parameters,
Field from source:Variable Sluongcon Ok
Ok
Field: ID, Value: ấn Fx
Data source: Current Item, Field from source: TenSanPhamxuat,
Return field as: Lookup Id(as Interger) Ok
Ok
Đặt con trỏ phía dưới Transition to stage
Vào Action chọn Goto a stage
Chọn End Of Workflow
Vào Stage add thêm stage 3, đổi tên thành Xuat het, đặt con trỏ phía dưới Xuat het vào action chọn Set Field in Current Item
Click vào Field
Chọn SluongXuat, click vào Value
Click vào Fx
Data source: Sản Phẩm, Field from source:Soluong, Field: ID, value ấn Fx
Data source: Current Item, Field from source: TenSanPhamXuat,
Return field as: Lookup Id(as Interger) Ok
Click Ok
Đặt con trỏ phía dưới Set Sluongxuat, vào Action chọn Update List Item
Click vào this List
List: sản Phẩm, ấn Add
Set this field: Soluong, to this value: 0 Ok. Field: ID, Value ấn Fx
Data source: Current Item, Field from source: TenSanPhamXuat,
Return field as: Lookup Id(asInterger) Ok
OK
Đặt con trỏ phía dưới Transition vào Action chọn Go to Stage
Click Go to a Stage
Chọn End of Workflow
Trong phần Else của Stage Tinh Xuat chọn Go to Xuat Het
Chọn Workflow setting check vào các checkbox như trong hình chọn Publish. Tạo Workflow xong.
B9. Thiết Kế Form Phiếu Xuất. Infopath designer, New\Sharepoint list Design form
Nhập vào site http://internal.nhatnghe.local/QLTK Next
Chọn list Phiếu Xuất Next
Check vào manage multiple list items with this form
Xóa dòng Attachment
Thiết kế form như trong hình. Vào Tab Data chọn Connections
Ấn Add
Chọn option Receive data Next
Chọn Option Sharepoint library or list Next
Nhập vào site: http://internal.nhatnghe.local/QLTK –> Next
Chọn List Phiếu Xuất Next
Check vào ID Next
Check vào Store a copy or the data in the form template
Nhập vào tên phiếu Xuất, check vào Automatic receive… Finish Close
Phải chuột vào Field MaPXuat chọn textbox properties …
Click vào Fx
Nhập Concat(“Phieu Xuat –“, ấn Insert Function chọn Max, click vào Double click to insert field
Chọn Show advanced view
Fields chọn Phiếu Xuất, Chọn ID OK
Mã phiếu xuất tự động tăng OK
Ok
Phải chuột vào Repeating Section Properties ….
Check vào Allow users to insert and delete the section OK
Thiết kế Phiếu Xuất xong vào tab File chọn Publish Ok
B10. Tạo View. Trở về site Internal.nhatnghe.local/QLTK chọn List phiếu xuất, vào Tab List Create view.
Chọn all items
View Name: groupbyPhieuXuat
Chọn các checkbox như trong hình
Trong phần Group by chọn Group by theo Created và MaPXuat
Trong phần Totals chọn Sum Giaxuat Ok
Tương tự chọn List Phiếu Nhập, vào Tab List Create View
Chọn All Items
View name: Groupbyphieunhap và các checkbox như trong hình
Trong phần Group by chọn group by theo Created và MaPhieuNhap
Trong phần Totals chọn Sum theo gia nhap Ok. Tạo View xong.
B11 Test. Tiến hành tạo phiếu nhập và Phiếu xuất kiểm tra xem có cộng và trừ số lượng trong list sản phẩm không?
Mr CTL – labs.ctl.vn