Wednesday, April 29, 2015

Source Code : Main Form

  No comments


****************************************************************************
Thisform.init

PUBLIC harix,bulanx,tahunx,nm_tgl_inp

*DECLARE SetWindowLong In Win32Api AS _Sol_SetWindowLong Integer, Integer, Integer
*DECLARE SetLayeredWindowAttributes In Win32Api AS _Sol_SetLayeredWindowAttributes Integer, String, Integer, Integer

*_Sol_SetWindowLong(this.hWnd, -20, 0x00080000)
*_Sol_SetLayeredWindowAttributes(this.hWnd, 0, 255, 2)

thisform.buatcursor
thisform.up_bdg
thisform.up_jns_brg
thisform.up_kat_brg
thisform.up_lok
thisform.up_brg
thisform.up_sexi
thisform.up_sup
thisform.up_inp
thisform.up_outp
thisform.up_det_inp
thisform.up_det_out                                        
thisform.up_idktr
thisform.up_staf
thisform.kliksexi
thisform.up_user
thisform.up_brg13
thisform.up_reg
*thisform.up_stok

*----------------------------------------
thisform.pageframe1.page14.optiongroup1.Click
thisform.lblid.VALUE=user_id
thisform.lbluser.VALUE=user_name
thisform.pageframe1.page2.cbjns_brg.RowSource="cjns_brg.nm_jns_brg"
thisform.pageframe1.page4.cbjns_brg.RowSource="cjns_brg.nm_jns_brg"
thisform.pageframe1.page2.cbkat_brg.RowSource="ckat_brg.nm_kat_brg"
thisform.pageframe1.page9.cbkat_brg.RowSource="ckat_brg.nm_kat_brg"
thisform.pageframe1.page2.cblok.RowSource="clok.nm_lok"
thisform.pageframe1.page16.cblok.RowSource="clok.nm_lok"
thisform.img_logo.Picture= 'C:\PROGRAM FILES\APPBRG\IMG\LOGO.PNG'

thisform.pageframe1.page4.grid2.RecordSource=''
thisform.pageframe1.page5.grid2.RecordSource=''
thisform.labelip.Caption='IP Database '+ALLTRIM(ipdata)

*----------------------------------------

bln=MONTH(DATE())
DO CASE
    CASE bln=1
    bula="Januari"
    CASE bln=2
    bula="Pebruari"
    CASE bln=3
    bula="Maret"
    CASE bln=4
    bula="April"
    CASE bln=5
    bula="Mei"
    CASE bln=6
    bula="Juni"
    CASE bln=7
    bula="Juli"
    CASE bln=8
    bula="Agustus"
    CASE bln=9
    bula="September"
    CASE bln=10
    bula="Oktober"
    CASE bln=11
    bula="Nopember"
    CASE bln=12
    bula="Desember"
ENDCASE
DO CASE
    CASE DOW(DATE())=1
         hr_="Minggu"
    CASE DOW(DATE())=2
         hr_="Senin"
    CASE DOW(DATE())=3
         hr_="Selasa"
    CASE DOW(DATE())=4
         hr_="Rabu"
    CASE DOW(DATE())=5
         hr_="Kamis"
    CASE DOW(DATE())=6
         hr_="Jumat"
    CASE DOW(DATE())=7
         hr_="Sabtu"
ENDCASE

thisform.txtid_user.Value=user_id
THISFORM.LABEL6.Caption="Anda Login sebagai "+ALLTRIM(user_name)+"( "+ALLTRIM(user_nama)+" )"
THISFORM.LABEL3.Caption="Hari ini : "+alltrim(hr_)+", "+ALLTRIM(STR(DAY(DATE())))+" "+bula+" "+ALLTRIM(STR(YEAR(DATE())))


public loReportListener

loForm = Createobject('form')
With loForm
   .Name = 'Pencetakan'
   .Caption = 'Print Preview Aplikasi Persediaan'
   .Visible = .F.
   .WindowType=1
   .WindowState=2
   .MaxButton = .T.
   .MinButton = .F.
   .HEIGHT=600
  .WIDTH=1000
   .BackColor = Rgb(255,255,255)
   lcWndName = .Name
ENDWITH

