Author Topic: Penomoran Otomatia  (Read 473 times)

0 Members and 1 Guest are viewing this topic.

Offline Fahmiriadi

  • Newbie
  • *
  • Posts: 10
Penomoran Otomatia
« on: January 02, 2017, 09:12:22 PM »
Ada yang bisa bantu membuat penomoran otomatis seperti ini "INV-00001/01/SMK/2017"   :sad5:
Saya udah coba menggunakan baris kode seperti berikut :
 
thisform.refresh
Select t_terima
Set order to tag no_inv
Goto bottom
Bln = month(date())
Thn = year(date())
a = right(no_inv,5)
b = padl(alltr(str(val(a)+1)),5,'0')
thisform.no_inv.value = 'INV' + '-' +  b + '/' + alltr(str(bln)) + '/SMK/' + alltr(str(thn))
Hasil output = INV-00001/1/SMK/2017
setelah transaksi di simpan dan ingin melakukan transaksi lagi nomor urut tetap di 00001 tidak menambah otomatis.
Kira kira bagaimana solusinya ? Mohon bantuannya  :crybaby2:

Offline poison

  • Hero Member
  • *
  • Posts: 1.581
  • Poison 4 Women
Re: Penomoran Otomatia
« Reply #1 on: January 03, 2017, 07:21:33 AM »
Code: [Select]
local lcPrefix,lnNextVal,lcHasil
lnNextVal = 0
lcPrefix = '/' + padl(month(date()),2,'0') + '/SMK/' + PADL(YEAR(DATE()),4)
select top 1 no_inv from t_terima where substr(no_inv,10) = lcPrefix order by no_inv desc into cursor crLastNo readwrite
if reccount('crLastNo') = 1
  lnNextVal = val(substr(no_inv,5,5))
endif
lcHasil = 'INV-'+padl(lnNextVal,5,'0')+lcPrefix
https://goo.gl/MbnaeW
think BIG to get BIG thing

Offline Fahmiriadi

  • Newbie
  • *
  • Posts: 10
Re: Penomoran Otomatia
« Reply #2 on: January 03, 2017, 03:53:39 PM »
Terima Kasih sebelumnya, saya sudah mencoba dengan code tersebut, tetapi masalah belum terpecahkan...

local lcPrefix,lnNextVal,lcHasil
lnNextVal = 0
lcPrefix = '/' + padl(month(date()),2,'0') + '/SMK/' + PADL(YEAR(DATE()),4)
select top 1 no_inv from t_terima where substr(no_inv,10) = lcPrefix order by no_inv desc into cursor crLastNo readwrite
if reccount('crLastNo') = 1
  lnNextVal = val(substr(no_inv,5,5))
endif
lcHasil = 'INV-'+padl(lnNextVal,5,'0')+lcPrefix
thisform.no_inv.value = lcHasil

output awal memang betul yaitu 'INV-00000/01/SMK/2017' tapi setelah transaksi disimpan penomoran berubah menjadi 'INV-00.00/01/SMK/2017'
kira2 dimana ya letak kesalahannya ? apakah saya yang salah menaruh nilai pada code...Terima kasih banyak

Offline poison

  • Hero Member
  • *
  • Posts: 1.581
  • Poison 4 Women
Re: Penomoran Otomatia
« Reply #3 on: January 04, 2017, 06:12:58 AM »
he..he..he...he...emang itu untested code..... :icon_biggrin: :icon_biggrin:
coba yg ini
Code: [Select]
local lcPrefix,lnNextVal,lcHasil
lnNextVal = 1
lcPrefix = '/' + padl(month(date()),2,'0') + '/SMK/' + PADL(YEAR(DATE()),4)
select top 1 no_inv from t_terima where substr(no_inv,10) = lcPrefix order by no_inv desc into cursor crLastNo readwrite
if reccount('crLastNo') = 1
  lnNextVal = val(substr(no_inv,5,5)) + 1
endif
lcHasil = 'INV-'+padl(lnNextVal,5,'0')+lcPrefix
think BIG to get BIG thing

Offline deni_msmsulsel

  • Junior Member
  • *
  • Posts: 337
Re: Penomoran Otomatia
« Reply #4 on: February 20, 2017, 09:41:58 AM »
pembahasan uda bolak-balik