Sales per Barang Report

Laporan penjualan per barang sangat diperlukan guna referensi pembuatan forecast sales di Marketing Dept.
Dan ini screen shoot serta coding minigui exstendednya

DAN INI CODING SAYA WITH MINIGUI EXSTENDED

#include “minigui.ch”
#include “miniprint.ch”

procedure salbar()

if !iswindowactive (salbar)

SET DATE ITALIA
SET DELETE ON
set browsesync on
set century on
set navigation extended

Define window salbar ;
at 30,30 ;
Width 650 ;
Height 460 ;
on init bukasalbar();
ON RELEASE dbcloseall();
child ;
nomaximize;
NOMINIMIZE;
backcolor {192,192,192}

DEFINE IMAGE SALBAR
ROW 30
COL 30
WIDTH 660
HEIGHT 450
PICTURE ‘D:\SOALGUI\dasar\birutelurpolos.gif’
END IMAGE

@ 17,130 LABEL TBL_LBL Value “LAPORAN PENJUALAN PER BARANG”;
FONT “ARIAL NARROW” SIZE 18 ;
fontcolor {255,0,0} ;
transparent ;
WIDTH 500

DRAW PANEL ;
IN WINDOW salbar ;
AT 10,30 ;
TO 50,615

DRAW PANEL ;
IN WINDOW salbar ;
AT 60,30 ;
TO 400,615

@ 70,440 frame kata_frm ;
caption “Jenis Laporan”;
width 150 ;
height 240

@ 70,40 frame kata_frm2 ;
caption “Data Posting laporan”;
width 385 ;
height 300

@ 110,55 LABEL PRODUK1_LBL VALUE ‘Nama Produk ‘;
font “arial” size 12 ;
transparent

@ 140,210 LABEL PRODUK11_LBL ;
font “arial” size 11 ;
width 200 ;
transparent

@ 170,55 LABEL PRODUK2_LBL VALUE ‘Nama Produk ‘;
font “arial” size 12 ;
transparent

@ 200,210 LABEL PRODUK21_LBL ;
font “arial” size 11;
width 200 ;
transparent

@ 230,55 label stgl1_lbl Value ‘Tanggal ‘;
font “arial” size 12 ;
width 150 ;
height 30 ;
transparent

@ 250,55 label stgl2_lbl Value ‘Tanggal ‘;
font “arial” size 12 ;
width 150 ;
height 30 ;
transparent

@ 110,210 btntextbox PRODUK1_txt ;
font “arial” size 12 ;
width 100 ;
action (playbeep(),carisalbar())

@ 170,210 btntextbox PRODUK2_txt ;
font “arial” size 12 ;
width 100 ;
action (playbeep(),carisalbar2())

define datepicker stanggal1
row 230
col 210

end datepicker

define datepicker stanggal2
row 270
col 210

end datepicker

@ 310,155 LABEL PROGRES_LBL VALUE ‘Proses Exsport ‘;
font “arial” size 10 ;
transparent

@ 330,55 progressbar progress_1;
range 1,100;
width 350 height 26

DEFINE IMAGE BK1
ROW 110
COL 455
WIDTH 20
HEIGHT 30
PICTURE ‘D:\YOKATA\ICO\EXCEL16.BMP’
WHITEBACKGROUND .t.
// ON CLICK { salbarxls(),DBFsalbar()}
END IMAGE

DEFINE IMAGE BK2
ROW 160
COL 455
WIDTH 20
HEIGHT 30
PICTURE ‘D:\YOKATA\ICO\PRINT.ICO’
WHITEBACKGROUND .F.
ON CLICK { salbar2() }
END IMAGE

@ 110,495 buttonex BK3;
caption ‘Exsport &XLS ‘;
height 30 ;
width 80 ;
BACKCOLOR {128,255,0};
// on click { salbarxls(),DBFsalbar()}

@ 160,495 buttonex BK4;
caption ‘Ke &Printer’;
height 30 ;
width 80 ;
BACKCOLOR {128,255,0};
on click { playbeep(),salbar2() }

@ 210,495 buttonex BK5;
caption ‘Ke &P D F ‘;
height 30 ;
width 80 ;
BACKCOLOR {128,255,0};
on click { playbeep(),salbar2() }

end window

salbar.progress_1.value := 0

center window salbar
activate window salbar

Endif
return nil

PROCEDURE bukasalbar

