Aging Acount Payable

Berikut codingnya untuk membuat umur hutang atau piutang berdasarkan kategori waktu invoice  yang terbagi menjadi  < 30 hari , 30 Hari , 60 Hari , 90 Hari dan > 90 Hari

Smoga Bermanfaat:

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

procedure AGINGH()

if !iswindowactive (AGINGH)

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

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

@ 17,130 LABEL TBL_LBL Value “LAPORAN AGING HUTANG DAGANG”;
FONT “ARIAL NARROW” SIZE 18 ;
fontcolor {255,0,0}  ;
backcolor {192,192,192}  ;
WIDTH 500

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

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

@  70,440 frame kata_frm ;
caption “Jenis Laporan”;
width 145 ;
height 150 ;
backcolor {192,192,192}

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

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

@ 150,55 LABEL SUPLIER2_LBL   VALUE ‘Nama Suplier  ‘;
font “arial” size 12 ;
transparent  ;
action cariAGINGH2()

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

@ 110,210 btntextbox SUPLIER1_txt ;
font “arial” size 12 ;
width 180 ;
action (playbeep(),cariAGINGH())

@ 150,210 btntextbox SUPLIER2_txt ;
font “arial” size 12 ;
width 180 ;
action (playbeep(),cariAGINGH2())

define datepicker stanggal1
row 210
col 210
action playbeep()
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 { AGINGHxls(),DBFAGINGH()}
END IMAGE

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

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

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

end window

AGINGH.progress_1.value := 0

center window AGINGH
activate window AGINGH

Endif
return nil

PROCEDURE bukaAGINGH

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

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

USE (cDRV+”AGINGAP”) NEW EXCLUSIVE
ZAP

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+”GLTRAN2″,.F.)
SET INDEX TO (cDRV+”GLTRAN2″)
ELSE
RETURN
ENDIF

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

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

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

RETURN

procedure cariAGINGH
do while .t.
findsuplier(“AGINGH”,”SUPLIER1_txt”)
exit
enddo
return

procedure cariAGINGH2
do while .t.
findsuplier(“AGINGH”,”SUPLIER2_txt”)
exit
enddo
return

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

cReg := getsuplier(Getproperty(cForm,cTextBtn,”Value”))
If !empty(cReg)
Setproperty(cForm,cTextBtn,”Value”,cReg)
EndIf

Return

Function getsuplier(nValue)
Local cReg:= “”, nReg := 1
private cvarnonota := “kd_wil”
suplier->(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_AGINGH ;
width 680 ;
height 80

@ 320,70 label cnonota_lbl value ‘ Masukan Kode Supplier 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_AGINGH() };
on enter {search_AGINGH() }

@ 5,5 BROWSE Browse_AGINGH   ;
WIDTH 670               ;
HEIGHT 300              ;
HEADERS { ‘Kode Suplier’ , ‘Nama   Suplier’,’Alamat Suplier’,’Atention’ } ;
WIDTHS { 70,250,210,150 } ;
WORKAREA SUPLIER ;
FIELDS { ‘suplier->kd_wil’,’suplier->nm_wil’,’suplier->alamat1′,’suplier->alamat3′} ;
VALUE nReg ;
READONLY {.t.,.t.,.t.} ;
Justify {BROWSE_JTFY_LEFT , BROWSE_JTFY_LEFT , BROWSE_JTFY_LEFT , BROWSE_JTFY_LEFT} ;
ON DBLCLICK ( cReg:=suplier->kd_wil,ThisWindow.release) ;
TOOLTIP “Pilihlah Kode Suplier  yang anda inginkan ”

ON KEY ESCAPE ACTION ThisWindow.Release
END WINDOW

CENTER WINDOW Form_11

ACTIVATE WINDOW Form_11

Return cReg

function  search_AGINGH

local cCari:= (“S”+form_11.cnonota_txt.value)
local nPanjang := len(ccari)

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

