Closed reach2rv closed 2 months ago
Hi @saivineeth100
I am creating a sales voucher with foreign currency. while posting I get failure with message
Voucher totals do not match! Dr: $ 35,940.42 Dr @ ₹ 81.20/$ = ₹ 29,18,362.10 Dr Cr: $ 35,940.42 Cr @ ₹ 81.20/$ = ₹ 29,18,362.11 Cr Diff: $ 0.00 Cr @ ₹ /$ = ₹ 0.01 Cr
as you can see USD amount is same but still it calculates difference of INR 0.01 also on Credit there are around 17 ledgers are crediting including inventory. I have validated value of each ledger and total amounts to INR 35940.42 and even converting each ledger value to INR I get ₹ 29,18,362.10.
Can you please shed some light where the issue may be
there is difference in INR - ₹ 29,18,362.10 Dr vs 29,18,362.11 Cr
@saivineeth100 - yes I am aware of it but if you check USD amount and exchange rate both are same then where does it adds 0.01?
As said earlier I have validated each ledger involved and found both values INR and USD are tallying.
it seems to be issue with conversion / or amount calculation while converting to xml
Here is the JSON output before posting
{
"Date": {},
"VoucherType": "Sales",
"View": 1,
"IsInvoice": {},
"VoucherNumber": "EXP/173/23-24",
"DeliveryNotes": {},
"Ledgers": [
{
"AdAllocType": 0,
"BillAllocations": [
{
"BillType": 0,
"Name": "EXP/173/23-24",
"BillId": 0,
"Amount": {
"Amount": 0,
"ForexAmount": 35940.42,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": true,
"PreserveAmount": false
}
}
],
"IndexNumber": 0,
"LedgerName": "Solutions S.L",
"IsDeemedPositive": {},
"Amount": {
"Amount": 0,
"ForexAmount": 35940.42,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": true,
"PreserveAmount": false
}
},
{
"AdAllocType": 0,
"InventoryAllocations": [
{
"IndexNumber": 0,
"StockItemName": "Gold",
"IsDeemedPositive": {},
"Rate": {
"RatePerUnit": 63.23,
"Unit": "gms"
},
"ActualQuantity": {
"Number": -202.057,
"PrimaryUnits": {
"Number": -202.057,
"Unit": "gms"
}
},
"BilledQuantity": {
"Number": -202.057,
"PrimaryUnits": {
"Number": -202.057,
"Unit": "gms"
}
},
"Amount": {
"Amount": 1037433,
"ForexAmount": 12776.27,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
},
"BatchAllocations": [
{
"GodownName": "WORKS PVT LTD - (From 1-Apr-2015 to 31-Mar-2016)",
"Amount": {
"Amount": 1037433,
"ForexAmount": 12776.27,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
},
"ActualQuantity": {
"Number": -202.057,
"PrimaryUnits": {
"Number": -202.057,
"Unit": "gms"
}
},
"BilledQuantity": {
"Number": -202.057,
"PrimaryUnits": {
"Number": -202.057,
"Unit": "gms"
}
}
}
]
}
],
"IndexNumber": 0,
"LedgerName": "Exports",
"IsDeemedPositive": {},
"Amount": {
"Amount": 0,
"ForexAmount": 12776.27,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
}
},
{
"AdAllocType": 0,
"InventoryAllocations": [
{
"IndexNumber": 0,
"StockItemName": "Gold Net Loss",
"IsDeemedPositive": {},
"Rate": {
"RatePerUnit": 63.23,
"Unit": "gms"
},
"ActualQuantity": {
"Number": -10.026,
"PrimaryUnits": {
"Number": -10.026,
"Unit": "gms"
}
},
"BilledQuantity": {
"Number": -10.026,
"PrimaryUnits": {
"Number": -10.026,
"Unit": "gms"
}
},
"Amount": {
"Amount": 51476,
"ForexAmount": 633.94,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
},
"BatchAllocations": [
{
"GodownName": "WORKS PVT LTD - (From 1-Apr-2015 to 31-Mar-2016)",
"Amount": {
"Amount": 51476,
"ForexAmount": 633.94,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
},
"ActualQuantity": {
"Number": -10.026,
"PrimaryUnits": {
"Number": -10.026,
"Unit": "gms"
}
},
"BilledQuantity": {
"Number": -10.026,
"PrimaryUnits": {
"Number": -10.026,
"Unit": "gms"
}
}
}
]
}
],
"IndexNumber": 0,
"LedgerName": "Exports",
"IsDeemedPositive": {},
"Amount": {
"Amount": 51476,
"ForexAmount": 633.94,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
}
},
{
"AdAllocType": 0,
"IndexNumber": 0,
"LedgerName": "Value Addition -Gold",
"IsDeemedPositive": {},
"Amount": {
"Amount": 233083,
"ForexAmount": 2870.48,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
}
},
{
"AdAllocType": 0,
"InventoryAllocations": [
{
"IndexNumber": 0,
"StockItemName": "Silver",
"IsDeemedPositive": {},
"Rate": {
"RatePerUnit": 0.79,
"Unit": "gms"
},
"ActualQuantity": {
"Number": -588.635,
"PrimaryUnits": {
"Number": -588.635,
"Unit": "gms"
}
},
"BilledQuantity": {
"Number": -588.635,
"PrimaryUnits": {
"Number": -588.635,
"Unit": "gms"
}
},
"Amount": {
"Amount": 37760,
"ForexAmount": 465.02,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
},
"BatchAllocations": [
{
"GodownName": "WORKS PVT LTD - (From 1-Apr-2015 to 31-Mar-2016)",
"Amount": {
"Amount": 37760,
"ForexAmount": 465.02,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
},
"ActualQuantity": {
"Number": -588.635,
"PrimaryUnits": {
"Number": -588.635,
"Unit": "gms"
}
},
"BilledQuantity": {
"Number": -588.635,
"PrimaryUnits": {
"Number": -588.635,
"Unit": "gms"
}
}
}
]
}
],
"IndexNumber": 0,
"LedgerName": "Exports",
"IsDeemedPositive": {},
"Amount": {
"Amount": 0,
"ForexAmount": 465.02,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
}
},
{
"AdAllocType": 0,
"IndexNumber": 0,
"LedgerName": "Value Addition-Silver",
"IsDeemedPositive": {},
"Amount": {
"Amount": 182037,
"ForexAmount": 2241.83,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
}
},
{
"AdAllocType": 0,
"InventoryAllocations": [
{
"IndexNumber": 0,
"StockItemName": "C & P Diamonds",
"IsDeemedPositive": {},
"Rate": {
"RatePerUnit": 530.86,
"Unit": "Cts"
},
"ActualQuantity": {
"Number": -21.698,
"PrimaryUnits": {
"Number": -21.698,
"Unit": "Cts"
}
},
"BilledQuantity": {
"Number": -21.698,
"PrimaryUnits": {
"Number": -21.698,
"Unit": "Cts"
}
},
"Amount": {
"Amount": 935310,
"ForexAmount": 11518.59,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
},
"BatchAllocations": [
{
"GodownName": "WORKS PVT LTD - (From 1-Apr-2015 to 31-Mar-2016)",
"Amount": {
"Amount": 935310,
"ForexAmount": 11518.59,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
},
"ActualQuantity": {
"Number": -21.698,
"PrimaryUnits": {
"Number": -21.698,
"Unit": "Cts"
}
},
"BilledQuantity": {
"Number": -21.698,
"PrimaryUnits": {
"Number": -21.698,
"Unit": "Cts"
}
}
}
]
}
],
"IndexNumber": 0,
"LedgerName": "Exports",
"IsDeemedPositive": {},
"Amount": {
"Amount": 0,
"ForexAmount": 11518.59,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
}
},
{
"AdAllocType": 0,
"IndexNumber": 0,
"LedgerName": "Value Addition -C&P",
"IsDeemedPositive": {},
"Amount": {
"Amount": 65473,
"ForexAmount": 806.32,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
}
},
{
"AdAllocType": 0,
"InventoryAllocations": [
{
"IndexNumber": 0,
"StockItemName": "Colour Stone",
"IsDeemedPositive": {},
"Rate": {
"RatePerUnit": 22.16,
"Unit": "Cts"
},
"ActualQuantity": {
"Number": -116.947,
"PrimaryUnits": {
"Number": -116.947,
"Unit": "Cts"
}
},
"BilledQuantity": {
"Number": -116.947,
"PrimaryUnits": {
"Number": -116.947,
"Unit": "Cts"
}
},
"Amount": {
"Amount": 210424,
"ForexAmount": 2591.43,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
},
"BatchAllocations": [
{
"GodownName": "WORKS PVT LTD - (From 1-Apr-2015 to 31-Mar-2016)",
"Amount": {
"Amount": 210424,
"ForexAmount": 2591.43,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
},
"ActualQuantity": {
"Number": -116.947,
"PrimaryUnits": {
"Number": -116.947,
"Unit": "Cts"
}
},
"BilledQuantity": {
"Number": -116.947,
"PrimaryUnits": {
"Number": -116.947,
"Unit": "Cts"
}
}
}
]
}
],
"IndexNumber": 0,
"LedgerName": "Exports",
"IsDeemedPositive": {},
"Amount": {
"Amount": 0,
"ForexAmount": 2591.43,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
}
},
{
"AdAllocType": 0,
"IndexNumber": 0,
"LedgerName": "Value Addition- Colour Stones",
"IsDeemedPositive": {},
"Amount": {
"Amount": 14726,
"ForexAmount": 181.36,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
}
},
{
"AdAllocType": 0,
"InventoryAllocations": [
{
"IndexNumber": 0,
"StockItemName": "C & P Diamond CZ",
"IsDeemedPositive": {},
"Rate": {
"RatePerUnit": 0.4,
"Unit": "Cts"
},
"ActualQuantity": {
"Number": -28.29,
"PrimaryUnits": {
"Number": -28.29,
"Unit": "Cts"
}
},
"BilledQuantity": {
"Number": -28.29,
"PrimaryUnits": {
"Number": -28.29,
"Unit": "Cts"
}
},
"Amount": {
"Amount": 925,
"ForexAmount": 11.39,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
},
"BatchAllocations": [
{
"GodownName": "WORKS PVT LTD - (From 1-Apr-2015 to 31-Mar-2016)",
"Amount": {
"Amount": 925,
"ForexAmount": 11.39,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
},
"ActualQuantity": {
"Number": -28.29,
"PrimaryUnits": {
"Number": -28.29,
"Unit": "Cts"
}
},
"BilledQuantity": {
"Number": -28.29,
"PrimaryUnits": {
"Number": -28.29,
"Unit": "Cts"
}
}
}
]
}
],
"IndexNumber": 0,
"LedgerName": "Exports",
"IsDeemedPositive": {},
"Amount": {
"Amount": 0,
"ForexAmount": 11.39,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
}
},
{
"AdAllocType": 0,
"IndexNumber": 0,
"LedgerName": "Value Addition -CZ",
"IsDeemedPositive": {},
"Amount": {
"Amount": 63,
"ForexAmount": 0.78,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
}
},
{
"AdAllocType": 0,
"InventoryAllocations": [
{
"IndexNumber": 0,
"StockItemName": "Gold Finding",
"IsDeemedPositive": {},
"Rate": {
"RatePerUnit": 48.17,
"Unit": "gms"
},
"ActualQuantity": {
"Number": -28.88,
"PrimaryUnits": {
"Number": -28.88,
"Unit": "gms"
}
},
"BilledQuantity": {
"Number": -28.88,
"PrimaryUnits": {
"Number": -28.88,
"Unit": "gms"
}
},
"Amount": {
"Amount": 112971,
"ForexAmount": 1391.27,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
},
"BatchAllocations": [
{
"GodownName": "WORKS PVT LTD - (From 1-Apr-2015 to 31-Mar-2016)",
"Amount": {
"Amount": 112971,
"ForexAmount": 1391.27,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
},
"ActualQuantity": {
"Number": -28.88,
"PrimaryUnits": {
"Number": -28.88,
"Unit": "gms"
}
},
"BilledQuantity": {
"Number": -28.88,
"PrimaryUnits": {
"Number": -28.88,
"Unit": "gms"
}
}
}
]
}
],
"IndexNumber": 0,
"LedgerName": "Exports",
"IsDeemedPositive": {},
"Amount": {
"Amount": 0,
"ForexAmount": 1391.27,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
}
},
{
"AdAllocType": 0,
"IndexNumber": 0,
"LedgerName": "Value Addition- Gold Findings",
"IsDeemedPositive": {},
"Amount": {
"Amount": 7908,
"ForexAmount": 97.39,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
}
},
{
"AdAllocType": 0,
"InventoryAllocations": [
{
"IndexNumber": 0,
"StockItemName": "Silver Finding",
"IsDeemedPositive": {},
"Rate": {
"RatePerUnit": 1.31,
"Unit": "gms"
},
"ActualQuantity": {
"Number": -231.223,
"PrimaryUnits": {
"Number": -231.223,
"Unit": "gms"
}
},
"BilledQuantity": {
"Number": -231.223,
"PrimaryUnits": {
"Number": -231.223,
"Unit": "gms"
}
},
"Amount": {
"Amount": 24674,
"ForexAmount": 303.87,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
},
"BatchAllocations": [
{
"GodownName": "WORKS PVT LTD - (From 1-Apr-2015 to 31-Mar-2016)",
"Amount": {
"Amount": 24674,
"ForexAmount": 303.87,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
},
"ActualQuantity": {
"Number": -231.223,
"PrimaryUnits": {
"Number": -231.223,
"Unit": "gms"
}
},
"BilledQuantity": {
"Number": -231.223,
"PrimaryUnits": {
"Number": -231.223,
"Unit": "gms"
}
}
}
]
}
],
"IndexNumber": 0,
"LedgerName": "Exports",
"IsDeemedPositive": {},
"Amount": {
"Amount": 0,
"ForexAmount": 303.87,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
}
},
{
"AdAllocType": 0,
"IndexNumber": 0,
"LedgerName": "Value Addition-Silver Findings",
"IsDeemedPositive": {},
"Amount": {
"Amount": 1724,
"ForexAmount": 21.23,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
}
},
{
"AdAllocType": 0,
"InventoryAllocations": [
{
"IndexNumber": 0,
"StockItemName": "Cord- Cotton/Leather/Nylon",
"IsDeemedPositive": {},
"Rate": {
"RatePerUnit": 0.57,
"Unit": "gms"
},
"ActualQuantity": {
"Number": -3.47,
"PrimaryUnits": {
"Number": -3.47,
"Unit": "gms"
}
},
"BilledQuantity": {
"Number": -3.47,
"PrimaryUnits": {
"Number": -3.47,
"Unit": "gms"
}
},
"Amount": {
"Amount": 159,
"ForexAmount": 1.96,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
},
"BatchAllocations": [
{
"GodownName": "WORKS PVT LTD - (From 1-Apr-2015 to 31-Mar-2016)",
"Amount": {
"Amount": 159,
"ForexAmount": 1.96,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
},
"ActualQuantity": {
"Number": -3.47,
"PrimaryUnits": {
"Number": -3.47,
"Unit": "gms"
}
},
"BilledQuantity": {
"Number": -3.47,
"PrimaryUnits": {
"Number": -3.47,
"Unit": "gms"
}
}
}
]
}
],
"IndexNumber": 0,
"LedgerName": "Exports",
"IsDeemedPositive": {},
"Amount": {
"Amount": 0,
"ForexAmount": 1.96,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
}
},
{
"AdAllocType": 0,
"IndexNumber": 0,
"LedgerName": "Value Addition - Cotton Cord",
"IsDeemedPositive": {},
"Amount": {
"Amount": 11,
"ForexAmount": 0.13,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
}
},
{
"AdAllocType": 0,
"InventoryAllocations": [
{
"IndexNumber": 0,
"StockItemName": "Steel Finding",
"IsDeemedPositive": {},
"Rate": {
"RatePerUnit": 49.79,
"Unit": "gms"
},
"ActualQuantity": {
"Number": -0.51,
"PrimaryUnits": {
"Number": -0.51,
"Unit": "gms"
}
},
"BilledQuantity": {
"Number": -0.51,
"PrimaryUnits": {
"Number": -0.51,
"Unit": "gms"
}
},
"Amount": {
"Amount": 2062,
"ForexAmount": 25.39,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
},
"BatchAllocations": [
{
"GodownName": "WORKS PVT LTD - (From 1-Apr-2015 to 31-Mar-2016)",
"Amount": {
"Amount": 2062,
"ForexAmount": 25.39,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
},
"ActualQuantity": {
"Number": -0.51,
"PrimaryUnits": {
"Number": -0.51,
"Unit": "gms"
}
},
"BilledQuantity": {
"Number": -0.51,
"PrimaryUnits": {
"Number": -0.51,
"Unit": "gms"
}
}
}
]
}
],
"IndexNumber": 0,
"LedgerName": "Exports",
"IsDeemedPositive": {},
"Amount": {
"Amount": 0,
"ForexAmount": 25.39,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
}
},
{
"AdAllocType": 0,
"IndexNumber": 0,
"LedgerName": "Value Addition-Steel Findings",
"IsDeemedPositive": {},
"Amount": {
"Amount": 144,
"ForexAmount": 1.77,
"RateOfExchange": 81.2,
"Currency": "$",
"IsDebit": false,
"PreserveAmount": false
}
}
],
"InventoryAllocations": [],
"Dt": "20230401",
"VchType": "Sales",
"_MasterId": "",
"Action": 0
}
Found it. Amount conversion to Local currency calculates 3 decimals
@saivineeth100 - yes I am aware of it but if you check USD amount and exchange rate both are same then where does it adds 0.01?
As said earlier I have validated each ledger involved and found both values INR and USD are tallying.
post the code you used for better understanding, I don't think we are mentioning number of decimals for amount in library, I left it to user as this setting can be customized in tally
you can mention amounts with custom rounding also
TallyAmount tallyAmount = new(117, 81.2, "$",Math.Round(117 * 81.2,2));
Hi @saivineeth100 -
the issue is Tally recalculates Local Currency while posting voucher and thus even though I am tallying both sides before voucher posting I get error in return.
Do you have any Idea how to overcome this? INR 0.01 is fractional, and this difference is due to USD to INR conversion Tally is making.
PS: I am rounding every amount to 2 decimals before sending data to Tally
Lets take Exports example in json , amount is mentioned as 51476 instead of 51,475.93 (if rounded to 2 decimals)
rounding number of decimals has to match tally settings
@saivineeth100 - My bad that json was not right. I have made those corrections and still issue persist. difference arises due to conversion of Forex to Local currency, and mainly in stock ledgers as tally calculates forex * exchange and then while rounding it leads to additional 0.01.
I spoke to accountant regarding this and her said they also face similar issue when stock in picture and to resolve this they amend party ledger with difference amount.
I am doing same here to overcome this issue but tally still recalculates everything and throw error.
Share minimum reproducible code along with version of tally you are using
Hi @saivineeth100
I am creating a sales voucher with foreign currency. while posting I get failure with message
Voucher totals do not match! Dr: $ 35,940.42 Dr @ ₹ 81.20/$ = ₹ 29,18,362.10 Dr Cr: $ 35,940.42 Cr @ ₹ 81.20/$ = ₹ 29,18,362.11 Cr Diff: $ 0.00 Cr @ ₹ /$ = ₹ 0.01 Cr
as you can see USD amount is same but still it calculates difference of INR 0.01 also on Credit there are around 17 ledgers are crediting including inventory. I have validated value of each ledger and total amounts to INR 35940.42 and even converting each ledger value to INR I get ₹ 29,18,362.10.
Can you please shed some light where the issue may be