diff --git a/src/TallyConnector.Core/Models/MasterType.cs b/src/TallyConnector.Core/Models/MasterType.cs index 657068c..bff3c16 100644 --- a/src/TallyConnector.Core/Models/MasterType.cs +++ b/src/TallyConnector.Core/Models/MasterType.cs @@ -2,22 +2,47 @@ public enum TallyObjectType { + [XmlEnum("Currencies")] Currencies = 1, + [XmlEnum("Groups")] Groups = 2, + [XmlEnum("Ledgers")] Ledgers = 3, + [XmlEnum("Cost Categories")] CostCategories = 4, + [XmlEnum("Cost Centres")] CostCentres = 5, + [XmlEnum("Godowns")] Godowns = 6, + [XmlEnum("Locations")] + Locations = 6, + [XmlEnum("Stock Categories")] StockCategories = 7, + [XmlEnum("Stock Groups")] StockGroups = 8, + [XmlEnum("Stock Items")] StockItems = 9, + [XmlEnum("Units")] Units = 10, + [XmlEnum("Attendance/Production Types")] AttendanceTypes = 11, + [XmlEnum("Employee Groups")] EmployeeGroups = 12, + [XmlEnum("Employees")] Employees = 13, + [XmlEnum("Voucher Types")] VoucherTypes = 14, + [XmlEnum("TaxUnits")] TaxUnits = 15, + [XmlEnum("GSTRegistrations")] GSTRegistrations = 16, + [XmlEnum("Budgets")] + Budgets = 17, + [XmlEnum("Budgets & Scenarios")] + BudgetsScenarios = 18, + [XmlEnum("Scenarios")] + Scenarios = 18, + [XmlEnum("Vouchers")] Vouchers = 100, } diff --git a/src/TallyConnector.Core/Models/Statistics.cs b/src/TallyConnector.Core/Models/Statistics.cs index 23b3f43..dbe6fcc 100644 --- a/src/TallyConnector.Core/Models/Statistics.cs +++ b/src/TallyConnector.Core/Models/Statistics.cs @@ -3,8 +3,10 @@ [XmlRoot(ElementName = "VOUCHERTYPE")] [TDLCollection(CollectionName = "STATVchType", Include = false)] -public class VoucherTypeStat : BaseStatistics, IReportInterfaceGenerator +public class VoucherTypeStat : BaseStatistics, IReportInterfaceGenerator { + [XmlElement(ElementName = "NAME")] + public string Name { get; set; } [XmlElement(ElementName = "CANCELLEDCOUNT")] [TDLXMLSet(Set = "if $$ISEMPTY:$CancVal then 0 else $CancVal")] public int CancelledCount { get; set; } @@ -33,6 +35,8 @@ public override string ToString() [TDLCollection(CollectionName = "STATObjects")] public class MasterTypeStat : BaseStatistics, IReportInterfaceGenerator { + [XmlElement(ElementName = "NAME")] + public TallyObjectType Name { get; set; } public IEnumerable GetFields() { throw new NotImplementedException(); @@ -52,8 +56,7 @@ public override string ToString() public class BaseStatistics { - [XmlElement(ElementName = "NAME")] - public string Name { get; set; } + [XmlElement(ElementName = "COUNT")] [TDLXMLSet(Set = "if $$ISEMPTY:$StatVal then 0 else $StatVal")] diff --git a/src/Tests/Services/TallyService/Main.cs b/src/Tests/Services/TallyService/Main.cs index e74df2e..6247098 100644 --- a/src/Tests/Services/TallyService/Main.cs +++ b/src/Tests/Services/TallyService/Main.cs @@ -21,6 +21,7 @@ public async Task TestGetLicenseInfo() [Test] public async Task TestGetMasterStatistics() { + _tallyService.Setup("localhost", 900); var masterstat = await _tallyService.GetMasterStatisticsAsync(); Assert.That(masterstat, Has.Count.EqualTo(16)); } @@ -28,10 +29,10 @@ public async Task TestGetMasterStatistics() [Test] public async Task TestGetVoucherStatistics() { - //var masterstats = await _tallyService.GetMasterStatisticsAsync(); + List? vchtats = await _tallyService.GetVoucherStatisticsAsync(new DateFilterRequestOptions()); //Get Vouchertype count from Master Statistics //var vouchertypecount = masterstats.FirstOrDefault(C => C.Name.Replace(" ", "") == TCM.TallyObjectType.VoucherTypes.ToString()).Count; - await _tallyService.GetVoucherStatisticsAsync(new TallyConnector.Core.Models.AutoColumnReportPeriodRequestOprions() { FromDate = new DateTime(2009, 04, 01),ToDate= new DateTime(2023, 03, 31),Periodicity= PeriodicityType.Year }); + AutoVoucherStatisticsEnvelope autoVoucherStatisticsEnvelope = await _tallyService.GetVoucherStatisticsAsync(new TallyConnector.Core.Models.AutoColumnReportPeriodRequestOprions() { FromDate = new DateTime(2009, 04, 01),ToDate= new DateTime(2023, 03, 31),Periodicity= PeriodicityType.Year }); //Assert.That(voucherstat, Has.Count.EqualTo(vouchertypecount)); } diff --git a/src/Tests/Services/TallyService/TallyObjects/Accounting/GroupTests.cs b/src/Tests/Services/TallyService/TallyObjects/Accounting/GroupTests.cs index bb30f6f..431dac0 100644 --- a/src/Tests/Services/TallyService/TallyObjects/Accounting/GroupTests.cs +++ b/src/Tests/Services/TallyService/TallyObjects/Accounting/GroupTests.cs @@ -23,7 +23,7 @@ public async Task CheckGetAllGroupsbyPaginate() { List Groups = new(); var Stat = await _tallyService.GetMasterStatisticsAsync(); - var TotalCount = Stat.FirstOrDefault(c => c.Name == TCM.TallyObjectType.Groups.ToString()).Count; + var TotalCount = Stat.FirstOrDefault(c => c.Name == TCM.TallyObjectType.Groups).Count; TCM.Pagination.Pagination pagination = new(50, 100); for (int i = 0; i < pagination.TotalPages; i++) {