If found()

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

EndIf
Return

function AGINGH2()

local aDbf := {}, w
Local SFLAG   := “H”
Local SFLAG1  := “S”
LOCAL STYPE   := “F”
Local SKD_WIL := ”  ”
Local nday    := Day(AGINGH.stanggal1.value)
Local nmonth  := Month(AGINGH.stanggal1.value)
Local nyear   := Year(AGINGH.stanggal1.value)
Local sHAL:=KEYPRESS:=TDEBET:=TKREDIT:=I:=SW:=FL:=0

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

Local TSALDO:=XSALDO:=NO2:=FL:=SW:=NO1:=SW1:=I:=0
Local SOB:=SOBP:=SAD:=SADP:=SPY:=SPYP:=SEB1:=SEB1P:=0
Local NAG := NK30:=N30:=N60:=N90:=NL90:=PPNRP:=0
Local xSEB1 := 0
Local xSEB1P:= 0
Local tSEB1 := 0
Local tSEB1P:= 0
Local tPPNRP:= 0
Local tNK30 :=tN30:=tN60:=tN90:=tNL90:=0
Local FL    := 0
Local xPPNRP:= 0
Local xNK30:=xN30:=xN60:=xN90:=xNL90:=0

if !file(cDRV+”hut.dbf”)
aadd(adbf,   {“yst1”,    “d”,    8,   0})
aadd(adbf,   {“ynmpt”,   “c”,   35,   0})
aadd(adbf,   {“yorder”,  “c”,   15,   0})
aadd(adbf,   {“ynonota”, “c”,   15,   0})
aadd(adbf,   {“yterm”,   “c”,    5,   0})
aadd(adbf,   {“yst2”,    “d”,    8,   0})
aadd(adbf,   {“yeb1”,    “n”,   18,   2})
aadd(adbf,   {“ynk30”,   “n”,   18,   2})
aadd(adbf,   {“yn30”,    “n”,   18,   2})
aadd(adbf,   {“yn60”,    “n”,   18,   2})
aadd(adbf,   {“yn90”,    “n”,   18,   2})
aadd(adbf,   {“ynl90”,   “n”,   18,   2})
aadd(adbf,   {“proses”,  “d”,    8,   0})

dbcreate(cDRV+”hut”, adbf)

if select(cDRV+”hut”) = 0
use (cDRV+”hut”) NEW exclusive
endif
else
if select(cDRV+”hut”) = 0
use (cDRV+”hut”) NEW exclusive
endif

endif

sbln        := strzero(nmonth,2)
sSUPLIER1   :=(alltrim(AGINGH.SUPLIER1_txt.value))
sSUPLIER2   :=(alltrim(AGINGH.SUPLIER2_txt.value))
xtanggal1   := AGINGH.stanggal1.value
sbl := substr(dtos(xtanggal1),5,2)
sth := substr(dtos(xtanggal1),1,4)

nCOPIES :=1
baris := 52
shal  := 0
mkolom  := 21  &&45

cPrinter := GetPrinter()
If Empty (cPrinter)
Return
EndIf
SELECT PRINTER cPrinter ;
ORIENTATION PRINTER_ORIENT_LANDSCAPE ;
PAPERSIZE   PRINTER_PAPER_LEGAL ;
COPIES      nCOPIES ;
QUALITY     PRINTER_RES_HIGH;
PREVIEW

START PRINTDOC  name “aginghutang”
START PRINTPAGE

SELECT SUPLIER
SET SOFTSEEK ON
dbseek(sFLAG1+sSUPLIER1)
SET SOFTSEEK OFF
mPageNo:=0
kpageno := 0

DO WHILE .NOT. EOF() .AND. SFLAG1 == FLAG .AND. KD_WIL >= sSUPLIER1 .AND. KD_WIL <= sSUPLIER2