SET CLASSLIB TO ("c:/program files/APPBRG/sys/_ReportListener.VCX") ADDITIVE
loReportListener = NEWOBJECT("FullJustifyListener", LOCFILE("c:/program files/APPBRG/sys/FJListener.Prg"))

SELECT * FROM cuser WHERE id_user=123456 INTO CURSOR lapx
SELECT lapx
REPORT FORM "C:\PROGRAM FILES\appbrg\rep\lap_rkp_kuitx.frx" OBJECT loReportListener NOCONSOLE PREVIEW WINDOW (lcWndName) TO PRINTER PROMPT NODIALOG

***********************************************************************************
*One of many up_*

thisform.up_brg

mtf = namakursor
msql  = "select * from brg;"
IF     SQLEXEC(Koneksi, msql, "&mtf") <= 0
       =MESSAGEBOX("Proses Query Ke MySQL Gagal 2", 0+16, "Informasi")
       RETURN
ENDIF

IF     USED("&mtf")
      SELECT cbrg
    DELETE ALL
     SELECT &mtf
      GO TOP
       DO     WHILE !EOF()
          SCATTER MEMVAR
          SELECT cbrg
          APPEND BLANK
          GATHER MEMVAR
         SELECT &mtf
          SKIP
       ENDDO
       USE IN &mtf
    ELSE
    =MESSAGEBOX("Gagal Query Ke Data Barang", 0+16, "Informasi")
     RETURN
ENDIF

SELECT     cbrg.id_brg,cbrg.nm_brg,cbrg.hrg_brg,cbrg.sat_brg,cbrg.stok,cbrg.kuo,cbrg.jml_bl,cbrg.id_lok,;
           cbrg.merk_brg,cbrg.id_jns_brg,cbrg.id_kat_brg,cjns_brg.id_jns_brg,cjns_brg.nm_jns_brg,cbrg.ed,;
        clok.id_lok,clok.nm_lok,ckat_brg.id_kat_brg,ckat_brg.nm_kat_brg FROM cbrg INNER JOIN cjns_brg ;
        ON  cbrg.id_jns_brg = cjns_brg.id_jns_brg INNER JOIN clok ON cbrg.id_lok=clok.id_lok;
        INNER JOIN ckat_brg ON cbrg.id_kat_brg=ckat_brg.id_kat_brg ;       
        INTO CURSOR cbrg1    

SELECT cbrg1
GO TOP


thisform.pageframe1.page2.grid1.RecordSource="cbrg1"
thisform.aturtabel2

thisform.pageframe1.page7.grid1.RecordSource="cbrg1"
thisform.aturtabel7

SELECT * FROM cbrg1 WHERE id_jns_brg_a=1 AND (kuo>0 OR stok>0) INTO CURSOR cbrg9
SELECT cbrg9
GO top
thisform.pageframe1.page9.grid1.RecordSource="cbrg9"
thisform.aturtabel9

SELECT * FROM cbrg1 WHERE stok>0 INTO CURSOR cbrg5
SELECT cbrg5
GO top

thisform.pageframe1.page5.grid1.RecordSource="cbrg5"
thisform.aturtabel5a

********************************************************************************
*One of many Print Command

thisform.pageframe1.page7.cmdCetak.Click


PUBLIC tanggal,bulanx,tahun,tgl

tanggal=DATE()
thisform.nm_bln
tgl=ALLTRIM(cidktr.kt_ktr)+", "+ALLTRIM(STR(DAY(DATE())))+" "+ALLTRIM(bulanx)+" "+alltrim(STR(YEAR(DATE())))
*----------------------------------------------------------------------------------------------------------------      
KEYBOARD "{Ctrl+F10}" PLAIN CLEAR
DO     CASE

    CASE     thisform.pageframe1.page7.Optiongroup2.option1.Value=1 && Lampiran 4 (Daftar Pengadaan Barang)
            SELECT     cdet_inp.id_inp,cdet_inp.id_brg,cdet_inp.jml_inp,cinp.id_inp,cinp.tgl_inp,cinp.tgl_sp,cinp.no_sp,cinp.no_inp,;
            cbrg.id_brg,cbrg.nm_brg,cbrg.hrg_brg,cbrg.sat_brg;
            FROM cdet_inp INNER JOIN cinp ON cdet_inp.id_inp=cinp.id_inp ;
            INNER JOIN cbrg ON cdet_inp.id_brg=cbrg.id_brg ;
            WHERE year(tgl_inp)=thisform.pageframe1.page7.spinner1.Value AND !(MONTH(tgl_inp)=1 AND DAY(tgl_inp)=1) ORDER BY tgl_inp ASC INTO CURSOR lapthn1
            SELECT lapthn1
            REPORT FORM "C:/Program Files/APPBRG/REP/Lamp4.frx" TO  PRINTER PREVIEW   
