Useful Keys of this TDL CODE:
place your cursor on the name of stock item and press F4 - to see Sales history, F5 to see Purchase history, F6 - to see both the sales & purchase history
ALT + E - to export sales & Purchase history in EXCEL, MS WORD, PDF, HTML etc
;;===========Rajiv Mishra Code starts here================
[Collection : ClnSaleInfo]
Type : Vouchers : Stock Item
Child Of : $$BaseOwner:#VchStockItem
Filter : SalesFilter
Sort : @@Default : -$Date
Fetch : LedgerEntries.PartyLedgerName, LedgerEntries.LedgerName
[System : Formula]
MStk : $StockItemName = $$BaseOwner:#VCHStockItem
SalesFilter : $$IsSales:$VoucherTypeName
PurchaseFilter : $$IsPurchase:$VoucherTypeName
; SalesPurFilter : $$IsPurchase:$VoucherTypeName or $$IsSales:$VoucherTypeName
ExtractYear : $$FinYearBeg:##SVCurrentDate:$StartingFrom:Company:##SVCurrentCompany
;
Historybeginyear : ExtractYear - 3 ;<----Change to capture specific number of years
[#Field : VCH StockItem]
Key : SalesHistory
Key : PurchaseHistory
Key : SalesPurHistory
Tooltip : "Press F5 for Purchase History, F4 for Sales History, F6 for Both"
[Key : SalesHistory]
Key : F4
Action : Display : RptSalesHistory
[Key: ExportButton11]
Key : Alt+E
Title : $$LocaleString:"Export"
Type : ExportButton
Action : Export Report
[Report : RptSalesHistory]
Form : FrmSalesHistory
;Use below 3 lines if you want to get report for specific no. of years ste above in system formula
;Variable : HistoryFrom, HistoryTo
; Set : HistoryFrom : "01/04" + @@Historybeginyear
; Set : HistoryTo : $$FinYearEnd:##SVCurrentDate:$StartingFrom:Company:##SVCurrentCompany
[Form : FrmSalesHistory]
Part : PrtSalesHistory
Height : if $$InPrintMode then 8.20 else 100% Screen
Width : if $$InPrintMode then 5.70 else 75% Screen
Use : DSP Template
Horizontal Align: Right
;Vertical Alignment : Bottom
Buttons: PrintButton, ExportButton
Background: @@SV_RELEASEDBLUE
[Part : PrtSalesHistory]
Line : LnSalesHistoryTitle, LnSalesHistoryHD, LnSalesHistoryData
Repeat : LnSalesHistoryData : ClnSaleInfo
Scroll : Vertical
[Line : LnSalesHistoryTitle]
Field : FldVwStkItem
Fixed : Yes
[Field : FldVwStkItem]
Use : Short Name Field
Set As : "Sales History For : " + #VCHStockItem
Full Width : Yes
Align : Centre
[Line : LnSalesHistoryHD]
Use : LnSalesHistoryData
Local : Field : Default : Type : String
;Local : Field : Default : Align : Centre
Local : Field : FldSalesHistory7 : Set As : "Sl. No"
Local : Field : FldSalesHistory7 : Align : Center
Local : Field : FldSalesHistory0 : Set As : "Voucher Type"
Local : Field : FldSalesHistory1 : Set As : "Invoice No"
Local : Field : FldSalesHistoryDt: Set As : "Date"
Local : Field : FldSalesHistoryDt: Align : Center
Local : Field : FldSalesHistory2 : Set As : "Party Name"
Local : Field : FldSalesHistorySr: Set as : "Inv Sl. No"
Local : Field : FldSalesHistorySr: Align : Center
Local : Field : FldSalesHistory3 : Set As : "Qty"
Local : Field : FldSalesHistory3 : Align : Center
Local : Field : FldSalesHistory4 : Set As : "Rate"
Local : Field : FldSalesHistory4 : Align : Left
Local : Field : FldSalesHistory5 : Set As : "Discount"
Local : Field : FldSalesHistory6 : Set As : "Amount"
Local : Field : FldSalesHistory6 : Align : Right
Local : Field : FldSalesHistory8 : Set As : "IGST Rate"
Local : Field : FldSalesHistory8 : Align : Center
Local : Field : FldSalesHistory9 : Set As : "Desc1"
Local : Field : FldSalesHistory10: Set As : "Desc2"
Local : Field : FldSalesHistory11: Set As : "Desc3"
Border : Column Titles
Fixed : Yes
[Line : LnSalesHistoryData]
Field : FldSalesHistory7, FldSalesHistory1, FldSalesHistoryDt, FldSalesHistory2 ;;FldSalesHistory0,
Right Field : FldSalesHistorySr, FldSalesHistory3, FldSalesHistory4, FldSalesHistory5, FldSalesHistory6, FldSalesHistory8, FldSalesHistory9, FldSalesHistory10, FldSalesHistory11
Local : Field : FldSalesHistory7 : Set As : $$Line
Local : Field : FldSalesHistory0 : Set As : $VoucherTypeName
Local : Field : FldSalesHistory1 : Set As : $VoucherNumber
Local : Field : FldSalesHistoryDt: Set As : $Date
Local : Field : FldSalesHistory2 : Set As : $PartyLedgerName
Local : Field : FldSalesHistorySr: Set As : $$FilterValue:$Line:InventoryEntries:1:mStk
Local : Field : FldSalesHistory3 : Set As : $$FilterValue:$BilledQty:InventoryEntries:1:mStk
Local : Field : FldsalesHistory4 : Set As : $$FilterValue:$Rate:InventoryEntries:1:mStk
Local : Field : FldSalesHistory5 : Set As : $$FilterValue:$discount:InventoryEntries:1:mStk
Local : Field : FldSalesHistory6 : Set As : $$FilterValue:$Amount:InventoryEntries:1:mStk
Local : Field : FldSalesHistory8 : Set As : $$FilterValue:$GSTRate:InventoryEntries:1:mStk ;to be fetched from the voucher, Not from Item Master
Local : Field : FldSalesHistory9 : Set As : $$FilterValue:$BasicUserDescription:InventoryEntries:1:mStk
Local : Field : FldSalesHistory10: Set As : $$FilterValue:$BasicUserDescription:BasicUserDescription:2:InventoryEntries:1:mStk
Local : Field : FldSalesHistory11: Set As : $$FilterValue:$BasicUserDescription:BasicUserDescription:3:InventoryEntries:1:mStk
;Empty If : NOT $$IsSalesOrder:$VoucherTypeName
Explode : PrtsalesHistoryData : $$FilterCount:InventoryEntries:mStk -1 > 0
Remove If : $$Line > 50 ;to limit the data to 50 transactions each for purchase and sale
Option : Alter on Enter
Option: DisplayOnAltEnter
[Part : PrtsalesHistoryData]
Line : LnsalesHistoryData1
Repeat : LnsalesHistoryData1 : InventoryEntries
[Line : LnsalesHistoryData1]
Field : FldSalesHistory7, FldSalesHistory1, FldSalesHistoryDt, FldSalesHistory2
Right Field : FldSalesHistorySr, FldSalesHistory3, FldSalesHistory4, FldSalesHistory5, FldSalesHistory6, FldSalesHistory8, FldSalesHistory9, FldSalesHistory10, FldSalesHistory11
Local : Field : FldSalesHistory7 : Set As : $$Line
Local : Field : FldSalesHistory0 : Set As : $$Owner:$VoucherTypeName
Local : Field : FldSalesHistory1 : Set As : $$Owner:$VoucherNumber
Local : Field : FldSalesHistoryDt: Set As : $$Owner:$Date
Local : Field : FldSalesHistory2 : Set As : $$Owner:$PartyLedgerName
Local : Field : FldSalesHistorySr: Set As : $Line
Local : Field : FldSalesHistory3 : Set As : $BilledQty
Local : Field : FldSalesHistory4 : Set As : $Rate
Local : Field : FldSalesHistory5 : Set As : $Discount
Local : Field : FldSalesHistory6 : Set As : $Amount
Local : Field : FldSalesHistory8 : Set As : $GSTRate ;to be fetched from the voucher, Not from Item Master
Local : Field : FldSalesHistory9 : Set As : $BasicUserDescription:1
Local : Field : FldSalesHistory10: Set As : $BasicUserDescription:BasicUserDescription:2
Local : Field : FldSalesHistory11: Set As : $BasicUserDescription:BasicUserDescription:3
Empty if : NOT @@mStk OR $$ItemSerial=0
[Field : FldSalesHistory0]
Use : Short Name Field
Style: HistoryBody
Align: Center
Alter: Voucher
Display: Voucher
[Field : FldSalesHistory1]
Use : Short Name Field
Style: HistoryBody
Align: Center
Alter: Voucher
Display: Voucher
[Field : FldSalesHistoryDt]
Use : Short Date Field
Style: HistoryBody
Alter: Voucher
Display: Voucher
[Field : FldSalesHistory2]
Use : Name Field
Style: HistoryBody
Width: Full Width
Indent : 1
Alter: Voucher
Display: Voucher
[Field : FldSalesHistorySr]
Use : Short Name Field
Style: HistoryBody
Align : Right
Alter: Voucher
Display: Voucher
[Field : FldSalesHistory3]
Use : Qty Field
Style: HistoryBody
Align : Right
Alter: Voucher
Display: Voucher
[Field : FldsalesHistory4]
Use : Rate Price Field
Style: HistoryBody
Width: Full Width
Indent : 2
Alter: Voucher
Display: Voucher
[Field : FldsalesHistory5]
Use : Number Field
Align : Right
Format : "Percentage"
Style: HistoryBody
Alter: Voucher
Display: Voucher
[Field : FldsalesHistory6]
Use : Amount Field
Style: HistoryBody
Alter: Voucher
Display: Voucher
[Field : FldSalesHistory7]
Use : Short Name Field
Style: HistoryBody
Align: Center
Alter: Voucher
Display: Voucher
[Field : FldSalesHistory8]
Use : Number Field
Style: HistoryBody
Align: Center
Alter: Voucher
Display: Voucher
[Field : FldSalesHistory9]
Use : Short Name Field
Style: HistoryBody
Align: Center
Alter: Voucher
Display: Voucher
[Field : FldSalesHistory10]
Use : Short Name Field
Style: HistoryBody
Align: Center
Alter: Voucher
Display: Voucher
[Field : FldSalesHistory11]
Use : Short Name Field
Style: HistoryBody
Align: Center
Alter: Voucher
Display: Voucher
[Style: HistoryBody]
Use : Tiny
Bold : Yes
[Collection : ClnPurchaseInfo]
Type : Vouchers : Stock Item
Child Of : $$BaseOwner:#VchStockItem
Filter : PurchaseFilter
Sort : @@Default : -$Date
Fetch : LedgerEntries.PartyLedgerName, LedgerEntries.LedgerName
[Key : PurchaseHistory]
Key : F5
Action : Display : RptPurchaseHistory
[Report : RptPurchaseHistory]
Form : FrmPurchaseHistory
;Use below 3 lines if you want to get report for specific no. of years ste above in system formula
;Variable : HistoryFrom, HistoryTo
; Set : HistoryFrom : "01/04" + @@Historybeginyear
; Set : HistoryTo : $$FinYearEnd:##SVCurrentDate:$StartingFrom:Company:##SVCurrentCompany
[Form : FrmPurchaseHistory]
Part : PrtPurchaseHistory
Height : if $$InPrintMode then 8.20 else 100% Screen
Width : if $$InPrintMode then 5.70 else 50% Screen
Use : DSP Template
Horizontal Align: Left
Buttons: PrintButton, ExportButton
Background: @@SV_RELEASEDYELLOW
[Part : PrtPurchaseHistory]
Line : LnPurchaseHistoryTitle, LnPurchaseHistoryHD, LnPurchaseHistoryData
Repeat : LnPurchaseHistoryData : ClnPurchaseInfo
Scroll : Vertical
[Key : SalesPurHistory]
Key : F6
Action : Display : RptSalesPurHistory
[Report : RptSalesPurHistory]
Form : FrmSalesPurHistory
;Use below 3 lines if you want to get report for specific no. of years ste above in system formula
;Variable : HistoryFrom, HistoryTo
; Set : HistoryFrom : "01/04" + @@Historybeginyear
; Set : HistoryTo : $$FinYearEnd:##SVCurrentDate:$StartingFrom:Company:##SVCurrentCompany
[Form : FrmSalesPurHistory]
Part : PrtPurchaseHistory
Part : PrtSalesHistory
Height : if $$InPrintMode then 4.10 else 100% Screen
Width : if $$InPrintMode then 5.70 else 50% Screen
Use : DSP Template
Horizontal Align: Left
; Vertical Alignment : Bottom
Background: @@SV_RELEASEDGREEN
Buttons : PrintButton, ExportButton
[Line: LnPurchaseHistoryTitle]
; Use : LnSalesHistoryTitle
Field : FldVwStkItem2
Fixed : Yes
[Field : FldVwStkItem2]
Use : Short Name Field
Set As : "Purchase History For : " + #VCHStockItem
Full Width : Yes
Align : Centre
[Line: LnPurchaseHistoryHD]
Use: LnSalesHistoryHD
[Line: LnPurchaseHistoryData]
Use: LnSalesHistoryData
;;===================================================================================
;;'Books Beginning From' & 'Date of Last Entry'
;;Set : SVFRomDate : $Booksfrom:Company:##SVCurrentCompany
;;Set : SVToDate : $LastVoucherDate:Company:##SVCurrentCompany
कोई टिप्पणी नहीं:
एक टिप्पणी भेजें