Accounting-Companion / TallyConnector

You can use Tally Connector to Connect your desktop/Mobile Applications with Tally seamlessly.
47 stars 29 forks source link

Get Vouchers based on ledger #32

Closed dhruvahuja2301 closed 10 months ago

dhruvahuja2301 commented 10 months ago

Is there a way to get all the vouchers for a time period for a ledger using python?

I am able to get all ledgers, but i am not able to find how to put a specific ledger in filter for GetVouchersAsync function

saivineeth100 commented 10 months ago

This library support filtering vouchers based on Date. Ex : VoucherTest

As of now we didn't added support to get voucher's based on Ledger (I am planning to add them in future for fetching vouchers based on ledger,stockitem ..etc.,)

For now, you can use filters. supported by this library.

var vchs = await _tallyService.GetVouchersAsync<Voucher>(new RequestOptions()
            {
                FromDate = new(2022, 4, 1),
               ToDate = new(2023 3, 31),
                Filters = new List<Filter>() { new("TC_VCHLEDGFILTER","$PartyName =LedgName") }               
            });
dhruvahuja2301 commented 10 months ago

I tried calling the function but getting error

TypeError: No method matches given arguments for TallyService.GetVouchersAsync: (<class 'TallyConnector.Core.Models.RequestOptions'>)

below is my code

reqoptions.FromDate=DateTime(2023,4,1)
reqoptions.ToDate=DateTime(2024,3,31)
print(reqoptions.FromDate)
print(reqoptions.ToDate)
reqoptions.Filter = List[Filter]()
reqoptions.Filter.Add(Filter("TC_VCHLEDGFILTER","PartyName ="+LedgName))

print(tally.GetVouchersAsync(reqoptions).Result)
saivineeth100 commented 10 months ago

you are using which version of tallyconnector?

dhruvahuja2301 commented 10 months ago

I had picked the latest one from here https://github.com/saivineeth100/Python_Tally/tree/main

saivineeth100 commented 10 months ago

Change code to tally.GetVouchersAsync[Voucher](reqoptions).Result and update the lib folder, pushed new files now

dhruvahuja2301 commented 10 months ago

Below code works (python) but it doesn't give list of inventories

reqoptions.Filters = List[Filter]()
reqoptions.Filters.Add(Filter("TC_VCHLEDGFILTER","$PartyName=ABCD EFGH"))
dhruvahuja2301 commented 10 months ago

Is there another filter to get the purchase and receipt details to for a specific ledger?

saivineeth100 commented 10 months ago

Below code works (python) but it doesn't give list of inventories

reqoptions.Filters = List[Filter]()
reqoptions.Filters.Add(Filter("TC_VCHLEDGFILTER","$PartyName=ABCD EFGH"))

There fetch list property in request option mention what you want there , For EX: refer -This FetchList Also refer tests even though its in c#, concept is same

saivineeth100 commented 10 months ago

Is there another filter to get the purchase and receipt details to for a specific ledger?

Purchase will be there in purchase vouchers so you need to filter based on property vouchertypename Ex : reqoptions.Filters.Add(Filter("TC_VCHTYPEFILTER","$vouchertypename={Constants.VoucherType.PurchaseVoucherType }"))

saivineeth100 commented 10 months ago

Also create a new issue for every new query and since you are using python create an issue here