Cara menampilkan Akumulasi Total Piutang dan Pembayaran Customer di Prevew Sales Invoice
Apabila anda ingin untuk menampilkan Total Piutang Anda terhadap customer tertentu sekaligus menampilkan total Jumlah DP yang telah diakumulasi, di Preview Sales Invoice, seperti gambar berikut ini adalah caranya.
1). Pada IBX ke-2 (qrySIARInv: TfrIBQuery) edit SQL-nya:
-Pada bagian SELECT (sebelum baris “from ARINV a”) tambahkan baris :
GET_CUSTOMERPERSONBALANCE.AMOUNT, GET_CUSTOMERPERSONBALANCE.AMOUNTDC
-Sebelum baris “Where a.ARInvoiceID=:ARINVOICEID” tambahkan baris dibawah ini :
LEFT OUTER JOIN GET_PERSONBALANCE (a.CUSTOMERID, CURRENT_DATE, CURRENT_DATE) GET_CUSTOMERPERSONBALANCE ON a.CUSTOMERID = GET_CUSTOMERPERSONBALANCE.ID
-Sehingga keseluruhan SQL menjadi :
select a.*, x1.TaxName TaxName1, x1.Rate Tax1Rate, x2.TaxName TaxName2, c.ADDRESSLINE1, c.ADDRESSLINE2, c.CITY, c.CONTACT, c.COUNTRY, c.DEFAULTINVDESCRIPTION, c.NAME, c.PERSONNO, c.PHONE, c.STATEPROV, c.ZIPCODE, c.TAX1EXEMPTIONNO, c.PersonMessage, c.Fax, c.Email, c.WebPage, c.TaxAddress1, c.TaxAddress2, c.TAX2EXEMPTIONNO, t.TERMNAME, t.NetDays, t.TERMMEMO, cu.CURRENCYNAME, s.FIRSTNAME, s.LASTNAME, v.NAME SHIPNAME, w.Name WarehouseName, br.ExchangeRate BankRate ,c.CHRRESERVED1,c.CHRRESERVED2,c.CHRRESERVED3,c.CHRRESERVED4, c.CHRRESERVED5,c.CHRRESERVED6,c.CHRRESERVED7,c.CHRRESERVED8, c.CHRRESERVED9,c.CHRRESERVED10,c.CURRRESERVED1,c.CURRRESERVED2, c.CURRRESERVED3,c.DATERESERVED1,c.DATERESERVED2, sn.SNList, GET_CUSTOMERPERSONBALANCE.AMOUNT, GET_CUSTOMERPERSONBALANCE.AMOUNTDC from ARINV a Inner join PersonData c on a.CustomerID=c.ID Inner Join Currency cu on c.CurrencyID=cu.CurrencyID Left Outer Join TermOPmt t on t.termID=a.TermsID Left Outer Join Salesman s on a.SalesmanID=s.SalesmanID Left Outer Join Shipment v on a.ShipVia=v.ShipID Left Outer Join Tax x1 ON x1.TaxID=a.Tax1ID Left Outer Join Tax x2 ON x2.TaxID=a.Tax2ID Left Outer Join WareHS w ON w.WarehouseID=a.WarehouseID Left Outer Join Currency br on br.CurrencyID=(select CurrencyID from GLAccnt where GLAccount=a.DepositTo) Left Outer Join View_SN_ByTrans(a.ARInvoiceID, ‘ARINV’) sn ON sn.ID=a.ARInvoiceID LEFT OUTER JOIN GET_PERSONBALANCE (a.CUSTOMERID, CURRENT_DATE, CURRENT_DATE) GET_CUSTOMERPERSONBALANCE ON a.CUSTOMERID = GET_CUSTOMERPERSONBALANCE.ID Where a.ARInvoiceID=:ARINVOICEID
2). Pada “Data Dictionary” buat New Variable pada folder “Invoice” dengan nama “TotalOutstanding” yang expression-nya kita isi seperti ini :
[if(DialogForm.qrySIARInv.”AMOUNTDC”=0, [STR(DialogForm.qrySIARInv.”AMOUNT”)], [STR(DialogForm.qrySIARInv.”AMOUNT”) + ‘ + ‘ + STR(DialogForm.qrySIARInv.”AMOUNTDC”) ])]
3). Tampilkan New Variable di memo (rectangle object) yang kita inginkan.
CATATAN : Total Piutang yang tampil adalah per tanggal komputer saat edang di preview/print (bukan per tanggal Sales Invoice). dan untuk Contoh template *.frf nya dapat anda Download di Link Download di bawah ini
Sorry, the comment form is closed at this time.