RddSetDefault(“DBFNTX”) //standar clipper-harbour
request dbfntx

&& ini dipakai jika memakai CDX
/*
afile := {“suplier”,”tblwmas”,”intran1″,”invtbl”,”intran2″,”intran28″}

for i := 1 to len(afile)

If opentables (cdrv+afile[i],.F.)
set index to (afile[i])
else
for a:= 1 to i-1
select (afile[i])
dbclosearea()
next
endif
next

*/
&& ini dipakai jika pakai NTX

IF opentables(cDRV+”GLTBL”,.F.)
ELSE
RETURN
ENDIF

IF .NOT. OPENTABLES(cDRV+”SALES”,.F.)
RETURN
ENDIF

IF OPENTABLES(cDRV+”TBLCMAS”,.F.)
SET INDEX TO (cDRV+”TBLCMAS”)
ELSE
RETURN
ENDIF

IF OPENTABLES(cDRV+”TBLWMAS”,.F.)
SET INDEX TO (cDRV+”TBLWMAS”)
ELSE
RETURN
ENDIF

IF OPENTABLES(cDRV+”INTRAN1″,.F.)
SET INDEX TO (cDRV+”INTRAN1″)
ELSE
RETURN
ENDIF

IF OPENTABLES(cDRV+”INVTBL”,.F.)
SET INDEX TO (cDRV+”INVTBL”)
ELSE
RETURN
ENDIF

IF OPENTABLES(cDRV+”INTRAN2″,.F.)
SET INDEX TO (cDRV+”INTRAN23″)
ELSE
RETURN
ENDIF

RETURN

procedure carisalbar
do while .t.
findsalbar(“salbar”,”PRODUK1_txt”)
exit
enddo
return

procedure carisalbar2
do while .t.
findsalbar(“salbar”,”PRODUK2_txt”)
// select invtbl
// salbar.produk21_lbl.value := invtbl->nmbrg
exit
enddo
return

Function findsalbar(cForm, cTextBtn)
Local cReg := “”

cReg := getsalbar(Getproperty(cForm,cTextBtn,”Value”))
If !empty(cReg)
Setproperty(cForm,cTextBtn,”Value”,cReg)
select invtbl
salbar.produk11_lbl.value := invtbl->nmbrg
salbar.produk21_lbl.value := invtbl->nmbrg
EndIf

Return

Function getsalbar(nValue)
Local cReg:= “”, nReg := 1
invtbl->(dbsetorder(1))

if !empty(nValue)
nValue := recno()
Seek Alltrim(str(nValue))
if !eof()
nReg := Recno()
endif
endif

DEFINE WINDOW Form_11;
AT 0,0 ;
WIDTH 700 HEIGHT 440 ;
MODAL NOSIZE

@310,5 frame pilih_salbar ;
width 680 ;
height 80

@ 320,70 label cnonota_lbl value ‘ Masukan Kode Customer yg dicari’;
font “arial” size 16 BOLD;
width 500;
transparent blink;
fontcolor{197,197,255}

@ 350,10 textbox cnonota_txt;
width 660 ;
on change {search_salbar() };
on enter {search_salbar() }

@ 5,5 BROWSE Browse_salbar ;
WIDTH 670 ;
HEIGHT 300 ;
HEADERS { ‘Kode Barang’ , ‘Nama Barang’,’Kode Perusahaan’,’Kode produksi’ } ;
WIDTHS { 70,230,150,150 } ;
WORKAREA INVTBL ;
FIELDS { ‘invtbl->kdbrg’,’invtbl->nmbrg’,’invtbl->kdyokata’,’invtbl->noprod’} ;
VALUE nReg ;
READONLY {.t.,.t.,.t.} ;
Justify {BROWSE_JTFY_LEFT , BROWSE_JTFY_LEFT , BROWSE_JTFY_LEFT , BROWSE_JTFY_LEFT} ;
ON DBLCLICK ( cReg:=invtbl->kdbrg,salbar.produk11_lbl.value:=invtbl->nmbrg,ThisWindow.release) ;
TOOLTIP “Pilihlah Kode customer yang anda inginkan ”

ON KEY ESCAPE ACTION ThisWindow.Release
END WINDOW

CENTER WINDOW Form_11

ACTIVATE WINDOW Form_11

Return cReg

function search_salbar

local cCari:= (form_11.cnonota_txt.value)
local nPanjang := len(ccari)

