/* */

Tuesday, November 23, 2010

Re: [belajar-access] kawan kawan mohon bantuanya untuk program Status approval non approval saya

SELECT order.no_order, sales.line_order, sales.id_item, item.kode_item, item.nama_item, customer.nama_customer, barang.approv_1, barang.approv_2
FROM barang RIGHT JOIN ((customer INNER JOIN [order] ON customer.id_customer = order.id_customer) INNER JOIN (item INNER JOIN sales ON item.id_item = sales.id_item) ON order.id_order = sales.no_order) ON barang.id_barang = item.kode_item;










sekarang anda bisa modif sql/query diatas agar yang approv_1 = -1 dan approv_2=-1 berstatus Approved, yang salah satu atau kedua approv bernilai 0 berstatus not approved, dan yang approv_1 / approv_2 is null berstatus belum di entry. Jika selesai, umpan lagi balik ke milis :)


aksan kurdin



On 11/22/2010 7:49 PM, cebleh_veteran wrote:
 

Kawan kawan, mohon bantuanya, saya punya suatu kasus neh wat nyari status aproval non approval..

terdapat 5 tabel. sebagai berikut :

1.tabel order
2.tabel item
3.tabel sales
4.tabel customer
5.tabel barang

field dalam tabel order :
* id_order (pk)
* id_customer
* no_order

field dalam tabel sales :
* id_sales (pk)
* id_item
* no_order
* line_order

field dalam tabel customer :
* id_customer (pk)
* nama_customer

field dalam tabel item :
* id_item (pk)
* kode_item
* nama_item

field dalam tabel barang :
* kode_barang (pk)
* approv_1
* approv_2

contoh isi 5 record :

*tabel order

id_order |id_customer |no_order
ord_001 | abb |pc001
ord_002 | toto |pc002
ord_003 | gt |tc001

*table sales

id_sales | id_item | id_order | line_no_order
sls_001 | itm_1 | ord_001 | 1
sls_002 | itm_2 | ord_001 | 2
sls_003 | itm_2 | ord_002 | 1
sls_004 | itm_3 | ord_002 | 2
sls_005 | itm_4 | ord_003 | 1

*tabel customer

id_customer | nama_customer
aab | pt.aab
gt | pt.gajah tunggal
toto | pt.toto

*tabel item

id_item | kode_item | nama_item
itm_1 | 20C001 | PVC/PVC
itm_2 | 23C002 | XLPE/PVC
itm_3 | 20C000 | XLPE
itm_4 | 24C002 | PVC

*tabel barang

kode_barang | approv_1 | approv_2
20C001 | -1 | -1
23C002 | -1 | 0
20C000 | 0 | 0

ket : no_order dengan isi PC =Power Cable,TC =Telepone Cable

relasinya seperti ini :

order.id_order = sales.id_order
order.id_customer = customer.id_customer
sales.id_item = _item.id_item

note :

* isi dari tabel barang adalah, inputan apabila design telah selesai dibuat, apabila design belum dibuat, tidak diinput kedalam tabel barang,

* maksud dari approv_1 adalah pihak pertama yang berhak mengapprove, approv_2 adalah pihak kedua yang menggapprove barang yang telah diinput,
* jika -1 berarti sudah approve, jika 0 belum approve
* Kondisi clear apabila pihak pertama dan kedua telah mengapprove.

Jika ingin menampilkan isi tabel dengan query normal, maka akan muncul seperti ini (tabel barang tidak disertakan).

no_order | line_no_order | kode_barang | nama_barang | customer
pc001 | 1 | 20C001 | PVC/PVC | pt.abb
pc001 | 2 | 23C002 | XLPE/PVC | pt.abb
pc002 | 1 | 23C002 | XLPE/PVC | pt.toto
pc002 | 2 | 20C000 | XLPE | pt.toto
tc001 | 1 | 24C002 | PVC | pt.gajag tgl.

Bagaimana caranya atau querinya apabila ingin melihat barang yang belum ada / belum diinput di tabel barang / belum approv..

Jika dilihat dari data diatas maka muncul tampilan seperti ini :

no_order | line_no_order | kode_barang | nama_barang | null=not input | approval | customer

pc_001 | 2 | 23C002 | XLPE/PVC | 23C002 | Not Approv | pt.abb
pc_002 | 1 | 23C002 | XLPE/PVC | 23C002 | Not Apprv | pt.toto
pc_002 | 2 | 20C000 | XLPE | 20C000 | Not apprv | pt.toto
tc001 | 1 | 24C002 | PVC | | Not apprv | pt.GT

Ket : tc_001 dalam kolom null=not input tidak terisi karena belum diinput kedalam tabel barang.

bagaimana querynya untuk memuncukan data not approv, sudah saya coba nyampe mabok tapi lum berhasil, tolong bantuanya... Terima Kasih


No comments:

Post a Comment