Batch report with sale and purchase date

Discussion in 'Tally Developer' started by Hasan@123, Sep 17, 2021.

    
  1. Hasan@123

    Hasan@123 Member


    How can i add sale date and purchase date in this report? please help




    [#Menu: Gateway of Tally]
    Item: "Batch Wise Item Summary" : Display Collection : Batch Report

    [Collection : Batch Report]
    Collection: MyBodyPart
    Variable: MyVar
    Report: ItemReport
    Trigger: MyTrigger
    Title: "List Of Batch's"
    Full Height: Yes
    Align: Center


    [Variable: MyVar]
    Type: String

    [Report: MyTrigger]
    Form : TriggerForm
    Variable: MyVar
    Title: "Select Batch Name"
    [Form: TriggerForm]
    Parts: TriggerPart
    Height: 100% Page
    Width:10% Page
    [Part: TriggerPart]
    Lines: TriggerLine
    [Line: TriggerLine]
    Field: TriggerField

    [Field: TriggerField]
    Use: Name Field
    Table: BatchReport

    SubForm :Item Report
    Show Table: Always
    Variable: MyVar
    Modifies: MyVar
    ;Align: Center
    ;Width: 100%

    ;============================Collections BATCHES=================================
    [Collection: BatchOpSrc]


    Type : Stock Item
    Fetch : BatchName, StockItemName
    [Collection : BatchOp]
    Source Collection : BatchOpSrc
    Walk : Batch Allocations
    By : BName : $BatchName
    [Collection: BatchPurSrc]
    Type : Voucher
    ; Filter : MyPurchaseFilter
    [Collection : BatchPur]
    Source Collection : BatchPurSrc
    Walk : Inventory Entries, Batch Allocations
    By : BName : $BatchName
    [Collection: MyBodyPart]
    Collection : BatchPur, ;BatchOp,
    Fetch : BName
    Format : $BName, 20
    Variable : MyVar
    Sort : Default : $BName
    [System: Formula]
    MyPurchaseFilter : $$IsPurchase:$VoucherTypeName

    ;=========================== ITEM REPORT=================================
    [Report: Item Report]
    ;Use : DSP Template
    Form : ItemForm
    ;Set : SV FromDate : $$MonthStart:$LastVoucherDate:Company:##SVCurrentCompany
    ;Set : SV ToDate : $$MonthEnd:$LastVoucherDate:Company:##SVCurrentCompany
    Set: bename : $$batchfilter


    ;; batch name filter function

    [Function:batchfilter]
    VARIABLE : vbatchName : String

    RETURNS : String


    30 : SET : vbatchName : #TriggerField


    70 : RETURN : ##vbatchName



    [Form: ItemForm]
    ;Use :DSP Template
    Parts: ItemTitlePart, ItemBodyPart
    Button: refreshthisbatch


    [Button:refreshthisbatch]
    Title:"Refresh TDL"
    Action: refresh TDL
    Key:F5

    [Part: ItemTitlePart]

    Lines: ItemBatchTitle, qtynametitle , ItemNameTitle,
    Border: Column Titles


    [Line: ItemBatchTitle]
    Field: ItemBatchTitle
    Right Field:ItemDateTitleFROM, ItemDateTitle
    Height: 1.5
    Space Top:.3
    Space Bottom: .3
    Border: thin bottom
    [Field: ItemBatchTitle]
    Use: Name Field
    Skip: yes
    Set as: "BATCH NAME " +": " + ##bename
    Width: 25
    [Field: ItemDateTitle]
    Use: Date Field
    Set as: #SVTodate
    Style: Normal Bold
    Skip: Yes

    [Field: ItemDateTitleFROM]
    Use: Date Field
    Set as: #SVFROMdate
    Style: Normal Bold
    Skip: Yes



    [Line:qtynametitle]
    ;Border: Column Titles
    Field: BeItemNameTitle, beitembatchoptitle,
    Right Fields:beitembatchintitle, beitembatchouttitle,beitembatchclotitle
    Height: 1.5

    [Line: ItemNameTitle]

    Field: emtyfield, ItemBalanceTitle, ItemRateTitle, ItemValueTitle,
    Right Fields: ItemBalanceTitle1, ItemValueTitle1, ItemBalanceTitle2, ItemValueTitle2,ItemBalanceTitle3, ItemRateTitle3, ItemValueTitle3
    Height: 1.5



    [Field: emtyfield]
    Set as:""
    Width:25 % page
    Skip: yes
    Border: thick right

    [Field: BeItemNameTitle]
    Set as: "particulars"
    Style: Normal Bold
    Skip: Yes
    Width: 25 % page
    Border: thick right
    Align: Center


    [Field:beitembatchclotitle]

    Set as: "Closing"
    Style: Normal Bold
    Skip: Yes
    Width: 22.50 % page
    Border: Thick Right and bottom
    Align: Center

    [Field:beitembatchoptitle]
    Use: beitembatchclotitle
    Set as:"Opening"
    Border:Thick Right and bottom
    Width: 22.50 % page

    [Field:beitembatchintitle]
    Use: beitembatchclotitle
    Set as:"Inwards"
    Width: 15 % page
    Border: Thick Right and bottom
    [Field:beitembatchouttitle]
    Use: beitembatchclotitle
    Set as:"outwards "
    Width: 15 % page
    Border: Thick Right and bottom



    [Field: ItemBalanceTitle]

    Set as: "Qty"
    Width: 7.5 % page
    Align: Center
    Style: Normal Bold
    Skip: Yes
    ;Border: thin box


    [Field: ItemRateTitle]
    Set as: "Rate"
    Width: 7.5 % page
    Align: Center
    Style: Normal Bold
    Skip: Yes
    ;Border: thin box

    [Field: ItemValueTitle]
    Set as: "Value"
    Width: 7.5 % page
    Align: Center
    Style: Normal Bold
    Skip: Yes


    [Field: ItemBalanceTitle1]

    Set as: "Qty"
    Width: 7.5 % page
    Align: Center
    Style: Normal Bold
    Skip: Yes
    Border: Thick left


    [Field: ItemValueTitle1]
    Set as: "Value"
    Width: 7.5 % page
    Align: Center
    Style: Normal Bold
    Skip: Yes
    ;Border: thin right

    [Field: ItemBalanceTitle2]

    Set as: "Qty"
    Width: 7.5 % page
    Align: Center
    Style: Normal Bold
    Skip: Yes
    Border: Thick left

    [Field: ItemValueTitle2]
    Set as: "Value"
    Width: 7.5 % page
    Align: Center
    Style: Normal Bold
    Skip: Yes



    [Field: ItemBalanceTitle3]

    Set as: "Qty"
    Width: 7.5 % page
    Align: Center
    Style: Normal Bold
    Skip: Yes
    Border: Thick left


    [Field: ItemRateTitle3]
    Set as: "Rate"
    Width: 7.5 % page
    Align: Center
    Style: Normal Bold
    Skip: Yes
    ;Border: thin box

    [Field: ItemValueTitle3]
    Set as: "Value"
    Width: 7.5 % page
    Align: Center
    Style: Normal Bold
    Skip: Yes
    ;Border: thin box


    [Part: ItemBodyPart]
    Lines: ItemBodyPart
    Bottom Line: ItemTotalLine
    Total: ItemValue
    Repeat: ItemBodyPart : MyItemBodyPart
    Scroll: Vertical
    Common Border: Yes

    [Line: ItemBodyPart]
    Field: BeItemName,ItemopBalance, ItemopRate, ItemopValue
    Right Field:IteminBalance,IteminValue, ItemoutBalance,ItemoutValue,ItemBalance, ItemRate, ItemValue
    ;Border: thin bottom

    [Field: BeItemName]

    Set as: $IName
    Style: Normal
    ;Skip: Yes
    Width:25 % page
    Border: thick right



    [Field: ItemBalance]
    Set as: $MyQty
    Width: 7.5% page
    Align: Left
    Skip: Yes
    Border: Thick left
    Align: Left
    [Field: ItemRate]
    Set as: $MyRate
    Width: 7.5% page
    Align: Left
    Skip: Yes
    ;Border: thin left
    Align: Left

    [Field: ItemValue]
    Use: Amount Field
    Set as: $MyValue
    Width: 7.5% page
    Align: Left
    Skip: Yes
    ;Border: thin left
    ;Align: Center

    [Field: itemopbalance]
    Use: itembalance
    Set as: $myopqty

    [Field: itemoprate]
    Use: itemrate
    Set as:$myoprate

    [Field: itemopvalue]
    Use: itemvalue
    Set as:$myopvalue

    [Field: iteminbalance]
    Use: itembalance
    Set as: $myinqty


    [Field: iteminvalue]
    Use: itemvalue
    Set as:$myinvalue

    [Field: itemoutbalance]
    Use: itembalance
    Set as: $myoutqty


    [Field: itemoutvalue]
    Use: itemvalue
    Set as:$myoutvalue


    [Line: ItemTotalLine]
    Left Field: ItemTotalName
    Right Field:itemoptotalvalue,itemintotalvalue, itemouttotalvalue,ItemTotalValue
    Border: Column Titles

    [Field: ItemTotalName]
    Use: Name Field
    Set as: "TOTAL "
    Skip: Yes
    Width: 25 % page

    [Field: itemoptotalvalue]
    Use: Amount Field
    Set as: $$Total:Itemopbalance
    Skip: Yes
    Width: 22.50% page

    [Field: itemintotalvalue]
    Use: Amount Field
    Set as: $$Total:Iteminbalance
    Skip: Yes
    Width: 15% page

    [Field: itemouttotalvalue]
    Use: Amount Field
    Set as: $$Total:ItemoutValue
    Skip: Yes
    Width: 15% page

    [Field: ItemTotalValue]
    Use: Amount Field
    Set as: $$Total:ItemValue
    Skip: Yes
    Width: 22.50% page




    ;============================== COLLECTION ITEM ======================
    [Collection : ItemOp]
    Source Collection : BatchOpSrc
    Walk : Batch Allocations
    By : BName : $BatchName
    By : IName : $StockItemName
    Compute : MyQty : $$FilterValue:$Closingbalance:DSDBATCHEXTRACT:1:isCorrectBatch
    Compute : MyRate : $$FilterValue:$ClosingRate:DSDBATCHEXTRACT:1:isCorrectBatch
    Compute : MyValue : $$FilterValue:$ClosingValue:DSDBATCHEXTRACT:1:isCorrectBatch

    [Collection : ItemPur]
    Source Collection : BatchPurSrc
    Walk : Inventory Entries, Batch Allocations
    By : BName : $BatchName
    By : IName : $StockItemName

    Compute : MyQty : $$FilterValue:$Closingbalance:DSDBATCHEXTRACT:1:isCorrectBatch
    Compute : MyRate : $$FilterValue:$ClosingRate:DSDBATCHEXTRACT:1:isCorrectBatch
    Compute : MyValue : $$FilterValue:$ClosingValue:DSDBATCHEXTRACT:1:isCorrectBatch

    Compute : MyopQty : $$FilterValue:$openingbalance:DSDBATCHEXTRACT:1:isCorrectBatch
    Compute : MyopRate : $$FilterValue:$openingRate:DSDBATCHEXTRACT:1:isCorrectBatch
    Compute : MyopValue : $$FilterValue:$openingValue:DSDBATCHEXTRACT:1:isCorrectBatch

    Compute : MyinQty : $$FilterValue:$inwardquantity:DSDBATCHEXTRACT:1:isCorrectBatch
    Compute : MyinValue : $$FilterValue:$inwardvalue:DSDBATCHEXTRACT:1:isCorrectBatch

    Compute : MyoutQty : $$FilterValue:$outwardquantity:DSDBATCHEXTRACT:1:isCorrectBatch
    Compute : MyoutValue : $$FilterValue:$outwardvalue:DSDBATCHEXTRACT:1:isCorrectBatch

    [Collection: MyItemBodyPart]
    Collection : ItemPur , ;ItemOp,
    Fetch : IName, BName , MyQty, MyRate, MyValue, MyopQty, MyopRate, MyopValue, MyinQty, MyinValue,MyoutQty, MyoutValue
    Sort : Default : $BName

    Variable: BeName : String : $BName
    Filter : MyItemFilter
    ;Filter : NotEmptyMyQty

    [Collection : DSD BATCH EXTRACT]
    Type : Batch
    Child of : ##pvItemName
    ParmVAR : pvItemName : String : $StockItemName
    Fetch : GodownName, ClosingBalance, Date, ClosingRate, ClosingValue, opening balance, opening rate, opening value, inward quantity, inward value, outward quantity, outward value
    [System: Formula]
    MyItemFilter :##BeName = $BName
    isCorrectBatch : $Name=$$ReqObject:$BatchName
    NOTEmptyMyQty : NOT $$IsEmpty:$MyQty

    [System: Variable]
    Variable : bename : String


    [Border: Thick Right and bottom]

    Right : Thick
    Bottom: thick
    Left: Thick
    Top: Thick









    upload_2021-9-17_14-7-5.png
     


  2. Vineet Jindal

    Vineet Jindal Member


    Purchase or sale rate is not working and if we want the purchase date and sale date in this list and no of days with a difference of purchase date from sale date
     


  3. sivam

    sivam Active Member


    Walk Inventory Entries, Batch allocations and use $$CollectionFieldByKey to fetch the values
     


  4. Vineet Jindal

    Vineet Jindal Member


    How to calculate no of days from purchase voucher date to sale voucher date?
     


  5. sivam

    sivam Active Member


    #SalesVoucherDateField - #PurchaseVoucherDateField
     


  6. Vineet Jindal

    Vineet Jindal Member


    This is not working.....I have used $$Number:#GLosRepDt2 - #GlosRepDt1 but unable to find the result..
    Else in print the first page is okay but from second page it takes only half page
     


  7. sivam

    sivam Active Member


    Just give #GLosRepDt2 - #GlosRepDt1
     


  8. Vineet Jindal

    Vineet Jindal Member


    Sir, please see the image... the first Page is okay but when we see from the second page it is shown in half pages till end??? What is the reason?
     

    Attached Files:



  9. sivam

    sivam Active Member


    Something in Column Titles Part. Check it or share that particular part code

    Better, Don't give any field width in % Jut give it as number like below

    [Field: My Field]
    Use : Name Field
    Width : 12
     


  10. Vineet Jindal

    Vineet Jindal Member


    Yes sir I have not given any field like you said but still there is an issue.....Can you pls spare sometime and see the error in TDL
    I will share my anydesk
     


  11. sivam

    sivam Active Member


    No Anydesk. Try yourself or Share Here
     


  12. Vineet Jindal

    Vineet Jindal Member


    Okay Sir...I will share you the code

    Errors
    1. In Print the second page is shown in half page.
    2. Calculating Grand Total with subtotal.
    3. stock item search button is not working to search an item in report.
     

    Attached Files:

    • one.txt
      File size:
      17.7 KB
      Views:
      20


  13. sivam

    sivam Active Member


    Report is not opened for me. Still loading after few mins.

    1. In SM Details Part - Add Total : <Fields>
    2. Don't use Title Lines in Body Part, separate it and Declare in Top Part
    3. This below field should be like this

    [Field:BtnStkItem]
    Use:Name Field
    Modifies:IsStockName

    and Variable IsStockName should be declare in Main report.
     


Share This Page