IF baris>=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,70 PRINT LINE TO mkolom,70 PENWIDTH 0.1   &&noorder
@ baris,103 PRINT LINE TO mkolom,103 PENWIDTH 0.1 &&nonota
@ baris,130  PRINT LINE TO mkolom,130  PENWIDTH 0.1 &&term
@ baris,145 PRINT LINE TO mkolom,145 PENWIDTH 0.1     &&tanggal
@ baris,170 PRINT LINE TO mkolom,170 PENWIDTH 0.1       &&AWAL ENDING
@ baris,205 PRINT LINE TO mkolom,205 PENWIDTH 0.1   && n<30 AWAL
@ baris,237 PRINT LINE TO mkolom,237 PENWIDTH 0.1   && N30 AWAL
@ baris,262 PRINT LINE TO mkolom,262 PENWIDTH 0.1   && N60
@ baris,292 PRINT LINE TO mkolom,292 PENWIDTH 0.1   && N90
@ baris,317 PRINT LINE TO mkolom,317 PENWIDTH 0.1   && N90
@ baris,347 PRINT LINE TO mkolom,347 PENWIDTH 0.1   && N>90

@ baris,03 print line to baris,347 penwidth 0.1
baris += 5
@ baris,55 PRINT “Lanjut ke Halaman: “+LTRIM(STR(mPageNo))
baris := 52
mkolom := 21

END PRINTPAGE
START PRINTPAGE

ENDIF
kpageno := (kpageno/mpageno)

@ 10,280 PRINT “Tanggal Cetak : “+dtoc(DATE())
@ 15,280 PRINT “Page: “+LTRIM(STR(mPageNo))    //+” of “+ltrim(str(kpageno))     //RIGHT
@ 10,15 PRINT “PT.YOKATTA INDONESIA ” Underline
@ 15,15 PRINT “Jl.Jababeka No. Cikarang Bekasi  ”
@ 20,165 print “LAPORAN AGING HUTANG” FONT “COURIER NEW” SIZE 18 BOLD CENTER
@ 30,130 print “For Periode : “+dtoc(xtanggal1)
@ 38,05  print line to 38,347 penwidth 0.5
@ 40,05  print ” NO.”
@ 40,15  print ” N A M A   S U P P L I E R ”
@ 40,75  print ” NOMER ”
@ 45,75  print ” ORDER ”
@ 40,110 print ” NOMER”
@ 45,110 print ” INVOICE”
@ 40,130 print ” TERM ”
@ 40,150 print ” TANGGAL ”
@ 45,150 PRINT ” JT TEMPO ”
@ 40,175 print ” ENDING  ”
@ 45,175 print ” BALANCE ”
@ 40,225 print ” AGEING ACCOUNT PAYABLE FOR MOTNTH (Rp.)”
@ 45,210 print ” < 30 HARI ”
@ 45,240 print ”   30 HARI ”
@ 45,270 print ”   60 HARI ”
@ 45,300 print ”   90 HARI ”
@ 45,325 print ” > 90 HARI ”
@ 49,05  print line to 49,347 penwidth 0.5

&& cetak garis vertical u/ HEADER
@ 38,03 PRINT LINE TO 50,03 PENWIDTH 0.1             && 1
@ 38,13 PRINT LINE TO 50,13 PENWIDTH 0.1             && 2
@ 38,70 PRINT LINE TO 50,70 PENWIDTH 0.1             && 4
@ 38,103 PRINT LINE TO 50,103  PENWIDTH 0.1           && 5
@ 38,130 PRINT LINE TO 50,130 PENWIDTH 0.1           && 6
@ 38,145 PRINT LINE TO 50,145 PENWIDTH 0.1           && 7
@ 38,170 PRINT LINE TO 50,170 PENWIDTH 0.1           && 8 ENDING
@ 38,205 PRINT LINE TO 50,205 PENWIDTH 0.1           && 8
@ 38,237 PRINT LINE TO 38,237 PENWIDTH 0.1           && 8
@ 38,262 PRINT LINE TO 38,262 PENWIDTH 0.1           && 8
@ 38,292 PRINT LINE TO 38,292 PENWIDTH 0.1           && 8
@ 38,317 PRINT LINE TO 38,317 PENWIDTH 0.1           && 8
@ 38,347 PRINT LINE TO 50,347 PENWIDTH 0.1           && 8

