public async Task <int> SendToVerification(SendToVerificationAccountingForm form) { var models = new List <GarmentPurchasingExpeditionModel>(); foreach (var item in form.Items) { var model = new GarmentPurchasingExpeditionModel(item.InternalNote.Id, item.InternalNote.DocumentNo, item.InternalNote.Date, item.InternalNote.DueDate, item.InternalNote.SupplierId, item.InternalNote.SupplierName, item.InternalNote.VAT, item.InternalNote.IncomeTax, item.InternalNote.TotalPaid, item.InternalNote.CurrencyId, item.InternalNote.CurrencyCode, item.Remark, item.InternalNote.AmountDPP, item.InternalNote.CorrectionAmount, item.InternalNote.PaymentMethod, item.InternalNote.PaymentType, item.InternalNote.PaymentDueDays, item.InternalNote.InvoicesNo); model.SendToVerification(_identityService.Username); EntityExtension.FlagForCreate(model, _identityService.Username, UserAgent); models.Add(model); } _dbContext.GarmentPurchasingExpeditions.UpdateRange(models); var httpClient = _serviceProvider.GetService <IHttpClientService>(); var updateInternalNotePositionData = new { Ids = models.Select(element => element.InternalNoteId).ToList(), Position = GarmentPurchasingExpeditionPosition.SendToVerification }; await httpClient.PutAsync($"{APIEndpoint.Purchasing}garment-purchasing-expeditions/internal-notes/position", new StringContent(JsonConvert.SerializeObject(updateInternalNotePositionData), Encoding.UTF8, General.JsonMediaType)); return(_dbContext.SaveChanges()); }
public GarmentPurchasingExpeditionReportViewModel(GarmentPurchasingExpeditionModel model) { InternalNoteId = model.InternalNoteId; InternalNoteNo = model.InternalNoteNo; InternalNoteDate = model.InternalNoteDate; InternalNoteDueDate = model.InternalNoteDueDate; SupplierId = model.SupplierId; SupplierName = model.SupplierName; DPP = model.DPP; VAT = model.VAT; CorrectionAmount = model.CorrectionAmount; IncomeTax = model.IncomeTax; TotalPaid = model.TotalPaid; CurrencyId = model.CurrencyId; CurrencyCode = model.CurrencyCode; PaymentType = model.PaymentType; InvoicesNo = model.InvoicesNo; PaymentMethod = model.PaymentMethod; PaymentDueDays = model.PaymentDueDays; Remark = model.Remark; Position = model.Position; SendToVerificationDate = model.SendToVerificationDate; SendToVerificationBy = model.SendToVerificationBy; VerificationAcceptedDate = model.VerificationAcceptedDate; VerificationAcceptedBy = model.VerificationAcceptedBy; SendToCashierDate = model.SendToCashierDate; SendToCashierBy = model.SendToCashierBy; CashierAcceptedDate = model.CashierAcceptedDate; CashierAcceptedBy = model.CashierAcceptedBy; SendToPurchasingDate = model.SendToPurchasingDate; SendToPurchasingBy = model.SendToPurchasingBy; SendToPurchasingRemark = model.SendToPurchasingRemark; SendToAccountingDate = model.SendToAccountingDate; SendToAccountingBy = model.SendToAccountingBy; AccountingAcceptedDate = model.AccountingAcceptedDate; AccountingAcceptedBy = model.AccountingAcceptedBy; if (Position == GarmentPurchasingExpeditionPosition.SendToCashier || Position == GarmentPurchasingExpeditionPosition.CashierAccepted || Position == GarmentPurchasingExpeditionPosition.DispositionPayment) { VerificationSendDate = model.SendToCashierDate; } else if (Position == GarmentPurchasingExpeditionPosition.SendToAccounting || Position == GarmentPurchasingExpeditionPosition.AccountingAccepted) { VerificationSendDate = model.SendToAccountingDate; } else if (Position == GarmentPurchasingExpeditionPosition.Purchasing || Position == GarmentPurchasingExpeditionPosition.SendToPurchasing) { VerificationSendDate = model.SendToPurchasingDate; } }
public IndexDto(GarmentPurchasingExpeditionModel entity) { Id = entity.Id; InternalNoteNo = entity.InternalNoteNo; InternalNoteDate = entity.InternalNoteDate; InternalNoteDueDate = entity.InternalNoteDueDate; InternalNoteId = entity.InternalNoteId; SupplierName = entity.SupplierName; Amount = entity.TotalPaid; CurrencyCode = entity.CurrencyCode; VerificationAcceptedDate = entity.VerificationAcceptedDate; SendToPurchasingRemark = entity.SendToPurchasingRemark; Remark = entity.Remark; Status = entity.Position.ToDescriptionString(); Date = entity.Position == GarmentPurchasingExpeditionPosition.SendToAccounting ? entity.SendToAccountingDate : entity.Position == GarmentPurchasingExpeditionPosition.SendToCashier ? entity.SendToCashierDate : entity.Position == GarmentPurchasingExpeditionPosition.SendToPurchasing ? entity.SendToPurchasingDate : entity.VerificationAcceptedDate; VerifiedBy = entity.Position == GarmentPurchasingExpeditionPosition.SendToAccounting ? entity.SendToAccountingBy : entity.Position == GarmentPurchasingExpeditionPosition.SendToCashier ? entity.SendToCashierBy : entity.Position == GarmentPurchasingExpeditionPosition.SendToPurchasing ? entity.SendToPurchasingBy : entity.VerificationAcceptedBy; SentDate = entity.Position == GarmentPurchasingExpeditionPosition.SendToAccounting || entity.Position == GarmentPurchasingExpeditionPosition.AccountingAccepted ? entity.SendToAccountingDate : entity.Position == GarmentPurchasingExpeditionPosition.SendToCashier || entity.Position == GarmentPurchasingExpeditionPosition.CashierAccepted ? entity.SendToCashierDate : entity.Position == GarmentPurchasingExpeditionPosition.SendToPurchasing ? entity.SendToPurchasingDate : entity.SendToVerificationDate; AcceptedDate = entity.Position == GarmentPurchasingExpeditionPosition.AccountingAccepted ? entity.AccountingAcceptedDate : entity.Position == GarmentPurchasingExpeditionPosition.CashierAccepted ? entity.CashierAcceptedDate : entity.Position == GarmentPurchasingExpeditionPosition.VerificationAccepted ? entity.VerificationAcceptedDate : null; }
public void Should_Success_Generate_Excel_With_Data() { var dbContext = GetDbContext(GetCurrentMethod()); var serviceProviderMock = GetServiceProvider(); var expedition = new GarmentPurchasingExpeditionModel(); expedition.SendToVerification("Test"); EntityExtension.FlagForCreate(expedition, "Test", "Test"); dbContext.GarmentPurchasingExpeditions.Add(expedition); dbContext.SaveChanges(); serviceProviderMock .Setup(serviceProvider => serviceProvider.GetService(typeof(FinanceDbContext))) .Returns(dbContext); var service = new GarmentPurchasingExpeditionReportService(serviceProviderMock.Object); var reportResponse = service.GenerateExcel(0, 0, GarmentPurchasingExpeditionPosition.SendToVerification, DateTimeOffset.Now.AddDays(-7), DateTimeOffset.Now.AddDays(7), DateTimeOffset.Now.AddDays(-7), DateTimeOffset.Now.AddDays(7)); Assert.NotNull(reportResponse); }