****************************************************************************************************************************************************           
           
    CASE     thisform.pageframe1.page7.Optiongroup2.option2.Value=1 && Lampiran 8 (Buku Penerimaan Barang)
            SELECT     cdet_inp.id_inp,cdet_inp.id_brg,cdet_inp.jml_inp,cinp.id_inp,cinp.tgl_inp,cinp.tgl_sp,cinp.no_sp,cinp.no_inp,;
            cinp.id_sup,csup.id_sup,csup.nm_sup,cbrg.id_brg,cbrg.nm_brg,cbrg.hrg_brg,cbrg.sat_brg;
            FROM cdet_inp INNER JOIN cinp ON cdet_inp.id_inp=cinp.id_inp ;
            INNER JOIN cbrg ON cdet_inp.id_brg=cbrg.id_brg ;
            INNER JOIN csup ON cinp.id_sup=csup.id_sup ;
            WHERE year(tgl_inp)=thisform.pageframe1.page7.spinner1.Value AND !(MONTH(tgl_inp)=1 AND DAY(tgl_inp)=1) ORDER BY tgl_inp ASC INTO CURSOR lapthn2
            SELECT lapthn2
            REPORT FORM "C:/Program Files/APPBRG/REP/Lamp8.frx" TO  PRINTER PREVIEW   
****************************************************************************************************************************************************                       
           
    CASE     thisform.pageframe1.page7.Optiongroup2.option3.Value=1 && Lampiran 9 (Buku Pengeluaran Barang)
            SELECT     cdet_out.id_out,cdet_out.id_brg,cdet_out.jml_out,coutp.id_out,coutp.tgl_out,coutp.id_staf,;
            cstaf.id_staf,cstaf.nm_staf,cbrg.id_brg,cbrg.nm_brg,cbrg.hrg_brg,cbrg.sat_brg;
            FROM cdet_out INNER JOIN coutp ON cdet_out.id_out=coutp.id_out ;
            INNER JOIN cbrg ON cdet_out.id_brg=cbrg.id_brg ;
            INNER JOIN cstaf ON coutp.id_staf=cstaf.id_staf ;
            WHERE year(tgl_out)=thisform.pageframe1.page7.spinner1.Value ORDER BY tgl_out ASC INTO CURSOR lapthn3
            SELECT lapthn3
            REPORT FORM "C:/Program Files/APPBRG/REP/Lamp9.frx" TO  PRINTER PREVIEW   