ENDIF

SELECT SUPLIER
SKDPT := KD_WIL
SNMPT := NM_WIL
FL    := 0

SELECT HAMAS
DBSEEK (SFLAG+STYPE+SKD_WIL+SKDPT)
DO WHILE .NOT. EOF() .AND. FLAG+TYPE+KD_WIL+KD_PT == SFLAG+STYPE+SKD_WIL+SKDPT .AND. BARIS <=189

IF TANGGAL <= agingh.stanggal1.value

SNONOTA   := NONOTA
STGL      := TANGGAL
ST1       := SUBSTR(DTOS(TANGGAL),7,2)+”-“+SUBSTR(DTOS(TANGGAL),5,2)+”-“+SUBSTR(DTOS(TANGGAL),3,2)
SJTEMPO   := JTEMPO
ST2       := SUBSTR(DTOS(JTEMPO),7,2)+”-“+SUBSTR(DTOS(JTEMPO),5,2)+”-“+SUBSTR(DTOS(JTEMPO),3,2)
NPP       := PPN
SREF      := SPACE(15)
SBAYAR    := 0

SELECT INTRAN1
DBSEEK(“SP”+SNONOTA)
XORDER:=ORDER
IF XORDER = “”
XORDER := HAMAS->NOORDER
ENDIF
IF !FOUND()   // BERARTI OPENING BALANCE
STERM     := SJTEMPO-STGL
SNOORDER  := SPACE(15)
ELSE
STERM     := SJTEMPO-STGL
SNOORDER  := INTRAN1->SRJLN
ENDIF
SELECT HIDET
SEEK SFLAG+STYPE+SKD_WIL+SKDPT+SNONOTA
DO WHILE .NOT. EOF() .AND.SFLAG+STYPE+SKD_WIL+SKDPT+SNONOTA == FLAG+TYPE+KD_WIL+KD_PT+NONOTA
SNOTRN := HIDET->NOTRAN
IF TANGGAL <= xtanggal1
SELECT GLTRAN2
DBSEEK(“H10″+SNOTRN)
IF FOUND()
DO WHILE FLAG+KD_WIL+NOTRAN==”H10″+SNOTRN .AND.!EOF()
if TPTRAN==”K”
SREF  := NONOTA
ENDIF
SKIP
ENDDO
SELECT HIDET
SBAYAR  +=  JUMLAH // U/.PIUTANG
SREF  := snotrn
ENDIF
SREF  := snotrn
ENDIF
SELECT HIDET
SKIP
ENDDO
SELECT HAMAS
SMATA   := MATA

IF EMPTY(SNOORDER) //… U/ OPENING BALANCE
IF SMATA <> “I”
SOB  :=  JUMLAH * KURS
SOBP :=  ((PPN/100)*(JUMLAH*KURS))
SAD  := 0
SADP := 0
ELSE
SOB  :=  JUMLAH
SOBP :=  ((PPN/100)*JUMLAH)
SAD  := 0
SADP := 0
ENDIF
ELSE
IF SMATA <> “I”
SOB  := 0
SOBP := 0
SAD  :=  JUMLAH * KURS
SADP := ((PPN/100)*(JUMLAH*KURS))
ELSE
SOB  := 0
SOBP := 0
SAD  :=  JUMLAH
SADP := ((PPN/100)*JUMLAH)
ENDIF
ENDIF