select invtbl
set order to 1
dbselectarea(“invtbl”)
dbseek(cCari)

If found()

If invtbl->(DbSeek(cCari))
form_11.browse_salbar.value := invtbl->(recno())
Else
MsgExclamation(‘Kode Barang tidak ada’)
EndIf
else
msginfo(“Kode Barang yg anda cari bukan kode Barang”,”Konfirmasi bukan kode Barang”)
form_11.cnonota_txt.value := “”

EndIf
Return

function salbar2()

LOCAL SFLAG1 := “W”
LOCAL SKODE := “SJ”

Local SKD_WIL := “10”
Local cHeader := ” SALES REPORT PER PRODUCT ”
Local cNamapt := gltbl->Namapt
Local cAlamat1 := gltbl->Alamat1
Local cAlamat2 := gltbl->Alamat2

Local i, nCOPIES, lijn, periode
Local cPrinter, bladnum

sPRODUK1 :=(alltrim(salbar.PRODUK1_txt.value))
sPRODUK2 :=(alltrim(salbar.PRODUK2_txt.value))

xtanggal1 := salbar.stanggal1.value
xtanggal2 := salbar.stanggal2.value

nCOPIES :=1
baris := 60
shal := 0
mkolom := 54 &&45

cPrinter := GetPrinter()
If Empty (cPrinter)
Return
EndIf

SELECT PRINTER cPrinter ;
ORIENTATION PRINTER_ORIENT_LANDSCAPE ;
PAPERSIZE PRINTER_PAPER_A4 ;
COPIES nCOPIES ;
QUALITY PRINTER_RES_HIGH;
PREVIEW

START PRINTDOC name “salbarutang”
START PRINTPAGE

mPageNo:=0
kpageno := 0

SELECT SALES
USE

IF OPENTABLEs(cDRV+”SALES”,.T.)
ZAP
index on kdbrg to (cDRV+”SALES.ntx”)
ELSE
RETURN
ENDIF

