
/*
Objective(s) -
-	This code demonstrates the concept of Sub-Form and Aggregate UDFs
-	While entering a receipt voucher and ledger selected is 'Bill Collection', this sub form 
	is activated

Dependencies -
-	Ledger by name "Bill Collection"
*/

[#Field: ACLSLed]

	Sub Form	: BillDetail	: yes  ;;##SVVoucherType = "Receipt" and $LedgerName = "Bill Collection"

[#Field: ACLSAmt]

	Set As 		: if $$NumItems:BAggre > 0 and $LedgerName = "Bill Collection" then @MyTot else @OldValue
	MyTot 		: $$CollAmtTotal:BAggre:$BillAmt 
	OldValue 	: $$Value

[Report: BillDetail] ;; Sub Form

	Form 	: BillDetail
	Title 	: $$LocaleString:"Bill Details"

[Form: BillDetail]

	Parts 		: Bill Titles, Bill Details
	Background 	: White, Lily White
	Height 		: 70% Screen
	Width 		: 70% Screen

[Part: BillTitles]

	Lines	: Bill Details

	[Line: Bill Details]

		Fields	: BHeader

		[Field: BHeader]

			Set as 		: "Bill Detail For " + $LedgerName
			Skip 		: Yes
			FullWidth 	: Yes
			Align 		: Centre
			Border 		: Thin Bottom
			Style 		: "Normal Bold"

[Part: BillDetails]

	Line 		: BillDetailsH, BillDetailsD
	Scroll 		: Vertical
	Repeat 		: BillDetailsD		: BAggre
	Break After : $$Line = 2

	[Line: BillDetailsH]

		Fields 	: SNo, CustName, BillNoTitle, BillAmt, FPrint
		Local 	: Field : Default : Skip 	: Yes
		Local 	: Field : Default : Width 	: 15
		Local 	: Field : Default : Align 	: Centre
	
	[Line: BillDetailsD]

		Fields 	: SNo1, CustName1, BillNo1, BillAmt1, FPrint1
		Local 	: Field : Default : Width 	: 15
		Local 	: Field : Default : Align 	: Centre
		
		[Field: SNo]

			Set as 	: "S.No"

		[Field: SNo1]

			Set as 	: $$Line
			Skip 	: Yes

		[Field: CustName]

			Set as 	: "Customer Name"

		[Field: CustName1]

			Use 	: Name Field
			Storage : CustName12

		[Field: BillNoTitle]

			Set as 	: "Bill Number"

		[Field: BillNo1]

			Use 	: Name Field
			Storage : BillNo

		[Field: BillAmt]

			Set as 	: "Bill Amount"

		[Field: BillAmt1]

			Use 	: Amount Field
			Storage : BillAmt

		[Field: FPrint]

			Set as 	: "Print"

		[Field: FPrint1]

			Use 	: Name Field
			Storage : FPrint1

[System: UDF]

	CustName12 	: String 	: 1001
	BillNo 		: String 	: 1002
	BillAmt 	: Amount 	: 1003
	FPrint1 	: String 	: 1004
	BAggre 		: Aggregate : 1000

;; End-of-File
