How To Add Field in Voucher

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 5

/*

Objective(s) -
- This code demonstrates the alteration of Voucher
- Receipt/Payment Voucher is altered to accept/print cheque details

*/

[#Part: VCH Narration] ;; Modify the Narration Part to add the details

;;Switch has been defined in narration part that will appear if it is payment
or receipt voucher

Add : Switch : BankDetRcpt : BankDet VCH Narration :


@@IsPayment OR @@IsReceipt
Add : Switch : BankDetRcpt : BankDet VCH NarrationRcpt :
@@ReceiptAfterSave

;;This part will execute in receipt and payment voucher

[!Part: BankDet VCH Narration]

Add : Line : At Beginning : BankDet VCH Cheque Number, BankDet VCH


Bank Name, +
BankDet VCH NarrWOChqDet

[!Part: BankDet VCH NarrationRcpt]

Delete : Lines : VCH


ReceiptName
Add : Line : At Beginning : VCH ReceiptName

;;locally at part level field width is set using system formula

Local : Line : VCH ReceiptName : Local : Field : Short


Prompt :Width: @@MediumWidth

[Line: BankDet VCH Cheque Number]

Fields : Medium Prompt, BankDet VCH Cheque Number, Short Prompt,


BankDet VCH ChqDate

Local : Field : Default : Inactive :


@@BankDetBank

Local : Field : Medium Prompt : Info : $


$LocaleString:"Cheque Number:"

Local : Field : Short Prompt : Set as : $


$LocaleString:"Dated:"

[Field: BankDet VCH Cheque Number]

Use : Number Field


Storage : ChequeNumber ;;; storage is used to store
cheque number in the field
Format : "NoZero, NoComma" ;;; formatting
mechanism to display numerical value without zero and comma
Max : 7
Width : 7

[Field: BankDet VCH ChqDate]

Use : Uni Date Field


Storage : ChqDate ;;;storage to store date
Set as : If $$IsEmpty:$$Value then $Date else $
$Value ;;;setting value in field based on if condition, if condition is true the
it is set to date or else it will take user defined value
Set Always : Yes ;;; set always will refresh
the field always
Align : Left ;;; align will display text at
left side of the field

[Line: BankDet VCH Bank Name]

Fields : Medium Prompt, BankDet VCH Bank Name


Local : Field : Default : Inactive : @@BankDetBank

Local : Field : Medium Prompt : Info : $


$LocaleString:"Vide Bank:" ;;;function localestring is used to provide
multilingual support
Invisible : NOT @@IsReceipt

[Field: BankDet VCH Bank Name]

Use : Name Field


Storage : BankName ;;;will store field value in the
storage

[Line: BankDet VCH NarrWOChqDet]

Fields : Medium Prompt, BankDet VCH NarrWOChqDet


Local : Field : Default : Inactive : @@BankDetBank

Local : Field : Medium Prompt : Info : $


$LocaleString:"Remark:"

[Field: BankDet VCH NarrWOChqDet]

Use : VCH Narration


Storage : NarrWOCh

[#Field: VCH Narration]

;;;declaring key in the field, pressing the key Ctrl + B in the field will
execute the beow details

Add : Key : At Beginning : Bank Det Key Narration

;;;defining the key

[Key: Bank Det Key Narration]

;;;Key is must with Ctrl + B

Key : CTRL + B
;;;Action is to set the field value with storage value
Action : Set : VCH Narration : $BankDetNarr
Inactive : @@BankDetBank

;;defining method in existing voucher object

[#Object: Voucher]

BankDetNarr : if @@IsReceipt then $$LocaleString:"Ch.No.: " + $$String:


$ChequeNumber+ " dated " + $$String:$ChqDate:UniDate + " drawn on " + $BankName + "
- " + $NarrWOCh +
else $$LocaleString:"Ch.No.: " + $$String:$ChequeNumber+
" dated " + $$String:$ChqDate:UniDate + " - " + $NarrWOCh

BankDetRcpt : $$LocaleString:"Cheque Number " + $$String:$ChequeNumber+ "


dated " + $$String:$ChqDate:UniDate + " drawn on " + $BankName

NarrPrn : if $$IsEmpty:$NarrWOCh then $Narration else $NarrWOCh

;;defining system formula

[System: Formula]

BankDetBank : $$FilterCount:AllLedgerEntries:HasBankEntry = 0

;;defing user defined fields that will be used to store values

[System: UDF]

;;Format
;;Storage name : Type of storage : Index number

BankName : String : 1000


NarrWOCh : String : 1001

ChequeNumber : Number : 1000

ChqDate : Date : 1000

;; Changes in the Voucher Print

[#Field: PPR Narr]

Option : PPR Narr Rct Pymt : @@IsPayment OR


@@IsReceipt AND ##PPRChqInfo

[!Field: PPR Narr Rct Pymt]

Set As : $NarrPrn

[#Part: PPRBottomDetails]

Option : PPRBottomDetails Rct Pymt : (@@IsPayment OR


@@IsReceipt) AND ##PPRChqInfo

[!Part: PPRBottomDetails Rct Pymt]

Add : Parts : At Beginning : BankDet VCH CheqDet


[Part: BankDet VCH CheqDet]

Lines : BankDet VCH PCheque No Title, BankDet VCH PCheque No,


+
BankDet VCH PBank Title, BankDet VCH PBank

[Line: BankDet VCH PCheque No Title]

Use : PPR SubTitles


Local : Field : Name Title Field : Info
: $$LocaleString:"Cheque Number and Date :"

[Line: BankDet VCH PCheque No]

Left Fields : BankDet VCH Cheque Number


RightFields : Amount Title Field
Indent : 4
Local : Field : AmountTitleField : Border
: Thin Left
Local : Field : Default
: Style : Normal
Local : Field : BankDet VCH Cheque Number : Type
: String
Local : Field : BankDet VCH Cheque Number :
Width : 0
Local : Field : BankDet VCH Cheque Number :
FullWidth : Yes
Local : Field : BankDet VCH Cheque Number :
Delete : Storage
Local : Field : BankDet VCH Cheque Number : Set
As : $$String:$ChequeNumber + " dt " + $$String:$ChqDate

[Line: BankDet VCH PBank Title]

Use : PPR SubTitles


Local : Field : Name Title Field : Info
: $$LocaleString:"Vide Bank :"
Invisible : NOT @@IsReceipt

[Line: BankDet VCH PBank]

Left Fields : BankDet VCH Bank Name


RightFields : Amount Title Field
Indent : 4
Local : Field : AmountTitleField : Border
: Thin Left
Local : Field : Default
: Style : Normal
Local : Field : BankDet VCH Bank Name :
Width : 0
Local : Field : BankDet VCH Bank Name :
FullWidth : Yes
Invisible : NOT @@IsReceipt

;; Changes in the print of Receipt

[#Field: PRCT Thru]

Option : PRCT Thru Rct Pymt : @@IsReceipt


[!Field: PRCT Thru Rct Pymt]

Set as : if $$IsLedOfGrp:@@BankName:$$GroupCash then $


$LocaleString:"Cash" else $BankDetRcpt

[#Field: PRCT Remarks]

Option : PRCT Remarks Rct Pymt : @@IsReceipt

[!Field: PRCT Remarks Rct Pymt]

Set As : $NarrPrn

;; Config Changes

;;defining system variable with default value

[System: Variable]

PPRChqInfo : Yes

;;Defining type of variable as logical and to retain the value for ever

[Variable: PPRChqInfo]

Type : Logical
Persistent : Yes

[#Part: Payment Print Config] ;; Payment Config Changes

Add : Lines : Before : PPRVchNarr : PPR ChqDetails

[#Part: Receipt Print Config] ;; Receipt Config Changes

Add : Lines : After : PPRWithCost: PPR ChqDetails

[Line: PPR ChqDetails]

Field: Medium Prompt, Logical Field


Local: Field: Medium Prompt : Info : $$LocaleString:"Print
Cheque Info ?"
Local: Field: Logical Field : Modifies : PPRChqInfo

;; End-of-File

You might also like