public void DoFilter(ref IQueryable <Data.Models.Contract> contracts, ContractFilterModel model)
        {
            if (contracts == null)
            {
                return;
            }

            if (model == null)
            {
                return;
            }

            if (!String.IsNullOrWhiteSpace(model.Number))
            {
                contracts = contracts.Where(w => w.ContractNumber.Contains(model.Number));
            }

            if (!String.IsNullOrWhiteSpace(model.Nick))
            {
                contracts = contracts.Where(w => w.ObjectName.Contains(model.Nick) ||
                                            w.Organization.Name.Contains(model.Nick));
            }

            if (model.EndDate != null && model.StartDate != null && model.StartDate <= model.EndDate)
            {
                contracts = contracts.Where(w => w.ContractDate >= model.StartDate && w.ContractDate <= model.EndDate);
            }
        }
        public IList <ContractReportSection2ReportModel> Report2Filter(ContractFilterModel model)
        {
            var conracts = Repository.Where(w => w.ContractDate != null &&
                                            w.ContractAmount > 0 &&
                                            w.DeadlinesContract == null);

            DoFilter(ref conracts, model);

            return(conracts.Select(s => new ContractReportSection2ReportModel
            {
                Object = s.ObjectName,
                Date = s.ContractDate,
                Client = s.Organization.Name,
                Number = s.ContractNumber,
                Amount = s.ContractAmount,
                Paid = s.Payments.Sum(payment => payment.Amount),
                Residue = s.ContractAmount - s.Payments.Sum(payment => payment.Amount),
                Col13 = s.ContractWorkPayments.FirstOrDefault(f => f.WorkTypeId == (int?)WorkTypeCode.Col13).Amount,
                Col14 = s.ContractWorkPayments.FirstOrDefault(f => f.WorkTypeId == (int?)WorkTypeCode.Col14).Amount,
                Col15 = s.ContractWorkPayments.FirstOrDefault(f => f.WorkTypeId == (int?)WorkTypeCode.Col15).Amount,
                Col16 = s.ContractWorkPayments.FirstOrDefault(f => f.WorkTypeId == (int?)WorkTypeCode.Col16).Amount,
                Col17 = s.ContractWorkPayments.FirstOrDefault(f => f.WorkTypeId == (int?)WorkTypeCode.Col17).Amount,
                Col18 = s.ContractWorkPayments.FirstOrDefault(f => f.WorkTypeId == (int?)WorkTypeCode.Col18).Amount,
                Col19 = s.ContractWorkPayments.FirstOrDefault(f => f.WorkTypeId == (int?)WorkTypeCode.Col19).Amount,
                Col24 = s.ContractWorkPayments.FirstOrDefault(f => f.WorkTypeId == (int?)WorkTypeCode.Col24).Amount,
            }).ToList());
        }
Beispiel #3
0
        public IList <ContractReportSection5ReportModel> GetSectionReport5Models(ContractFilterModel model)
        {
            var contractService = DiConfig.Resolve <IContractService>();
            var contractModels  = contractService.Report5Filter(model);

            return(contractModels);
        }
        public IList <NakladnoyFilterModel> NakladnoyFilterModels(ContractFilterModel model)
        {
            var conracts = Repository.Include(a => a.Organization,
                                              a => a.Nakladnoys,
                                              a => a.ContractWorkPayments,
                                              a => a.ContractWorkPayments.Select(s => s.WorkType))
                           .Where(w => w.ContractDate != null &&
                                  w.ContractAmount > 0);

            DoFilter(ref conracts, model);

            return(conracts.Select(s => new NakladnoyFilterModel
            {
                Object = s.ObjectName,
                Date = s.ContractDate,
                Client = s.Organization.Name,
                Number = s.ContractNumber,
                Amount = s.ContractAmount,
                NakladnoyDate = s.Nakladnoys.FirstOrDefault().Date,
                NakladnoyNumber = s.Nakladnoys.FirstOrDefault().Number,
                Col13 = s.ContractWorkPayments.Where(f => f.WorkType.Code == WorkTypeCode.Col13).Sum(a => a.Amount),
                Col14_16 = s.ContractWorkPayments.Where(f => f.WorkType.Code == WorkTypeCode.Col14 || f.WorkType.Code == WorkTypeCode.Col16).Sum(a => a.Amount),
                Col15 = s.ContractWorkPayments.Where(f => f.WorkType.Code == WorkTypeCode.Col15).Sum(a => a.Amount),
                Col17_18 = s.ContractWorkPayments.Where(f => f.WorkType.Code == WorkTypeCode.Col17 || f.WorkType.Code == WorkTypeCode.Col18).Sum(a => a.Amount),
                Col19_24 = s.ContractWorkPayments.Where(f => f.WorkType.Code >= WorkTypeCode.Col19 && f.WorkType.Code <= WorkTypeCode.Col24).Sum(a => a.Amount)
            }).ToList());
        }