****************************************************************************************************************************************************                       
   
    CASE     thisform.pageframe1.page7.Optiongroup2.option4.Value=1 && Lampiran 11 (Buku Barang Pakai Habis)
            SELECT     cdet_out.id_out,cdet_out.id_brg,cdet_out.id_brg as id_brg1,cdet_out.jml_out,coutp.id_out,coutp.id_out as no_out,coutp.tgl_out,coutp.id_staf,cstaf.id_staf,cstaf.nm_staf,;
                    cbrg.id_brg,cbrg.nm_brg,cbrg.hrg_brg,cbrg.merk_brg,cbrg.sat_brg FROM cdet_out INNER JOIN coutp ON cdet_out.id_out=coutp.id_out INNER JOIN cstaf ON coutp.id_staf=cstaf.id_staf;
                    INNER JOIN cbrg ON cdet_out.id_brg=cbrg.id_brg WHERE YEAR(tgl_out)=thisform.pageframe1.page7.spinner1.Value INTO CURSOR cbrg7d
            SELECT     cdet_inp.id_inp,cdet_inp.id_brg,cdet_inp.id_brg as id_brg1,cdet_inp.jml_inp,cinp.id_inp,cinp.tgl_inp,cinp.id_sup,cinp.no_inp,csup.id_sup,csup.nm_sup,;
                    cbrg.id_brg,cbrg.nm_brg,cbrg.hrg_brg,cbrg.merk_brg,cbrg.sat_brg FROM cdet_inp INNER JOIN cinp ON cdet_inp.id_inp=cinp.id_inp INNER JOIN csup ON cinp.id_sup=csup.id_sup;
                    INNER JOIN cbrg ON cdet_inp.id_brg=cbrg.id_brg WHERE YEAR(tgl_inp)=thisform.pageframe1.page7.spinner1.Value AND (MONTH(tgl_inp)<>1 AND DAY(tgl_inp)<>1) INTO CURSOR cbrg7e
            select per_brg       
            DELETE ALL
           
            SELECT cbrg7d
            GO     TOP
            DO     WHILE NOT EOF()
                INSERT INTO  per_brg (id_brg,tgl_inp,nm_brg,merk_brg,thn_brg,jml_inp,sat_brg,no_inp,hrg_brg,tgl_out,nm_staf,jml_out,no_out);
                VALUES (cbrg7d.id_brg1,cbrg7d.tgl_out,cbrg7d.nm_brg,cbrg7d.merk_brg,thisform.pageframe1.page7.spinner1.Value,0,cbrg7d.sat_brg,"",cbrg7d.hrg_brg,;
                cbrg7d.tgl_out,cbrg7d.nm_staf,cbrg7d.jml_out,cbrg7d.no_out)
                SELECT     cbrg7d
                SKIP 
                ENDDO

            SELECT cbrg7e
            GO     TOP
            DO     WHILE NOT EOF()
                INSERT INTO  per_brg (id_brg,tgl_inp,nm_brg,merk_brg,thn_brg,jml_inp,sat_brg,no_inp,hrg_brg,tgl_out,nm_staf,jml_out,no_out);
                VALUES (cbrg7e.id_brg1,cbrg7e.tgl_inp,cbrg7e.nm_brg,cbrg7e.merk_brg,thisform.pageframe1.page7.spinner1.Value,cbrg7e.jml_inp,cbrg7e.sat_brg,cbrg7e.no_inp,cbrg7e.hrg_brg,;
                cbrg7e.tgl_inp,"",0,0)
                SELECT     cbrg7e
                SKIP 
                ENDDO
           

                SELECT * FROM per_brg ORDER BY id_brg,tgl_inp,tgl_out ASC INTO CURSOR per_brg2
                SELECT per_brg2
                REPORT FORM "C:/Program Files/APPBRG/REP/Lamp11.frx" TO  PRINTER PREVIEW   
    
           
