Closed SpideySaif closed 2 years ago
Yes(we need to extend Stock Item Model for that) I removed closing balances from all models as it can be calculated If you wat to get closing balance or any field that is not there in default models you can extend that model and add that properties with correct XML Tag In your case Stock Item Closing Balance is divided into 3 properties Closing Balance, Closing Value, Closing Rate
[XmlRoot(ElementName = "STOCKITEM")]
[XmlType(AnonymousType = true)]
public class StockItem : StockItem
{
[XmlElement(ElementName = "CLOSINGBALANCE")]
public TallyQuantity? ClosingBal { get; set; }
[XmlElement(ElementName = "CLOSINGVALUE")]
public TallyAmount? ClosingValue { get; set; }
[XmlElement(ElementName = "CLOSINGRATE")]
public TallyRate? ClosingRate { get; set; }
}
#Make sure You use above type in GetStockItem<type>()
#Since Closingvalues not fetched automatically we need to explicitly specify in fetch list and send them as parameter
List<string> fetchList = new() { "MasterId", "CanDelete", "ClosingBalance", "ClosingRate", "ClosingValue", "*" };
StockItem TallystockItem = tally.GetStockItem<StockItem>("name of StckItm", fetchList: fetchList);
# If you want closing bal at specified date then you need to send both from and to date parameters
StockItem TallystockItem = await Tally.GetStockItem<StockItem>("name of StckItm",fromDate: new DateTime(2006, 4, 1), toDate:new DateTime(2016,5,31), fetchList: fetchList);
# TallystockItem.ClosingBal will have closingBal
Can we get the closing details through XML request for a stock item?
Can we get the closing details through XML request for a stock item?
If you any issue regarding this library raise a issue here, else use forums like stackoverflow I added postman collection in other useful resources there you can find all XMLS
Yes(we need to extend Stock Item Model for that) I removed closing balances from all models as it can be calculated If you wat to get closing balance or any field that is not there in default models you can extend that model and add that properties with correct XML Tag In your case Stock Item Closing Balance is divided into 3 properties Closing Balance, Closing Value, Closing Rate
[XmlRoot(ElementName = "STOCKITEM")] [XmlType(AnonymousType = true)] public class StockItem : StockItem { [XmlElement(ElementName = "CLOSINGBALANCE")] public TallyQuantity? ClosingBal { get; set; } [XmlElement(ElementName = "CLOSINGVALUE")] public TallyAmount? ClosingValue { get; set; } [XmlElement(ElementName = "CLOSINGRATE")] public TallyRate? ClosingRate { get; set; } } #Make sure You use above type in GetStockItem<type>() StockItem TallystockItem = tally.GetStockItem<StockItem>("name of StckItm"); # TallystockItem.ClosingBal will have closingBal
I tried getting this data through your library(which is great btw) by extending the StockItem model as you said, but I am getting errors on TallyQuantity and TallyRate as their references could not be found.
You need to import relevant namespaces TallyQuantity and TallyRate are in TallyConnector.Core.Converters.XMLConverterHelpers; if TallyConnector.Core.Converters.XMLConverterHelpers is not there update TallyConnector package to latest version 1.0.8
Yup.. updating to 1.0.8 solved the namespace issue. Now I am getting the ClosingBal, ClosingValue, ClosingRate as null but getting the values for same item if I check it through a xml request in postman.
Yes(we need to extend Stock Item Model for that) I removed closing balances from all models as it can be calculated If you wat to get closing balance or any field that is not there in default models you can extend that model and add that properties with correct XML Tag In your case Stock Item Closing Balance is divided into 3 properties Closing Balance, Closing Value, Closing Rate
[XmlRoot(ElementName = "STOCKITEM")] [XmlType(AnonymousType = true)] public class StockItem : StockItem { [XmlElement(ElementName = "CLOSINGBALANCE")] public TallyQuantity? ClosingBal { get; set; } [XmlElement(ElementName = "CLOSINGVALUE")] public TallyAmount? ClosingValue { get; set; } [XmlElement(ElementName = "CLOSINGRATE")] public TallyRate? ClosingRate { get; set; } } #Make sure You use above type in GetStockItem<type>() #Since Closingvalues not fetched automatically we need to explicitly specify in fetch list and send them as parameter List<string> fetchList = new() { "MasterId", "CanDelete", "ClosingBalance", "ClosingRate", "ClosingValue", "*" }; StockItem TallystockItem = tally.GetStockItem<StockItem>("name of StckItm", fetchList: fetchList); # If you want closing bal at specified date then you need to send both from and to date parameters StockItem TallystockItem = await Tally.GetStockItem<StockItem>("name of StckItm",fromDate: new DateTime(2006, 4, 1), toDate:new DateTime(2016,5,31), fetchList: fetchList); # TallystockItem.ClosingBal will have closingBal
I updated previous code (Added Ex: to get closing balance on specific date) Closing bal ,rate, value are not calculated by tally by default , if we want them we need to explicitly specify them in fetch list an d send to tally
Worked like a charm. Thank you for your help.
Worked like a charm. Thank you for your help.
I am creating a Tutorial Series on Tally Connector You can see Status at - Project
Don't forget to Start this Repo
What is the best way to get list of ALL stock items with closing Balance for a given date? (Total Stock Items are around 15,000)
I added new method to get large data from Tally Which will fetch data in a paginated manner, so you no need to worry about
var StockItems= await _tallyService.GetAllObjectsAsync<StockItem>()
This update is not released yet; you can enable include-pre-release to get this update
Is it possible to get the available stock quantity for a particular stock item?
Thanks.