IF SMATA <> “I”
SPY  :=  SBAYAR * KURS
SNET := (SOB+SOBP)+(SAD+SADP)
STMNT:= (SNET – (SBAYAR*KURS))
ELSE
SPY  :=  SBAYAR
SNET := (SOB+SOBP)+(SAD+SADP)
STMNT:= SNET – SBAYAR
ENDIF

SEB1  :=SNET-SPY
if SEB1+SEB1P==0
SEB1   := 0
else
endif
xSEB1  += SEB1
tSEB1  += SEB1

SELECT HAMAS
IF SFLAG   == “P”
SJMLH := IIF(TPTRAN==”D”,STMNT,-(STMNT))
ELSE
SJMLH := IIF(TPTRAN==”K”,STMNT,-(STMNT))
ENDIF

TSALDO  := TSALDO  + SJMLH
XSALDO  := XSALDO  + SJMLH

// MENCARI AGEING
NAG := NK30:=N30:=N60:=N90:=NL90:=0
NAG := xTANGGAL1-SJTEMPO

DO CASE
CASE NAG <1
NK30  := (SEB1+SEB1P)
CASE NAG >=1 .AND. NAG<=30  // 30 HARI
N30   := (SEB1+SEB1P)
CASE NAG >30 .AND. NAG<=60  // 60 HR
N60   := (SEB1+SEB1P)
CASE NAG >60 .AND. NAG<=90  // 90 HR
N90   := (SEB1+SEB1P)
CASE NAG >90
NL90  := (SEB1+SEB1P)
ENDCASE
xNK30+=NK30
xN30 +=N30
xN60 +=N60
xN90 +=N90
xNL90+=NL90
tNK30 += NK30
tN30  += N30
tN60  += N60
tN90  += N90
tNL90 += NL90

IF SEB1#0  .or. substr(sref,4,2)==sbl
//   baris := baris + 5
shal := shal + 1

@ BARIS,05  PRINT Transform(shal,”9999″) SIZE 9
@ baris,15  print SUBSTR(SNMPT,1,25)   SIZE 9
@ baris,74  print SUBSTR(XORDER,1,10)  SIZE 9
@ baris,105 print SUBSTR(snonota,1,12) SIZE 9
@ BARIS,128 PRINT (STR(SJTEMPO-STGL)) SIZE 9
@ BARIS,150 PRINT SJTEMPO SIZE 9
@ BARIS,200 PRINT TRANSFORM(SEB1,”9,999,999,999.99″) SIZE 9 RIGHT
@ BARIS,230 PRINT TRANSFORM(NK30,”9,999,999,999.99″) SIZE 9 RIGHT
@ BARIS,260 PRINT TRANSFORM(N30,”9,999,999,999.99″) SIZE 9 RIGHT
@ BARIS,290 PRINT TRANSFORM(N60,”9,999,999,999.99″) SIZE 9 RIGHT
@ BARIS,315 PRINT TRANSFORM(N90,”9,999,999,999.99″) SIZE 9 RIGHT
@ BARIS,345 PRINT TRANSFORM(NL90,”9,999,999,999.99″) SIZE 9 RIGHT

SELECT hut
APPEND BLANK
REPLACE YST1    WITH STGL //CTOD(ST1)
REPLACE YNMPT   WITH SNMPT
REPLACE YORDER  WITH XORDER
REPLACE YNONOTA WITH SNONOTA
REPLACE YTERM   WITH (STR(SJTEMPO-STGL))
REPLACE YST2    WITH SJTEMPO
REPLACE YEB1    WITH SEB1
REPLACE YNK30   WITH NK30
REPLACE YN30    WITH N30
REPLACE YN90    WITH N90
REPLACE YNL90   WITH NL90
REPLACE PROSES  WITH xTANGGAL1

SELECT hamas
BARIS := baris+5
mkolom++
ENDIF
ENDIF
SELECT HAMAS
DbSkip()
ENDDO
select suplier
dbskip()
ENDDO

END PRINTPAGE
END PRINTDOC
// CLOSE hut

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: