public IHttpActionResult PostComplete(NvKiemKeVm.Dto instance) { string unitCode = _service.GetCurrentUnitCode(); MdPeriod curentDate = CurrentSetting.GetKhoaSo(unitCode); int period = curentDate.Period; int year = curentDate.Year; string tablleName = curentDate.GetTableName(); instance.NgayDuyetPhieu = curentDate.ToDate; try { string msg = _serviceKK.Approval(instance, tablleName, year.ToString(), period); if (msg.Length > 0) { return(BadRequest(msg)); } _serviceKK.UpdateApproval(instance); _serviceKK.UnitOfWork.Save(); return(Ok(msg)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IHttpActionResult> GetLastPeriod() { var result = new MdPeriod(); var unitCode = _servicePeriod.GetCurrentUnitCode(); result = CurrentSetting.GetKhoaSo(unitCode); //if(result!=null) //{ } return(Ok(result)); }
public async Task <IHttpActionResult> PostApproval(NvVatTuChungTu instance) { string unitCode = _service.GetCurrentUnitCode(); NvVatTuChungTu chungTu = _service.FindById(instance.Id); if (chungTu == null || chungTu.TrangThai == (int)ApprovalState.IsComplete) { return(NotFound()); } #region For Only ILOVEVN - B&T //chungTu.NgayDuyetPhieu = CurrentSetting.GetNgayKhoaSo(unitCode); //_InsertPhieuCongNo(chungTu); #endregion //chungTu = _service.FindById(instance.Id); chungTu.TrangThai = (int)ApprovalState.IsComplete; chungTu.NgayDuyetPhieu = CurrentSetting.GetNgayKhoaSo(unitCode); chungTu.ThoiGianDuyetPhieu = int.Parse(DateTime.Now.ToString("HHmmssfff")); chungTu.ObjectState = ObjectState.Modified; _service.UnitOfWork.Save(); switch (_service.Approval(chungTu)) { case StateProcessApproval.NoPeriod: try { await _service.UnitOfWork.SaveAsync(); return(Ok(true)); } catch (Exception e) { return(InternalServerError()); } case StateProcessApproval.Success: try { await _service.UnitOfWork.SaveAsync(); return(Ok(true)); } catch (Exception e) { return(InternalServerError()); } case StateProcessApproval.Failed: break; default: break; } return(BadRequest("Không thể duyệt phiếu này")); }
public virtual bool ValidateNgayCT(DateTime ngayCt) { var currentUnitCode = GetCurrentUnitCode(); var ngayKhoaSo = CurrentSetting.GetNgayKhoaSo(currentUnitCode); if (ngayCt.Date < ngayKhoaSo.Date) { return(false); } return(true); }
public async Task <IHttpActionResult> PostApproval(NvXuatKhacVm.Dto instance) { var unitCode = _service.GetCurrentUnitCode(); var chungTu = _service.FindById(instance.Id); if (chungTu == null || chungTu.TrangThai == (int)ApprovalState.IsComplete) { return(NotFound()); } _service.UpdatePhieu(instance); chungTu.TrangThai = (int)ApprovalState.IsComplete; chungTu.NgayDuyetPhieu = CurrentSetting.GetNgayKhoaSo(unitCode); chungTu.ObjectState = ObjectState.Modified; await _service.UnitOfWork.SaveAsync(); switch (_service.Approval(chungTu.Id)) { case StateProcessApproval.NoPeriod: try { await _service.UnitOfWork.SaveAsync(); return(Ok(true)); } catch (Exception e) { return(InternalServerError()); } case StateProcessApproval.Success: try { await _service.UnitOfWork.SaveAsync(); return(Ok(true)); } catch (Exception e) { return(InternalServerError()); } case StateProcessApproval.Failed: break; default: break; } return(BadRequest("Không thể duyệt phiếu này")); }
public async Task <IHttpActionResult> PostReportDatHang(NvPhieuDatHangVm.ParameterDatHang para) { var result = new TransferObj <NvPhieuDatHangVm.DatHangReport>(); try { var data = new List <NvPhieuDatHangVm.DatHangExpImpModel>(); var reporter = new NvPhieuDatHangVm.DatHangReport(); reporter.UnitCode = _service.GetCurrentUnitCode(); reporter.Year = para.ToDate.Year; var period = _service.UnitOfWork.Repository <MdPeriod>().DbSet.Where(x => x.ToDate == para.ToDate).FirstOrDefault(); if (period != null) { reporter.Period = period.Period; } var unitCode = _service.GetCurrentUnitCode(); reporter.CreateDateNow(); reporter.FromDay = para.FromDate.Day; reporter.FromMonth = para.FromDate.Month; reporter.FromYear = para.FromDate.Year; reporter.ToDay = para.ToDate.Day; reporter.ToMonth = para.ToDate.Month; reporter.ToYear = para.ToDate.Year; reporter.TenDonVi = CurrentSetting.GetUnitName(unitCode); reporter.DiaChiDonVi = CurrentSetting.GetUnitAddress(unitCode); //GetNhanVien if (HttpContext.Current != null && HttpContext.Current.User is ClaimsPrincipal) { var currentUser = (HttpContext.Current.User as ClaimsPrincipal); var name = currentUser.Identity.Name; var nhanVien = _service.UnitOfWork.Repository <AU_NGUOIDUNG>().DbSet.Where(x => x.Username == name).FirstOrDefault(); if (nhanVien != null) { reporter.Username = nhanVien.TenNhanVien; } else { reporter.Username = "******"; } } data = _service.ReportDatHangTongHop(para); reporter.DetailData.AddRange(data); result.Data = reporter; result.Status = true; result.Message = "Xuất báo cáo thành công"; return(Ok(result)); } catch (Exception e) { return(InternalServerError()); } }
public async Task <IHttpActionResult> ReportDoanhSoSn(ParameterDoanhSoSn para) { var result = new TransferObj <ReportDSSN>(); try { var reporter = new ReportDSSN(); var data = new List <CustomDoanhSoSnReport>(); reporter.UnitCode = _servicePeriod.GetCurrentUnitCode(); var unitCode = _servicePeriod.GetCurrentUnitCode(); reporter.FromDate = para.FromDate; reporter.ToDate = para.ToDate; reporter.CreateDate = DateTime.Now; reporter.TenDonVi = CurrentSetting.GetUnitName(unitCode); reporter.DiaChiDonVi = CurrentSetting.GetUnitAddress(unitCode); //GetNhanVien if (HttpContext.Current != null && HttpContext.Current.User is ClaimsPrincipal) { var currentUser = (HttpContext.Current.User as ClaimsPrincipal); var name = currentUser.Identity.Name; var nhanVien = _service.UnitOfWork.Repository <AU_NGUOIDUNG>().DbSet.Where(x => x.Username == name).FirstOrDefault(); if (nhanVien != null) { reporter.Username = nhanVien.TenNhanVien; } else { reporter.Username = "******"; } } //thêm data = _service.ReportDoanhSoSn(para); reporter.Data = data.ToList(); reporter.Data.ForEach(x => x.MapCustomerName(_service.UnitOfWork)); //reporter.MapUnitUserName(_service.UnitOfWork); //------ // reporter.Data = _service.ReportDoanhSoSn(para); result.Data = reporter; result.Status = true; result.Message = "Xuất báo cáo thành công"; return(Ok(result)); } catch (Exception e) { return(InternalServerError()); } }
public PuSetting(Action <float, string> onLoadConfig) { persistentDataPath = Application.persistentDataPath; CurrentSetting setting = new CurrentSetting(); PuMain.Setting = setting; PuMain.Setting.Init(); setting.CustomServer(); PuMain.Dispatcher.onChangeScene += ChangeScene; PuMain.Instance.Load(onLoadConfig); Puppet.Poker.PokerMain.Instance.StartListen(); }
public MdPeriod GetPeriodDate() { var unitCode = _servicePeriod.GetCurrentUnitCode(); var period = new MdPeriod(); period = CurrentSetting.GetKhoaSo(unitCode); if (period != null) { return(period); } else { return(null); } }
public async Task <IHttpActionResult> GetNewParameter() { var unitCode = _service.GetCurrentUnitCode(); var currentDate = DateTime.Now.Date; var datelock = CurrentSetting.GetNgayKhoaSo(unitCode); var result = new ParameterCongNo() { ToDate = datelock, FromDate = datelock.AddDays(-1), UnitCode = unitCode, LoaiBaoCao = "0", }; return(Ok(result)); }
public async Task <IHttpActionResult> PostReportGDQTongHop(ParameterCashier para) { NvGiaoDichQuayVm.ReportGDQTongHopNew reporter = new NvGiaoDichQuayVm.ReportGDQTongHopNew(); try { var unitCode = _service.GetCurrentUnitCode(); reporter.CreateDateNow(); reporter.FromDay = para.FromDate.Day; reporter.FromMonth = para.FromDate.Month; reporter.FromYear = para.FromDate.Year; reporter.ToDay = para.ToDate.Day; reporter.ToMonth = para.ToDate.Month; reporter.ToYear = para.ToDate.Year; reporter.ToDate = para.ToDate; reporter.FromDate = para.FromDate; reporter.TenDonVi = CurrentSetting.GetUnitName(unitCode); reporter.DiaChiDonVi = CurrentSetting.GetUnitAddress(unitCode); //GetNhanVien if (HttpContext.Current != null && HttpContext.Current.User is ClaimsPrincipal) { var currentUser = (HttpContext.Current.User as ClaimsPrincipal); var name = currentUser.Identity.Name; var nhanVien = _service.UnitOfWork.Repository <AU_NGUOIDUNG>().DbSet.Where(x => x.Username == name).FirstOrDefault(); if (nhanVien != null) { reporter.Username = nhanVien.Username; } else { reporter.Username = "******"; } } switch (para.LoaiGiaoDich) { case TypeGiaoDich.NHAPBANLETRALAI: reporter.DataDetails.AddRange(_service.ReportNhapBLeTraLai(para)); break; default: reporter.DataDetails.AddRange(_service.ReportGiaoDichQuay(para)); break; } } catch (Exception ex) { } return(Ok(reporter)); }
public async Task <IHttpActionResult> GetNewParameter() { string unitCode = _service.GetCurrentUnitCode(); DateTime currentDate = DateTime.Now.Date; DateTime datelock = CurrentSetting.GetNgayKhoaSo(unitCode); ParameterNgayHetHanHangHoa result = new ParameterNgayHetHanHangHoa() { ToDate = datelock, FromDate = datelock, MaxDate = currentDate, UnitCode = unitCode, GroupBy = "MADONVI", }; return(Ok(result)); }
public async Task <IHttpActionResult> GetNewParameter() { var unitCode = _serviceKK.GetCurrentUnitCode(); var currentDate = DateTime.Now.Date; var datelock = CurrentSetting.GetNgayKhoaSo(unitCode); var result = new ParameterKiemKe() { ToDate = datelock, FromDate = datelock, MaxDate = currentDate, UnitCode = unitCode, GroupBy = TypeGroupKiemKe.WAREHOUSE, ReportType = TypeReportKiemKe.BAOCAODAYDU }; return(Ok(result)); }
public async Task <IHttpActionResult> GetNewParameter() { var unitCode = _service.GetCurrentUnitCode(); var currentDate = DateTime.Now.Date; var datelock = CurrentSetting.GetNgayKhoaSo(unitCode); var result = new ParameterCashier() { ToDate = datelock, FromDate = datelock, MaxDate = currentDate, UnitCode = unitCode, GroupBy = TypeGroupInventoryCashier.MALOAIVATTU, LoaiGiaoDich = TypeGiaoDich.XUATBANLE }; return(Ok(result)); }
public async Task <IHttpActionResult> PostPrintTranferCashieer(ParameterCashier para) { NvGiaoDichQuayVm.ReportGDQ reporter = new NvGiaoDichQuayVm.ReportGDQ(); List <NvGiaoDichQuayVm.ReportGDQDetailLevel2> result = new List <NvGiaoDichQuayVm.ReportGDQDetailLevel2>(); try { //for (int i = 0; i < nv.Count();i++ ) //{ var unitCode = _service.GetCurrentUnitCode(); reporter.CreateDateNow(); reporter.FromDay = para.FromDate.Day; reporter.FromMonth = para.FromDate.Month; reporter.FromYear = para.FromDate.Year; reporter.ToDay = para.ToDate.Day; reporter.ToMonth = para.ToDate.Month; reporter.ToYear = para.ToDate.Year; reporter.ToDate = para.ToDate; reporter.FromDate = para.FromDate; reporter.TenDonVi = CurrentSetting.GetUnitName(unitCode); reporter.DiaChiDonVi = CurrentSetting.GetUnitAddress(unitCode); //GetNhanVien if (HttpContext.Current != null && HttpContext.Current.User is ClaimsPrincipal) { var currentUser = (HttpContext.Current.User as ClaimsPrincipal); var name = currentUser.Identity.Name; var nhanVien = _service.UnitOfWork.Repository <AU_NGUOIDUNG>().DbSet.Where(x => x.Username == name).FirstOrDefault(); if (nhanVien != null) { reporter.Username = nhanVien.TenNhanVien; } else { reporter.Username = "******"; } } reporter.DataDetails.AddRange(_service.CreatePrintTranferCashieer(para.FromDate, para.ToDate, para.UnitCode, para.SellingMachineCodes, para.CashieerCodes)); //} } catch (Exception ex) { } return(Ok(reporter)); }
private void _InsertPhieuCongNo(NvVatTuChungTu chungTu) { //Cos nhieu phieu trong ngay phat sinh no. var unitCode = _service.GetCurrentUnitCode(); var _thanhTienCanTra = _serviceCongNo.GetAmmountCustomerBorrowed(chungTu.MaKhachHang, chungTu.NgayDuyetPhieu.Value).ThanhTienCanTra; _serviceCongNo.InsertPhieu(new NvCongNoVm.Dto() { Id = Guid.NewGuid().ToString(), LoaiChungTu = LoaiCongNo.CNKH.ToString(), NgayCT = CurrentSetting.GetNgayKhoaSo(unitCode), MaKhachHang = chungTu.MaKhachHang, GhiChu = "[" + chungTu.MaChungTu + "]", ThanhTien = chungTu.ThanhTienSauVat, ThanhTienCanTra = _thanhTienCanTra, }); _serviceCongNo.UnitOfWork.Save(); }
private void BtnImport_Click(object sender, RoutedEventArgs e) { // 임포트 (불러오기) try { SettingReader sr = new SettingReader(ShowSelectFileDialog(new string[] { ".aucasetting" }).FullName); if (MsgBox("정말 현재 설정을 바꾸시겠습니까?", "설정 변경 여부 확인", Globals.MessageBoxStyle.YesNo) == MessageBoxResult.Yes) { CurrentSetting = sr.ReadSetting(); SettingWriter settingw = new SettingWriter((Setting.Setting)CurrentSetting.Clone()); MsgBox("정상적으로 변경 완료되었습니다!"); SaveChangeAllow = CloseType.JustClose; this.Close(); } } catch (NullReferenceException) { } }
public async Task <IHttpActionResult> GetExternalCode(ParameterKiemKe para) { string unitCode = _service.GetCurrentUnitCode(); MdPeriod curentDate = CurrentSetting.GetKhoaSo(unitCode); if (para.WareHouseCodes == null) { para.WareHouseCodes = unitCode + "-K2"; } string tableName = curentDate.GetTableName(); List <NvKiemKeVm.ExternalCodeInInventory> result = new List <NvKiemKeVm.ExternalCodeInInventory>(); result = ProcedureCollection.GetExternalCodeInventory(unitCode, tableName, para); if (result != null) { return(Ok(result)); } else { return(NotFound()); } }
public SettingStorage() { context = new ExhibitionSettingContext(); if (context.CurrentSettings.Select(s => s).Count() == 0) { CurrentSetting ncs = new CurrentSetting("default"); context.CurrentSettings.Add(ncs); context.SaveChanges(); } if (context.TemplateSettings.Select(t => t).Count() == 0) { TemplateSetting defaultSetting = new TemplateSetting(); defaultSetting.isCanDelete = false; defaultSetting.isFNvisible = true; defaultSetting.isLNvisible = true; defaultSetting.isPAvisible = true; defaultSetting.isCOvisible = true; defaultSetting.isPOvisible = true; defaultSetting.FontNameNA = "Arial"; defaultSetting.FontNameCO = "Arial"; defaultSetting.FontNamePO = "Arial"; defaultSetting.FontSizeNA = 9.75f; defaultSetting.FontSizeCO = 8.25f; defaultSetting.FontSizePO = 8.25f; defaultSetting.FontStyleNA = 0; defaultSetting.FontStyleCO = 0; defaultSetting.FontStylePO = 0; defaultSetting.SettingName = "default"; context.TemplateSettings.Add(defaultSetting); context.SaveChanges(); } cs = context.CurrentSettings.Select(c => c).FirstOrDefault(); lts = context.TemplateSettings.Select(t => t).ToList(); }
public async Task <IHttpActionResult> PostComplete(NvKiemKeVm.Dto instance) { string unitCode = _service.GetCurrentUnitCode(); MdPeriod curentDate = CurrentSetting.GetKhoaSo(unitCode); int period = curentDate.Period; int year = curentDate.Year; string tablleName = curentDate.GetTableName(); NvKiemKe phieuKiemKe = _serviceKK.FindById(instance.Id); instance.NgayDuyetPhieu = curentDate.ToDate; //thực hiện tạo phiếu kiểm kê nhập, kiểm kê xuất try { _serviceKK.Approval(instance, tablleName, year.ToString(), period); _serviceKK.UpdateApproval(instance); _serviceKK.UnitOfWork.Save(); return(Ok(true)); } catch (Exception) { return(InternalServerError()); } }
protected TOutput ReactToTarget(Point objectOfInterest) { var output = new TOutput(); _panTiltModifier.Objective = objectOfInterest; var newPosition = _panTiltModifier.CalculateNewSetting(CurrentSetting); output.Target = objectOfInterest; output.PanTiltPrior = CurrentSetting.Clone(); output.PanTiltNow = newPosition.Clone(); if (!objectOfInterest.Equals(CentrePoint)) { var moved = MoveAbsolute(newPosition); if (moved) { _timerUntilServoSettled.Start(); IsServoInMotion = true; } } return(output); }
// 세팅 창 오픈 private void PathButton_Click(object sender, RoutedEventArgs e) { scworker.IsUsed = false; sw = new SettingWindow(); sw.ShowDialog(); DetectGrid.Width = CurrentSetting.RecoWidth; DetectGrid.Height = CurrentSetting.RecoHeight; RegistryKey rkey = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"); if (CurrentSetting.IsStartupProgram) { rkey.SetValue("AutoCapturer", $"\"{System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName}\" -bystartup"); } else { rkey.DeleteValue("AutoCapturer", false); } SettingWriter settingw = new SettingWriter((Setting.Setting)CurrentSetting.Clone()); scworker.IsUsed = true; }
public async Task <IHttpActionResult> GetDetails(string id) { var _ParentUnitCode = _service.GetParentUnitCode(); var result = new TransferObj <NvXuatKhacVm.Dto>(); var temp = new NvXuatKhacVm.Dto(); var phieu = _service.FindById(id); if (phieu != null) { temp = Mapper.Map <NvVatTuChungTu, NvXuatKhacVm.Dto>(phieu); var chiTietPhieu = _service.UnitOfWork.Repository <NvVatTuChungTuChiTiet>().DbSet.Where(x => x.MaChungTuPk == phieu.MaChungTuPk).ToList(); temp.DataDetails = Mapper.Map <List <NvVatTuChungTuChiTiet>, List <NvXuatKhacVm.DtoDetail> >(chiTietPhieu); temp.DataDetails.ForEach( x => { x.CalcResult(); x.GiaVon = x.GiaVon; } ); if (phieu.TrangThai != 10) { decimal sum = 0; List <NvXuatKhacVm.DtoDetail> listDetails = new List <NvXuatKhacVm.DtoDetail>(); var unitCode = _service.GetCurrentUnitCode(); var ky = CurrentSetting.GetKhoaSo(unitCode); var tableName = ProcedureCollection.GetTableName(ky.Year, ky.Period); var MaKho = temp.MaKhoXuat; decimal giaVon = 0; //string kyKeToan = _servicePeriod.GetKyKeToan((DateTime)phieu.NgayCT); foreach (var value in temp.DataDetails) { var sp = _service.UnitOfWork.Repository <MdMerchandisePrice>().DbSet.Where(x => x.MaVatTu.Equals(value.MaHang) && x.MaDonVi.StartsWith(_ParentUnitCode)).FirstOrDefault(); var item = _service.UnitOfWork.Repository <MdMerchandise>().DbSet.Where(x => x.MaVatTu.Equals(value.MaHang) && x.UnitCode.StartsWith(_ParentUnitCode)).FirstOrDefault(); if (sp != null) { value.TyLeVATVao = sp.TyLeVatVao; } if (item != null) { value.TenHang = item.TenHang; } List <MdMerchandiseVm.DataXNT> data = ProcedureCollection.GetDataInventoryByCondition(unitCode, MaKho, value.MaHang, tableName, _ParentUnitCode); if (data.Count > 0) { decimal.TryParse(value.GiaVon.ToString(), out giaVon); value.DonGia = giaVon; value.TyLeVATRa = data[0].TyLeVATRa; value.TyLeVATVao = data[0].TyLeVATVao; value.ThanhTien = value.DonGia * value.SoLuong; sum += (decimal)value.ThanhTien; } listDetails.Add(value); } temp.DataDetails = listDetails; var tyLe = _service.UnitOfWork.Repository <MdTax>().DbSet.Where(x => x.MaLoaiThue == temp.VAT).Select(x => x.TaxRate).FirstOrDefault(); if (tyLe != null) { temp.TienVat = sum * (tyLe / 100); } else { temp.TienVat = 0; } temp.ThanhTienTruocVat = sum; temp.ThanhTienSauVat = temp.ThanhTienTruocVat + temp.TienVat; } result.Data = temp; result.Status = true; return(Ok(result)); } return(NotFound()); }
public async Task <IHttpActionResult> ReportTheoNCCByMerChandise(ParameterInventory para) { var result = new TransferObj <InventoryReport>(); try { var reporter = new InventoryReport(); var data = new List <InventoryExpImp>(); reporter.UnitCode = _servicePeriod.GetCurrentUnitCode(); reporter.Year = para.ToDate.Year; var period = _service.UnitOfWork.Repository <MdPeriod>().DbSet.Where(x => x.ToDate == para.ToDate).FirstOrDefault(); if (period != null) { reporter.Period = period.Period; } var unitCode = _servicePeriod.GetCurrentUnitCode(); reporter.CreateDateNow(); reporter.FromDay = para.FromDate.Day; reporter.FromMonth = para.FromDate.Month; reporter.FromYear = para.FromDate.Year; reporter.ToDay = para.ToDate.Day; reporter.ToMonth = para.ToDate.Month; reporter.ToYear = para.ToDate.Year; reporter.TenDonVi = CurrentSetting.GetUnitName(unitCode); reporter.DiaChiDonVi = CurrentSetting.GetUnitAddress(unitCode); //GetNhanVien if (HttpContext.Current != null && HttpContext.Current.User is ClaimsPrincipal) { var currentUser = (HttpContext.Current.User as ClaimsPrincipal); var name = currentUser.Identity.Name; var nhanVien = _service.UnitOfWork.Repository <AU_NGUOIDUNG>().DbSet.Where(x => x.Username == name).FirstOrDefault(); if (nhanVien != null) { reporter.Username = nhanVien.TenNhanVien; } else { reporter.Username = "******"; } } //switch (para.GroupBy) //{ // case TypeGroupInventory.WAREHOUSE: // data = _service.CreateReportInventoryByWareHouse(para.FromDate, para.ToDate, para.UnitCode, para.WareHouseCodes, para.MerchandiseTypeCodes, para.MerchandiseGroupCodes, para.MerchandiseCodes); // reporter.DetailData = data.ToList(); // reporter.DetailData.ForEach(x => x.MapWareHouseName(_service.UnitOfWork)); // reporter.MapUnitUserName(_service.UnitOfWork); // reporter.GroupType = "Kho hàng"; // break; // case TypeGroupInventory.TYPE: // data = _service.CreateReportInventoryByType(para.FromDate, para.ToDate, para.UnitCode, para.WareHouseCodes, para.MerchandiseTypeCodes, para.MerchandiseGroupCodes, para.MerchandiseCodes); // reporter.DetailData = data.ToList(); // reporter.DetailData.ForEach(x => x.MapTypeName(_service.UnitOfWork)); // reporter.MapUnitUserName(_service.UnitOfWork); // reporter.GroupType = "Loại hàng hóa"; // break; // case TypeGroupInventory.GROUP: // data = _service.CreateReportInventoryByGroup(para.FromDate, para.ToDate, para.UnitCode, para.WareHouseCodes, para.MerchandiseTypeCodes, para.MerchandiseGroupCodes, para.MerchandiseCodes); // reporter.DetailData = data.ToList(); // reporter.DetailData.ForEach(x => x.MapGroupName(_service.UnitOfWork)); // reporter.MapUnitUserName(_service.UnitOfWork); // reporter.GroupType = "Nhóm hàng hóa"; // break; // case TypeGroupInventory.MERCHANDISE: // data = _service.CreateReportInventoryByMerchandise(para.FromDate, para.ToDate, para.UnitCode, para.WareHouseCodes, para.MerchandiseTypeCodes, para.MerchandiseGroupCodes, para.MerchandiseCodes); // reporter.DetailData = data.ToList(); // reporter.DetailData.ForEach(x => x.MapMerchandiseName(_service.UnitOfWork)); // reporter.MapUnitUserName(_service.UnitOfWork); // reporter.GroupType = "Hàng hóa"; // break; // default: // //data = _service.CreateReportInventoryByDay(para.FromDate, para.ToDate, para.UnitCode, para.WareHouseCodes, para.MerchandiseTypeCodes, para.MerchandiseGroupCodes, para.MerchandiseCodes); // break; //} //result.Data = reporter; result.Status = true; result.Message = "Xuất báo cáo thành công"; return(Ok(result)); } catch (Exception e) { return(InternalServerError()); } }
private void SetSetting(CurrentSetting setting) { Setting = setting; }
public async Task <IHttpActionResult> ReportLanDauKh(ParameterLanDauKh para) { ReportLanDauKh reporter = new ReportLanDauKh(); try { var unitCode = _servicePeriod.GetCurrentUnitCode(); reporter.FromDate = para.FromDate; reporter.ToDate = para.ToDate; reporter.CreateDate = DateTime.Now; reporter.TenDonVi = CurrentSetting.GetUnitName(unitCode); reporter.DiaChiDonVi = CurrentSetting.GetUnitAddress(unitCode); //GetNhanVien if (HttpContext.Current != null && HttpContext.Current.User is ClaimsPrincipal) { var currentUser = (HttpContext.Current.User as ClaimsPrincipal); var name = currentUser.Identity.Name; var nhanVien = _service.UnitOfWork.Repository <AU_NGUOIDUNG>().DbSet.Where(x => x.Username == name).FirstOrDefault(); if (nhanVien != null) { reporter.Username = nhanVien.Username; } else { reporter.Username = "******"; } } reporter.DataDetails.AddRange(_service.ReportLanDauKh(para)); } catch (Exception ex) { } return(Ok(reporter)); //var result = new TransferObj<ReportLanDauKh>(); //try //{ // var reporter = new ReportLanDauKh(); // //var data = new List<CustomLanDauKhReport>(); // reporter.UnitCode = _servicePeriod.GetCurrentUnitCode(); // var unitCode = _servicePeriod.GetCurrentUnitCode(); // reporter.FromDate = para.FromDate; // reporter.ToDate = para.ToDate; // reporter.CreateDate = DateTime.Now; // reporter.TenDonVi = CurrentSetting.GetUnitName(unitCode); // reporter.DiaChiDonVi = CurrentSetting.GetUnitAddress(unitCode); // //GetNhanVien // if (HttpContext.Current != null && HttpContext.Current.User is ClaimsPrincipal) // { // var currentUser = (HttpContext.Current.User as ClaimsPrincipal); // var name = currentUser.Identity.Name; // var nhanVien = _service.UnitOfWork.Repository<AU_NGUOIDUNG>().DbSet.Where(x => x.Username == name).FirstOrDefault(); // if (nhanVien != null) // { // reporter.Username = nhanVien.TenNhanVien; // } // else // { // reporter.Username = "******"; // } // } // reporter.Data = _service.ReportLanDauKh(para); // result.Data = reporter; // result.Status = true; // result.Message = "Xuất báo cáo thành công"; // return Ok(result); //} //catch (Exception e) //{ // return InternalServerError(); //} }
public new void ShowDialog() { TempSetting = (Setting.Setting)CurrentSetting.Clone(); SettingSync(TempSetting); base.ShowDialog(); }
public HttpResponseMessage ExportExcel(ParameterCashier para) { var _ParentUnitCode = _service.GetParentUnitCode(); NvGiaoDichQuayVm.ReportExcel result = null; var unitCode = _service.GetCurrentUnitCode(); //var instance = _service.Repository.DbSet.FirstOrDefault(x => x.MaVatTu.ToUpper() == code.ToUpper());//&& x.UnitCode == unitCode); var service = new ProcedureService <NvGiaoDichQuayVm.ReportExcel>(); var data = ProcedureCollection.GetReportGDQExcel(para.FromDate, para.ToDate, new BTS.API.ENTITY.ERPContext(), unitCode); using (ExcelPackage package = new ExcelPackage()) { var ms = new MemoryStream(); package.Workbook.Worksheets.Add("Data"); var worksheet = package.Workbook.Worksheets[1]; int index = 0; worksheet.Cells[1, 1, 1, 5].Merge = true; worksheet.Cells[1, 1].Value = "SIÊU THỊ TỪ SƠN "; worksheet.Cells[2, 1, 2, 5].Merge = true; worksheet.Cells[2, 1].Value = "Đường Lý Thái Tổ, P. Đình Bảng, TX Từ Sơn, Bắc Ninh "; worksheet.Cells[4, 4, 4, 7].Merge = true; worksheet.Cells[4, 4].Value = "BÁO CÁO GIAO DỊCH QUẦY "; worksheet.Cells[5, 4, 5, 8].Merge = true; worksheet.Cells[5, 4].Value = "Từ ngày: " + para.FromDate.Day + "/" + para.FromDate.Month + "/" + para.FromDate.Year + " Đến ngày:" + para.ToDate.Day + "/" + para.ToDate.Month + "/" + para.ToDate.Year; worksheet.Cells[7, 1].Value = "STT"; worksheet.Cells[7, 2].Value = "Nhân viên"; worksheet.Cells[7, 3].Value = "Máy bán"; worksheet.Cells[7, 4].Value = "Ngày phát sinh"; worksheet.Cells[7, 5].Value = "Loại giao dịch"; worksheet.Cells[7, 6].Value = "Mã hàng"; worksheet.Cells[7, 7].Value = "Tên hàng"; worksheet.Cells[7, 8].Value = "Số lượng"; worksheet.Cells[7, 9].Value = "Tổng tiền"; index = 8; if (data != null && data.Count() >= 1) { var item = data.ToList(); for (int i = 0; i < item.Count; i++) { var hanghoa = new MdMerchandiseVm.Dto(); var innerindex = item[i].MaVatTu; var hanghoatg = _merchandiseservice.UnitOfWork.Repository <MdMerchandise>().DbSet.FirstOrDefault(x => x.MaVatTu == innerindex && x.UnitCode.StartsWith(_ParentUnitCode)); hanghoa = Mapper.Map <MdMerchandise, MdMerchandiseVm.Dto>(hanghoatg); worksheet.Cells[index, 1].Value = index; worksheet.Cells[index, 2].Value = item[i].MaNguoiTao + "-" + item[i].NguoiTao; worksheet.Cells[index, 3].Value = item[i].MaQuayBan; worksheet.Cells[index, 4].Value = item[i].NgayPhatSinh.Date + "/" + item[i].NgayPhatSinh.Month + "/" + item[i].NgayPhatSinh.Year; worksheet.Cells[index, 6].Value = item[i].MaVatTu; if (hanghoa == null) { worksheet.Cells[index, 7].Value = " "; } worksheet.Cells[index, 7].Value = hanghoa.TenHang; worksheet.Cells[index, 8].Value = item[i].SoLuong; worksheet.Cells[index, 9].Value = CurrentSetting.FormatTienViet(item[i].TTienCoVat.ToString()); if (item[i].LoaiGiaoDich == 1) { worksheet.Cells[index, 5].Value = "xuất bán"; } else if (item[i].LoaiGiaoDich == 2) { worksheet.Cells[index, 5].Value = "bán trả lại"; } index++; } } else { //return null; } package.SaveAs(ms); HttpResponseMessage response = Request.CreateResponse(); response.StatusCode = HttpStatusCode.OK; ms.Seek(0, SeekOrigin.Begin); response.Content = new StreamContent(ms); response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("inline") { FileName = "BaoCaoGiaoDichQuay.xlsx" }; response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); return(response); } }
public async Task <IHttpActionResult> PostReportTongHop(ParameterKiemKe para) { NvKiemKeVm.ReportTongHop reporter = new NvKiemKeVm.ReportTongHop(); List <NvKiemKeVm.ObjectReport> result = new List <NvKiemKeVm.ObjectReport>(); try { var unitCode = _serviceKK.GetCurrentUnitCode(); reporter.CreateDateNow(); reporter.FromDay = para.FromDate.Day; reporter.FromMonth = para.FromDate.Month; reporter.FromYear = para.FromDate.Year; reporter.ToDay = para.ToDate.Day; reporter.ToMonth = para.ToDate.Month; reporter.ToYear = para.ToDate.Year; reporter.ToDate = para.ToDate; reporter.FromDate = para.FromDate; reporter.TenDonVi = CurrentSetting.GetUnitName(unitCode); reporter.DiaChiDonVi = CurrentSetting.GetUnitAddress(unitCode); switch (para.GroupBy) { case TypeGroupKiemKe.WAREHOUSE: reporter.NameGroupBy = "Kho hàng"; break; case TypeGroupKiemKe.TYPE: reporter.NameGroupBy = "Loại vật tư"; break; case TypeGroupKiemKe.GROUP: reporter.NameGroupBy = "Nhóm vật tư"; break; case TypeGroupKiemKe.MERCHANDISE: reporter.NameGroupBy = "Vật tư"; break; case TypeGroupKiemKe.NHACUNGCAP: reporter.NameGroupBy = "Nhà cung cấp"; break; case TypeGroupKiemKe.KEHANG: reporter.NameGroupBy = "Kệ hàng"; break; default: reporter.NameGroupBy = "Vật tư"; break; } //GetNhanVien if (HttpContext.Current != null && HttpContext.Current.User is ClaimsPrincipal) { var currentUser = (HttpContext.Current.User as ClaimsPrincipal); var name = currentUser.Identity.Name; var nhanVien = _serviceKK.UnitOfWork.Repository <AU_NGUOIDUNG>().DbSet.Where(x => x.Username == name).FirstOrDefault(); if (nhanVien != null) { reporter.Username = nhanVien.TenNhanVien; } else { reporter.Username = "******"; } } reporter.DataDetails.AddRange(_serviceKK.ReportKiemKe(para)); } catch (Exception ex) { } return(Ok(reporter)); }
public HttpResponseMessage ExportExcelSyntheticByCondition(ParameterExcelByCondition para) { var _ParentUnitCode = _service.GetParentUnitCode(); NvGiaoDichQuayVm.ReportExcel result = null; var unitCode = _service.GetCurrentUnitCode(); para.UnitCode = unitCode; var service = new ProcedureService <NvGiaoDichQuayVm.ReportExcel>(); var data = ProcedureCollection.DuLieuTongHopGiaoDichQuayTheoDieuKien(para.TuNgay, para.DenNgay, para.UnitCode, new BTS.API.ENTITY.ERPContext()); using (ExcelPackage package = new ExcelPackage()) { var ms = new MemoryStream(); package.Workbook.Worksheets.Add("Data"); var worksheet = package.Workbook.Worksheets[1]; int index = 0; worksheet.Cells[1, 1, 1, 5].Merge = true; worksheet.Cells[1, 1].Value = "SIÊU THỊ TỪ SƠN "; worksheet.Cells[2, 1, 2, 5].Merge = true; worksheet.Cells[2, 1].Value = "Đường Lý Thái Tổ, P. Đình Bảng, TX Từ Sơn, Bắc Ninh "; worksheet.Cells[4, 4, 4, 7].Merge = true; worksheet.Cells[4, 4].Value = "BÁO CÁO GIAO DỊCH QUẦY TỔNG HỢP "; worksheet.Cells[5, 4, 5, 8].Merge = true; worksheet.Cells[5, 4].Value = "Từ ngày: " + para.TuNgay.Day + "/" + para.TuNgay.Month + "/" + para.TuNgay.Year + " Đến ngày:" + para.DenNgay.Day + "/" + para.DenNgay.Month + "/" + para.DenNgay.Year; worksheet.Cells[7, 1].Value = "STT"; worksheet.Cells[7, 2].Value = "Mã giao dịch"; worksheet.Cells[7, 3].Value = "Mã giao dịch PK"; worksheet.Cells[7, 4].Value = "Loại giao dịch"; worksheet.Cells[7, 5].Value = "Tổng tiền"; int stt = 1; index = 8; if (data != null && data.Count() >= 1) { var item = data.ToList(); for (int i = 0; i < item.Count; i++) { var hanghoa = new MdMerchandiseVm.Dto(); var innerindex = item[i].MaVatTu; var hanghoatg = _merchandiseservice.UnitOfWork.Repository <MdMerchandise>().DbSet.FirstOrDefault(x => x.MaVatTu == innerindex && x.UnitCode.StartsWith(_ParentUnitCode)); hanghoa = Mapper.Map <MdMerchandise, MdMerchandiseVm.Dto>(hanghoatg); worksheet.Cells[index, 1].Value = stt; worksheet.Cells[index, 2].Value = item[i].MaGiaoDich; worksheet.Cells[index, 3].Value = item[i].MaGiaoDichQuayPK; if (item[i].LoaiGiaoDich == 1) { worksheet.Cells[index, 4].Value = "Bán lẻ"; } else if (item[i].LoaiGiaoDich == 2) { worksheet.Cells[index, 4].Value = "Trả lại"; } worksheet.Cells[index, 5].Value = CurrentSetting.FormatTienViet(item[i].TTienCoVat.ToString()); index++; stt++; } } else { //return null; } package.SaveAs(ms); HttpResponseMessage response = Request.CreateResponse(); response.StatusCode = HttpStatusCode.OK; ms.Seek(0, SeekOrigin.Begin); response.Content = new StreamContent(ms); response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("inline") { FileName = "BaoCaoGiaoDichQuayTongHop.xlsx" }; response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); return(response); } }