****************************************************************************************************************************************************                       

    CASE     thisform.pageframe1.page7.Optiongroup2.option5.Value=1 && Lampiran 15 (Laporan Semester)
            DO CASE
            CASE    thisform.pageframe1.page7.cbsmt.ListIndex=1
                    SELECT     cdet_out.id_out,cdet_out.id_brg,cdet_out.id_brg as id_brg1,cdet_out.jml_out,coutp.id_out,coutp.id_out as no_out,coutp.tgl_out,coutp.id_staf,cstaf.id_staf,cstaf.nm_staf,;
                            cbrg.id_brg,cbrg.nm_brg,cbrg.hrg_brg,cbrg.sat_brg FROM cdet_out INNER JOIN coutp ON cdet_out.id_out=coutp.id_out INNER JOIN cstaf ON coutp.id_staf=cstaf.id_staf;
                            INNER JOIN cbrg ON cdet_out.id_brg=cbrg.id_brg WHERE YEAR(tgl_out)=thisform.pageframe1.page7.spinner1.Value AND MONTH(tgl_out)<7 INTO CURSOR cbrg7f
                    SELECT     cdet_inp.id_inp,cdet_inp.id_brg,cdet_inp.id_brg as id_brg1,cdet_inp.jml_inp,cinp.id_inp,cinp.tgl_inp,cinp.id_sup,cinp.no_inp,cinp.no_sp,cinp.tgl_sp,csup.id_sup,csup.nm_sup,;
                            cbrg.id_brg,cbrg.nm_brg,cbrg.hrg_brg,cbrg.sat_brg FROM cdet_inp INNER JOIN cinp ON cdet_inp.id_inp=cinp.id_inp INNER JOIN csup ON cinp.id_sup=csup.id_sup;
                            INNER JOIN cbrg ON cdet_inp.id_brg=cbrg.id_brg WHERE YEAR(tgl_inp)=thisform.pageframe1.page7.spinner1.Value AND (MONTH(tgl_inp)<>1 AND DAY(tgl_inp)<>1) AND MONTH(tgl_inp)<7 INTO CURSOR cbrg7g
            CASE    thisform.pageframe1.page7.cbsmt.ListIndex=2
                    SELECT     cdet_out.id_out,cdet_out.id_brg,cdet_out.id_brg as id_brg1,cdet_out.jml_out,coutp.id_out,coutp.id_out as no_out,coutp.tgl_out,coutp.id_staf,cstaf.id_staf,cstaf.nm_staf,;
                            cbrg.id_brg,cbrg.nm_brg,cbrg.hrg_brg,cbrg.sat_brg FROM cdet_out INNER JOIN coutp ON cdet_out.id_out=coutp.id_out INNER JOIN cstaf ON coutp.id_staf=cstaf.id_staf;
                            INNER JOIN cbrg ON cdet_out.id_brg=cbrg.id_brg WHERE YEAR(tgl_out)=thisform.pageframe1.page7.spinner1.Value AND MONTH(tgl_out)>6 INTO CURSOR cbrg7f
                    SELECT     cdet_inp.id_inp,cdet_inp.id_brg,cdet_inp.id_brg as id_brg1,cdet_inp.jml_inp,cinp.id_inp,cinp.tgl_inp,cinp.id_sup,cinp.no_inp,cinp.no_sp,cinp.tgl_sp,csup.id_sup,csup.nm_sup,;
                            cbrg.id_brg,cbrg.nm_brg,cbrg.hrg_brg,cbrg.sat_brg FROM cdet_inp INNER JOIN cinp ON cdet_inp.id_inp=cinp.id_inp INNER JOIN csup ON cinp.id_sup=csup.id_sup;
                            INNER JOIN cbrg ON cdet_inp.id_brg=cbrg.id_brg WHERE YEAR(tgl_inp)=thisform.pageframe1.page7.spinner1.Value AND (MONTH(tgl_inp)<>1 AND DAY(tgl_inp)<>1) AND MONTH(tgl_inp)>6 INTO CURSOR cbrg7g
            ENDCASE
           
            SELECT smt_brg       
            DELETE ALL
           
            SELECT cbrg7f
            GO     TOP
            DO     WHILE NOT EOF()
                INSERT INTO  smt_brg (id_brg,tgl_inp,nm_brg,jml_inp,sat_brg,no_inp,hrg_brg,tgl_out,no_sp,tgl_sp,nm_sup,nm_staf,jml_out,no_out);
                VALUES (cbrg7f.id_brg1,cbrg7f.tgl_out,cbrg7f.nm_brg,0,cbrg7f.sat_brg,"",cbrg7f.hrg_brg,cbrg7f.tgl_out,"",;
                cbrg7f.tgl_out,"",cbrg7f.nm_staf,cbrg7f.jml_out,cbrg7f.no_out)
                SELECT     cbrg7f
                SKIP 
                ENDDO

            SELECT cbrg7g
            GO     TOP
            DO     WHILE NOT EOF()
                INSERT INTO  smt_brg (id_brg,tgl_inp,nm_brg,jml_inp,sat_brg,no_inp,hrg_brg,tgl_out,no_sp,tgl_sp,nm_sup,nm_staf,jml_out,no_out);
                VALUES (cbrg7g.id_brg1,cbrg7g.tgl_inp,cbrg7g.nm_brg,cbrg7g.jml_inp,cbrg7g.sat_brg,cbrg7g.no_inp,cbrg7g.hrg_brg,;
                cbrg7g.tgl_inp,cbrg7g.no_sp,cbrg7g.tgl_sp,cbrg7g.nm_sup,"",0,0)
                SELECT     cbrg7g
                SKIP 
                ENDDO
           

                SELECT * FROM smt_brg ORDER BY id_brg,tgl_inp,tgl_out ASC INTO CURSOR smt_brg2
                SELECT smt_brg2
                REPORT FORM "C:/Program Files/APPBRG/REP/Lamp15.frx" TO  PRINTER PREVIEW   

*************************************************************************************************************************************

ENDCASE

No comments :

Post a Comment