public InvoiceReplaceRequest(InvoiceReplaceModel model) : base(model) { ReferenceId = model.ReferenceId; RecordNo = model.RecordNo; RecordDate = model.RecordDate.ConvertToString(); Reason = model.Reason; FileNameOfRecord = model.FileNameOfRecord; FileOfRecord = model.FileOfRecord; }
/// <summary> /// Sửa 1 hóa đơn có sẵn trên hệ thống /// Nếu hóa đơn được sửa chưa ký thì các bản ghi mới sẽ update đè lên bản ghi đã có, trạng thái hóa đơn không thay đổi. /// Nếu hóa đơn được sửa đã ký thì hóa đơn này sẽ được đưa về trạng thái hủy bỏ và thông tin sau khi sửa sẽ tạo thành /// hóa đơn mới. /// Nếu hóa đơn được sửa đã báo cáo, kê khai thì thông tin sau khi sửa sẽ tạo thành 2 hóa đơn mới. 1 hóa đơn điều chỉnh /// giảm toàn bộ hóa đơn sửa và 1 hóa đơn điều chỉnh tăng theo thông tin mới /// </summary> /// <param name="authentication"></param> /// <param name="model"></param> /// <returns></returns> public MessageResult Replace(Authentication authentication, InvoiceReplaceModel model) { MessageResult result = new MessageResult(); try { var token = GetToken(authentication); if (!string.IsNullOrEmpty(token)) { string apiLink = $"{authentication.DomainName}/api/invoices/replace/{model.Id}"; InvoiceReplaceRequest request = new InvoiceReplaceRequest(model); var rawResponse = AppUtil.CreateRequest(apiLink, request.ToJson(), token); var response = rawResponse.ToObject <BaseResponse <InvoiceReplaceResponse> >(); if (response != null) { result.Code = response.Code; result.Succeeded = response.Succeeded; result.Data = response.Data; } } else { result.CannotLogin(); } } catch (Exception) { result.ErrorApi(); } return(result); }