Beispiel #5
0
        public static string DoExportReport4(ContractFilterModel model)
        {
            try
            {
                var contractService = DiConfig.Resolve <IContractService>();
                var contractModels  = contractService.Report4Filter(model);
                var file            = new MemoryStream(Resources.template4);
                var wb          = new XLWorkbook(file);
                var ws          = wb.Worksheets.Worksheet(1);
                var filePath    = Path.Combine(Path.GetTempPath(), Path.ChangeExtension(Path.GetRandomFileName(), "xlsx"));
                var topRowIndex = 9;

                //rows
                ws.Range(topRowIndex + 1, 1, contractModels.Count + topRowIndex, 10)
                .InsertRowsAbove(contractModels.Count, true);

                ws.Cell(5, 8).Value = DateTime.Now;
                ws.Cell(5, 8).Style.DateFormat.Format = "dd/MM/yyyy";

                for (var i = 0; i < contractModels.Count; i++)
                {
                    ws.Cell(topRowIndex + i, 1).Value = i + 1;
                    ws.Cell(topRowIndex + i, 2).Value = contractModels[i].Client;
                    ws.Cell(topRowIndex + i, 3).Value = contractModels[i].Object;
                    ws.Cell(topRowIndex + i, 4).SetValue(contractModels[i].Number);

                    ws.Cell(topRowIndex + i, 5).Value = contractModels[i].Col27;
                    ws.Cell(topRowIndex + i, 5).Style.DateFormat.Format = "dd/MM/yyyy";

                    ws.Cell(topRowIndex + i, 6).Value = contractModels[i].Col28;
                    ws.Cell(topRowIndex + i, 6).Style.DateFormat.Format = "dd/MM/yyyy";

                    ws.Cell(topRowIndex + i, 7).Value = contractModels[i].Col31;
                    ws.Cell(topRowIndex + i, 7).Style.DateFormat.Format = "dd/MM/yyyy";

                    ws.Cell(topRowIndex + i, 8).Value = contractModels[i].Date;
                    ws.Cell(topRowIndex + i, 8).Style.DateFormat.Format = "dd/MM/yyyy";

                    ws.Cell(topRowIndex + i, 9).Value = contractModels[i].Amount;
                    ws.Cell(topRowIndex + i, 9).Style.NumberFormat.Format = "#,##0.00";

                    ws.Cell(topRowIndex + i, 10).Value = contractModels[i].Paid;
                    ws.Cell(topRowIndex + i, 10).Style.NumberFormat.Format = "#,##0.00";
                }

                FitToColumns(ws, contractModels.Count);

                //save
                wb.SaveAs(filePath);

                return(filePath);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Beispiel #6
0
        private void filterButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (_worker.IsBusy)
            {
                return;
            }

            _model = FilterControl.Model;

            _worker.RunWorkerAsync();
        }
        public IList <ContractReportSection5ReportModel> Report5Filter(ContractFilterModel model)
        {
            var conracts = Repository.Where(w => (w.Payments.Sum(s => s.Amount) - w.ContractAmount) == 0 &&
                                            w.DeadlinesFact != null);

            DoFilter(ref conracts, model);

            return(conracts.Select(s => new ContractReportSection5ReportModel
            {
                Client = s.Organization.Name,
                Object = s.ObjectName,
                Number = s.ContractNumber,
                Date = s.ContractDate,
                Amount = s.ContractAmount
            }).ToList());
        }
Beispiel #8
0
        private void filterButton_Click(object sender, RoutedEventArgs e)
        {
            if (_worker.IsBusy)
            {
                return;
            }

            _model = FilterControl.Model;

            if (!DataGrid.Items.IsEmpty)
            {
                DataGrid.Items.Clear();
            }

            _worker.RunWorkerAsync();
        }
        public IPagedList <ContractReportModel> Paging(ContractFilterModel model, int pageIndex, int pageSize)
        {
            var conracts = Repository.Include(a => a.Organization);

            DoFilter(ref conracts, model);

            return(conracts.Select(s => new ContractReportModel
            {
                Object = s.ObjectName,
                Date = s.ContractDate,
                Client = s.Organization.Name,
                Number = s.ContractNumber,
                Amount = s.ContractAmount,
                Id = s.Id
            }).OrderByDescending(o => o.Id).ToPagedList(pageIndex, pageSize));
        }
        public IList <ActInvoiceFilterModel> ActInvoiceFilterModels(ContractFilterModel model)
        {
            var conracts = Repository.Include(a => a.Organization)
                           .Where(w => w.ContractDate != null &&
                                  w.ContractAmount > 0);

            DoFilter(ref conracts, model);

            return(conracts.Select(s => new ActInvoiceFilterModel
            {
                Object = s.ObjectName,
                Date = s.ContractDate,
                Client = s.Organization.Name,
                Number = s.ContractNumber,
                Amount = s.ContractAmount
            }).ToList());
        }
        public IList <ContractReportSection4ReportModel> Report4Filter(ContractFilterModel model)
        {
            var conracts = Repository.Where(w => (w.Payments.Sum(s => s.Amount) - w.ContractAmount) == 0 &&
                                            w.DeadlinesContract == null);

            DoFilter(ref conracts, model);

            return(conracts.Select(s => new ContractReportSection4ReportModel
            {
                Client = s.Organization.Name,
                Object = s.ObjectName,
                Number = s.ContractNumber,
                Date = s.ContractDate,
                Amount = s.ContractAmount,
                Paid = s.Payments.Sum(p => p.Amount),
                Col27 = s.ContractDepartments.FirstOrDefault(f => f.DepartmentId == (int?)DepartmentCode.Col27).Date,
                Col28 = s.ContractDepartments.FirstOrDefault(f => f.DepartmentId == (int?)DepartmentCode.Col28).Date,
                Col31 = s.ContractDepartments.FirstOrDefault(f => f.DepartmentId == (int?)DepartmentCode.Col31).Date
            }).ToList());
        }
        public IList <ContractReportSection3ReportModel> Report3Filter(ContractFilterModel model)
        {
            var conracts = Repository.Where(w => w.DeadlinesContract != null &&
                                            (w.ContractDate == null || w.Payments.Count == 0 ||
                                             w.ActInvoices.Count == 0));

            DoFilter(ref conracts, model);

            return(conracts.Select(s => new ContractReportSection3ReportModel
            {
                Client = s.Organization.Name,
                Object = s.ObjectName,
                Number = s.ContractNumber,
                Date = s.ContractDate,
                Amount = s.ContractAmount,
                Paid = s.Payments.Sum(p => p.Amount),
                Debt = s.ContractAmount - s.Payments.Sum(p => p.Amount),
                ActInvoiceNumber = s.ActInvoices.FirstOrDefault().Number,
                ContractStatus = s.ContractDate != null ? ContractStatus.Yes : ContractStatus.No
            }).ToList());
        }
        public IList <ContractReportSection1ReportModel> Report1Filter(ContractFilterModel model)
        {
            var conracts = Repository.Where(w => w.ContractDate != null &&
                                            w.ContractAmount > 0 &&
                                            (w.ContractAmount - w.Payments.Sum(s => s.Amount)) > 0 &&
                                            w.ActInvoices.Count > 0 &&
                                            w.DeadlinesFact != null);

            DoFilter(ref conracts, model);

            return(conracts.Select(s => new ContractReportSection1ReportModel
            {
                Object = s.ObjectName,
                Date = s.ContractDate,
                Client = s.Organization.Name,
                Number = s.ContractNumber,
                Amount = s.ContractAmount,
                Paid = s.Payments.Sum(payment => payment.Amount),
                Comment = s.Limitation,
                Debt = s.ContractAmount - s.Payments.Sum(payment => payment.Amount)
            }).ToList());
        }
Beispiel #14
0
        public async Task <List <ContractDTO> > FilterContractAsync(ContractFilterModel contractFilter)
        {
            List <ContractDTO> list = await this.GetAllContractsAsync();

            if (contractFilter.BuyerID != null)
            {
                list = list.Where(emp => emp.BuyerID == contractFilter.BuyerID).ToList();
            }
            if (contractFilter.ContractID != null)
            {
                list = list.Where(emp => emp.ContractID == contractFilter.ContractID).ToList();
            }
            if (contractFilter.ContractTypeID != null)
            {
                list = list.Where(emp => emp.ContractTypeID == contractFilter.ContractTypeID).ToList();
            }
            if (contractFilter.EmployeeID != null)
            {
                list = list.Where(emp => emp.EmployeeID == contractFilter.EmployeeID).ToList();
            }
            if (contractFilter.RealEstateID != null)
            {
                list = list.Where(emp => emp.RealEstateID == contractFilter.RealEstateID).ToList();
            }
            if (contractFilter.SellerID != null)
            {
                list = list.Where(emp => emp.SellerID == contractFilter.SellerID).ToList();
            }
            if (contractFilter.RecordDate != null)
            {
                list = list.Where(emp => emp.RecordDate == contractFilter.RecordDate).ToList();
            }
            //if (contractFilter.BeginRecordDate != null) list = list.Where(emp => emp.BeginRecordDate == contractFilter.BeginRecordDate).ToList();
            //if (contractFilter.EndRecordDate != null) list = list.Where(emp => emp.EndRecordDate == contractFilter.EndRecordDate).ToList();
            return(list);
        }
Beispiel #15
0
        private void filterButton_Click(object sender, RoutedEventArgs e)
        {
            _model = FilterControl.Model;

            ExecuteQuery();
        }
 public async Task <List <ContractDTO> > FilterContract(ContractFilterModel ContractDto)
 {
     return(await contractService.FilterContractAsync(ContractDto));
 }
Beispiel #17
0
        public IList <ExportModel> GetExportModels(ContractFilterModel model)
        {
            var contractService = DiConfig.Resolve <IContractService>();
            var contracts       = contractService.Repository.Include
                                  (
                a => a.Organization,
                a => a.ActInvoices,
                a => a.Nakladnoys,
                a => a.Payments,
                a => a.ContractWorkPayments.Select(s => s.WorkType),
                a => a.ContractWorkPayments.Select(s => s.Period),
                a => a.ContractDepartments.Select(s => s.Department)
                                  );
            var exportModels = new List <ExportModel>();

            contractService.DoFilter(ref contracts, model);

            contracts = contracts.Where(w => w.Organization != null &&
                                        w.ActInvoices.Any() &&
                                        w.Nakladnoys.Any() &&
                                        w.Payments.Any() &&
                                        w.ContractDepartments.Any(a => a.Department != null) &&
                                        w.ContractWorkPayments.Any(a => a.WorkType != null));
            foreach (var contract in contracts)
            {
                var exportModel = new ExportModel
                {
                    Id = contract.Id
                };

                /*
                 *  client
                 */
                exportModel.V2 = contract.Organization.Name;
                exportModel.V4 = contract.Organization.Inn;
                exportModel.V5 = contract.Organization.AccountNumber;
                exportModel.V6 = contract.Organization.Mfo1;
                exportModel.V7 = contract.Organization.Okohx;
                exportModel.V8 = contract.Organization.PhoneNumbers;
                exportModel.V9 = contract.Organization.BankName1;

                /*
                 *  contract
                 */
                exportModel.V3  = contract.ObjectName;
                exportModel.V10 = contract.ContractNumber;
                exportModel.V11 = contract.ContractDate;
                exportModel.V12 = contract.ContractAmount;
                exportModel.V38 = contract.Limitation;
                exportModel.V32 = contract.DeadlinesContract;
                exportModel.V33 = contract.DeadlinesFact;

                /*
                 *  work payment type
                 */
                exportModel.V13 =
                    contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col13).Amount;
                exportModel.V14 =
                    contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col14).Amount;
                exportModel.V15 =
                    contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col15).Amount;
                exportModel.V16 =
                    contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col16).Amount;
                exportModel.V17 =
                    contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col17).Amount;
                exportModel.V18 =
                    contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col18).Amount;
                exportModel.V19 =
                    contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col19).Amount;
                exportModel.V20 =
                    contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col20).Amount;
                exportModel.V21 =
                    contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col21).Amount;
                exportModel.V22 =
                    contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col22).Amount;
                exportModel.V23 =
                    contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col23).Amount;
                exportModel.V24 =
                    contract.ContractWorkPayments.FindOrDefault(f => f.WorkType.Code == WorkTypeCode.Col24).Amount;

                /*
                 *  contract department
                 */
                exportModel.V27 =
                    contract.ContractDepartments.FindOrDefault(f => f.Department.Code == DepartmentCode.Col27).Date;
                exportModel.V28 =
                    contract.ContractDepartments.FindOrDefault(f => f.Department.Code == DepartmentCode.Col28).Date;
                exportModel.V29 =
                    contract.ContractDepartments.FindOrDefault(f => f.Department.Code == DepartmentCode.Col29).Date;
                exportModel.V30 =
                    contract.ContractDepartments.FindOrDefault(f => f.Department.Code == DepartmentCode.Col30).Date;
                exportModel.V31 =
                    contract.ContractDepartments.FindOrDefault(f => f.Department.Code == DepartmentCode.Col31).Date;

                /*
                 *  act invoice
                 */
                exportModel.V34 = contract.ActInvoices.FindOrDefault().Number;

                /*
                 *  contract payment
                 */
                exportModel.V25 = contract.Payments.FindOrDefault().Date;
                exportModel.V26 = contract.Payments.FindOrDefault().Amount;

                /*
                 *  nakladnoy
                 */
                exportModel.V36 = contract.Nakladnoys.FindOrDefault().Number;
                exportModel.V37 = contract.Nakladnoys.FindOrDefault().Date;

                exportModels.Add(exportModel);
            }

            return(exportModels);
        }
 public async Task <List <ContractViewDTO> > FilterUsersRecord(ContractFilterModel contractFilterModel)
 {
     return((await new SendToServerService <List <ContractViewDTO>, ContractFilterModel>().PostDataByJsonObjectAsync("Contract/FilterContractView", contractFilterModel)).Result);
 }
Beispiel #19
0
        public static string DoExport(ContractFilterModel model, int startRow, int sizeRow)
        {
            try
            {
                var manager        = new DalManager();
                var contractModels = manager.GetExportModels(model);
                var file           = new MemoryStream(Resources.template0);
                var wb             = new XLWorkbook(file);
                var ws             = wb.Worksheets.Worksheet(1);
                var filePath       = Path.Combine(Path.GetTempPath(), Path.ChangeExtension(Path.GetRandomFileName(), "xlsx"));
                var topRowIndex    = 4;

                for (var i = startRow; (i < startRow + sizeRow) && (i < contractModels.Count); i++)
                {
                    ws.Cell(topRowIndex + i, 1).Value = i + 1;
                    ws.Cell(topRowIndex + i, 2).Value = contractModels[i].V2;
                    ws.Cell(topRowIndex + i, 3).Value = contractModels[i].V3;
                    ws.Cell(topRowIndex + i, 4).Value = contractModels[i].V4;
                    ws.Cell(topRowIndex + i, 5).SetValue(contractModels[i].V5);
                    ws.Cell(topRowIndex + i, 6).Value = contractModels[i].V6;
                    ws.Cell(topRowIndex + i, 7).Value = contractModels[i].V7;
                    ws.Cell(topRowIndex + i, 8).Value = contractModels[i].V8;
                    ws.Cell(topRowIndex + i, 9).Value = contractModels[i].V9;
                    ws.Cell(topRowIndex + i, 10).SetValue(contractModels[i].V10);

                    ws.Cell(topRowIndex + i, 11).Value = contractModels[i].V11;
                    ws.Cell(topRowIndex + i, 11).Style.DateFormat.Format = "dd/MM/yyyy";

                    ws.Cell(topRowIndex + i, 12).Value = contractModels[i].V12;
                    ws.Cell(topRowIndex + i, 12).Style.NumberFormat.Format = "#,##0.00";

                    ws.Cell(topRowIndex + i, 13).Value = contractModels[i].V13;
                    ws.Cell(topRowIndex + i, 13).Style.NumberFormat.Format = "#,##0.00";

                    ws.Cell(topRowIndex + i, 14).Value = contractModels[i].V14;
                    ws.Cell(topRowIndex + i, 14).Style.NumberFormat.Format = "#,##0.00";

                    ws.Cell(topRowIndex + i, 15).Value = contractModels[i].V15;
                    ws.Cell(topRowIndex + i, 15).Style.NumberFormat.Format = "#,##0.00";

                    ws.Cell(topRowIndex + i, 16).Value = contractModels[i].V16;
                    ws.Cell(topRowIndex + i, 16).Style.NumberFormat.Format = "#,##0.00";

                    ws.Cell(topRowIndex + i, 17).Value = contractModels[i].V17;
                    ws.Cell(topRowIndex + i, 17).Style.NumberFormat.Format = "#,##0.00";

                    ws.Cell(topRowIndex + i, 18).Value = contractModels[i].V18;
                    ws.Cell(topRowIndex + i, 18).Style.NumberFormat.Format = "#,##0.00";

                    ws.Cell(topRowIndex + i, 19).Value = contractModels[i].V19;
                    ws.Cell(topRowIndex + i, 19).Style.NumberFormat.Format = "#,##0.00";

                    ws.Cell(topRowIndex + i, 20).Value = contractModels[i].V20;
                    ws.Cell(topRowIndex + i, 20).Style.NumberFormat.Format = "#,##0.00";

                    ws.Cell(topRowIndex + i, 21).Value = contractModels[i].V21;
                    ws.Cell(topRowIndex + i, 21).Style.NumberFormat.Format = "#,##0.00";

                    ws.Cell(topRowIndex + i, 22).Value = contractModels[i].V22;
                    ws.Cell(topRowIndex + i, 22).Style.NumberFormat.Format = "#,##0.00";

                    ws.Cell(topRowIndex + i, 23).Value = contractModels[i].V23;
                    ws.Cell(topRowIndex + i, 23).Style.NumberFormat.Format = "#,##0.00";

                    ws.Cell(topRowIndex + i, 24).Value = contractModels[i].V24;
                    ws.Cell(topRowIndex + i, 24).Style.NumberFormat.Format = "#,##0.00";

                    ws.Cell(topRowIndex + i, 25).Value = contractModels[i].V25;
                    ws.Cell(topRowIndex + i, 25).Style.DateFormat.Format = "dd/MM/yyyy";

                    ws.Cell(topRowIndex + i, 26).Value = contractModels[i].V26;
                    ws.Cell(topRowIndex + i, 26).Style.NumberFormat.Format = "#,##0.00";

                    ws.Cell(topRowIndex + i, 27).Value = contractModels[i].V27;
                    ws.Cell(topRowIndex + i, 27).Style.DateFormat.Format = "dd/MM/yyyy";

                    ws.Cell(topRowIndex + i, 28).Value = contractModels[i].V28;
                    ws.Cell(topRowIndex + i, 28).Style.DateFormat.Format = "dd/MM/yyyy";

                    ws.Cell(topRowIndex + i, 29).Value = contractModels[i].V29;
                    ws.Cell(topRowIndex + i, 29).Style.DateFormat.Format = "dd/MM/yyyy";

                    ws.Cell(topRowIndex + i, 30).Value = contractModels[i].V30;
                    ws.Cell(topRowIndex + i, 30).Style.DateFormat.Format = "dd/MM/yyyy";

                    ws.Cell(topRowIndex + i, 31).Value = contractModels[i].V31;
                    ws.Cell(topRowIndex + i, 31).Style.DateFormat.Format = "dd/MM/yyyy";

                    ws.Cell(topRowIndex + i, 32).Value = contractModels[i].V32;
                    ws.Cell(topRowIndex + i, 32).Style.DateFormat.Format = "dd/MM/yyyy";

                    ws.Cell(topRowIndex + i, 33).Value = contractModels[i].V33;
                    ws.Cell(topRowIndex + i, 33).Style.DateFormat.Format = "dd/MM/yyyy";

                    ws.Cell(topRowIndex + i, 34).SetValue(contractModels[i].V34);

                    ws.Cell(topRowIndex + i, 35).SetValue(contractModels[i].V35);

                    ws.Cell(topRowIndex + i, 36).SetValue(contractModels[i].V36);

                    ws.Cell(topRowIndex + i, 37).Value = contractModels[i].V37;
                    ws.Cell(topRowIndex + i, 37).Style.DateFormat.Format = "dd/MM/yyyy";

                    ws.Cell(topRowIndex + i, 38).Value = contractModels[i].V38;

                    ws.Cell(topRowIndex + i, 39).Value = contractModels[i].V39;
                    ws.Cell(topRowIndex + i, 39).Style.DateFormat.Format = "dd/MM/yyyy";

                    ws.Cell(topRowIndex + i, 40).Value = contractModels[i].V40;
                    ws.Cell(topRowIndex + i, 40).Style.NumberFormat.Format = "#,##0.00";
                }

                FitToColumns(ws, contractModels.Count);

                //save
                wb.SaveAs(filePath);

                return(filePath);
            }
            catch (Exception e)
            {
                throw e;
            }
        }