AWHILE := { || TANGGAL >= xTANGGAL1 .AND. TANGGAL = SPRODUK1 .AND. KDBRG =190 .OR. mPageNo=0
mPageNo++
kpageno = kpageno + mpageno
IF mPageNo>1
&& cetak garis vertical halaman
@ baris,03 PRINT LINE TO mkolom,03 PENWIDTH 0.1
@ baris,13 PRINT LINE TO mkolom,13 PENWIDTH 0.1
@ baris,37 PRINT LINE TO mkolom,37 PENWIDTH 0.1 && 4 && akhir produk
@ baris,100 PRINT LINE TO mkolom,100 PENWIDTH 0.1 &&noorder
@ baris,132 PRINT LINE TO mkolom,132 PENWIDTH 0.1 &&nonota
@ baris,172 PRINT LINE TO mkolom,172 PENWIDTH 0.1 &&term
@ baris,212 PRINT LINE TO mkolom,212 PENWIDTH 0.1 &&tanggal
@ baris,252 PRINT LINE TO mkolom,252 PENWIDTH 0.1 &&AWAL ENDING
@ baris,292 PRINT LINE TO mkolom,292 PENWIDTH 0.1 && n(DBSEEK(SPRODUK),INVTBL->NMJUAL)
SPACK2 := INVTBL->(DBSEEK(SPRODUK),INVTBL->PACK2)

SQUANBK:=SQUANBP:=SQUANTK:=SQUANTP:=0
SNET:=SDISC:=SPPN:=SJUMLAH:=0

DO WHILE .NOT. EOF() .AND. EVAL(BWHILE)

IF HARGA == 0
SQUANBK := SQUANBK + QUANTK
SQUANBP := SQUANBP + QUANTP
ELSE
SQUANTK := SQUANTK + QUANTK
SQUANTP := SQUANTP + QUANTP
ENDIF
SHARGA := HARGA
SDISC1 := INTRAN1->(DBSEEK(“SJ”+SALES->NONOTA),INTRAN1->DISC)
// SPPN1 := INTRAN1->(DBSEEK(“SJ”+SALES->NONOTA),INTRAN1->PPN)
SPPN1 := INTRAN1->(DBSEEK(“SJ”+NONOTA),INTRAN1->PPN)
STOTAL := (QUANTK+(QUANTP/SPACK2))*SHARGA
SDISC := SDISC + (SDISC1 / 100 * STOTAL)
SPPN := SPPN + (SPPN1 / 100 * (STOTAL-SDISC))
SNET := SNET + (STOTAL – SDISC + SPPN)
SJUMLAH := SJUMLAH + (STOTAL – SDISC)

SELECT sales
DbSkip()
ENDDO

IF .NOT. SQUANTK+SQUANTP+SQUANBK+SQUANBP+SJUMLAH+SNET+SDISC+SPPN == 0

XJUMLAH := XJUMLAH + SJUMLAH
XDISC := XDISC + SDISC
XPPN := XPPN + SPPN
XNET := XNET + SNET
XQUANBK := XQUANBK + SQUANBK
XQUANBP := XQUANBP + SQUANBP
XQUANTK := XQUANTK + SQUANTK
XQUANTP := XQUANTP + SQUANTP

shal := shal + 1
@ BARIS,05 PRINT transform(shal,”9999″) SIZE 7
@ baris,15 print sproduk size 8
@ baris,40 print snmproduk size 8
@ baris,130 print IF(SDISC==0,SPACE(12)+”-“,TRANSFORM(SDISC,”9,999,999,999″)) size 8 right
@ baris,170 print IF(SQUANTK==0,SPACE(8)+”-“,TRANSFORM(SQUANTK,”9,999,999″)) size 8 right
@ baris,210 print IF(SJUMLAH==0,SPACE(12)+”-“,TRANSFORM(SJUMLAH,”9,999,999,999″)) size 8 right
@ baris,250 print IF(SPPN==0,SPACE(12)+”-“,TRANSFORM(SPPN,”9,999,999,999″)) size 8 right
@ baris,290 print IF(SNET==0,SPACE(12)+”-“,TRANSFORM(SNET,”9,999,999,999”))size 8 right

baris := baris + 4

ENDIF

IF EOF()
IF .NOT. XJUMLAH+XDISC+XNET+XPPN == 0
SJUMLAH := XJUMLAH
SDISC := XDISC
SNET := XNET
SPPN := XPPN
SQUANTK := XQUANTK
SQUANTP := XQUANTP
SQUANBK := XQUANBK
SQUANBP := XQUANBP

@ baris,03 PRINT LINE TO mkolom,03 PENWIDTH 0.1
@ baris,13 PRINT LINE TO mkolom,13 PENWIDTH 0.1
@ baris,37 PRINT LINE TO mkolom,37 PENWIDTH 0.1 && 4 && akhir produk
@ baris,100 PRINT LINE TO mkolom,100 PENWIDTH 0.1 &&noorder
@ baris,132 PRINT LINE TO mkolom,132 PENWIDTH 0.1 &&nonota
@ baris,172 PRINT LINE TO mkolom,172 PENWIDTH 0.1 &&term
@ baris,212 PRINT LINE TO mkolom,212 PENWIDTH 0.1 &&tanggal
@ baris,252 PRINT LINE TO mkolom,252 PENWIDTH 0.1 &&AWAL ENDING
@ baris,292 PRINT LINE TO mkolom,292 PENWIDTH 0.1 && n<30 AWAL

BARIS := BARIS + 4
@ BARIS,04 print line to BARIS,292 penwidth 0.2
baris := baris + 4
@ BARIS, 10 PRINT "GRAND TOTAL :"
@ baris, 130 print IF(SDISC==0,SPACE(12)+"-",TRANSFORM(SDISC,"9,999,999,999")) size 8 right
@ BARIS, 170 PRINT IF(SQUANTK==0,SPACE(8)+"-",TRANSFORM(SQUANTK,"9,999,999")) SIZE 8 RIGHT
@ BARIS, 210 PRINT IF(SJUMLAH==0,SPACE(13)+"-",TRANSFORM(SJUMLAH,"99,999,999,999.99")) SIZE 8 RIGHT
@ baris, 250 print IF(SPPN==0,SPACE(12)+"-",TRANSFORM(SPPN,"9,999,999,999")) size 8 right
@ baris, 290 print IF(SNET==0,SPACE(12)+"-",TRANSFORM(SNET,"9,999,999,999"))size 8 right
BARIS := BARIS + 4
@ BARIS,04 print line to BARIS,292 penwidth 0.2
BARIS := BARIS + 4

ENDIF
ENDIF

// @ BARIS, 0 SAY AA
SELECT SALES
ENDDO
END PRINTPAGE
END PRINTDOC

RETURN Nil

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: