TallyConnector
TallyConnector copied to clipboard
Altering existing Voucher creating new Voucher
As per your suggestion, I am retrieving voucher first. And then immediately posting same voucher without any modification, via PostVoucherAsync() method. Still Tally is creating new voucher, insteading of updating existing one.
voucher = await tally.GetVoucherAsync<TCM.Voucher>(_invoice.Tally_MasterId.ToString(), new TCM.VoucherRequestOptions()
{
LookupField = TCM.VoucherLookupField.MasterId,
FetchList = TCM.Constants.Voucher.InvoiceViewFetchList.All
});
if (voucher != null)
{
var resultVT = await tally.PostVoucherAsync<TCM.Voucher>(voucher);
if (resultVT.Status == TCM.RespStatus.Sucess)
{
var y = System.Text.RegularExpressions.Regex.Matches(resultVT.Response!, @"[0-9.]+")[0].Value;
_invoice.Tally_MasterId = int.Parse(y ?? "0");
_context.Invoices.Update(_invoice);
await _context.SaveChangesAsync();
}
}
Originally posted by @drparasmehta in https://github.com/Accounting-Companion/TallyConnector/issues/5#issuecomment-1407551179